@skyux/datetime 5.5.0-beta.0 → 5.6.1

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 (65) hide show
  1. package/bundles/skyux-datetime.umd.js +1007 -690
  2. package/documentation.json +187 -187
  3. package/esm2015/lib/modules/date-pipe/date-format-utility.js.map +1 -1
  4. package/esm2015/lib/modules/date-pipe/date-pipe.module.js.map +1 -1
  5. package/esm2015/lib/modules/date-pipe/date.pipe.js.map +1 -1
  6. package/esm2015/lib/modules/date-pipe/fuzzy-date.pipe.js.map +1 -1
  7. package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js +3 -3
  8. package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js.map +1 -1
  9. package/esm2015/lib/modules/date-range-picker/date-range-picker.module.js.map +1 -1
  10. package/esm2015/lib/modules/date-range-picker/date-range.service.js.map +1 -1
  11. package/esm2015/lib/modules/date-range-picker/types/date-range-calculation.js.map +1 -1
  12. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator-config.js.map +1 -1
  13. package/esm2015/lib/modules/date-range-picker/types/date-range-calculator.js.map +1 -1
  14. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-config.js.map +1 -1
  15. package/esm2015/lib/modules/date-range-picker/types/date-range-default-calculator-configs.js.map +1 -1
  16. package/esm2015/lib/modules/datepicker/date-formatter.js.map +1 -1
  17. package/esm2015/lib/modules/datepicker/datepicker-calendar-change.js.map +1 -1
  18. package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js +6 -6
  19. package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js.map +1 -1
  20. package/esm2015/lib/modules/datepicker/datepicker-calendar.component.js +1 -1
  21. package/esm2015/lib/modules/datepicker/datepicker-calendar.component.js.map +1 -1
  22. package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js +2 -2
  23. package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js.map +1 -1
  24. package/esm2015/lib/modules/datepicker/datepicker-input.directive.js +3 -3
  25. package/esm2015/lib/modules/datepicker/datepicker-input.directive.js.map +1 -1
  26. package/esm2015/lib/modules/datepicker/datepicker.component.js +2 -2
  27. package/esm2015/lib/modules/datepicker/datepicker.component.js.map +1 -1
  28. package/esm2015/lib/modules/datepicker/datepicker.module.js +10 -10
  29. package/esm2015/lib/modules/datepicker/datepicker.module.js.map +1 -1
  30. package/esm2015/lib/modules/datepicker/daypicker-button.component.js.map +1 -1
  31. package/esm2015/lib/modules/datepicker/daypicker-cell.component.js +1 -1
  32. package/esm2015/lib/modules/datepicker/daypicker-cell.component.js.map +1 -1
  33. package/esm2015/lib/modules/datepicker/daypicker.component.js +13 -13
  34. package/esm2015/lib/modules/datepicker/daypicker.component.js.map +1 -1
  35. package/esm2015/lib/modules/datepicker/fuzzy-date.service.js +10 -10
  36. package/esm2015/lib/modules/datepicker/fuzzy-date.service.js.map +1 -1
  37. package/esm2015/lib/modules/datepicker/monthpicker.component.js +5 -5
  38. package/esm2015/lib/modules/datepicker/monthpicker.component.js.map +1 -1
  39. package/esm2015/lib/modules/datepicker/yearpicker.component.js +2 -2
  40. package/esm2015/lib/modules/datepicker/yearpicker.component.js.map +1 -1
  41. package/esm2015/lib/modules/shared/sky-datetime-resources.module.js +1 -1
  42. package/esm2015/lib/modules/shared/sky-datetime-resources.module.js.map +1 -1
  43. package/esm2015/lib/modules/timepicker/timepicker.component.js +8 -8
  44. package/esm2015/lib/modules/timepicker/timepicker.component.js.map +1 -1
  45. package/esm2015/lib/modules/timepicker/timepicker.directive.js +4 -5
  46. package/esm2015/lib/modules/timepicker/timepicker.directive.js.map +1 -1
  47. package/esm2015/lib/modules/timepicker/timepicker.module.js +3 -3
  48. package/esm2015/lib/modules/timepicker/timepicker.module.js.map +1 -1
  49. package/esm2015/testing/datepicker-fixture.js.map +1 -1
  50. package/esm2015/testing/timepicker-fixture.js.map +1 -1
  51. package/fesm2015/skyux-datetime-testing.js.map +1 -1
  52. package/fesm2015/skyux-datetime.js +445 -446
  53. package/fesm2015/skyux-datetime.js.map +1 -1
  54. package/lib/modules/date-range-picker/date-range-picker.component.d.ts +2 -2
  55. package/lib/modules/date-range-picker/date-range.service.d.ts +1 -1
  56. package/lib/modules/date-range-picker/types/date-range-calculation.d.ts +1 -1
  57. package/lib/modules/date-range-picker/types/date-range-calculator.d.ts +1 -1
  58. package/lib/modules/datepicker/datepicker-calendar-change.d.ts +1 -1
  59. package/lib/modules/datepicker/datepicker-calendar-inner.component.d.ts +1 -1
  60. package/lib/modules/datepicker/datepicker-calendar.component.d.ts +1 -1
  61. package/lib/modules/datepicker/datepicker-input-fuzzy.directive.d.ts +1 -1
  62. package/lib/modules/datepicker/datepicker-input.directive.d.ts +1 -1
  63. package/lib/modules/datepicker/datepicker.component.d.ts +2 -2
  64. package/lib/modules/datepicker/daypicker.component.d.ts +1 -1
  65. package/package.json +18 -16
@@ -1 +1 @@
1
- {"version":3,"file":"date-format-utility.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-pipe/date-format-utility.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,6FAA6F;AAC7F,oBAAoB;AACpB,uFAAuF;AAEvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,OAAO,oBAAoB;IAY/B,0BAA0B;IAC1B,gBAAe,CAAC;IAET,MAAM,CAAC,MAAM,CAClB,MAAc,EACd,KAAU,EACV,OAAe;QAEf,IAAI,IAAU,CAAC;QAEf,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,KAAK,EAAE;YACrC,OAAO,SAAS,CAAC;SAClB;QAED,wEAAwE;QACxE,uFAAuF;QACvF,6BAA6B;QAC7B,IAAI,KAAK,YAAY,MAAM,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,EAAE;YACvD,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC1B;QAED,2FAA2F;QAC3F,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE;YACxB,IAAI,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;SAC5B;aAAM;YACL,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC1B;QAED,OAAO,oBAAoB,CAAC,MAAM,CAChC,IAAI,EACJ,MAAM,EACN,oBAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,CAClD,CAAC;IACJ,CAAC;;AA7Cc,6BAAQ,GAA8B;IACnD,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,IAAI;CAChB,CAAC;AAuCJ,SAAS,OAAO,CAAC,GAAQ;IACvB,OAAO,CAAC,GAAG,CAAC;AACd,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAU;IACnC,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["// This class is mostly ported from the Angular 4.x DatePipe in order to maintain the old\n// behavior of using the `Intl` API for formatting dates rather than having to register every\n// supported locale.\n// https://github.com/angular/angular/blob/4.4.x/packages/common/src/pipes/date_pipe.ts\n\nimport { SkyIntlDateFormatter } from '@skyux/i18n';\n\nimport moment from 'moment';\n\nexport class SkyDateFormatUtility {\n private static _ALIASES: { [key: string]: string } = {\n medium: 'yMMMdjms',\n short: 'yMdjm',\n fullDate: 'yMMMMEEEEd',\n longDate: 'yMMMMd',\n mediumDate: 'yMMMd',\n shortDate: 'yMd',\n mediumTime: 'jms',\n shortTime: 'jm',\n };\n\n /* istanbul ignore next */\n constructor() {}\n\n public static format(\n locale: string,\n value: any,\n pattern: string\n ): string | null {\n let date: Date;\n\n if (isBlank(value) || value !== value) {\n return undefined;\n }\n\n // Moment will interpret any non-date object as today's date. That would\n // introduce a breaking change, so we check for it here. This could probably be removed\n // in a future major version.\n if (value instanceof Object && !(value instanceof Date)) {\n handleInvalidDate(value);\n }\n\n // Use moment to avoid inconsistencies between browsers interpreting the value differently.\n const momentDate = moment(value);\n if (momentDate.isValid()) {\n date = momentDate.toDate();\n } else {\n handleInvalidDate(value);\n }\n\n return SkyIntlDateFormatter.format(\n date,\n locale,\n SkyDateFormatUtility._ALIASES[pattern] || pattern\n );\n }\n}\n\nfunction isBlank(obj: any): boolean {\n return !obj;\n}\n\nfunction handleInvalidDate(value: any): void {\n throw new Error('Invalid value: ' + value);\n}\n"]}
1
+ {"version":3,"file":"date-format-utility.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-pipe/date-format-utility.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,6FAA6F;AAC7F,oBAAoB;AACpB,uFAAuF;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,OAAO,oBAAoB;IAY/B,0BAA0B;IAC1B,gBAAe,CAAC;IAET,MAAM,CAAC,MAAM,CAClB,MAAc,EACd,KAAU,EACV,OAAe;QAEf,IAAI,IAAU,CAAC;QAEf,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,KAAK,EAAE;YACrC,OAAO,SAAS,CAAC;SAClB;QAED,wEAAwE;QACxE,uFAAuF;QACvF,6BAA6B;QAC7B,IAAI,KAAK,YAAY,MAAM,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,EAAE;YACvD,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC1B;QAED,2FAA2F;QAC3F,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE;YACxB,IAAI,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;SAC5B;aAAM;YACL,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC1B;QAED,OAAO,oBAAoB,CAAC,MAAM,CAChC,IAAI,EACJ,MAAM,EACN,oBAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,CAClD,CAAC;IACJ,CAAC;;AA7Cc,6BAAQ,GAA8B;IACnD,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,IAAI;CAChB,CAAC;AAuCJ,SAAS,OAAO,CAAC,GAAQ;IACvB,OAAO,CAAC,GAAG,CAAC;AACd,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAU;IACnC,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["// This class is mostly ported from the Angular 4.x DatePipe in order to maintain the old\n// behavior of using the `Intl` API for formatting dates rather than having to register every\n// supported locale.\n// https://github.com/angular/angular/blob/4.4.x/packages/common/src/pipes/date_pipe.ts\nimport { SkyIntlDateFormatter } from '@skyux/i18n';\n\nimport moment from 'moment';\n\nexport class SkyDateFormatUtility {\n private static _ALIASES: { [key: string]: string } = {\n medium: 'yMMMdjms',\n short: 'yMdjm',\n fullDate: 'yMMMMEEEEd',\n longDate: 'yMMMMd',\n mediumDate: 'yMMMd',\n shortDate: 'yMd',\n mediumTime: 'jms',\n shortTime: 'jm',\n };\n\n /* istanbul ignore next */\n constructor() {}\n\n public static format(\n locale: string,\n value: any,\n pattern: string\n ): string | null {\n let date: Date;\n\n if (isBlank(value) || value !== value) {\n return undefined;\n }\n\n // Moment will interpret any non-date object as today's date. That would\n // introduce a breaking change, so we check for it here. This could probably be removed\n // in a future major version.\n if (value instanceof Object && !(value instanceof Date)) {\n handleInvalidDate(value);\n }\n\n // Use moment to avoid inconsistencies between browsers interpreting the value differently.\n const momentDate = moment(value);\n if (momentDate.isValid()) {\n date = momentDate.toDate();\n } else {\n handleInvalidDate(value);\n }\n\n return SkyIntlDateFormatter.format(\n date,\n locale,\n SkyDateFormatUtility._ALIASES[pattern] || pattern\n );\n }\n}\n\nfunction isBlank(obj: any): boolean {\n return !obj;\n}\n\nfunction handleInvalidDate(value: any): void {\n throw new Error('Invalid value: ' + value);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"date-pipe.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-pipe/date-pipe.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;;AAQrD,MAAM,OAAO,iBAAiB;;+GAAjB,iBAAiB;gHAAjB,iBAAiB,iBALb,WAAW,EAAE,gBAAgB,aAElC,YAAY,EAAE,0BAA0B,aACxC,WAAW,EAAE,gBAAgB;gHAE5B,iBAAiB,aAJjB,CAAC,WAAW,EAAE,gBAAgB,CAAC,YACjC,CAAC,YAAY,EAAE,0BAA0B,CAAC;4FAGxC,iBAAiB;kBAN7B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC;oBAC7C,SAAS,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC;oBAC1C,OAAO,EAAE,CAAC,YAAY,EAAE,0BAA0B,CAAC;oBACnD,OAAO,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC;iBACzC","sourcesContent":["import { CommonModule } from '@angular/common';\n\nimport { NgModule } from '@angular/core';\nimport { SkyDatetimeResourcesModule } from '../shared/sky-datetime-resources.module';\n\nimport { SkyDatePipe } from './date.pipe';\n\nimport { SkyFuzzyDatePipe } from './fuzzy-date.pipe';\n\n@NgModule({\n declarations: [SkyDatePipe, SkyFuzzyDatePipe],\n providers: [SkyDatePipe, SkyFuzzyDatePipe],\n imports: [CommonModule, SkyDatetimeResourcesModule],\n exports: [SkyDatePipe, SkyFuzzyDatePipe],\n})\nexport class SkyDatePipeModule {}\n"]}
1
+ {"version":3,"file":"date-pipe.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-pipe/date-pipe.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;;AAQrD,MAAM,OAAO,iBAAiB;;+GAAjB,iBAAiB;gHAAjB,iBAAiB,iBALb,WAAW,EAAE,gBAAgB,aAElC,YAAY,EAAE,0BAA0B,aACxC,WAAW,EAAE,gBAAgB;gHAE5B,iBAAiB,aAJjB,CAAC,WAAW,EAAE,gBAAgB,CAAC,YACjC,CAAC,YAAY,EAAE,0BAA0B,CAAC;4FAGxC,iBAAiB;kBAN7B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC;oBAC7C,SAAS,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC;oBAC1C,OAAO,EAAE,CAAC,YAAY,EAAE,0BAA0B,CAAC;oBACnD,OAAO,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC;iBACzC","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { SkyDatetimeResourcesModule } from '../shared/sky-datetime-resources.module';\n\nimport { SkyDatePipe } from './date.pipe';\nimport { SkyFuzzyDatePipe } from './fuzzy-date.pipe';\n\n@NgModule({\n declarations: [SkyDatePipe, SkyFuzzyDatePipe],\n providers: [SkyDatePipe, SkyFuzzyDatePipe],\n imports: [CommonModule, SkyDatetimeResourcesModule],\n exports: [SkyDatePipe, SkyFuzzyDatePipe],\n})\nexport class SkyDatePipeModule {}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"date.pipe.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-pipe/date.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAiB,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;;;AAE7D;;;;;;;;GAQG;AAKH,MAAM,OAAO,WAAW;IAetB,YAAoB,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;QAdhD,kBAAa,GAAG,OAAO,CAAC;QAIxB,kBAAa,GAAG,OAAO,CAAC;QAQxB,kBAAa,GAAG,IAAI,OAAO,EAAQ,CAAC;QAG1C,IAAI,CAAC,cAAc;aAChB,aAAa,EAAE;aACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACnC,SAAS,CAAC,CAAC,UAA4B,EAAE,EAAE;YAC1C,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC;YACvC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACI,SAAS,CAAC,KAAU,EAAE,MAAe,EAAE,MAAe;QAC3D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAE5B,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEO,oBAAoB;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC;QAEjD,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC,MAAM,CAC/C,MAAM,EACN,IAAI,CAAC,KAAK,EACV,MAAM,CACP,CAAC;IACJ,CAAC;;yGAzDU,WAAW;uGAAX,WAAW;4FAAX,WAAW;kBAJvB,IAAI;mBAAC;oBACJ,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,KAAK;iBACZ","sourcesContent":["import { OnDestroy, Pipe, PipeTransform } from '@angular/core';\n\nimport { SkyAppLocaleInfo, SkyAppLocaleProvider } from '@skyux/i18n';\n\nimport { Subject } from 'rxjs';\n\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyDateFormatUtility } from './date-format-utility';\n\n/**\n * Formats date values according to locale rules.\n * @example\n * ```markup\n * {{ myDate | skyDate }}\n * {{ myDate | skyDate:'medium' }}\n * {{ myDate | skyDate:'medium':'en-CA' }}\n * ```\n */\n@Pipe({\n name: 'skyDate',\n pure: false,\n})\nexport class SkyDatePipe implements OnDestroy, PipeTransform {\n private defaultFormat = 'short';\n\n private format: string;\n\n private defaultLocale = 'en-US';\n\n private locale: string;\n\n private value: any;\n\n private formattedValue: string;\n\n private ngUnsubscribe = new Subject<void>();\n\n constructor(private localeProvider: SkyAppLocaleProvider) {\n this.localeProvider\n .getLocaleInfo()\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((localeInfo: SkyAppLocaleInfo) => {\n this.defaultLocale = localeInfo.locale;\n this.updateFormattedValue();\n });\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n /**\n * Transforms a date value using locale and format rules.\n * @param value Specifies the date value to transform.\n * @param format Specifies the format to apply to the transform. The format string is\n * constructed by a series of symbols that represent date-time values. The symbols are\n * identical to [Angular's `DatePipe`](https://angular.io/api/common/DatePipe#pre-defined-format-options) format options.\n * @param locale Specifies the locale code to use in the transform.\n */\n public transform(value: any, format?: string, locale?: string): string {\n this.value = value;\n this.format = format;\n this.locale = locale;\n\n this.updateFormattedValue();\n\n return this.formattedValue;\n }\n\n private updateFormattedValue(): void {\n const locale = this.locale || this.defaultLocale;\n const format = this.format || this.defaultFormat;\n\n this.formattedValue = SkyDateFormatUtility.format(\n locale,\n this.value,\n format\n );\n }\n}\n"]}
1
+ {"version":3,"file":"date.pipe.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-pipe/date.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAiB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;;;AAE7D;;;;;;;;GAQG;AAKH,MAAM,OAAO,WAAW;IAetB,YAAoB,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;QAdhD,kBAAa,GAAG,OAAO,CAAC;QAIxB,kBAAa,GAAG,OAAO,CAAC;QAQxB,kBAAa,GAAG,IAAI,OAAO,EAAQ,CAAC;QAG1C,IAAI,CAAC,cAAc;aAChB,aAAa,EAAE;aACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACnC,SAAS,CAAC,CAAC,UAA4B,EAAE,EAAE;YAC1C,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC;YACvC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACI,SAAS,CAAC,KAAU,EAAE,MAAe,EAAE,MAAe;QAC3D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAE5B,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEO,oBAAoB;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC;QAEjD,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC,MAAM,CAC/C,MAAM,EACN,IAAI,CAAC,KAAK,EACV,MAAM,CACP,CAAC;IACJ,CAAC;;yGAzDU,WAAW;uGAAX,WAAW;4FAAX,WAAW;kBAJvB,IAAI;mBAAC;oBACJ,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,KAAK;iBACZ","sourcesContent":["import { OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { SkyAppLocaleInfo, SkyAppLocaleProvider } from '@skyux/i18n';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyDateFormatUtility } from './date-format-utility';\n\n/**\n * Formats date values according to locale rules.\n * @example\n * ```markup\n * {{ myDate | skyDate }}\n * {{ myDate | skyDate:'medium' }}\n * {{ myDate | skyDate:'medium':'en-CA' }}\n * ```\n */\n@Pipe({\n name: 'skyDate',\n pure: false,\n})\nexport class SkyDatePipe implements OnDestroy, PipeTransform {\n private defaultFormat = 'short';\n\n private format: string;\n\n private defaultLocale = 'en-US';\n\n private locale: string;\n\n private value: any;\n\n private formattedValue: string;\n\n private ngUnsubscribe = new Subject<void>();\n\n constructor(private localeProvider: SkyAppLocaleProvider) {\n this.localeProvider\n .getLocaleInfo()\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((localeInfo: SkyAppLocaleInfo) => {\n this.defaultLocale = localeInfo.locale;\n this.updateFormattedValue();\n });\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n /**\n * Transforms a date value using locale and format rules.\n * @param value Specifies the date value to transform.\n * @param format Specifies the format to apply to the transform. The format string is\n * constructed by a series of symbols that represent date-time values. The symbols are\n * identical to [Angular's `DatePipe`](https://angular.io/api/common/DatePipe#pre-defined-format-options) format options.\n * @param locale Specifies the locale code to use in the transform.\n */\n public transform(value: any, format?: string, locale?: string): string {\n this.value = value;\n this.format = format;\n this.locale = locale;\n\n this.updateFormattedValue();\n\n return this.formattedValue;\n }\n\n private updateFormattedValue(): void {\n const locale = this.locale || this.defaultLocale;\n const format = this.format || this.defaultFormat;\n\n this.formattedValue = SkyDateFormatUtility.format(\n locale,\n this.value,\n format\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fuzzy-date.pipe.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-pipe/fuzzy-date.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AAIpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;;;AAEvE;;;;;;;;GAQG;AAKH,MAAM,OAAO,gBAAgB;IAC3B,YAAoB,gBAAqC;QAArC,qBAAgB,GAAhB,gBAAgB,CAAqB;IAAG,CAAC;IAE7D;;;;;;;;;;OAUG;IACI,SAAS,CACd,KAAmB,EACnB,MAAe,EACf,MAAe;QAEf,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,eAAe,GACnB,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC/D,MAAM,eAAe,GAAG,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC;QAC3E,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CACjC,KAAK,EACL,eAAe,EACf,eAAe,CAChB,CAAC;IACJ,CAAC;;8GA9BU,gBAAgB;4GAAhB,gBAAgB;4FAAhB,gBAAgB;kBAJ5B,IAAI;mBAAC;oBACJ,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,KAAK;iBACZ","sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\nimport { SkyFuzzyDate } from '../datepicker/fuzzy-date';\n\nimport { SkyFuzzyDateService } from '../datepicker/fuzzy-date.service';\n\n/**\n * Formats date values using two or more date tokens that represent the day, month,\n * and year. The tokens are described in the [moment.js values](https://momentjs.com/docs/#/displaying/).\n * @example\n * ```markup\n * {{ myFuzzyDate | skyFuzzyDate:'MMM Y' }}\n * {{ myFuzzyDate | skyFuzzyDate:'MMM Y':'en-CA' }}\n * ```\n */\n@Pipe({\n name: 'skyFuzzyDate',\n pure: false,\n})\nexport class SkyFuzzyDatePipe implements PipeTransform {\n constructor(private fuzzyDateService: SkyFuzzyDateService) {}\n\n /**\n * Transforms fuzzy date values using two or more date tokens that represent the day, month,\n * and year.\n * @param value Specifies the date value to transform.\n * @param format Specifies the format to apply to the transform. You construct the format\n * string with a two or more tokens that specify the components of date-time value. The\n * tokens are described in the [moment.js values](https://momentjs.com/docs/#/displaying/).\n * If you don't provide a format, `SkyFuzzyDatePipe` attempts to format fuzzy dates based\n * on the browser's default locale.\n * @param locale Specifies the locale code to use in the transform.\n */\n public transform(\n value: SkyFuzzyDate,\n format?: string,\n locale?: string\n ): string {\n if (!value) {\n return undefined;\n }\n const fuzzyDateFormat =\n format || this.fuzzyDateService.getLocaleShortFormat(locale);\n const fuzzyDateLocale = locale || this.fuzzyDateService.getCurrentLocale();\n return this.fuzzyDateService.format(\n value,\n fuzzyDateFormat,\n fuzzyDateLocale\n );\n }\n}\n"]}
1
+ {"version":3,"file":"fuzzy-date.pipe.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/date-pipe/fuzzy-date.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;;;AAEvE;;;;;;;;GAQG;AAKH,MAAM,OAAO,gBAAgB;IAC3B,YAAoB,gBAAqC;QAArC,qBAAgB,GAAhB,gBAAgB,CAAqB;IAAG,CAAC;IAE7D;;;;;;;;;;OAUG;IACI,SAAS,CACd,KAAmB,EACnB,MAAe,EACf,MAAe;QAEf,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,eAAe,GACnB,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC/D,MAAM,eAAe,GAAG,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC;QAC3E,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CACjC,KAAK,EACL,eAAe,EACf,eAAe,CAChB,CAAC;IACJ,CAAC;;8GA9BU,gBAAgB;4GAAhB,gBAAgB;4FAAhB,gBAAgB;kBAJ5B,IAAI;mBAAC;oBACJ,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,KAAK;iBACZ","sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\nimport { SkyFuzzyDate } from '../datepicker/fuzzy-date';\nimport { SkyFuzzyDateService } from '../datepicker/fuzzy-date.service';\n\n/**\n * Formats date values using two or more date tokens that represent the day, month,\n * and year. The tokens are described in the [moment.js values](https://momentjs.com/docs/#/displaying/).\n * @example\n * ```markup\n * {{ myFuzzyDate | skyFuzzyDate:'MMM Y' }}\n * {{ myFuzzyDate | skyFuzzyDate:'MMM Y':'en-CA' }}\n * ```\n */\n@Pipe({\n name: 'skyFuzzyDate',\n pure: false,\n})\nexport class SkyFuzzyDatePipe implements PipeTransform {\n constructor(private fuzzyDateService: SkyFuzzyDateService) {}\n\n /**\n * Transforms fuzzy date values using two or more date tokens that represent the day, month,\n * and year.\n * @param value Specifies the date value to transform.\n * @param format Specifies the format to apply to the transform. You construct the format\n * string with a two or more tokens that specify the components of date-time value. The\n * tokens are described in the [moment.js values](https://momentjs.com/docs/#/displaying/).\n * If you don't provide a format, `SkyFuzzyDatePipe` attempts to format fuzzy dates based\n * on the browser's default locale.\n * @param locale Specifies the locale code to use in the transform.\n */\n public transform(\n value: SkyFuzzyDate,\n format?: string,\n locale?: string\n ): string {\n if (!value) {\n return undefined;\n }\n const fuzzyDateFormat =\n format || this.fuzzyDateService.getLocaleShortFormat(locale);\n const fuzzyDateLocale = locale || this.fuzzyDateService.getCurrentLocale();\n return this.fuzzyDateService.format(\n value,\n fuzzyDateFormat,\n fuzzyDateLocale\n );\n }\n}\n"]}
@@ -1,14 +1,14 @@
1
- import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Input, Optional, } from '@angular/core';
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, Optional, forwardRef, } from '@angular/core';
2
2
  import { FormBuilder, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, } from '@angular/forms';
3
3
  import { SkyAppWindowRef } from '@skyux/core';
4
4
  import { SkyAppLocaleProvider } from '@skyux/i18n';
5
5
  import { SkyThemeService } from '@skyux/theme';
6
- import { combineLatest, Subject } from 'rxjs';
6
+ import { Subject, combineLatest } from 'rxjs';
7
7
  import { distinctUntilChanged, first, takeUntil } from 'rxjs/operators';
8
8
  import { SkyDateFormatter } from '../datepicker/date-formatter';
9
+ import { SkyDateRangeService } from './date-range.service';
9
10
  import { SkyDateRangeCalculatorId } from './types/date-range-calculator-id';
10
11
  import { SkyDateRangeCalculatorType } from './types/date-range-calculator-type';
11
- import { SkyDateRangeService } from './date-range.service';
12
12
  import * as i0 from "@angular/core";
13
13
  import * as i1 from "./date-range.service";
14
14
  import * as i2 from "@angular/forms";
@@ -1 +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,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,0BAA0B,EAA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AAQ,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"]}
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,KAAK,EAIL,QAAQ,EAER,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,WAAW,EACX,WAAW,EAEX,aAAa,EACb,iBAAiB,GAGlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;;;;;;;;;;;AAEhF,yDAAyD;AACzD,MAAM,oCAAoC,GAAG;IAC3C,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC;IAC1D,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,+BAA+B,GAAG;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K;gBAwBC,KAAK;sBADX,KAAK;gBAQC,iBAAiB;sBADvB,KAAK;gBAQC,eAAe;sBADrB,KAAK","sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Optional,\n SimpleChanges,\n forwardRef,\n} from '@angular/core';\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';\nimport { SkyAppWindowRef } from '@skyux/core';\nimport { SkyAppLocaleProvider } from '@skyux/i18n';\nimport { SkyThemeService } from '@skyux/theme';\n\nimport { Subject, combineLatest } from 'rxjs';\nimport { distinctUntilChanged, first, takeUntil } from 'rxjs/operators';\n\nimport { SkyDateFormatter } from '../datepicker/date-formatter';\n\nimport { SkyDateRangeService } from './date-range.service';\nimport { SkyDateRangeCalculation } from './types/date-range-calculation';\nimport { SkyDateRangeCalculator } from './types/date-range-calculator';\nimport { SkyDateRangeCalculatorId } from './types/date-range-calculator-id';\nimport { SkyDateRangeCalculatorType } from './types/date-range-calculator-type';\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 = false;\n\n /**\n * Indicates whether to require users to specify a end date.\n * @default false\n */\n @Input()\n public endDateRequired = 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"]}
@@ -1 +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"]}
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;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,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';\nimport { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { SkyInputBoxModule } from '@skyux/forms';\nimport { SkyI18nModule } from '@skyux/i18n';\n\nimport { SkyDatepickerModule } from '../datepicker/datepicker.module';\nimport { SkyDatetimeResourcesModule } from '../shared/sky-datetime-resources.module';\n\nimport { SkyDateRangePickerComponent } from './date-range-picker.component';\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"]}
@@ -1 +1 @@
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;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAc,MAAM,MAAM,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBA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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';\n\nimport { SkyLibResourcesService } from '@skyux/i18n';\n\nimport { BehaviorSubject, forkJoin, Observable } from 'rxjs';\n\nimport { first, map } from 'rxjs/operators';\n\nimport { SkyDateRangeCalculatorConfig } from './types/date-range-calculator-config';\n\nimport { SkyDateRangeCalculatorId } from './types/date-range-calculator-id';\n\nimport { SkyDateRangeCalculator } from './types/date-range-calculator';\n\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
+ {"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,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I,CAAC,KAAK,EAAE,CAAC;aACb,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 +1 @@
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 { SkyDateRangeCalculatorId } from './date-range-calculator-id';\n\nimport { SkyDateRange } from './date-range';\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
+ {"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 +1 @@
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';\n\nimport { SkyDateRangeCalculatorType } from './date-range-calculator-type';\n\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
+ {"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 +1 @@
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":"AAYA;;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 { SkyDateRangeCalculation } from './date-range-calculation';\n\nimport { SkyDateRangeCalculatorConfig } from './date-range-calculator-config';\n\nimport { SkyDateRangeCalculatorId } from './date-range-calculator-id';\n\nimport { SkyDateRangeCalculatorType } from './date-range-calculator-type';\n\nimport { SkyDateRange } from './date-range';\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
+ {"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 +1 @@
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';\n\nimport { SkyDateRangeCalculatorId } from './date-range-calculator-id';\n\nimport { SkyDateRangeCalculatorType } from './date-range-calculator-type';\n\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
+ {"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 +1 @@
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;AAEtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAI1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,CAAC,MAAM,8BAA8B,GACzC;IACE;QACE,YAAY,EAAE,wBAAwB,CAAC,OAAO;QAC9C,IAAI,EAAE,0BAA0B,CAAC,QAAQ;QACzC,2BAA2B,EACzB,+CAA+C;QACjD,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC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AAQ,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';\n\nimport { SkyDateRangeCalculatorType } from './date-range-calculator-type';\n\nimport { SkyDateRangeDefaultCalculatorConfig } from './date-range-default-calculator-config';\n\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"]}
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;AAExE,MAAM,CAAC,MAAM,8BAA8B,GACzC;IACE;QACE,YAAY,EAAE,wBAAwB,CAAC,OAAO;QAC9C,IAAI,EAAE,0BAA0B,CAAC,QAAQ;QACzC,2BAA2B,EACzB,+CAA+C;QACjD,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;KAC3D;IAED;QACE,YAAY,EAAE,wBAAwB,CAAC,MAAM;QAC7C,IAAI,EAAE,0BAA0B,CAAC,MAAM;QACvC,2BAA2B,EACzB,6CAA6C;QAC/C,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE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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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"date-formatter.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/date-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,OAAO,gBAAgB;IAK3B;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,MAAc;QACpC,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,2BAA2B;QACvC,0BAA0B;QAC1B,OAAO,CACL,MAAM,CAAC,UAAU,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC;YACvC,gBAAgB,CAAC,sBAAsB,CACxC,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,IAAU,EAAE,MAAc;QACtC,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IAEM,iBAAiB,CACtB,UAAkB,EAClB,MAAc;IACd,0BAA0B;IAC1B,SAAkB,KAAK;QAEvB,IAAI,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAErD,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE;YAC1B,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,wBAAwB,EAAE,MAAM,CAAC,CAAC;SACpE;QAED,OAAO,WAAW,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;IAEM,WAAW,CAAC,IAAU;QAC3B,OAAO,CACL,IAAI;YACJ,IAAI,YAAY,IAAI;YACpB,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACtB,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CACjC,CAAC;IACJ,CAAC;;AAhDc,8BAAa,GAAW,OAAO,CAAC;AAEhC,uCAAsB,GAAW,YAAY,CAAC","sourcesContent":["import moment from 'moment';\n\nexport class SkyDateFormatter {\n private static defaultLocale: string = 'en-US';\n\n private static defaultShortDateFormat: string = 'MM/DD/YYYY';\n\n /**\n * Sets moment's global locale.\n */\n public static setLocale(locale: string): void {\n moment.locale(locale || SkyDateFormatter.defaultLocale);\n }\n\n /**\n * Returns the preferred short date format for the current locale.\n */\n public static getPreferredShortDateFormat(): string {\n /* istanbul ignore next */\n return (\n moment.localeData().longDateFormat('L') ||\n SkyDateFormatter.defaultShortDateFormat\n );\n }\n\n public format(date: Date, format: string): string {\n return moment(date.getTime()).format(format);\n }\n\n public getDateFromString(\n dateString: string,\n format: string,\n /* istanbul ignore next */\n strict: boolean = false\n ): Date {\n let momentValue = moment(dateString, format, strict);\n\n if (!momentValue.isValid()) {\n momentValue = moment(dateString, 'YYYY-MM-DDThh:mm:ss.SZ', strict);\n }\n\n return momentValue.toDate();\n }\n\n public dateIsValid(date: Date): boolean {\n return (\n date &&\n date instanceof Date &&\n !isNaN(date.valueOf()) &&\n !isNaN(new Date(date).getDate())\n );\n }\n}\n"]}
1
+ {"version":3,"file":"date-formatter.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/date-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,OAAO,gBAAgB;IAK3B;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,MAAc;QACpC,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,2BAA2B;QACvC,0BAA0B;QAC1B,OAAO,CACL,MAAM,CAAC,UAAU,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC;YACvC,gBAAgB,CAAC,sBAAsB,CACxC,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,IAAU,EAAE,MAAc;QACtC,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IAEM,iBAAiB,CACtB,UAAkB,EAClB,MAAc;IACd,0BAA0B;IAC1B,SAAkB,KAAK;QAEvB,IAAI,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAErD,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE;YAC1B,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,wBAAwB,EAAE,MAAM,CAAC,CAAC;SACpE;QAED,OAAO,WAAW,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;IAEM,WAAW,CAAC,IAAU;QAC3B,OAAO,CACL,IAAI;YACJ,IAAI,YAAY,IAAI;YACpB,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACtB,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CACjC,CAAC;IACJ,CAAC;;AAhDc,8BAAa,GAAG,OAAO,CAAC;AAExB,uCAAsB,GAAG,YAAY,CAAC","sourcesContent":["import moment from 'moment';\n\nexport class SkyDateFormatter {\n private static defaultLocale = 'en-US';\n\n private static defaultShortDateFormat = 'MM/DD/YYYY';\n\n /**\n * Sets moment's global locale.\n */\n public static setLocale(locale: string): void {\n moment.locale(locale || SkyDateFormatter.defaultLocale);\n }\n\n /**\n * Returns the preferred short date format for the current locale.\n */\n public static getPreferredShortDateFormat(): string {\n /* istanbul ignore next */\n return (\n moment.localeData().longDateFormat('L') ||\n SkyDateFormatter.defaultShortDateFormat\n );\n }\n\n public format(date: Date, format: string): string {\n return moment(date.getTime()).format(format);\n }\n\n public getDateFromString(\n dateString: string,\n format: string,\n /* istanbul ignore next */\n strict: boolean = false\n ): Date {\n let momentValue = moment(dateString, format, strict);\n\n if (!momentValue.isValid()) {\n momentValue = moment(dateString, 'YYYY-MM-DDThh:mm:ss.SZ', strict);\n }\n\n return momentValue.toDate();\n }\n\n public dateIsValid(date: Date): boolean {\n return (\n date &&\n date instanceof Date &&\n !isNaN(date.valueOf()) &&\n !isNaN(new Date(date).getDate())\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"datepicker-calendar-change.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar-change.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyDatepickerCustomDate } from './datepicker-custom-date';\nimport { Observable } from 'rxjs';\n\n/**\n * Specifies changes in the datepicker calendar.\n */\nexport interface SkyDatepickerCalendarChange {\n /**\n * The end date.\n */\n endDate: Date;\n\n /**\n * The start date.\n */\n startDate: Date;\n\n /**\n * Provides an observable that allows the consumer to push custom dates back to the calendar\n * when the `SkyCalendarDateRangeChangeEvent` event fires. This is useful\n * for displaying key dates or disabled dates each time the calendar changes. If disabled dates\n * are provided, SKY UX will prevent the user from selecting the date from the calendar.\n * However, consumers will still need to add a custom validator to prevent users from entering\n * disabled dates in the text input.\n */\n customDates?: Observable<SkyDatepickerCustomDate[]>;\n}\n"]}
1
+ {"version":3,"file":"datepicker-calendar-change.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar-change.ts"],"names":[],"mappings":"","sourcesContent":["import { Observable } from 'rxjs';\n\nimport { SkyDatepickerCustomDate } from './datepicker-custom-date';\n\n/**\n * Specifies changes in the datepicker calendar.\n */\nexport interface SkyDatepickerCalendarChange {\n /**\n * The end date.\n */\n endDate: Date;\n\n /**\n * The start date.\n */\n startDate: Date;\n\n /**\n * Provides an observable that allows the consumer to push custom dates back to the calendar\n * when the `SkyCalendarDateRangeChangeEvent` event fires. This is useful\n * for displaying key dates or disabled dates each time the calendar changes. If disabled dates\n * are provided, SKY UX will prevent the user from selecting the date from the calendar.\n * However, consumers will still need to add a custom validator to prevent users from entering\n * disabled dates in the text input.\n */\n customDates?: Observable<SkyDatepickerCustomDate[]>;\n}\n"]}
@@ -149,7 +149,7 @@ export class SkyDatepickerCalendarInnerComponent {
149
149
  return false;
150
150
  }
151
151
  onKeydown(event) {
152
- let key = this.keys[event.which];
152
+ const key = this.keys[event.which];
153
153
  if (!key || event.shiftKey || event.altKey) {
154
154
  return;
155
155
  }
@@ -171,7 +171,7 @@ export class SkyDatepickerCalendarInnerComponent {
171
171
  }
172
172
  createDateObject(date, format, isSecondary, id) {
173
173
  const customDateMatch = this.getCustomDate(date);
174
- let dateObject = {
174
+ const dateObject = {
175
175
  date: new Date(date.getFullYear(), date.getMonth(), date.getDate()),
176
176
  label: this.dateFilter(date, format),
177
177
  selected: this.compare(date, this.selectedDate) === 0,
@@ -185,7 +185,7 @@ export class SkyDatepickerCalendarInnerComponent {
185
185
  return dateObject;
186
186
  }
187
187
  createCalendarRows(dates, size) {
188
- let rows = [];
188
+ const rows = [];
189
189
  while (dates.length > 0) {
190
190
  rows.push(dates.splice(0, size));
191
191
  }
@@ -195,7 +195,7 @@ export class SkyDatepickerCalendarInnerComponent {
195
195
  This is ensures that no strangeness happens when converting a date to local time.
196
196
  */
197
197
  fixTimeZone(date) {
198
- let newDate = new Date(date);
198
+ const newDate = new Date(date);
199
199
  newDate.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
200
200
  return newDate;
201
201
  }
@@ -244,8 +244,8 @@ export class SkyDatepickerCalendarInnerComponent {
244
244
  /* istanbul ignore else */
245
245
  /* sanity check */
246
246
  if (expectedStep) {
247
- let year = this.activeDate.getFullYear() + direction * (expectedStep.years || 0);
248
- let month = this.activeDate.getMonth() + direction * (expectedStep.months || 0);
247
+ const year = this.activeDate.getFullYear() + direction * (expectedStep.years || 0);
248
+ const month = this.activeDate.getMonth() + direction * (expectedStep.months || 0);
249
249
  this.activeDate = new Date(year, month, 1);
250
250
  this.refreshView();
251
251
  }
@@ -1 +1 @@
1
- {"version":3,"file":"datepicker-calendar-inner.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar-inner.component.ts","../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar-inner.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EAIL,MAAM,EAEN,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;;;AAIpD,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB;;GAEG;AAOH,MAAM,OAAO,mCAAmC;IANhD;QAkCS,uBAAkB,GAAuB,IAAI,YAAY,CAC9D,SAAS,CACV,CAAC;QAGK,uBAAkB,GAAyB,IAAI,YAAY,EAAU,CAAC;QAKtE,YAAO,GAAW,KAAK,CAAC;QACxB,YAAO,GAAW,MAAM,CAAC;QACzB,kBAAa,GAAW,CAAC,CAAC;QAC1B,iBAAY,GAAW,CAAC,CAAC;QACzB,mBAAc,GAAW,KAAK,CAAC;QAC/B,cAAS,GAAW,EAAE,CAAC;QAEvB,cAAS,GAAW,IAAI,CAAC;QACzB,gBAAW,GAAW,MAAM,CAAC;QAC7B,eAAU,GAAW,MAAM,CAAC;QAC5B,oBAAe,GAAW,IAAI,CAAC;QAC/B,mBAAc,GAAW,WAAW,CAAC;QACrC,qBAAgB,GAAW,MAAM,CAAC;QAElC,iBAAY,GAAW,kBAAkB,EAAE,gBAAgB,EAAE,CAAC;QAE9D,YAAO,GAAQ,EAAE,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AAM;gBAMA,kBAAkB;sBADxB,MAAM","sourcesContent":["import {\n Component,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n ViewEncapsulation,\n} from '@angular/core';\nimport { SkyDatepickerCustomDate } from './datepicker-custom-date';\nimport { Subject } from 'rxjs';\n\nimport { SkyDateFormatter } from './date-formatter';\n\nimport { SkyDatepickerDate } from './datepicker-date';\n\nlet nextDatepickerId = 0;\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-datepicker-inner',\n templateUrl: './datepicker-calendar-inner.component.html',\n styleUrls: ['./datepicker-calendar-inner.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class SkyDatepickerCalendarInnerComponent\n implements OnDestroy, OnInit, OnChanges\n{\n @Input()\n public customDates: SkyDatepickerCustomDate[];\n\n @Input()\n public startingDay: number;\n\n @Input()\n public minDate: Date;\n\n @Input()\n public maxDate: Date;\n\n @Input()\n public set selectedDate(value: Date) {\n if (this.dateFormatter.dateIsValid(value)) {\n this._selectedDate = value;\n this.activeDate = value;\n }\n }\n\n public get selectedDate(): Date {\n return this._selectedDate;\n }\n\n @Output()\n public selectedDateChange: EventEmitter<Date> = new EventEmitter<Date>(\n undefined\n );\n\n @Output()\n public calendarModeChange: EventEmitter<string> = new EventEmitter<string>();\n\n public activeDate: Date;\n public activeDateId: string;\n\n public minMode: string = 'day';\n public maxMode: string = 'year';\n public monthColLimit: number = 3;\n public yearColLimit: number = 5;\n public datepickerMode: string = 'day';\n public yearRange: number = 20;\n\n public formatDay: string = 'DD';\n public formatMonth: string = 'MMMM';\n public formatYear: string = 'YYYY';\n public formatDayHeader: string = 'dd';\n public formatDayTitle: string = 'MMMM YYYY';\n public formatMonthTitle: string = 'YYYY';\n\n public datepickerId: string = `sky-datepicker-${++nextDatepickerId}`;\n\n public stepDay: any = {};\n public stepMonth: any = {};\n public stepYear: any = {};\n\n protected modes: string[] = ['day', 'month', 'year'];\n protected dateFormatter: SkyDateFormatter = new SkyDateFormatter();\n\n public refreshViewHandlerDay: Function;\n public compareHandlerDay: Function;\n public refreshViewHandlerMonth: Function;\n public compareHandlerMonth: Function;\n public refreshViewHandlerYear: Function;\n public compareHandlerYear: Function;\n\n public handleKeydownDay: Function;\n public handleKeydownMonth: Function;\n public handleKeydownYear: Function;\n\n public keys: any = {\n 13: 'enter',\n 32: 'space',\n 33: 'pageup',\n 34: 'pagedown',\n 35: 'end',\n 36: 'home',\n 37: 'left',\n 38: 'up',\n 39: 'right',\n 40: 'down',\n };\n\n private ngUnsubscribe = new Subject();\n\n private _selectedDate: Date;\n\n public ngOnInit(): void {\n if (this.selectedDate) {\n this.activeDate = new Date(this.selectedDate);\n } else {\n this.activeDate = new Date();\n }\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n this.refreshView();\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public setCompareHandler(handler: Function, type: string): void {\n if (type === 'day') {\n this.compareHandlerDay = handler;\n }\n\n if (type === 'month') {\n this.compareHandlerMonth = handler;\n }\n\n if (type === 'year') {\n this.compareHandlerYear = handler;\n }\n }\n\n public compare(date1: Date, date2: Date) {\n if (date1 === undefined || date2 === undefined) {\n return undefined;\n }\n\n if (this.datepickerMode === 'day' && this.compareHandlerDay) {\n return this.compareHandlerDay(date1, date2);\n }\n\n if (this.datepickerMode === 'month' && this.compareHandlerMonth) {\n return this.compareHandlerMonth(date1, date2);\n }\n\n /* istanbul ignore else */\n /* sanity check */\n if (this.datepickerMode === 'year' && this.compareHandlerYear) {\n return this.compareHandlerYear(date1, date2);\n }\n }\n\n public setRefreshViewHandler(handler: Function, type: string): void {\n if (type === 'day') {\n this.refreshViewHandlerDay = handler;\n }\n\n if (type === 'month') {\n this.refreshViewHandlerMonth = handler;\n }\n\n if (type === 'year') {\n this.refreshViewHandlerYear = handler;\n }\n }\n\n public refreshView(): void {\n if (this.datepickerMode === 'day' && this.refreshViewHandlerDay) {\n this.refreshViewHandlerDay();\n }\n\n if (this.datepickerMode === 'month' && this.refreshViewHandlerMonth) {\n this.refreshViewHandlerMonth();\n }\n\n if (this.datepickerMode === 'year' && this.refreshViewHandlerYear) {\n this.refreshViewHandlerYear();\n }\n }\n\n public setKeydownHandler(handler: Function, type: string) {\n if (type === 'day') {\n this.handleKeydownDay = handler;\n }\n\n if (type === 'month') {\n this.handleKeydownMonth = handler;\n }\n\n if (type === 'year') {\n this.handleKeydownYear = handler;\n }\n }\n\n public handleKeydown(key: string, event: KeyboardEvent): void {\n if (this.datepickerMode === 'day' && this.handleKeydownDay) {\n this.handleKeydownDay(key, event);\n }\n\n if (this.datepickerMode === 'month' && this.handleKeydownMonth) {\n this.handleKeydownMonth(key, event);\n }\n\n if (this.datepickerMode === 'year' && this.handleKeydownYear) {\n this.handleKeydownYear(key, event);\n }\n }\n\n public dateFilter(date: Date, format: string): string {\n return this.dateFormatter.format(date, format);\n }\n\n public isActive(dateObject: any): boolean {\n if (this.compare(dateObject.date, this.activeDate) === 0) {\n this.activeDateId = dateObject.uid;\n return true;\n }\n\n return false;\n }\n\n public onKeydown(event: KeyboardEvent) {\n let key = this.keys[event.which];\n\n if (!key || event.shiftKey || event.altKey) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n if (key === 'enter' || key === 'space') {\n if (this.isDisabled(this.activeDate)) {\n return;\n }\n this.select(this.activeDate);\n } else if (event.ctrlKey && (key === 'up' || key === 'down')) {\n this.toggleMode(key === 'up' ? 1 : -1);\n } else {\n this.handleKeydown(key, event);\n this.refreshView();\n }\n }\n\n public createDateObject(\n date: Date,\n format: string,\n isSecondary: boolean,\n id: string\n ): SkyDatepickerDate {\n const customDateMatch = this.getCustomDate(date);\n\n let dateObject: SkyDatepickerDate = {\n date: new Date(date.getFullYear(), date.getMonth(), date.getDate()),\n label: this.dateFilter(date, format),\n selected: this.compare(date, this.selectedDate) === 0,\n disabled: this.isDisabled(date),\n current: this.compare(date, new Date()) === 0,\n secondary: isSecondary,\n uid: id,\n keyDate: customDateMatch ? customDateMatch.keyDate : undefined,\n keyDateText: customDateMatch ? customDateMatch.keyDateText : [],\n };\n\n return dateObject;\n }\n\n public createCalendarRows(\n dates: Array<SkyDatepickerDate>,\n size: number\n ): Array<Array<SkyDatepickerDate>> {\n let rows: Array<Array<SkyDatepickerDate>> = [];\n while (dates.length > 0) {\n rows.push(dates.splice(0, size));\n }\n return rows;\n }\n\n /*\n This is ensures that no strangeness happens when converting a date to local time.\n */\n public fixTimeZone(date: Date): Date {\n let newDate = new Date(date);\n newDate.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n\n return newDate;\n }\n\n public selectCalendar(\n event: Event,\n date: Date,\n closePicker: boolean = false\n ) {\n if (!closePicker) {\n event.preventDefault();\n event.stopPropagation();\n }\n this.select(date);\n }\n\n public select(date: Date, isManual: boolean = true): void {\n this.activeDate = new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate()\n );\n\n /*\n Only actually select date if in minmode (day picker mode).\n Otherwise, just change the active view for the datepicker.\n */\n if (this.datepickerMode === this.minMode) {\n this.selectedDate = new Date(this.activeDate);\n if (isManual) {\n this.selectedDateChange.emit(this.selectedDate);\n }\n } else {\n this.datepickerMode =\n this.modes[this.modes.indexOf(this.datepickerMode) - 1];\n this.calendarModeChange.emit(this.datepickerMode);\n }\n\n this.refreshView();\n }\n\n public moveCalendar(event: Event, direction: number) {\n event.preventDefault();\n event.stopPropagation();\n this.move(direction);\n }\n\n public move(direction: number): void {\n let expectedStep: any;\n if (this.datepickerMode === 'day') {\n expectedStep = this.stepDay;\n }\n\n if (this.datepickerMode === 'month') {\n expectedStep = this.stepMonth;\n }\n\n if (this.datepickerMode === 'year') {\n expectedStep = this.stepYear;\n }\n\n /* istanbul ignore else */\n /* sanity check */\n if (expectedStep) {\n let year =\n this.activeDate.getFullYear() + direction * (expectedStep.years || 0);\n let month =\n this.activeDate.getMonth() + direction * (expectedStep.months || 0);\n\n this.activeDate = new Date(year, month, 1);\n\n this.refreshView();\n }\n }\n\n public toggleModeCalendar(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n this.toggleMode(1);\n }\n\n public toggleMode(direction: number): void {\n /*istanbul ignore next */\n direction = direction || 1;\n\n /* istanbul ignore else */\n /* sanity check */\n if (\n !(direction === 1 && this.datepickerMode === this.maxMode) &&\n !(this.datepickerMode === this.minMode && direction === -1)\n ) {\n this.datepickerMode =\n this.modes[this.modes.indexOf(this.datepickerMode) + direction];\n this.calendarModeChange.emit(this.datepickerMode);\n this.refreshView();\n }\n }\n\n /**\n * Date is disabled if it meets any of these criteria:\n * 1. Date falls outside the min or max dates set by the SkyDatepickerConfigService.\n * 2. Date is marked as disabled in the customDates array.\n */\n protected isDisabled(date: Date): boolean {\n const customDate = this.getCustomDate(date);\n return (\n (this.minDate && this.compare(date, this.minDate) < 0) ||\n (this.maxDate && this.compare(date, this.maxDate) > 0) ||\n (customDate && customDate.disabled)\n );\n }\n private getCustomDate(date: Date): SkyDatepickerCustomDate | undefined {\n if (this.customDates) {\n return this.customDates.find((customDate: SkyDatepickerCustomDate) => {\n return customDate.date.getTime() === date.getTime();\n });\n }\n }\n}\n","<div\n *ngIf=\"datepickerMode\"\n class=\"sky-datepicker-calendar-inner\"\n (keydown)=\"onKeydown($event)\"\n>\n <ng-content></ng-content>\n</div>\n"]}
1
+ {"version":3,"file":"datepicker-calendar-inner.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar-inner.component.ts","../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-calendar-inner.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EAIL,MAAM,EAEN,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;;;AAIpD,IAAI,gBAAgB,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QAC9B,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAmC,EAAE,EAAE;gBACnE,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACtD,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;;iIArYU,mCAAmC;qHAAnC,mCAAmC,4TC7BhD,0JAOA;4FDsBa,mCAAmC;kBAN/C,SAAS;mBAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,WAAW,EAAE,4CAA4C;oBACzD,SAAS,EAAE,CAAC,4CAA4C,CAAC;oBACzD,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC;8BAKQ,WAAW;sBADjB,KAAK;gBAIC,WAAW;sBADjB,KAAK;gBAIC,OAAO;sBADb,KAAK;gBAIC,OAAO;sBADb,KAAK;gBAIK,YAAY;sBADtB,KAAK;gBAaC,kBAAkB;sBADxB,MAAM;gBAMA,kBAAkB;sBADxB,MAAM","sourcesContent":["import {\n Component,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { Subject } from 'rxjs';\n\nimport { SkyDateFormatter } from './date-formatter';\nimport { SkyDatepickerCustomDate } from './datepicker-custom-date';\nimport { SkyDatepickerDate } from './datepicker-date';\n\nlet nextDatepickerId = 0;\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-datepicker-inner',\n templateUrl: './datepicker-calendar-inner.component.html',\n styleUrls: ['./datepicker-calendar-inner.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class SkyDatepickerCalendarInnerComponent\n implements OnDestroy, OnInit, OnChanges\n{\n @Input()\n public customDates: SkyDatepickerCustomDate[];\n\n @Input()\n public startingDay: number;\n\n @Input()\n public minDate: Date;\n\n @Input()\n public maxDate: Date;\n\n @Input()\n public set selectedDate(value: Date) {\n if (this.dateFormatter.dateIsValid(value)) {\n this._selectedDate = value;\n this.activeDate = value;\n }\n }\n\n public get selectedDate(): Date {\n return this._selectedDate;\n }\n\n @Output()\n public selectedDateChange: EventEmitter<Date> = new EventEmitter<Date>(\n undefined\n );\n\n @Output()\n public calendarModeChange: EventEmitter<string> = new EventEmitter<string>();\n\n public activeDate: Date;\n public activeDateId: string;\n\n public minMode = 'day';\n public maxMode = 'year';\n public monthColLimit = 3;\n public yearColLimit = 5;\n public datepickerMode = 'day';\n public yearRange = 20;\n\n public formatDay = 'DD';\n public formatMonth = 'MMMM';\n public formatYear = 'YYYY';\n public formatDayHeader = 'dd';\n public formatDayTitle = 'MMMM YYYY';\n public formatMonthTitle = 'YYYY';\n\n public datepickerId = `sky-datepicker-${++nextDatepickerId}`;\n\n public stepDay: any = {};\n public stepMonth: any = {};\n public stepYear: any = {};\n\n protected modes: string[] = ['day', 'month', 'year'];\n protected dateFormatter: SkyDateFormatter = new SkyDateFormatter();\n\n public refreshViewHandlerDay: Function;\n public compareHandlerDay: Function;\n public refreshViewHandlerMonth: Function;\n public compareHandlerMonth: Function;\n public refreshViewHandlerYear: Function;\n public compareHandlerYear: Function;\n\n public handleKeydownDay: Function;\n public handleKeydownMonth: Function;\n public handleKeydownYear: Function;\n\n public keys: any = {\n 13: 'enter',\n 32: 'space',\n 33: 'pageup',\n 34: 'pagedown',\n 35: 'end',\n 36: 'home',\n 37: 'left',\n 38: 'up',\n 39: 'right',\n 40: 'down',\n };\n\n private ngUnsubscribe = new Subject();\n\n private _selectedDate: Date;\n\n public ngOnInit(): void {\n if (this.selectedDate) {\n this.activeDate = new Date(this.selectedDate);\n } else {\n this.activeDate = new Date();\n }\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n this.refreshView();\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public setCompareHandler(handler: Function, type: string): void {\n if (type === 'day') {\n this.compareHandlerDay = handler;\n }\n\n if (type === 'month') {\n this.compareHandlerMonth = handler;\n }\n\n if (type === 'year') {\n this.compareHandlerYear = handler;\n }\n }\n\n public compare(date1: Date, date2: Date) {\n if (date1 === undefined || date2 === undefined) {\n return undefined;\n }\n\n if (this.datepickerMode === 'day' && this.compareHandlerDay) {\n return this.compareHandlerDay(date1, date2);\n }\n\n if (this.datepickerMode === 'month' && this.compareHandlerMonth) {\n return this.compareHandlerMonth(date1, date2);\n }\n\n /* istanbul ignore else */\n /* sanity check */\n if (this.datepickerMode === 'year' && this.compareHandlerYear) {\n return this.compareHandlerYear(date1, date2);\n }\n }\n\n public setRefreshViewHandler(handler: Function, type: string): void {\n if (type === 'day') {\n this.refreshViewHandlerDay = handler;\n }\n\n if (type === 'month') {\n this.refreshViewHandlerMonth = handler;\n }\n\n if (type === 'year') {\n this.refreshViewHandlerYear = handler;\n }\n }\n\n public refreshView(): void {\n if (this.datepickerMode === 'day' && this.refreshViewHandlerDay) {\n this.refreshViewHandlerDay();\n }\n\n if (this.datepickerMode === 'month' && this.refreshViewHandlerMonth) {\n this.refreshViewHandlerMonth();\n }\n\n if (this.datepickerMode === 'year' && this.refreshViewHandlerYear) {\n this.refreshViewHandlerYear();\n }\n }\n\n public setKeydownHandler(handler: Function, type: string) {\n if (type === 'day') {\n this.handleKeydownDay = handler;\n }\n\n if (type === 'month') {\n this.handleKeydownMonth = handler;\n }\n\n if (type === 'year') {\n this.handleKeydownYear = handler;\n }\n }\n\n public handleKeydown(key: string, event: KeyboardEvent): void {\n if (this.datepickerMode === 'day' && this.handleKeydownDay) {\n this.handleKeydownDay(key, event);\n }\n\n if (this.datepickerMode === 'month' && this.handleKeydownMonth) {\n this.handleKeydownMonth(key, event);\n }\n\n if (this.datepickerMode === 'year' && this.handleKeydownYear) {\n this.handleKeydownYear(key, event);\n }\n }\n\n public dateFilter(date: Date, format: string): string {\n return this.dateFormatter.format(date, format);\n }\n\n public isActive(dateObject: any): boolean {\n if (this.compare(dateObject.date, this.activeDate) === 0) {\n this.activeDateId = dateObject.uid;\n return true;\n }\n\n return false;\n }\n\n public onKeydown(event: KeyboardEvent) {\n const key = this.keys[event.which];\n\n if (!key || event.shiftKey || event.altKey) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n if (key === 'enter' || key === 'space') {\n if (this.isDisabled(this.activeDate)) {\n return;\n }\n this.select(this.activeDate);\n } else if (event.ctrlKey && (key === 'up' || key === 'down')) {\n this.toggleMode(key === 'up' ? 1 : -1);\n } else {\n this.handleKeydown(key, event);\n this.refreshView();\n }\n }\n\n public createDateObject(\n date: Date,\n format: string,\n isSecondary: boolean,\n id: string\n ): SkyDatepickerDate {\n const customDateMatch = this.getCustomDate(date);\n\n const dateObject: SkyDatepickerDate = {\n date: new Date(date.getFullYear(), date.getMonth(), date.getDate()),\n label: this.dateFilter(date, format),\n selected: this.compare(date, this.selectedDate) === 0,\n disabled: this.isDisabled(date),\n current: this.compare(date, new Date()) === 0,\n secondary: isSecondary,\n uid: id,\n keyDate: customDateMatch ? customDateMatch.keyDate : undefined,\n keyDateText: customDateMatch ? customDateMatch.keyDateText : [],\n };\n\n return dateObject;\n }\n\n public createCalendarRows(\n dates: Array<SkyDatepickerDate>,\n size: number\n ): Array<Array<SkyDatepickerDate>> {\n const rows: Array<Array<SkyDatepickerDate>> = [];\n while (dates.length > 0) {\n rows.push(dates.splice(0, size));\n }\n return rows;\n }\n\n /*\n This is ensures that no strangeness happens when converting a date to local time.\n */\n public fixTimeZone(date: Date): Date {\n const newDate = new Date(date);\n newDate.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n\n return newDate;\n }\n\n public selectCalendar(\n event: Event,\n date: Date,\n closePicker: boolean = false\n ) {\n if (!closePicker) {\n event.preventDefault();\n event.stopPropagation();\n }\n this.select(date);\n }\n\n public select(date: Date, isManual: boolean = true): void {\n this.activeDate = new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate()\n );\n\n /*\n Only actually select date if in minmode (day picker mode).\n Otherwise, just change the active view for the datepicker.\n */\n if (this.datepickerMode === this.minMode) {\n this.selectedDate = new Date(this.activeDate);\n if (isManual) {\n this.selectedDateChange.emit(this.selectedDate);\n }\n } else {\n this.datepickerMode =\n this.modes[this.modes.indexOf(this.datepickerMode) - 1];\n this.calendarModeChange.emit(this.datepickerMode);\n }\n\n this.refreshView();\n }\n\n public moveCalendar(event: Event, direction: number) {\n event.preventDefault();\n event.stopPropagation();\n this.move(direction);\n }\n\n public move(direction: number): void {\n let expectedStep: any;\n if (this.datepickerMode === 'day') {\n expectedStep = this.stepDay;\n }\n\n if (this.datepickerMode === 'month') {\n expectedStep = this.stepMonth;\n }\n\n if (this.datepickerMode === 'year') {\n expectedStep = this.stepYear;\n }\n\n /* istanbul ignore else */\n /* sanity check */\n if (expectedStep) {\n const year =\n this.activeDate.getFullYear() + direction * (expectedStep.years || 0);\n const month =\n this.activeDate.getMonth() + direction * (expectedStep.months || 0);\n\n this.activeDate = new Date(year, month, 1);\n\n this.refreshView();\n }\n }\n\n public toggleModeCalendar(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n this.toggleMode(1);\n }\n\n public toggleMode(direction: number): void {\n /*istanbul ignore next */\n direction = direction || 1;\n\n /* istanbul ignore else */\n /* sanity check */\n if (\n !(direction === 1 && this.datepickerMode === this.maxMode) &&\n !(this.datepickerMode === this.minMode && direction === -1)\n ) {\n this.datepickerMode =\n this.modes[this.modes.indexOf(this.datepickerMode) + direction];\n this.calendarModeChange.emit(this.datepickerMode);\n this.refreshView();\n }\n }\n\n /**\n * Date is disabled if it meets any of these criteria:\n * 1. Date falls outside the min or max dates set by the SkyDatepickerConfigService.\n * 2. Date is marked as disabled in the customDates array.\n */\n protected isDisabled(date: Date): boolean {\n const customDate = this.getCustomDate(date);\n return (\n (this.minDate && this.compare(date, this.minDate) < 0) ||\n (this.maxDate && this.compare(date, this.maxDate) > 0) ||\n (customDate && customDate.disabled)\n );\n }\n private getCustomDate(date: Date): SkyDatepickerCustomDate | undefined {\n if (this.customDates) {\n return this.customDates.find((customDate: SkyDatepickerCustomDate) => {\n return customDate.date.getTime() === date.getTime();\n });\n }\n }\n}\n","<div\n *ngIf=\"datepickerMode\"\n class=\"sky-datepicker-calendar-inner\"\n (keydown)=\"onKeydown($event)\"\n>\n <ng-content></ng-content>\n</div>\n"]}