@skyux/datetime 5.9.4 → 6.0.0-beta.10

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 (163) hide show
  1. package/documentation.json +709 -790
  2. package/esm2020/index.mjs +31 -0
  3. package/esm2020/lib/modules/date-pipe/date-format-utility.mjs +46 -0
  4. package/esm2020/lib/modules/date-pipe/date-pipe.module.mjs +21 -0
  5. package/esm2020/lib/modules/date-pipe/date.pipe.mjs +65 -0
  6. package/esm2020/lib/modules/date-pipe/fuzzy-date.pipe.mjs +47 -0
  7. package/esm2020/lib/modules/date-range-picker/date-range-picker.component.mjs +437 -0
  8. package/esm2020/lib/modules/date-range-picker/date-range-picker.module.mjs +47 -0
  9. package/esm2020/lib/modules/date-range-picker/date-range.service.mjs +97 -0
  10. package/esm2020/lib/modules/date-range-picker/types/date-range-calculation.mjs +2 -0
  11. package/esm2020/lib/modules/date-range-picker/types/date-range-calculator-config.mjs +2 -0
  12. package/esm2020/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.mjs +2 -0
  13. package/esm2020/lib/modules/date-range-picker/types/date-range-calculator-id.mjs +118 -0
  14. package/esm2020/lib/modules/date-range-picker/types/date-range-calculator-type.mjs +23 -0
  15. package/esm2020/lib/modules/date-range-picker/types/date-range-calculator-validate-function.mjs +2 -0
  16. package/esm2020/lib/modules/date-range-picker/types/date-range-calculator.mjs +53 -0
  17. package/esm2020/lib/modules/date-range-picker/types/date-range-default-calculator-config.mjs +2 -0
  18. package/esm2020/lib/modules/date-range-picker/types/date-range-default-calculator-configs.mjs +147 -0
  19. package/esm2020/lib/modules/date-range-picker/types/date-range-relative-value.mjs +249 -0
  20. package/esm2020/lib/modules/date-range-picker/types/date-range.mjs +2 -0
  21. package/esm2020/lib/modules/datepicker/date-formatter.mjs +38 -0
  22. package/esm2020/lib/modules/datepicker/datepicker-adapter.service.mjs +33 -0
  23. package/esm2020/lib/modules/datepicker/datepicker-calendar-change.mjs +2 -0
  24. package/esm2020/lib/modules/datepicker/datepicker-calendar-inner.component.mjs +310 -0
  25. package/esm2020/lib/modules/datepicker/datepicker-calendar.component.mjs +104 -0
  26. package/esm2020/lib/modules/datepicker/datepicker-config.service.mjs +21 -0
  27. package/esm2020/lib/modules/datepicker/datepicker-custom-date.mjs +2 -0
  28. package/esm2020/lib/modules/datepicker/datepicker-date.mjs +2 -0
  29. package/esm2020/lib/modules/datepicker/datepicker-input-fuzzy.directive.mjs +464 -0
  30. package/esm2020/lib/modules/datepicker/datepicker-input.directive.mjs +488 -0
  31. package/esm2020/lib/modules/datepicker/datepicker.component.mjs +328 -0
  32. package/esm2020/lib/modules/datepicker/datepicker.module.mjs +95 -0
  33. package/esm2020/lib/modules/datepicker/datepicker.service.mjs +21 -0
  34. package/esm2020/lib/modules/datepicker/daypicker-button.component.mjs +22 -0
  35. package/esm2020/lib/modules/datepicker/daypicker-cell.component.mjs +126 -0
  36. package/esm2020/lib/modules/datepicker/daypicker.component.mjs +211 -0
  37. package/esm2020/lib/modules/datepicker/fuzzy-date.mjs +2 -0
  38. package/esm2020/lib/modules/datepicker/fuzzy-date.service.mjs +402 -0
  39. package/esm2020/lib/modules/datepicker/monthpicker.component.mjs +80 -0
  40. package/esm2020/lib/modules/datepicker/yearpicker.component.mjs +86 -0
  41. package/esm2020/lib/modules/shared/sky-datetime-resources.module.mjs +131 -0
  42. package/esm2020/lib/modules/timepicker/timepicker.component.mjs +361 -0
  43. package/esm2020/lib/modules/timepicker/timepicker.directive.mjs +226 -0
  44. package/esm2020/lib/modules/timepicker/timepicker.interface.mjs +2 -0
  45. package/esm2020/lib/modules/timepicker/timepicker.module.mjs +46 -0
  46. package/esm2020/skyux-datetime.mjs +5 -0
  47. package/esm2020/testing/datepicker-fixture.mjs +53 -0
  48. package/esm2020/testing/public-api.mjs +3 -0
  49. package/esm2020/testing/skyux-datetime-testing.mjs +5 -0
  50. package/esm2020/testing/timepicker-fixture.mjs +50 -0
  51. package/fesm2015/{skyux-datetime-testing.js → skyux-datetime-testing.mjs} +1 -2
  52. package/fesm2015/skyux-datetime-testing.mjs.map +1 -0
  53. package/fesm2015/skyux-datetime.mjs +4752 -0
  54. package/fesm2015/skyux-datetime.mjs.map +1 -0
  55. package/{esm2015/testing/datepicker-fixture.js → fesm2020/skyux-datetime-testing.mjs} +57 -3
  56. package/fesm2020/skyux-datetime-testing.mjs.map +1 -0
  57. package/{fesm2015/skyux-datetime.js → fesm2020/skyux-datetime.mjs} +196 -218
  58. package/fesm2020/skyux-datetime.mjs.map +1 -0
  59. package/lib/modules/date-range-picker/date-range-picker.component.d.ts +2 -6
  60. package/lib/modules/datepicker/datepicker-input.directive.d.ts +11 -0
  61. package/package.json +42 -18
  62. package/testing/package.json +5 -5
  63. package/bundles/skyux-datetime-testing.umd.js +0 -143
  64. package/bundles/skyux-datetime.umd.js +0 -5488
  65. package/esm2015/index.js +0 -31
  66. package/esm2015/index.js.map +0 -1
  67. package/esm2015/lib/modules/date-pipe/date-format-utility.js +0 -46
  68. package/esm2015/lib/modules/date-pipe/date-format-utility.js.map +0 -1
  69. package/esm2015/lib/modules/date-pipe/date-pipe.module.js +0 -21
  70. package/esm2015/lib/modules/date-pipe/date-pipe.module.js.map +0 -1
  71. package/esm2015/lib/modules/date-pipe/date.pipe.js +0 -65
  72. package/esm2015/lib/modules/date-pipe/date.pipe.js.map +0 -1
  73. package/esm2015/lib/modules/date-pipe/fuzzy-date.pipe.js +0 -47
  74. package/esm2015/lib/modules/date-pipe/fuzzy-date.pipe.js.map +0 -1
  75. package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js +0 -453
  76. package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js.map +0 -1
  77. package/esm2015/lib/modules/date-range-picker/date-range-picker.module.js +0 -47
  78. package/esm2015/lib/modules/date-range-picker/date-range-picker.module.js.map +0 -1
  79. package/esm2015/lib/modules/date-range-picker/date-range.service.js +0 -97
  80. package/esm2015/lib/modules/date-range-picker/date-range.service.js.map +0 -1
  81. package/esm2015/lib/modules/date-range-picker/types/date-range-calculation.js +0 -2
  82. package/esm2015/lib/modules/date-range-picker/types/date-range-calculation.js.map +0 -1
  83. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-config.js +0 -2
  84. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-config.js.map +0 -1
  85. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.js +0 -2
  86. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.js.map +0 -1
  87. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-id.js +0 -118
  88. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-id.js.map +0 -1
  89. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-type.js +0 -23
  90. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-type.js.map +0 -1
  91. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-validate-function.js +0 -2
  92. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-validate-function.js.map +0 -1
  93. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator.js +0 -56
  94. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator.js.map +0 -1
  95. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-config.js +0 -2
  96. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-config.js.map +0 -1
  97. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-configs.js +0 -147
  98. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-configs.js.map +0 -1
  99. package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js +0 -249
  100. package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js.map +0 -1
  101. package/esm2015/lib/modules/date-range-picker/types/date-range.js +0 -2
  102. package/esm2015/lib/modules/date-range-picker/types/date-range.js.map +0 -1
  103. package/esm2015/lib/modules/datepicker/date-formatter.js +0 -38
  104. package/esm2015/lib/modules/datepicker/date-formatter.js.map +0 -1
  105. package/esm2015/lib/modules/datepicker/datepicker-adapter.service.js +0 -33
  106. package/esm2015/lib/modules/datepicker/datepicker-adapter.service.js.map +0 -1
  107. package/esm2015/lib/modules/datepicker/datepicker-calendar-change.js +0 -2
  108. package/esm2015/lib/modules/datepicker/datepicker-calendar-change.js.map +0 -1
  109. package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js +0 -315
  110. package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js.map +0 -1
  111. package/esm2015/lib/modules/datepicker/datepicker-calendar.component.js +0 -109
  112. package/esm2015/lib/modules/datepicker/datepicker-calendar.component.js.map +0 -1
  113. package/esm2015/lib/modules/datepicker/datepicker-config.service.js +0 -21
  114. package/esm2015/lib/modules/datepicker/datepicker-config.service.js.map +0 -1
  115. package/esm2015/lib/modules/datepicker/datepicker-custom-date.js +0 -2
  116. package/esm2015/lib/modules/datepicker/datepicker-custom-date.js.map +0 -1
  117. package/esm2015/lib/modules/datepicker/datepicker-date.js +0 -2
  118. package/esm2015/lib/modules/datepicker/datepicker-date.js.map +0 -1
  119. package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js +0 -467
  120. package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js.map +0 -1
  121. package/esm2015/lib/modules/datepicker/datepicker-input.directive.js +0 -446
  122. package/esm2015/lib/modules/datepicker/datepicker-input.directive.js.map +0 -1
  123. package/esm2015/lib/modules/datepicker/datepicker.component.js +0 -333
  124. package/esm2015/lib/modules/datepicker/datepicker.component.js.map +0 -1
  125. package/esm2015/lib/modules/datepicker/datepicker.module.js +0 -95
  126. package/esm2015/lib/modules/datepicker/datepicker.module.js.map +0 -1
  127. package/esm2015/lib/modules/datepicker/datepicker.service.js +0 -21
  128. package/esm2015/lib/modules/datepicker/datepicker.service.js.map +0 -1
  129. package/esm2015/lib/modules/datepicker/daypicker-button.component.js +0 -26
  130. package/esm2015/lib/modules/datepicker/daypicker-button.component.js.map +0 -1
  131. package/esm2015/lib/modules/datepicker/daypicker-cell.component.js +0 -130
  132. package/esm2015/lib/modules/datepicker/daypicker-cell.component.js.map +0 -1
  133. package/esm2015/lib/modules/datepicker/daypicker.component.js +0 -215
  134. package/esm2015/lib/modules/datepicker/daypicker.component.js.map +0 -1
  135. package/esm2015/lib/modules/datepicker/fuzzy-date.js +0 -2
  136. package/esm2015/lib/modules/datepicker/fuzzy-date.js.map +0 -1
  137. package/esm2015/lib/modules/datepicker/fuzzy-date.service.js +0 -403
  138. package/esm2015/lib/modules/datepicker/fuzzy-date.service.js.map +0 -1
  139. package/esm2015/lib/modules/datepicker/monthpicker.component.js +0 -84
  140. package/esm2015/lib/modules/datepicker/monthpicker.component.js.map +0 -1
  141. package/esm2015/lib/modules/datepicker/yearpicker.component.js +0 -90
  142. package/esm2015/lib/modules/datepicker/yearpicker.component.js.map +0 -1
  143. package/esm2015/lib/modules/shared/sky-datetime-resources.module.js +0 -131
  144. package/esm2015/lib/modules/shared/sky-datetime-resources.module.js.map +0 -1
  145. package/esm2015/lib/modules/timepicker/timepicker.component.js +0 -367
  146. package/esm2015/lib/modules/timepicker/timepicker.component.js.map +0 -1
  147. package/esm2015/lib/modules/timepicker/timepicker.directive.js +0 -228
  148. package/esm2015/lib/modules/timepicker/timepicker.directive.js.map +0 -1
  149. package/esm2015/lib/modules/timepicker/timepicker.interface.js +0 -2
  150. package/esm2015/lib/modules/timepicker/timepicker.interface.js.map +0 -1
  151. package/esm2015/lib/modules/timepicker/timepicker.module.js +0 -46
  152. package/esm2015/lib/modules/timepicker/timepicker.module.js.map +0 -1
  153. package/esm2015/skyux-datetime.js +0 -5
  154. package/esm2015/skyux-datetime.js.map +0 -1
  155. package/esm2015/testing/datepicker-fixture.js.map +0 -1
  156. package/esm2015/testing/public-api.js +0 -3
  157. package/esm2015/testing/public-api.js.map +0 -1
  158. package/esm2015/testing/skyux-datetime-testing.js +0 -5
  159. package/esm2015/testing/skyux-datetime-testing.js.map +0 -1
  160. package/esm2015/testing/timepicker-fixture.js +0 -50
  161. package/esm2015/testing/timepicker-fixture.js.map +0 -1
  162. package/fesm2015/skyux-datetime-testing.js.map +0 -1
  163. package/fesm2015/skyux-datetime.js.map +0 -1
@@ -1,97 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { SkyLibResourcesService } from '@skyux/i18n';
3
- import { BehaviorSubject, forkJoin } from 'rxjs';
4
- import { first, map } from 'rxjs/operators';
5
- import { SkyDateRangeCalculator } from './types/date-range-calculator';
6
- import { SKY_DEFAULT_CALCULATOR_CONFIGS } from './types/date-range-default-calculator-configs';
7
- import * as i0 from "@angular/core";
8
- import * as i1 from "@skyux/i18n";
9
- /**
10
- * Creates and manages `SkyDateRangeCalculator` instances.
11
- */
12
- export class SkyDateRangeService {
13
- constructor(resourcesService) {
14
- this.resourcesService = resourcesService;
15
- this.calculatorReadyStream = new BehaviorSubject(false);
16
- this.calculatorConfigs = {};
17
- this.calculators = [];
18
- this.createDefaultCalculators();
19
- }
20
- /**
21
- * Creates a custom date range calculator.
22
- * @param config The calculator config.
23
- */
24
- createCalculator(config) {
25
- const newId = SkyDateRangeService.lastId++;
26
- const calculator = new SkyDateRangeCalculator(newId, config);
27
- this.calculators.push(calculator);
28
- return calculator;
29
- }
30
- /**
31
- * Returns calculators from an array of calculator IDs.
32
- * @param ids The array of calculator IDs.
33
- */
34
- getCalculators(ids) {
35
- const promises = ids.map((id) => {
36
- return this.getCalculatorById(id);
37
- });
38
- return Promise.all(promises);
39
- }
40
- /**
41
- * Returns a calculator from a calculator ID.
42
- * @param id The calculator ID.
43
- */
44
- getCalculatorById(id) {
45
- const calculatorId = parseInt(id, 10);
46
- const found = this.calculators.find((calculator) => {
47
- return calculator.calculatorId === calculatorId;
48
- });
49
- return new Promise((resolve, reject) => {
50
- if (!found) {
51
- reject(new Error(`A calculator with the ID ${id} was not found.`));
52
- return;
53
- }
54
- this.calculatorReadyStream.pipe(first()).subscribe(() => {
55
- resolve(found);
56
- });
57
- });
58
- }
59
- createDefaultCalculators() {
60
- const tasks = [];
61
- // Get resource strings for short descriptions.
62
- SKY_DEFAULT_CALCULATOR_CONFIGS.forEach((defaultConfig) => {
63
- const config = {
64
- getValue: defaultConfig.getValue,
65
- validate: defaultConfig.validate,
66
- shortDescription: '',
67
- type: defaultConfig.type,
68
- };
69
- tasks.push(this.resourcesService
70
- .getString(defaultConfig.shortDescriptionResourceKey)
71
- .pipe(first(), map((value) => {
72
- config.shortDescription = value;
73
- })));
74
- this.calculatorConfigs[defaultConfig.calculatorId] = config;
75
- });
76
- forkJoin(tasks)
77
- .pipe(first())
78
- .subscribe(() => {
79
- const calculatorIds = Object.keys(this.calculatorConfigs);
80
- const calculators = calculatorIds.map((calculatorId) => {
81
- const id = parseInt(calculatorId, 10);
82
- return new SkyDateRangeCalculator(id, this.calculatorConfigs[id]);
83
- });
84
- this.calculators = calculators;
85
- this.calculatorReadyStream.next(true);
86
- });
87
- }
88
- }
89
- // Start the count higher than the number of available values
90
- // provided in the SkyDateRangeCalculatorId enum.
91
- SkyDateRangeService.lastId = 1000;
92
- SkyDateRangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangeService, deps: [{ token: i1.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Injectable });
93
- SkyDateRangeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangeService });
94
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangeService, decorators: [{
95
- type: Injectable
96
- }], ctorParameters: function () { return [{ type: i1.SkyLibResourcesService }]; } });
97
- //# sourceMappingURL=date-range.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/date-range.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC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b,SAAS,CAAC,GAAG,EAAE;YACd,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC1D,MAAM,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;gBACrD,MAAM,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;gBACtC,OAAO,IAAI,sBAAsB,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAC/B,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACP,CAAC;;AA1GD,6DAA6D;AAC7D,iDAAiD;AAClC,0BAAM,GAAG,IAAI,CAAC;iHAHlB,mBAAmB;qHAAnB,mBAAmB;4FAAnB,mBAAmB;kBAD/B,UAAU","sourcesContent":["import { Injectable } from '@angular/core';\nimport { SkyLibResourcesService } from '@skyux/i18n';\n\nimport { BehaviorSubject, Observable, forkJoin } from 'rxjs';\nimport { first, map } from 'rxjs/operators';\n\nimport { SkyDateRangeCalculator } from './types/date-range-calculator';\nimport { SkyDateRangeCalculatorConfig } from './types/date-range-calculator-config';\nimport { SkyDateRangeCalculatorId } from './types/date-range-calculator-id';\nimport { SKY_DEFAULT_CALCULATOR_CONFIGS } from './types/date-range-default-calculator-configs';\n\n/**\n * Creates and manages `SkyDateRangeCalculator` instances.\n */\n@Injectable()\nexport class SkyDateRangeService {\n // Start the count higher than the number of available values\n // provided in the SkyDateRangeCalculatorId enum.\n private static lastId = 1000;\n\n private calculatorReadyStream = new BehaviorSubject<boolean>(false);\n\n private calculatorConfigs: { [id: number]: SkyDateRangeCalculatorConfig } =\n {};\n\n private calculators: SkyDateRangeCalculator[] = [];\n\n constructor(private resourcesService: SkyLibResourcesService) {\n this.createDefaultCalculators();\n }\n\n /**\n * Creates a custom date range calculator.\n * @param config The calculator config.\n */\n public createCalculator(\n config: SkyDateRangeCalculatorConfig\n ): SkyDateRangeCalculator {\n const newId = SkyDateRangeService.lastId++;\n const calculator = new SkyDateRangeCalculator(newId, config);\n\n this.calculators.push(calculator);\n\n return calculator;\n }\n\n /**\n * Returns calculators from an array of calculator IDs.\n * @param ids The array of calculator IDs.\n */\n public getCalculators(\n ids: SkyDateRangeCalculatorId[]\n ): Promise<SkyDateRangeCalculator[]> {\n const promises = ids.map((id) => {\n return this.getCalculatorById(id);\n });\n\n return Promise.all(promises);\n }\n\n /**\n * Returns a calculator from a calculator ID.\n * @param id The calculator ID.\n */\n public getCalculatorById(\n id: SkyDateRangeCalculatorId\n ): Promise<SkyDateRangeCalculator> {\n const calculatorId = parseInt(id as any, 10);\n const found = this.calculators.find((calculator) => {\n return calculator.calculatorId === calculatorId;\n });\n\n return new Promise((resolve, reject) => {\n if (!found) {\n reject(new Error(`A calculator with the ID ${id} was not found.`));\n return;\n }\n\n this.calculatorReadyStream.pipe(first()).subscribe(() => {\n resolve(found);\n });\n });\n }\n\n private createDefaultCalculators(): void {\n const tasks: Observable<void>[] = [];\n\n // Get resource strings for short descriptions.\n SKY_DEFAULT_CALCULATOR_CONFIGS.forEach((defaultConfig) => {\n const config = {\n getValue: defaultConfig.getValue,\n validate: defaultConfig.validate,\n shortDescription: '',\n type: defaultConfig.type,\n };\n\n tasks.push(\n this.resourcesService\n .getString(defaultConfig.shortDescriptionResourceKey)\n .pipe(\n first(),\n map((value) => {\n config.shortDescription = value;\n })\n )\n );\n\n this.calculatorConfigs[defaultConfig.calculatorId] = config;\n });\n\n forkJoin(tasks)\n .pipe(first())\n .subscribe(() => {\n const calculatorIds = Object.keys(this.calculatorConfigs);\n const calculators = calculatorIds.map((calculatorId) => {\n const id = parseInt(calculatorId, 10);\n return new SkyDateRangeCalculator(id, this.calculatorConfigs[id]);\n });\n\n this.calculators = calculators;\n this.calculatorReadyStream.next(true);\n });\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=date-range-calculation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-calculation.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-calculation.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyDateRange } from './date-range';\nimport { SkyDateRangeCalculatorId } from './date-range-calculator-id';\n\n/**\n * Represents the returned value of a `SkyDateRangeCalculator`.\n */\nexport interface SkyDateRangeCalculation extends SkyDateRange {\n /**\n * Specifies the calculator that determines the dates in the date range.\n */\n calculatorId: SkyDateRangeCalculatorId;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=date-range-calculator-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-calculator-config.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-calculator-config.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyDateRangeCalculatorGetValueFunction } from './date-range-calculator-date-range-function';\nimport { SkyDateRangeCalculatorType } from './date-range-calculator-type';\nimport { SkyDateRangeCalculatorValidateFunction } from './date-range-calculator-validate-function';\n\n/**\n * The configuration for a date range calculator.\n */\nexport interface SkyDateRangeCalculatorConfig {\n /**\n * Text to display within the calculator select menu to represent your calculator.\n */\n shortDescription: string;\n\n /**\n * The type of calculator to create.\n */\n type: SkyDateRangeCalculatorType;\n\n /**\n * A callback function that returns a `SkyDateRange` value.\n */\n getValue: SkyDateRangeCalculatorGetValueFunction;\n\n /**\n * A callback function that accepts user-selected start and end dates.\n * Returning an Angular `ValidationErrors` value invalidates the date range form control.\n */\n validate?: SkyDateRangeCalculatorValidateFunction;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=date-range-calculator-date-range-function.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-calculator-date-range-function.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyDateRange } from './date-range';\n\nexport type SkyDateRangeCalculatorGetValueFunction = (\n startDateInput?: Date,\n endDateInput?: Date\n) => SkyDateRange;\n"]}
@@ -1,118 +0,0 @@
1
- /**
2
- * `SkyDateRangeCalculatorId` values specify calculator objects that return
3
- * two `Date` objects to represent date ranges. The values populate the options
4
- * in the date range picker's dropdown. SKY UX uses `SkyDateRangeService` to create
5
- * calculators and configures each one with a `validate` function to confirm that dates
6
- * are compatible. For example, `validate` functions ensure that start dates are before
7
- * end dates. SKY UX also configures calculators to call a `getValue` function after
8
- * the `validate` function and return a range of two `Date` objects.
9
- */
10
- export var SkyDateRangeCalculatorId;
11
- (function (SkyDateRangeCalculatorId) {
12
- /**
13
- * Selects no dates and considers all dates within the date range. This is the default selection.
14
- */
15
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["AnyTime"] = 0] = "AnyTime";
16
- /**
17
- * Enables users to select an end date with no starting date.
18
- */
19
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["Before"] = 1] = "Before";
20
- /**
21
- * Enables users to select a start date with no end date.
22
- */
23
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["After"] = 2] = "After";
24
- /**
25
- * Enables users to select specific start and end dates.
26
- */
27
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["SpecificRange"] = 3] = "SpecificRange";
28
- /**
29
- * Sets the start and end dates to the day before the current day.
30
- */
31
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["Yesterday"] = 4] = "Yesterday";
32
- /**
33
- * Sets the start and end dates to the current day.
34
- */
35
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["Today"] = 5] = "Today";
36
- /**
37
- * Sets the start and end dates to the day after the current day.
38
- */
39
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["Tomorrow"] = 6] = "Tomorrow";
40
- /**
41
- * Sets the start date to Sunday of the week before the current week and
42
- * the end date to Saturday of that week.
43
- */
44
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["LastWeek"] = 7] = "LastWeek";
45
- /**
46
- * Sets the start date to Sunday of the current week and the end date to Saturday.
47
- */
48
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["ThisWeek"] = 8] = "ThisWeek";
49
- /**
50
- * Sets the start date to Sunday of the week after the current week and
51
- * the end date to Saturday of that week.
52
- */
53
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["NextWeek"] = 9] = "NextWeek";
54
- /**
55
- * Sets the start date to the first day of the month before the current month and
56
- * the end date to the last day of that month.
57
- */
58
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["LastMonth"] = 10] = "LastMonth";
59
- /**
60
- * Sets the start date to the first day of the current month and
61
- * the end date to the last day of the month.
62
- */
63
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["ThisMonth"] = 11] = "ThisMonth";
64
- /**
65
- * Sets the start date to the first day of the month after the current month
66
- * and the end date to the last day of that month.
67
- */
68
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["NextMonth"] = 12] = "NextMonth";
69
- /**
70
- * Sets the start date to the first day of the quarter before the current quarter and
71
- * the end date to the last day of that quarter. Quarters are
72
- * January to March, April to June, July to September, and October to December.
73
- */
74
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["LastQuarter"] = 13] = "LastQuarter";
75
- /**
76
- * Sets the start date to the first day of the current quarter and
77
- * the end date to the last day of the quarter. Quarters are
78
- * January to March, April to June, July to September, and October to December.
79
- */
80
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["ThisQuarter"] = 14] = "ThisQuarter";
81
- /**
82
- * Sets the start date to the first day of the quarter after the current quarter and
83
- * the end date to the last day of that quarter. Quarters are
84
- * January to March, April to June, July to September, and October to December.
85
- */
86
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["NextQuarter"] = 15] = "NextQuarter";
87
- /**
88
- * Sets the start date to the first day of the year before the current year
89
- * and the end date to the last day of that year.
90
- */
91
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["LastCalendarYear"] = 16] = "LastCalendarYear";
92
- /**
93
- * Sets the start date to the first day of the current year and
94
- * the end date to the last day of the year.
95
- */
96
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["ThisCalendarYear"] = 17] = "ThisCalendarYear";
97
- /**
98
- * Sets the start date to the first day of the year after the current year and
99
- * the end date to the last day of that year.
100
- */
101
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["NextCalendarYear"] = 18] = "NextCalendarYear";
102
- /**
103
- * Sets the start date to the first day of the fiscal year before the current fiscal year and
104
- * the end date to the last day of that fiscal year. The fiscal year is Oct. 1 to Sept. 30.
105
- */
106
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["LastFiscalYear"] = 19] = "LastFiscalYear";
107
- /**
108
- * Sets the start date to the first day of the current fiscal year and
109
- * the end date to the last day of the fiscal year. The fiscal year is Oct. 1 to Sept. 30.
110
- */
111
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["ThisFiscalYear"] = 20] = "ThisFiscalYear";
112
- /**
113
- * Sets the start date to the first day of the fiscal year after the current fiscal year
114
- * and the end date to the last day of that fiscal year. The fiscal year is Oct. 1 to Sept. 30.
115
- */
116
- SkyDateRangeCalculatorId[SkyDateRangeCalculatorId["NextFiscalYear"] = 21] = "NextFiscalYear";
117
- })(SkyDateRangeCalculatorId || (SkyDateRangeCalculatorId = {}));
118
- //# sourceMappingURL=date-range-calculator-id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-calculator-id.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-calculator-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,wBA+HX;AA/HD,WAAY,wBAAwB;IAClC;;OAEG;IACH,6EAAO,CAAA;IAEP;;OAEG;IACH,2EAAM,CAAA;IAEN;;OAEG;IACH,yEAAK,CAAA;IAEL;;OAEG;IACH,yFAAa,CAAA;IAEb;;OAEG;IACH,iFAAS,CAAA;IAET;;OAEG;IACH,yEAAK,CAAA;IAEL;;OAEG;IACH,+EAAQ,CAAA;IAER;;;OAGG;IACH,+EAAQ,CAAA;IAER;;OAEG;IACH,+EAAQ,CAAA;IAER;;;OAGG;IACH,+EAAQ,CAAA;IAER;;;OAGG;IACH,kFAAS,CAAA;IAET;;;OAGG;IACH,kFAAS,CAAA;IAET;;;OAGG;IACH,kFAAS,CAAA;IAET;;;;OAIG;IACH,sFAAW,CAAA;IAEX;;;;OAIG;IACH,sFAAW,CAAA;IAEX;;;;OAIG;IACH,sFAAW,CAAA;IAEX;;;OAGG;IACH,gGAAgB,CAAA;IAEhB;;;OAGG;IACH,gGAAgB,CAAA;IAEhB;;;OAGG;IACH,gGAAgB,CAAA;IAEhB;;;OAGG;IACH,4FAAc,CAAA;IAEd;;;OAGG;IACH,4FAAc,CAAA;IAEd;;;OAGG;IACH,4FAAc,CAAA;AAChB,CAAC,EA/HW,wBAAwB,KAAxB,wBAAwB,QA+HnC","sourcesContent":["/**\n * `SkyDateRangeCalculatorId` values specify calculator objects that return\n * two `Date` objects to represent date ranges. The values populate the options\n * in the date range picker's dropdown. SKY UX uses `SkyDateRangeService` to create\n * calculators and configures each one with a `validate` function to confirm that dates\n * are compatible. For example, `validate` functions ensure that start dates are before\n * end dates. SKY UX also configures calculators to call a `getValue` function after\n * the `validate` function and return a range of two `Date` objects.\n */\nexport enum SkyDateRangeCalculatorId {\n /**\n * Selects no dates and considers all dates within the date range. This is the default selection.\n */\n AnyTime,\n\n /**\n * Enables users to select an end date with no starting date.\n */\n Before,\n\n /**\n * Enables users to select a start date with no end date.\n */\n After,\n\n /**\n * Enables users to select specific start and end dates.\n */\n SpecificRange,\n\n /**\n * Sets the start and end dates to the day before the current day.\n */\n Yesterday,\n\n /**\n * Sets the start and end dates to the current day.\n */\n Today,\n\n /**\n * Sets the start and end dates to the day after the current day.\n */\n Tomorrow,\n\n /**\n * Sets the start date to Sunday of the week before the current week and\n * the end date to Saturday of that week.\n */\n LastWeek,\n\n /**\n * Sets the start date to Sunday of the current week and the end date to Saturday.\n */\n ThisWeek,\n\n /**\n * Sets the start date to Sunday of the week after the current week and\n * the end date to Saturday of that week.\n */\n NextWeek,\n\n /**\n * Sets the start date to the first day of the month before the current month and\n * the end date to the last day of that month.\n */\n LastMonth,\n\n /**\n * Sets the start date to the first day of the current month and\n * the end date to the last day of the month.\n */\n ThisMonth,\n\n /**\n * Sets the start date to the first day of the month after the current month\n * and the end date to the last day of that month.\n */\n NextMonth,\n\n /**\n * Sets the start date to the first day of the quarter before the current quarter and\n * the end date to the last day of that quarter. Quarters are\n * January to March, April to June, July to September, and October to December.\n */\n LastQuarter,\n\n /**\n * Sets the start date to the first day of the current quarter and\n * the end date to the last day of the quarter. Quarters are\n * January to March, April to June, July to September, and October to December.\n */\n ThisQuarter,\n\n /**\n * Sets the start date to the first day of the quarter after the current quarter and\n * the end date to the last day of that quarter. Quarters are\n * January to March, April to June, July to September, and October to December.\n */\n NextQuarter,\n\n /**\n * Sets the start date to the first day of the year before the current year\n * and the end date to the last day of that year.\n */\n LastCalendarYear,\n\n /**\n * Sets the start date to the first day of the current year and\n * the end date to the last day of the year.\n */\n ThisCalendarYear,\n\n /**\n * Sets the start date to the first day of the year after the current year and\n * the end date to the last day of that year.\n */\n NextCalendarYear,\n\n /**\n * Sets the start date to the first day of the fiscal year before the current fiscal year and\n * the end date to the last day of that fiscal year. The fiscal year is Oct. 1 to Sept. 30.\n */\n LastFiscalYear,\n\n /**\n * Sets the start date to the first day of the current fiscal year and\n * the end date to the last day of the fiscal year. The fiscal year is Oct. 1 to Sept. 30.\n */\n ThisFiscalYear,\n\n /**\n * Sets the start date to the first day of the fiscal year after the current fiscal year\n * and the end date to the last day of that fiscal year. The fiscal year is Oct. 1 to Sept. 30.\n */\n NextFiscalYear,\n}\n"]}
@@ -1,23 +0,0 @@
1
- /**
2
- * Indicates the types of calculations available for a date range calculator.
3
- */
4
- export var SkyDateRangeCalculatorType;
5
- (function (SkyDateRangeCalculatorType) {
6
- /**
7
- * Includes an input for a date after the current date.
8
- */
9
- SkyDateRangeCalculatorType[SkyDateRangeCalculatorType["After"] = 0] = "After";
10
- /**
11
- * Includes an input for a date before the current date.
12
- */
13
- SkyDateRangeCalculatorType[SkyDateRangeCalculatorType["Before"] = 1] = "Before";
14
- /**
15
- * Includes two inputs for a range of dates.
16
- */
17
- SkyDateRangeCalculatorType[SkyDateRangeCalculatorType["Range"] = 2] = "Range";
18
- /**
19
- * Does not accept any input but calculates a specific range based on the current date.
20
- */
21
- SkyDateRangeCalculatorType[SkyDateRangeCalculatorType["Relative"] = 3] = "Relative";
22
- })(SkyDateRangeCalculatorType || (SkyDateRangeCalculatorType = {}));
23
- //# sourceMappingURL=date-range-calculator-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-calculator-type.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-calculator-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,0BAoBX;AApBD,WAAY,0BAA0B;IACpC;;OAEG;IACH,6EAAK,CAAA;IAEL;;OAEG;IACH,+EAAM,CAAA;IAEN;;OAEG;IACH,6EAAK,CAAA;IAEL;;OAEG;IACH,mFAAQ,CAAA;AACV,CAAC,EApBW,0BAA0B,KAA1B,0BAA0B,QAoBrC","sourcesContent":["/**\n * Indicates the types of calculations available for a date range calculator.\n */\nexport enum SkyDateRangeCalculatorType {\n /**\n * Includes an input for a date after the current date.\n */\n After,\n\n /**\n * Includes an input for a date before the current date.\n */\n Before,\n\n /**\n * Includes two inputs for a range of dates.\n */\n Range,\n\n /**\n * Does not accept any input but calculates a specific range based on the current date.\n */\n Relative,\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=date-range-calculator-validate-function.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-calculator-validate-function.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-calculator-validate-function.ts"],"names":[],"mappings":"","sourcesContent":["import { ValidationErrors } from '@angular/forms';\n\nimport { SkyDateRange } from './date-range';\n\nexport type SkyDateRangeCalculatorValidateFunction = (\n value?: SkyDateRange\n) => ValidationErrors;\n"]}
@@ -1,56 +0,0 @@
1
- /**
2
- * Represents the calculator.
3
- */
4
- export class SkyDateRangeCalculator {
5
- constructor(
6
- /**
7
- * Provides a calculator ID to specify calculator objects that represent date ranges.
8
- */
9
- calculatorId, config) {
10
- this.calculatorId = calculatorId;
11
- this.config = config;
12
- this.type = config.type;
13
- this.shortDescription = config.shortDescription;
14
- }
15
- /**
16
- * Gets the current value of the calculator.
17
- * @param startDateInput The start date.
18
- * @param endDateInput The end date.
19
- */
20
- getValue(startDateInput, endDateInput) {
21
- const result = this.config.getValue(startDateInput, endDateInput);
22
- /* tslint:disable:no-null-keyword */
23
- // (Angular form controls use null for the "empty" value.)
24
- let startDate = null;
25
- if (result.startDate instanceof Date) {
26
- startDate = this.parseDateWithoutTime(result.startDate);
27
- }
28
- let endDate = null;
29
- if (result.endDate instanceof Date) {
30
- endDate = this.parseDateWithoutTime(result.endDate);
31
- }
32
- /* tslint:enable */
33
- return {
34
- calculatorId: this.calculatorId,
35
- startDate,
36
- endDate,
37
- };
38
- }
39
- /**
40
- * Performs synchronous validation against the control.
41
- */
42
- validate(value) {
43
- if (!this.config.validate) {
44
- return;
45
- }
46
- return this.config.validate(value);
47
- }
48
- /**
49
- * Get a date object without time information.
50
- * See: https://stackoverflow.com/a/38050824/6178885
51
- */
52
- parseDateWithoutTime(date) {
53
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
54
- }
55
- }
56
- //# sourceMappingURL=date-range-calculator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-calculator.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-calculator.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAWjC;IACE;;OAEG;IACa,YAAsC,EAC9C,MAAoC;QAD5B,iBAAY,GAAZ,YAAY,CAA0B;QAC9C,WAAM,GAAN,MAAM,CAA8B;QAE5C,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACI,QAAQ,CACb,cAAqB,EACrB,YAAmB;QAEnB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAElE,oCAAoC;QACpC,0DAA0D;QAE1D,IAAI,SAAS,GAAS,IAAI,CAAC;QAC3B,IAAI,MAAM,CAAC,SAAS,YAAY,IAAI,EAAE;YACpC,SAAS,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SACzD;QAED,IAAI,OAAO,GAAS,IAAI,CAAC;QACzB,IAAI,MAAM,CAAC,OAAO,YAAY,IAAI,EAAE;YAClC,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SACrD;QAED,mBAAmB;QAEnB,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS;YACT,OAAO;SACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,KAAoB;QAClC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YACzB,OAAO;SACR;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACK,oBAAoB,CAAC,IAAU;QACrC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF","sourcesContent":["import { ValidationErrors } from '@angular/forms';\n\nimport { SkyDateRange } from './date-range';\nimport { SkyDateRangeCalculation } from './date-range-calculation';\nimport { SkyDateRangeCalculatorConfig } from './date-range-calculator-config';\nimport { SkyDateRangeCalculatorId } from './date-range-calculator-id';\nimport { SkyDateRangeCalculatorType } from './date-range-calculator-type';\n\n/**\n * Represents the calculator.\n */\nexport class SkyDateRangeCalculator {\n /**\n * Specifies the text to display in the calculator select menu.\n */\n public readonly shortDescription: string;\n\n /**\n * Specifies the type of calculations available for the date range.\n */\n public readonly type: SkyDateRangeCalculatorType;\n\n constructor(\n /**\n * Provides a calculator ID to specify calculator objects that represent date ranges.\n */\n public readonly calculatorId: SkyDateRangeCalculatorId,\n private config: SkyDateRangeCalculatorConfig\n ) {\n this.type = config.type;\n this.shortDescription = config.shortDescription;\n }\n\n /**\n * Gets the current value of the calculator.\n * @param startDateInput The start date.\n * @param endDateInput The end date.\n */\n public getValue(\n startDateInput?: Date,\n endDateInput?: Date\n ): SkyDateRangeCalculation {\n const result = this.config.getValue(startDateInput, endDateInput);\n\n /* tslint:disable:no-null-keyword */\n // (Angular form controls use null for the \"empty\" value.)\n\n let startDate: Date = null;\n if (result.startDate instanceof Date) {\n startDate = this.parseDateWithoutTime(result.startDate);\n }\n\n let endDate: Date = null;\n if (result.endDate instanceof Date) {\n endDate = this.parseDateWithoutTime(result.endDate);\n }\n\n /* tslint:enable */\n\n return {\n calculatorId: this.calculatorId,\n startDate,\n endDate,\n };\n }\n\n /**\n * Performs synchronous validation against the control.\n */\n public validate(value?: SkyDateRange): ValidationErrors {\n if (!this.config.validate) {\n return;\n }\n\n return this.config.validate(value);\n }\n\n /**\n * Get a date object without time information.\n * See: https://stackoverflow.com/a/38050824/6178885\n */\n private parseDateWithoutTime(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate());\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=date-range-default-calculator-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-default-calculator-config.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-default-calculator-config.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyDateRangeCalculatorGetValueFunction } from './date-range-calculator-date-range-function';\nimport { SkyDateRangeCalculatorId } from './date-range-calculator-id';\nimport { SkyDateRangeCalculatorType } from './date-range-calculator-type';\nimport { SkyDateRangeCalculatorValidateFunction } from './date-range-calculator-validate-function';\n\n/**\n * @internal\n */\nexport interface SkyDateRangeDefaultCalculatorConfig {\n calculatorId: SkyDateRangeCalculatorId;\n\n shortDescriptionResourceKey: string;\n\n type: SkyDateRangeCalculatorType;\n\n getValue: SkyDateRangeCalculatorGetValueFunction;\n\n validate?: SkyDateRangeCalculatorValidateFunction;\n}\n"]}
@@ -1,147 +0,0 @@
1
- import { SkyDateRangeCalculatorId } from './date-range-calculator-id';
2
- import { SkyDateRangeCalculatorType } from './date-range-calculator-type';
3
- import { SkyDateRangeRelativeValue } from './date-range-relative-value';
4
- export const SKY_DEFAULT_CALCULATOR_CONFIGS = [
5
- {
6
- calculatorId: SkyDateRangeCalculatorId.AnyTime,
7
- type: SkyDateRangeCalculatorType.Relative,
8
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_any_time',
9
- getValue: (startDate, endDate) => ({ startDate, endDate }),
10
- },
11
- {
12
- calculatorId: SkyDateRangeCalculatorId.Before,
13
- type: SkyDateRangeCalculatorType.Before,
14
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_before',
15
- getValue: (startDate, endDate) => ({ startDate, endDate }),
16
- },
17
- {
18
- calculatorId: SkyDateRangeCalculatorId.After,
19
- type: SkyDateRangeCalculatorType.After,
20
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_after',
21
- getValue: (startDate, endDate) => ({ startDate, endDate }),
22
- },
23
- {
24
- calculatorId: SkyDateRangeCalculatorId.SpecificRange,
25
- type: SkyDateRangeCalculatorType.Range,
26
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_specific_range',
27
- getValue: (startDate, endDate) => ({ startDate, endDate }),
28
- validate: (value) => {
29
- if (value.startDate &&
30
- value.endDate &&
31
- value.startDate > value.endDate) {
32
- return {
33
- endDateBeforeStartDate: true,
34
- };
35
- }
36
- },
37
- },
38
- {
39
- calculatorId: SkyDateRangeCalculatorId.LastFiscalYear,
40
- type: SkyDateRangeCalculatorType.Relative,
41
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_last_fiscal_year',
42
- getValue: () => SkyDateRangeRelativeValue.lastFiscalYear,
43
- },
44
- {
45
- calculatorId: SkyDateRangeCalculatorId.LastMonth,
46
- type: SkyDateRangeCalculatorType.Relative,
47
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_last_month',
48
- getValue: () => SkyDateRangeRelativeValue.lastMonth,
49
- },
50
- {
51
- calculatorId: SkyDateRangeCalculatorId.LastQuarter,
52
- type: SkyDateRangeCalculatorType.Relative,
53
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_last_quarter',
54
- getValue: () => SkyDateRangeRelativeValue.lastQuarter,
55
- },
56
- {
57
- calculatorId: SkyDateRangeCalculatorId.LastWeek,
58
- type: SkyDateRangeCalculatorType.Relative,
59
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_last_week',
60
- getValue: () => SkyDateRangeRelativeValue.lastWeek,
61
- },
62
- {
63
- calculatorId: SkyDateRangeCalculatorId.LastCalendarYear,
64
- type: SkyDateRangeCalculatorType.Relative,
65
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_last_calendar_year',
66
- getValue: () => SkyDateRangeRelativeValue.lastCalendarYear,
67
- },
68
- {
69
- calculatorId: SkyDateRangeCalculatorId.NextFiscalYear,
70
- type: SkyDateRangeCalculatorType.Relative,
71
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_next_fiscal_year',
72
- getValue: () => SkyDateRangeRelativeValue.nextFiscalYear,
73
- },
74
- {
75
- calculatorId: SkyDateRangeCalculatorId.NextMonth,
76
- type: SkyDateRangeCalculatorType.Relative,
77
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_next_month',
78
- getValue: () => SkyDateRangeRelativeValue.nextMonth,
79
- },
80
- {
81
- calculatorId: SkyDateRangeCalculatorId.NextQuarter,
82
- type: SkyDateRangeCalculatorType.Relative,
83
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_next_quarter',
84
- getValue: () => SkyDateRangeRelativeValue.nextQuarter,
85
- },
86
- {
87
- calculatorId: SkyDateRangeCalculatorId.NextWeek,
88
- type: SkyDateRangeCalculatorType.Relative,
89
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_next_week',
90
- getValue: () => SkyDateRangeRelativeValue.nextWeek,
91
- },
92
- {
93
- calculatorId: SkyDateRangeCalculatorId.NextCalendarYear,
94
- type: SkyDateRangeCalculatorType.Relative,
95
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_next_calendar_year',
96
- getValue: () => SkyDateRangeRelativeValue.nextCalendarYear,
97
- },
98
- {
99
- calculatorId: SkyDateRangeCalculatorId.ThisFiscalYear,
100
- type: SkyDateRangeCalculatorType.Relative,
101
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_this_fiscal_year',
102
- getValue: () => SkyDateRangeRelativeValue.thisFiscalYear,
103
- },
104
- {
105
- calculatorId: SkyDateRangeCalculatorId.ThisMonth,
106
- type: SkyDateRangeCalculatorType.Relative,
107
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_this_month',
108
- getValue: () => SkyDateRangeRelativeValue.thisMonth,
109
- },
110
- {
111
- calculatorId: SkyDateRangeCalculatorId.ThisQuarter,
112
- type: SkyDateRangeCalculatorType.Relative,
113
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_this_quarter',
114
- getValue: () => SkyDateRangeRelativeValue.thisQuarter,
115
- },
116
- {
117
- calculatorId: SkyDateRangeCalculatorId.ThisWeek,
118
- type: SkyDateRangeCalculatorType.Relative,
119
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_this_week',
120
- getValue: () => SkyDateRangeRelativeValue.thisWeek,
121
- },
122
- {
123
- calculatorId: SkyDateRangeCalculatorId.ThisCalendarYear,
124
- type: SkyDateRangeCalculatorType.Relative,
125
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_this_calendar_year',
126
- getValue: () => SkyDateRangeRelativeValue.thisCalendarYear,
127
- },
128
- {
129
- calculatorId: SkyDateRangeCalculatorId.Today,
130
- type: SkyDateRangeCalculatorType.Relative,
131
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_today',
132
- getValue: () => SkyDateRangeRelativeValue.today,
133
- },
134
- {
135
- calculatorId: SkyDateRangeCalculatorId.Tomorrow,
136
- type: SkyDateRangeCalculatorType.Relative,
137
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_tomorrow',
138
- getValue: () => SkyDateRangeRelativeValue.tomorrow,
139
- },
140
- {
141
- calculatorId: SkyDateRangeCalculatorId.Yesterday,
142
- type: SkyDateRangeCalculatorType.Relative,
143
- shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_yesterday',
144
- getValue: () => SkyDateRangeRelativeValue.yesterday,
145
- },
146
- ];
147
- //# sourceMappingURL=date-range-default-calculator-configs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-default-calculator-configs.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-default-calculator-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;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QACzC,2BAA2B,EACzB,yDAAyD;QAC3D,QAAQ,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,gBAAgB;KAC3D;IAED;QACE,YAAY,EAAE,wBAAwB,CAAC,KAAK;QAC5C,IAAI,EAAE,0BAA0B,CAAC,QAAQ;QACzC,2BAA2B,EAAE,4CAA4C;QACzE,QAAQ,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,KAAK;KAChD;IAED;QACE,YAAY,EAAE,wBAAwB,CAAC,QAAQ;QAC/C,IAAI,EAAE,0BAA0B,CAAC,QAAQ;QACzC,2BAA2B,EACzB,+CAA+C;QACjD,QAAQ,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,QAAQ;KACnD;IAED;QACE,YAAY,EAAE,wBAAwB,CAAC,SAAS;QAChD,IAAI,EAAE,0BAA0B,CAAC,QAAQ;QACzC,2BAA2B,EACzB,gDAAgD;QAClD,QAAQ,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,SAAS;KACpD;CACF,CAAC","sourcesContent":["import { SkyDateRangeCalculatorId } from './date-range-calculator-id';\nimport { SkyDateRangeCalculatorType } from './date-range-calculator-type';\nimport { SkyDateRangeDefaultCalculatorConfig } from './date-range-default-calculator-config';\nimport { SkyDateRangeRelativeValue } from './date-range-relative-value';\n\nexport const SKY_DEFAULT_CALCULATOR_CONFIGS: SkyDateRangeDefaultCalculatorConfig[] =\n [\n {\n calculatorId: SkyDateRangeCalculatorId.AnyTime,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_any_time',\n getValue: (startDate, endDate) => ({ startDate, endDate }),\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.Before,\n type: SkyDateRangeCalculatorType.Before,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_before',\n getValue: (startDate, endDate) => ({ startDate, endDate }),\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.After,\n type: SkyDateRangeCalculatorType.After,\n shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_after',\n getValue: (startDate, endDate) => ({ startDate, endDate }),\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.SpecificRange,\n type: SkyDateRangeCalculatorType.Range,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_specific_range',\n getValue: (startDate, endDate) => ({ startDate, endDate }),\n validate: (value) => {\n if (\n value.startDate &&\n value.endDate &&\n value.startDate > value.endDate\n ) {\n return {\n endDateBeforeStartDate: true,\n };\n }\n },\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.LastFiscalYear,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_last_fiscal_year',\n getValue: () => SkyDateRangeRelativeValue.lastFiscalYear,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.LastMonth,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_last_month',\n getValue: () => SkyDateRangeRelativeValue.lastMonth,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.LastQuarter,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_last_quarter',\n getValue: () => SkyDateRangeRelativeValue.lastQuarter,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.LastWeek,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_last_week',\n getValue: () => SkyDateRangeRelativeValue.lastWeek,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.LastCalendarYear,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_last_calendar_year',\n getValue: () => SkyDateRangeRelativeValue.lastCalendarYear,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.NextFiscalYear,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_next_fiscal_year',\n getValue: () => SkyDateRangeRelativeValue.nextFiscalYear,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.NextMonth,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_next_month',\n getValue: () => SkyDateRangeRelativeValue.nextMonth,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.NextQuarter,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_next_quarter',\n getValue: () => SkyDateRangeRelativeValue.nextQuarter,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.NextWeek,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_next_week',\n getValue: () => SkyDateRangeRelativeValue.nextWeek,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.NextCalendarYear,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_next_calendar_year',\n getValue: () => SkyDateRangeRelativeValue.nextCalendarYear,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.ThisFiscalYear,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_this_fiscal_year',\n getValue: () => SkyDateRangeRelativeValue.thisFiscalYear,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.ThisMonth,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_this_month',\n getValue: () => SkyDateRangeRelativeValue.thisMonth,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.ThisQuarter,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_this_quarter',\n getValue: () => SkyDateRangeRelativeValue.thisQuarter,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.ThisWeek,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_this_week',\n getValue: () => SkyDateRangeRelativeValue.thisWeek,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.ThisCalendarYear,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_this_calendar_year',\n getValue: () => SkyDateRangeRelativeValue.thisCalendarYear,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.Today,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_today',\n getValue: () => SkyDateRangeRelativeValue.today,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.Tomorrow,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_tomorrow',\n getValue: () => SkyDateRangeRelativeValue.tomorrow,\n },\n\n {\n calculatorId: SkyDateRangeCalculatorId.Yesterday,\n type: SkyDateRangeCalculatorType.Relative,\n shortDescriptionResourceKey:\n 'skyux_date_range_picker_format_label_yesterday',\n getValue: () => SkyDateRangeRelativeValue.yesterday,\n },\n ];\n"]}