@skyux/datetime 5.6.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/bundles/skyux-datetime.umd.js +488 -162
  2. package/documentation.json +696 -835
  3. package/esm2015/lib/modules/date-pipe/date-format-utility.js +0 -2
  4. package/esm2015/lib/modules/date-pipe/date-format-utility.js.map +1 -1
  5. package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js +47 -58
  6. package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js.map +1 -1
  7. package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js +0 -3
  8. package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js.map +1 -1
  9. package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js.map +1 -1
  10. package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js +60 -50
  11. package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js.map +1 -1
  12. package/esm2015/lib/modules/datepicker/datepicker-input.directive.js +51 -40
  13. package/esm2015/lib/modules/datepicker/datepicker-input.directive.js.map +1 -1
  14. package/esm2015/lib/modules/shared/sky-datetime-resources.module.js +1 -1
  15. package/esm2015/lib/modules/shared/sky-datetime-resources.module.js.map +1 -1
  16. package/esm2015/lib/modules/timepicker/timepicker.component.js +6 -6
  17. package/esm2015/lib/modules/timepicker/timepicker.component.js.map +1 -1
  18. package/esm2015/lib/modules/timepicker/timepicker.directive.js +4 -5
  19. package/esm2015/lib/modules/timepicker/timepicker.directive.js.map +1 -1
  20. package/fesm2015/skyux-datetime.js +168 -164
  21. package/fesm2015/skyux-datetime.js.map +1 -1
  22. package/lib/modules/date-pipe/date-format-utility.d.ts +0 -1
  23. package/lib/modules/date-range-picker/date-range-picker.component.d.ts +4 -3
  24. package/lib/modules/date-range-picker/types/date-range-relative-value.d.ts +0 -1
  25. package/lib/modules/datepicker/datepicker-calendar-inner.component.d.ts +16 -13
  26. package/lib/modules/datepicker/datepicker-input-fuzzy.directive.d.ts +6 -1
  27. package/lib/modules/datepicker/datepicker-input.directive.d.ts +6 -2
  28. package/lib/modules/shared/sky-datetime-resources.module.d.ts +1 -1
  29. package/package.json +18 -16
@@ -40,14 +40,15 @@ export class SkyFuzzyDatepickerInputDirective {
40
40
  */
41
41
  this.skyDatepickerNoValidate = false;
42
42
  this.dateFormatter = new SkyDateFormatter();
43
- this.isFirstChange = true;
44
43
  this.ngUnsubscribe = new Subject();
45
44
  this._futureDisabled = false;
46
45
  this._disabled = false;
47
46
  this._yearRequired = false;
47
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
48
48
  this.onChange = (_) => { };
49
- /*istanbul ignore next */
49
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
50
50
  this.onTouched = () => { };
51
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
51
52
  this.onValidatorChange = () => { };
52
53
  this.localeProvider
53
54
  .getLocaleInfo()
@@ -137,7 +138,9 @@ export class SkyFuzzyDatepickerInputDirective {
137
138
  * through the `ngModel` attribute specified on the `input` element.
138
139
  * @required
139
140
  */
140
- set skyFuzzyDatepickerInput(value) { }
141
+ set skyFuzzyDatepickerInput(value) {
142
+ // TODO: Remove this property in a future version of SKY UX.
143
+ }
141
144
  /**
142
145
  * Specifies the starting day of the week in the calendar, where `0` sets the starting day
143
146
  * to Sunday. Place this attribute on the `input` element to override the default
@@ -167,50 +170,7 @@ export class SkyFuzzyDatepickerInputDirective {
167
170
  return this._value;
168
171
  }
169
172
  set value(value) {
170
- let fuzzyDate;
171
- let fuzzyMoment;
172
- let dateValue;
173
- let formattedDate;
174
- if (value instanceof Date) {
175
- dateValue = value;
176
- formattedDate = this.dateFormatter.format(value, this.dateFormat);
177
- fuzzyDate = this.fuzzyDateService.getFuzzyDateFromSelectedDate(value, this.dateFormat);
178
- }
179
- else if (typeof value === 'string') {
180
- fuzzyDate = this.fuzzyDateService.getFuzzyDateFromString(value, this.dateFormat);
181
- formattedDate = this.fuzzyDateService.format(fuzzyDate, this.dateFormat, this.locale);
182
- if (!formattedDate) {
183
- formattedDate = value;
184
- }
185
- fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);
186
- if (fuzzyMoment) {
187
- dateValue = fuzzyMoment.toDate();
188
- }
189
- }
190
- else {
191
- fuzzyDate = value;
192
- formattedDate = this.fuzzyDateService.format(fuzzyDate, this.dateFormat, this.locale);
193
- fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);
194
- if (fuzzyMoment) {
195
- dateValue = fuzzyMoment.toDate();
196
- }
197
- }
198
- const areFuzzyDatesEqual = this.fuzzyDatesEqual(this._value, fuzzyDate);
199
- const isNewValue = fuzzyDate !== this._value || !areFuzzyDatesEqual;
200
- this._value = fuzzyDate || value;
201
- if (isNewValue) {
202
- this.onChange(this._value);
203
- // Do not mark the field as "dirty"
204
- // if the field has been initialized with a value.
205
- if (this.isFirstChange && this.control) {
206
- this.control.markAsPristine();
207
- }
208
- if (this.isFirstChange && this._value) {
209
- this.isFirstChange = false;
210
- }
211
- this.datepickerComponent.selectedDate = dateValue;
212
- }
213
- this.setInputElementValue(formattedDate || '');
173
+ this.updateValue(value);
214
174
  }
215
175
  ngOnInit() {
216
176
  if (this.yearRequired) {
@@ -239,7 +199,6 @@ export class SkyFuzzyDatepickerInputDirective {
239
199
  this.datepickerComponent.dateChange
240
200
  .pipe(distinctUntilChanged(), takeUntil(this.ngUnsubscribe))
241
201
  .subscribe((value) => {
242
- this.isFirstChange = false;
243
202
  this.value = value;
244
203
  this.onTouched();
245
204
  });
@@ -278,7 +237,7 @@ export class SkyFuzzyDatepickerInputDirective {
278
237
  this.control.markAsDirty();
279
238
  }
280
239
  writeValue(value) {
281
- this.value = value;
240
+ this.updateValue(value, false);
282
241
  }
283
242
  validate(control) {
284
243
  if (!this.control) {
@@ -374,7 +333,6 @@ export class SkyFuzzyDatepickerInputDirective {
374
333
  this.onValueChange(this.elementRef.nativeElement.value);
375
334
  }
376
335
  onValueChange(newValue) {
377
- this.isFirstChange = false;
378
336
  this.value = newValue;
379
337
  }
380
338
  setInputElementValue(value) {
@@ -409,6 +367,58 @@ export class SkyFuzzyDatepickerInputDirective {
409
367
  ((!dateA.month && !dateB.month) || dateA.month === dateB.month) &&
410
368
  ((!dateA.year && !dateB.year) || dateA.year === dateB.year));
411
369
  }
370
+ /**
371
+ * Update the value of the form control and input element
372
+ * @param emitEvent Denotes if we emit an event to the consumer's form control. We do not want to do this if the value is being updated via a `setValue` call or a `patchValue` call as this is already handled by Angular.
373
+ * In these cases we do not want to fire `onChange` as it will cause extra `valueChange` and `statusChange` events and the status of the form should not be affected by these changes.
374
+ */
375
+ updateValue(value, emitEvent = true) {
376
+ var _a;
377
+ if (this._value === value) {
378
+ return;
379
+ }
380
+ let fuzzyDate;
381
+ let fuzzyMoment;
382
+ let dateValue;
383
+ let formattedDate;
384
+ if (value instanceof Date) {
385
+ dateValue = value;
386
+ formattedDate = this.dateFormatter.format(value, this.dateFormat);
387
+ fuzzyDate = this.fuzzyDateService.getFuzzyDateFromSelectedDate(value, this.dateFormat);
388
+ }
389
+ else if (typeof value === 'string') {
390
+ fuzzyDate = this.fuzzyDateService.getFuzzyDateFromString(value, this.dateFormat);
391
+ formattedDate = this.fuzzyDateService.format(fuzzyDate, this.dateFormat, this.locale);
392
+ if (!formattedDate) {
393
+ formattedDate = value;
394
+ }
395
+ fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);
396
+ if (fuzzyMoment) {
397
+ dateValue = fuzzyMoment.toDate();
398
+ }
399
+ }
400
+ else {
401
+ fuzzyDate = value;
402
+ formattedDate = this.fuzzyDateService.format(fuzzyDate, this.dateFormat, this.locale);
403
+ fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);
404
+ if (fuzzyMoment) {
405
+ dateValue = fuzzyMoment.toDate();
406
+ }
407
+ }
408
+ const areFuzzyDatesEqual = this.fuzzyDatesEqual(this._value, fuzzyDate);
409
+ const isNewValue = fuzzyDate !== this._value || !areFuzzyDatesEqual;
410
+ this._value = fuzzyDate || value;
411
+ if (isNewValue) {
412
+ if (emitEvent) {
413
+ this.onChange(this._value);
414
+ }
415
+ else {
416
+ (_a = this.control) === null || _a === void 0 ? void 0 : _a.setValue(this._value, { emitEvent: false });
417
+ }
418
+ this.datepickerComponent.selectedDate = dateValue;
419
+ }
420
+ this.setInputElementValue(formattedDate || '');
421
+ }
412
422
  }
413
423
  SkyFuzzyDatepickerInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFuzzyDatepickerInputDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.SkyDatepickerConfigService }, { token: i0.ElementRef }, { token: i2.SkyFuzzyDateService }, { token: i3.SkyAppLocaleProvider }, { token: i0.Renderer2 }, { token: i3.SkyLibResourcesService }, { token: i4.SkyDatepickerComponent, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
414
424
  SkyFuzzyDatepickerInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyFuzzyDatepickerInputDirective, selector: "[skyFuzzyDatepickerInput]", inputs: { dateFormat: "dateFormat", disabled: "disabled", futureDisabled: "futureDisabled", maxDate: "maxDate", minDate: "minDate", skyDatepickerNoValidate: "skyDatepickerNoValidate", skyFuzzyDatepickerInput: "skyFuzzyDatepickerInput", startingDay: "startingDay", yearRequired: "yearRequired" }, host: { listeners: { "change": "onInputChange($event)", "blur": "onInputBlur()", "keyup": "onInputKeyup()" } }, providers: [
@@ -1 +1 @@
1
- {"version":3,"file":"datepicker-input-fuzzy.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-input-fuzzy.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EA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AAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,CAC5D,CAAC;IACJ,CAAC;;8HA9hBU,gCAAgC;kHAAhC,gCAAgC,4cALhC;QACT,mCAAmC;QACnC,8BAA8B;KAC/B;4FAEU,gCAAgC;kBAP5C,SAAS;mBAAC;oBACT,QAAQ,EAAE,2BAA2B;oBACrC,SAAS,EAAE;wBACT,mCAAmC;wBACnC,8BAA8B;qBAC/B;iBACF;;0BA0QI,QAAQ;4CA1PA,UAAU;sBADpB,KAAK;gBA4BK,QAAQ;sBADlB,KAAK;gBAkBK,cAAc;sBADxB,KAAK;gBAiBK,OAAO;sBADjB,KAAK;gBAkBK,OAAO;sBADjB,KAAK;gBAgBC,uBAAuB;sBAD7B,KAAK;gBAYK,uBAAuB;sBADjC,KAAK;gBAYK,WAAW;sBADrB,KAAK;gBAiBK,YAAY;sBADtB,KAAK;gBA0MC,aAAa;sBADnB,YAAY;uBAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBAM3B,WAAW;sBADjB,YAAY;uBAAC,MAAM;gBAgBb,YAAY;sBADlB,YAAY;uBAAC,OAAO","sourcesContent":["import {\n AfterContentInit,\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n ElementRef,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Renderer2,\n forwardRef,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\nimport { SkyAppLocaleProvider, SkyLibResourcesService } from '@skyux/i18n';\n\nimport { Subject } from 'rxjs';\nimport { distinctUntilChanged, takeUntil } from 'rxjs/operators';\n\nimport { SkyDateFormatter } from './date-formatter';\nimport { SkyDatepickerConfigService } from './datepicker-config.service';\nimport { SkyDatepickerComponent } from './datepicker.component';\nimport { SkyFuzzyDate } from './fuzzy-date';\nimport { SkyFuzzyDateService } from './fuzzy-date.service';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_FUZZY_DATEPICKER_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyFuzzyDatepickerInputDirective),\n multi: true,\n};\n\nconst SKY_FUZZY_DATEPICKER_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyFuzzyDatepickerInputDirective),\n multi: true,\n};\n// tslint:enable\n\n@Directive({\n selector: '[skyFuzzyDatepickerInput]',\n providers: [\n SKY_FUZZY_DATEPICKER_VALUE_ACCESSOR,\n SKY_FUZZY_DATEPICKER_VALIDATOR,\n ],\n})\nexport class SkyFuzzyDatepickerInputDirective\n implements\n OnInit,\n OnDestroy,\n AfterViewInit,\n AfterContentInit,\n ControlValueAccessor,\n Validator\n{\n /**\n * Specifies the date format for the input. Place this attribute on the `input` element\n * to override the default in `SkyDatepickerConfigService`.\n * @default \"MM/DD/YYYY\"\n */\n @Input()\n public set dateFormat(value: string) {\n this._dateFormat = value;\n\n if (this.value) {\n const formattedDate = this.fuzzyDateService.format(\n this.value,\n this.dateFormat,\n this.locale\n );\n this.setInputElementValue(formattedDate);\n this.changeDetector.markForCheck();\n }\n }\n\n public get dateFormat(): string {\n return (\n this._dateFormat ||\n this.configService.dateFormat ||\n this.preferredShortDateFormat\n );\n }\n\n /**\n * Indicates whether to disable the datepicker.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n this._disabled = value;\n this.datepickerComponent.disabled = value;\n\n this.renderer.setProperty(this.elementRef.nativeElement, 'disabled', value);\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Indicates whether to prevent users from specifying dates that are in the future.\n * Place this attribute on the `input` element.\n * @default false\n */\n @Input()\n public set futureDisabled(value: boolean) {\n this._futureDisabled = value;\n this.onValidatorChange();\n }\n\n public get futureDisabled(): boolean {\n return this._futureDisabled;\n }\n\n /**\n * Specifies the latest fuzzy date allowed. Place this attribute on the `input` element\n * to prevent fuzzy dates after a specified date. This property accepts\n * a `SkyFuzzyDate` value that includes numeric month, day, and year values.\n * For example: `{ month: 1, day: 1, year: 2027 }`.\n */\n @Input()\n public set maxDate(value: SkyFuzzyDate) {\n this._maxDate = value;\n this.datepickerComponent.maxDate = this.getMaxDate();\n this.onValidatorChange();\n }\n\n public get maxDate(): SkyFuzzyDate {\n return this._maxDate;\n }\n\n /**\n * Specifies the earliest fuzzy date allowed. Place this attribute on the `input` element\n * to prevent fuzzy dates before a specified date. This property accepts a `SkyFuzzyDate` value\n * that includes numeric month, day, and year values.\n * For example: `{ month: 1, day: 1, year: 2007 }`.\n */\n @Input()\n public set minDate(value: SkyFuzzyDate) {\n this._minDate = value;\n this.datepickerComponent.minDate = this.getMinDate();\n this.onValidatorChange();\n }\n\n public get minDate(): SkyFuzzyDate {\n return this._minDate;\n }\n\n /**\n * Indicates whether to disable date validation on the fuzzy datepicker input.\n * @default false\n */\n @Input()\n public skyDatepickerNoValidate = false;\n\n /**\n * Creates the fuzzy datepicker input and calendar to let users specify dates that are\n * not complete. For example, if users know the year but not the month or day, they can\n * enter just the year. Place this directive on an `input` element, and wrap the `input`\n * in a `sky-datepicker` component. The value that users select is driven\n * through the `ngModel` attribute specified on the `input` element.\n * @required\n */\n @Input()\n public set skyFuzzyDatepickerInput(\n value: SkyDatepickerComponent | undefined | ''\n ) {}\n\n /**\n * Specifies the starting day of the week in the calendar, where `0` sets the starting day\n * to Sunday. Place this attribute on the `input` element to override the default\n * in `SkyDatepickerConfigService`.\n * @default 0\n */\n @Input()\n public set startingDay(value: number) {\n this._startingDay = value;\n this.datepickerComponent.startingDay = this.startingDay;\n\n this.onValidatorChange();\n }\n\n public get startingDay(): number {\n return this._startingDay || this.configService.startingDay;\n }\n\n /**\n * Indicates whether to require the year in fuzzy dates.\n * @default false\n */\n @Input()\n public set yearRequired(value: boolean) {\n this._yearRequired = value;\n this.onValidatorChange();\n }\n\n public get yearRequired(): boolean {\n return this._yearRequired;\n }\n\n private get value(): any {\n return this._value;\n }\n\n private set value(value: any) {\n let fuzzyDate: SkyFuzzyDate;\n let fuzzyMoment: any;\n let dateValue: Date;\n let formattedDate: string;\n\n if (value instanceof Date) {\n dateValue = value;\n formattedDate = this.dateFormatter.format(value, this.dateFormat);\n fuzzyDate = this.fuzzyDateService.getFuzzyDateFromSelectedDate(\n value,\n this.dateFormat\n );\n } else if (typeof value === 'string') {\n fuzzyDate = this.fuzzyDateService.getFuzzyDateFromString(\n value,\n this.dateFormat\n );\n formattedDate = this.fuzzyDateService.format(\n fuzzyDate,\n this.dateFormat,\n this.locale\n );\n\n if (!formattedDate) {\n formattedDate = value;\n }\n\n fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);\n\n if (fuzzyMoment) {\n dateValue = fuzzyMoment.toDate();\n }\n } else {\n fuzzyDate = value as SkyFuzzyDate;\n formattedDate = this.fuzzyDateService.format(\n fuzzyDate,\n this.dateFormat,\n this.locale\n );\n fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);\n\n if (fuzzyMoment) {\n dateValue = fuzzyMoment.toDate();\n }\n }\n\n const areFuzzyDatesEqual = this.fuzzyDatesEqual(this._value, fuzzyDate);\n const isNewValue = fuzzyDate !== this._value || !areFuzzyDatesEqual;\n\n this._value = fuzzyDate || value;\n\n if (isNewValue) {\n this.onChange(this._value);\n\n // Do not mark the field as \"dirty\"\n // if the field has been initialized with a value.\n if (this.isFirstChange && this.control) {\n this.control.markAsPristine();\n }\n\n if (this.isFirstChange && this._value) {\n this.isFirstChange = false;\n }\n\n this.datepickerComponent.selectedDate = dateValue;\n }\n\n this.setInputElementValue(formattedDate || '');\n }\n\n private control: AbstractControl;\n\n private dateFormatter = new SkyDateFormatter();\n\n private isFirstChange = true;\n\n private locale: string;\n\n private preferredShortDateFormat: string;\n\n private ngUnsubscribe = new Subject<void>();\n\n private _futureDisabled = false;\n\n private _dateFormat: string;\n\n private _disabled = false;\n\n private _maxDate: SkyFuzzyDate;\n\n private _minDate: SkyFuzzyDate;\n\n private _startingDay: number;\n\n private _value: any;\n\n private _yearRequired = false;\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private configService: SkyDatepickerConfigService,\n private elementRef: ElementRef,\n private fuzzyDateService: SkyFuzzyDateService,\n private localeProvider: SkyAppLocaleProvider,\n private renderer: Renderer2,\n private resourcesService: SkyLibResourcesService,\n @Optional() private datepickerComponent: SkyDatepickerComponent\n ) {\n this.localeProvider\n .getLocaleInfo()\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((localeInfo) => {\n this.locale = localeInfo.locale;\n SkyDateFormatter.setLocale(this.locale);\n this.preferredShortDateFormat =\n SkyDateFormatter.getPreferredShortDateFormat();\n });\n }\n\n public ngOnInit(): void {\n if (this.yearRequired) {\n if (this.dateFormat.toLowerCase().indexOf('y') === -1) {\n throw new Error(\n 'You have configured conflicting settings. Year is required and dateFormat does not include year.'\n );\n }\n }\n\n if (!this.datepickerComponent) {\n throw new Error(\n 'You must wrap the `skyFuzzyDatepickerInput` directive within a ' +\n '`<sky-datepicker>` component!'\n );\n }\n\n const element = this.elementRef.nativeElement;\n\n this.renderer.addClass(element, 'sky-form-control');\n\n const hasAriaLabel = element.getAttribute('aria-label');\n\n /* istanbul ignore else */\n if (!hasAriaLabel) {\n this.resourcesService\n .getString('skyux_date_field_default_label')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((value: string) => {\n this.renderer.setAttribute(element, 'aria-label', value);\n });\n }\n }\n\n public ngAfterContentInit(): void {\n this.datepickerComponent.dateChange\n .pipe(distinctUntilChanged(), takeUntil(this.ngUnsubscribe))\n .subscribe((value: Date) => {\n this.isFirstChange = false;\n this.value = value;\n this.onTouched();\n });\n }\n\n public ngAfterViewInit(): void {\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 // Of note is the parent check which allows us to determine if the form is reactive.\n // Without this check there is a changed before checked error\n /* istanbul ignore else */\n\n if (this.control && this.control.parent) {\n setTimeout(() => {\n this.control.setValue(this.value, {\n emitEvent: false,\n });\n\n this.changeDetector.markForCheck();\n });\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n @HostListener('change', ['$event'])\n public onInputChange(event: any) {\n this.onValueChange(event.target.value);\n }\n\n @HostListener('blur')\n public onInputBlur(): void {\n this.onTouched();\n\n const formattedDate = this.fuzzyDateService.format(\n this.value,\n this.dateFormat,\n this.locale\n );\n\n if (this.control.valid) {\n this.setInputElementValue(formattedDate);\n }\n }\n\n @HostListener('keyup')\n public onInputKeyup(): void {\n this.control.markAsDirty();\n }\n\n public writeValue(value: any): void {\n this.value = value;\n }\n\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n if (this.skyDatepickerNoValidate) {\n return;\n }\n\n if (!this.control.value) {\n return;\n }\n\n const value: any = control.value;\n\n let fuzzyDate: SkyFuzzyDate;\n let validationError: ValidationErrors;\n\n if (typeof value === 'string') {\n fuzzyDate = this.fuzzyDateService.getFuzzyDateFromString(\n value,\n this.dateFormat\n );\n } else {\n fuzzyDate = value;\n }\n\n if (!fuzzyDate) {\n validationError = {\n skyFuzzyDate: {\n invalid: value,\n },\n };\n }\n\n if (!validationError && !fuzzyDate.year && this.yearRequired) {\n validationError = {\n skyFuzzyDate: {\n yearRequired: value,\n },\n };\n }\n\n if (!validationError && fuzzyDate.year) {\n let fuzzyDateRange;\n\n if (this.maxDate) {\n fuzzyDateRange = this.fuzzyDateService.getFuzzyDateRange(\n fuzzyDate,\n this.maxDate\n );\n\n if (!fuzzyDateRange.valid) {\n validationError = {\n skyFuzzyDate: {\n maxDate: value,\n },\n };\n }\n }\n\n if (!validationError && this.minDate) {\n fuzzyDateRange = this.fuzzyDateService.getFuzzyDateRange(\n this.minDate,\n fuzzyDate\n );\n if (!fuzzyDateRange.valid) {\n validationError = {\n skyFuzzyDate: {\n minDate: value,\n },\n };\n }\n }\n\n if (!validationError && this.futureDisabled) {\n fuzzyDateRange = this.fuzzyDateService.getFuzzyDateRange(\n fuzzyDate,\n this.fuzzyDateService.getCurrentFuzzyDate()\n );\n if (!fuzzyDateRange.valid) {\n validationError = {\n skyFuzzyDate: {\n futureDisabled: value,\n },\n };\n }\n }\n }\n\n if (validationError) {\n // Mark the invalid control as touched so that the input's invalid CSS styles appear.\n // (This is only required when the invalid value is set by the FormControl constructor.)\n this.control.markAsTouched();\n }\n\n return validationError;\n }\n\n public registerOnChange(fn: (value: any) => void): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => void): 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 this.datepickerComponent.disabled = disabled;\n }\n\n /**\n * Detects changes to the underlying input element's value and updates the ngModel accordingly.\n * This is useful if you need to update the ngModel value before the input element loses focus.\n */\n public detectInputValueChange(): void {\n this.onValueChange(this.elementRef.nativeElement.value);\n }\n\n private onValueChange(newValue: string): void {\n this.isFirstChange = false;\n this.value = newValue;\n }\n\n private setInputElementValue(value: string): void {\n this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);\n }\n\n private getMaxDate(): Date {\n if (this.maxDate) {\n const maxDate = this.fuzzyDateService.getMomentFromFuzzyDate(\n this.maxDate\n );\n if (maxDate.isValid()) {\n return maxDate.toDate();\n }\n } else if (this.futureDisabled) {\n return new Date();\n }\n return this.configService.maxDate;\n }\n\n private getMinDate(): Date {\n if (this.minDate) {\n const minDate = this.fuzzyDateService.getMomentFromFuzzyDate(\n this.minDate\n );\n if (minDate.isValid()) {\n return minDate.toDate();\n }\n }\n return this.configService.minDate;\n }\n\n /* istanbul ignore next */\n private fuzzyDatesEqual(dateA: SkyFuzzyDate, dateB: SkyFuzzyDate): boolean {\n return (\n dateA &&\n dateB &&\n ((!dateA.day && !dateB.day) || dateA.day === dateB.day) &&\n ((!dateA.month && !dateB.month) || dateA.month === dateB.month) &&\n ((!dateA.year && !dateB.year) || dateA.year === dateB.year)\n );\n }\n\n private onChange = (_: any) => {};\n /*istanbul ignore next */\n private onTouched = () => {};\n private onValidatorChange = () => {};\n}\n"]}
1
+ {"version":3,"file":"datepicker-input-fuzzy.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-input-fuzzy.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,QAAQ,EACR,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,aAAa,EACb,iBAAiB,GAGlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;;;;;;AAE3D,sDAAsD;AACtD,MAAM,mCAAmC,GAAG;IAC1C,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,gCAAgC,CAAC;IAC/D,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,8BAA8B,GAAG;IACrC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,gCAAgC,CAAC;IAC/D,KAAK,EAAE,IAA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n ChangeDetectorRef,\n Directive,\n ElementRef,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Renderer2,\n forwardRef,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\nimport { SkyAppLocaleProvider, SkyLibResourcesService } from '@skyux/i18n';\n\nimport { Subject } from 'rxjs';\nimport { distinctUntilChanged, takeUntil } from 'rxjs/operators';\n\nimport { SkyDateFormatter } from './date-formatter';\nimport { SkyDatepickerConfigService } from './datepicker-config.service';\nimport { SkyDatepickerComponent } from './datepicker.component';\nimport { SkyFuzzyDate } from './fuzzy-date';\nimport { SkyFuzzyDateService } from './fuzzy-date.service';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_FUZZY_DATEPICKER_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyFuzzyDatepickerInputDirective),\n multi: true,\n};\n\nconst SKY_FUZZY_DATEPICKER_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyFuzzyDatepickerInputDirective),\n multi: true,\n};\n// tslint:enable\n\n@Directive({\n selector: '[skyFuzzyDatepickerInput]',\n providers: [\n SKY_FUZZY_DATEPICKER_VALUE_ACCESSOR,\n SKY_FUZZY_DATEPICKER_VALIDATOR,\n ],\n})\nexport class SkyFuzzyDatepickerInputDirective\n implements\n OnInit,\n OnDestroy,\n AfterViewInit,\n AfterContentInit,\n ControlValueAccessor,\n Validator\n{\n /**\n * Specifies the date format for the input. Place this attribute on the `input` element\n * to override the default in `SkyDatepickerConfigService`.\n * @default \"MM/DD/YYYY\"\n */\n @Input()\n public set dateFormat(value: string) {\n this._dateFormat = value;\n\n if (this.value) {\n const formattedDate = this.fuzzyDateService.format(\n this.value,\n this.dateFormat,\n this.locale\n );\n this.setInputElementValue(formattedDate);\n this.changeDetector.markForCheck();\n }\n }\n\n public get dateFormat(): string {\n return (\n this._dateFormat ||\n this.configService.dateFormat ||\n this.preferredShortDateFormat\n );\n }\n\n /**\n * Indicates whether to disable the datepicker.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n this._disabled = value;\n this.datepickerComponent.disabled = value;\n\n this.renderer.setProperty(this.elementRef.nativeElement, 'disabled', value);\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Indicates whether to prevent users from specifying dates that are in the future.\n * Place this attribute on the `input` element.\n * @default false\n */\n @Input()\n public set futureDisabled(value: boolean) {\n this._futureDisabled = value;\n this.onValidatorChange();\n }\n\n public get futureDisabled(): boolean {\n return this._futureDisabled;\n }\n\n /**\n * Specifies the latest fuzzy date allowed. Place this attribute on the `input` element\n * to prevent fuzzy dates after a specified date. This property accepts\n * a `SkyFuzzyDate` value that includes numeric month, day, and year values.\n * For example: `{ month: 1, day: 1, year: 2027 }`.\n */\n @Input()\n public set maxDate(value: SkyFuzzyDate) {\n this._maxDate = value;\n this.datepickerComponent.maxDate = this.getMaxDate();\n this.onValidatorChange();\n }\n\n public get maxDate(): SkyFuzzyDate {\n return this._maxDate;\n }\n\n /**\n * Specifies the earliest fuzzy date allowed. Place this attribute on the `input` element\n * to prevent fuzzy dates before a specified date. This property accepts a `SkyFuzzyDate` value\n * that includes numeric month, day, and year values.\n * For example: `{ month: 1, day: 1, year: 2007 }`.\n */\n @Input()\n public set minDate(value: SkyFuzzyDate) {\n this._minDate = value;\n this.datepickerComponent.minDate = this.getMinDate();\n this.onValidatorChange();\n }\n\n public get minDate(): SkyFuzzyDate {\n return this._minDate;\n }\n\n /**\n * Indicates whether to disable date validation on the fuzzy datepicker input.\n * @default false\n */\n @Input()\n public skyDatepickerNoValidate = false;\n\n /**\n * Creates the fuzzy datepicker input and calendar to let users specify dates that are\n * not complete. For example, if users know the year but not the month or day, they can\n * enter just the year. Place this directive on an `input` element, and wrap the `input`\n * in a `sky-datepicker` component. The value that users select is driven\n * through the `ngModel` attribute specified on the `input` element.\n * @required\n */\n @Input()\n public set skyFuzzyDatepickerInput(\n value: SkyDatepickerComponent | undefined | ''\n ) {\n // TODO: Remove this property in a future version of SKY UX.\n }\n\n /**\n * Specifies the starting day of the week in the calendar, where `0` sets the starting day\n * to Sunday. Place this attribute on the `input` element to override the default\n * in `SkyDatepickerConfigService`.\n * @default 0\n */\n @Input()\n public set startingDay(value: number) {\n this._startingDay = value;\n this.datepickerComponent.startingDay = this.startingDay;\n\n this.onValidatorChange();\n }\n\n public get startingDay(): number {\n return this._startingDay || this.configService.startingDay;\n }\n\n /**\n * Indicates whether to require the year in fuzzy dates.\n * @default false\n */\n @Input()\n public set yearRequired(value: boolean) {\n this._yearRequired = value;\n this.onValidatorChange();\n }\n\n public get yearRequired(): boolean {\n return this._yearRequired;\n }\n\n private get value(): any {\n return this._value;\n }\n\n private set value(value: any) {\n this.updateValue(value);\n }\n\n private control: AbstractControl;\n\n private dateFormatter = new SkyDateFormatter();\n\n private locale: string;\n\n private preferredShortDateFormat: string;\n\n private ngUnsubscribe = new Subject<void>();\n\n private _futureDisabled = false;\n\n private _dateFormat: string;\n\n private _disabled = false;\n\n private _maxDate: SkyFuzzyDate;\n\n private _minDate: SkyFuzzyDate;\n\n private _startingDay: number;\n\n private _value: any;\n\n private _yearRequired = false;\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private configService: SkyDatepickerConfigService,\n private elementRef: ElementRef,\n private fuzzyDateService: SkyFuzzyDateService,\n private localeProvider: SkyAppLocaleProvider,\n private renderer: Renderer2,\n private resourcesService: SkyLibResourcesService,\n @Optional() private datepickerComponent: SkyDatepickerComponent\n ) {\n this.localeProvider\n .getLocaleInfo()\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((localeInfo) => {\n this.locale = localeInfo.locale;\n SkyDateFormatter.setLocale(this.locale);\n this.preferredShortDateFormat =\n SkyDateFormatter.getPreferredShortDateFormat();\n });\n }\n\n public ngOnInit(): void {\n if (this.yearRequired) {\n if (this.dateFormat.toLowerCase().indexOf('y') === -1) {\n throw new Error(\n 'You have configured conflicting settings. Year is required and dateFormat does not include year.'\n );\n }\n }\n\n if (!this.datepickerComponent) {\n throw new Error(\n 'You must wrap the `skyFuzzyDatepickerInput` directive within a ' +\n '`<sky-datepicker>` component!'\n );\n }\n\n const element = this.elementRef.nativeElement;\n\n this.renderer.addClass(element, 'sky-form-control');\n\n const hasAriaLabel = element.getAttribute('aria-label');\n\n /* istanbul ignore else */\n if (!hasAriaLabel) {\n this.resourcesService\n .getString('skyux_date_field_default_label')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((value: string) => {\n this.renderer.setAttribute(element, 'aria-label', value);\n });\n }\n }\n\n public ngAfterContentInit(): void {\n this.datepickerComponent.dateChange\n .pipe(distinctUntilChanged(), takeUntil(this.ngUnsubscribe))\n .subscribe((value: Date) => {\n this.value = value;\n this.onTouched();\n });\n }\n\n public ngAfterViewInit(): void {\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 // Of note is the parent check which allows us to determine if the form is reactive.\n // Without this check there is a changed before checked error\n /* istanbul ignore else */\n\n if (this.control && this.control.parent) {\n setTimeout(() => {\n this.control.setValue(this.value, {\n emitEvent: false,\n });\n\n this.changeDetector.markForCheck();\n });\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n @HostListener('change', ['$event'])\n public onInputChange(event: any) {\n this.onValueChange(event.target.value);\n }\n\n @HostListener('blur')\n public onInputBlur(): void {\n this.onTouched();\n\n const formattedDate = this.fuzzyDateService.format(\n this.value,\n this.dateFormat,\n this.locale\n );\n\n if (this.control.valid) {\n this.setInputElementValue(formattedDate);\n }\n }\n\n @HostListener('keyup')\n public onInputKeyup(): void {\n this.control.markAsDirty();\n }\n\n public writeValue(value: any): void {\n this.updateValue(value, false);\n }\n\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n if (this.skyDatepickerNoValidate) {\n return;\n }\n\n if (!this.control.value) {\n return;\n }\n\n const value: any = control.value;\n\n let fuzzyDate: SkyFuzzyDate;\n let validationError: ValidationErrors;\n\n if (typeof value === 'string') {\n fuzzyDate = this.fuzzyDateService.getFuzzyDateFromString(\n value,\n this.dateFormat\n );\n } else {\n fuzzyDate = value;\n }\n\n if (!fuzzyDate) {\n validationError = {\n skyFuzzyDate: {\n invalid: value,\n },\n };\n }\n\n if (!validationError && !fuzzyDate.year && this.yearRequired) {\n validationError = {\n skyFuzzyDate: {\n yearRequired: value,\n },\n };\n }\n\n if (!validationError && fuzzyDate.year) {\n let fuzzyDateRange;\n\n if (this.maxDate) {\n fuzzyDateRange = this.fuzzyDateService.getFuzzyDateRange(\n fuzzyDate,\n this.maxDate\n );\n\n if (!fuzzyDateRange.valid) {\n validationError = {\n skyFuzzyDate: {\n maxDate: value,\n },\n };\n }\n }\n\n if (!validationError && this.minDate) {\n fuzzyDateRange = this.fuzzyDateService.getFuzzyDateRange(\n this.minDate,\n fuzzyDate\n );\n if (!fuzzyDateRange.valid) {\n validationError = {\n skyFuzzyDate: {\n minDate: value,\n },\n };\n }\n }\n\n if (!validationError && this.futureDisabled) {\n fuzzyDateRange = this.fuzzyDateService.getFuzzyDateRange(\n fuzzyDate,\n this.fuzzyDateService.getCurrentFuzzyDate()\n );\n if (!fuzzyDateRange.valid) {\n validationError = {\n skyFuzzyDate: {\n futureDisabled: value,\n },\n };\n }\n }\n }\n\n if (validationError) {\n // Mark the invalid control as touched so that the input's invalid CSS styles appear.\n // (This is only required when the invalid value is set by the FormControl constructor.)\n this.control.markAsTouched();\n }\n\n return validationError;\n }\n\n public registerOnChange(fn: (value: any) => void): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => void): 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 this.datepickerComponent.disabled = disabled;\n }\n\n /**\n * Detects changes to the underlying input element's value and updates the ngModel accordingly.\n * This is useful if you need to update the ngModel value before the input element loses focus.\n */\n public detectInputValueChange(): void {\n this.onValueChange(this.elementRef.nativeElement.value);\n }\n\n private onValueChange(newValue: string): void {\n this.value = newValue;\n }\n\n private setInputElementValue(value: string): void {\n this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);\n }\n\n private getMaxDate(): Date {\n if (this.maxDate) {\n const maxDate = this.fuzzyDateService.getMomentFromFuzzyDate(\n this.maxDate\n );\n if (maxDate.isValid()) {\n return maxDate.toDate();\n }\n } else if (this.futureDisabled) {\n return new Date();\n }\n return this.configService.maxDate;\n }\n\n private getMinDate(): Date {\n if (this.minDate) {\n const minDate = this.fuzzyDateService.getMomentFromFuzzyDate(\n this.minDate\n );\n if (minDate.isValid()) {\n return minDate.toDate();\n }\n }\n return this.configService.minDate;\n }\n\n /* istanbul ignore next */\n private fuzzyDatesEqual(dateA: SkyFuzzyDate, dateB: SkyFuzzyDate): boolean {\n return (\n dateA &&\n dateB &&\n ((!dateA.day && !dateB.day) || dateA.day === dateB.day) &&\n ((!dateA.month && !dateB.month) || dateA.month === dateB.month) &&\n ((!dateA.year && !dateB.year) || dateA.year === dateB.year)\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChange = (_: any) => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onTouched = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onValidatorChange = () => {};\n\n /**\n * Update the value of the form control and input element\n * @param emitEvent Denotes if we emit an event to the consumer's form control. We do not want to do this if the value is being updated via a `setValue` call or a `patchValue` call as this is already handled by Angular.\n * In these cases we do not want to fire `onChange` as it will cause extra `valueChange` and `statusChange` events and the status of the form should not be affected by these changes.\n */\n private updateValue(value: any, emitEvent = true): void {\n if (this._value === value) {\n return;\n }\n\n let fuzzyDate: SkyFuzzyDate;\n let fuzzyMoment: any;\n let dateValue: Date;\n let formattedDate: string;\n\n if (value instanceof Date) {\n dateValue = value;\n formattedDate = this.dateFormatter.format(value, this.dateFormat);\n fuzzyDate = this.fuzzyDateService.getFuzzyDateFromSelectedDate(\n value,\n this.dateFormat\n );\n } else if (typeof value === 'string') {\n fuzzyDate = this.fuzzyDateService.getFuzzyDateFromString(\n value,\n this.dateFormat\n );\n formattedDate = this.fuzzyDateService.format(\n fuzzyDate,\n this.dateFormat,\n this.locale\n );\n\n if (!formattedDate) {\n formattedDate = value;\n }\n\n fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);\n\n if (fuzzyMoment) {\n dateValue = fuzzyMoment.toDate();\n }\n } else {\n fuzzyDate = value as SkyFuzzyDate;\n formattedDate = this.fuzzyDateService.format(\n fuzzyDate,\n this.dateFormat,\n this.locale\n );\n fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);\n\n if (fuzzyMoment) {\n dateValue = fuzzyMoment.toDate();\n }\n }\n\n const areFuzzyDatesEqual = this.fuzzyDatesEqual(this._value, fuzzyDate);\n const isNewValue = fuzzyDate !== this._value || !areFuzzyDatesEqual;\n\n this._value = fuzzyDate || value;\n\n if (isNewValue) {\n if (emitEvent) {\n this.onChange(this._value);\n } else {\n this.control?.setValue(this._value, { emitEvent: false });\n }\n\n this.datepickerComponent.selectedDate = dateValue;\n }\n\n this.setInputElementValue(formattedDate || '');\n }\n}\n"]}
@@ -41,11 +41,12 @@ export class SkyDatepickerInputDirective {
41
41
  */
42
42
  this.skyDatepickerNoValidate = false;
43
43
  this.dateFormatter = new SkyDateFormatter();
44
- this.isFirstChange = true;
45
44
  this.ngUnsubscribe = new Subject();
45
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
46
46
  this.onChange = (_) => { };
47
- /*istanbul ignore next */
47
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
48
48
  this.onTouched = () => { };
49
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
49
50
  this.onValidatorChange = () => { };
50
51
  this.initialPlaceholder = this.adapter.getPlaceholder(this.elementRef);
51
52
  this.updatePlaceholder();
@@ -166,28 +167,7 @@ export class SkyDatepickerInputDirective {
166
167
  return this._value;
167
168
  }
168
169
  set value(value) {
169
- const dateValue = this.getDateValue(value);
170
- const areDatesEqual = this._value instanceof Date &&
171
- dateValue &&
172
- dateValue.getTime() === this._value.getTime();
173
- const isValidDateString = this.isDateStringValid(value);
174
- // If the string value supplied is malformed, do not set the value to its Date equivalent.
175
- // (JavaScript's Date parser will convert poorly formatted dates to Date objects, such as "abc 123", which isn't ideal.)
176
- if (!isValidDateString) {
177
- this._value = value;
178
- this.notifyUpdatedValue();
179
- }
180
- else if (dateValue !== this._value || !areDatesEqual) {
181
- this._value = dateValue || value;
182
- this.notifyUpdatedValue();
183
- }
184
- if (dateValue && isValidDateString) {
185
- const formattedDate = this.dateFormatter.format(dateValue, this.dateFormat);
186
- this.setInputElementValue(formattedDate);
187
- }
188
- else {
189
- this.setInputElementValue(value || '');
190
- }
170
+ this.updateValue(value);
191
171
  }
192
172
  ngOnInit() {
193
173
  if (!this.datepickerComponent) {
@@ -211,7 +191,6 @@ export class SkyDatepickerInputDirective {
211
191
  .pipe(distinctUntilChanged())
212
192
  .pipe(takeUntil(this.ngUnsubscribe))
213
193
  .subscribe((value) => {
214
- this.isFirstChange = false;
215
194
  this.value = value;
216
195
  this.onTouched();
217
196
  });
@@ -263,7 +242,7 @@ export class SkyDatepickerInputDirective {
263
242
  this.control.markAsDirty();
264
243
  }
265
244
  writeValue(value) {
266
- this.value = value;
245
+ this.updateValue(value, false);
267
246
  }
268
247
  validate(control) {
269
248
  if (!this.control) {
@@ -334,7 +313,6 @@ export class SkyDatepickerInputDirective {
334
313
  }
335
314
  }
336
315
  onValueChange(newValue) {
337
- this.isFirstChange = false;
338
316
  this.value = newValue;
339
317
  }
340
318
  setInputElementValue(value) {
@@ -361,7 +339,7 @@ export class SkyDatepickerInputDirective {
361
339
  return true;
362
340
  }
363
341
  // Does the value only include digits, dashes, or slashes?
364
- const regexp = /^[\d\/\-]+$/;
342
+ const regexp = /^[\d/-]+$/;
365
343
  const isValid = regexp.test(value);
366
344
  if (isValid) {
367
345
  return true;
@@ -370,23 +348,56 @@ export class SkyDatepickerInputDirective {
370
348
  const isValidIso = moment(value, moment.ISO_8601).isValid();
371
349
  return isValidIso;
372
350
  }
373
- notifyUpdatedValue() {
374
- this.onChange(this._value);
375
- // Do not mark the field as "dirty"
376
- // if the field has been initialized with a value.
377
- if (this.isFirstChange && this.control) {
378
- this.control.markAsPristine();
379
- }
380
- if (this.isFirstChange && this._value) {
381
- this.isFirstChange = false;
382
- }
383
- this.datepickerComponent.selectedDate = this._value;
384
- }
385
351
  updatePlaceholder() {
386
352
  if (!this.initialPlaceholder) {
387
353
  this.adapter.setPlaceholder(this.elementRef, this.dateFormat);
388
354
  }
389
355
  }
356
+ /**
357
+ * Update the value of the form control and input element
358
+ * @param emitEvent Denotes if we emit an event to the consumer's form control. We do not want to do this if the value is being updated via a `setValue` call or a `patchValue` call as this is already handled by Angular.
359
+ * In these cases we do not want to fire `onChange` as it will cause extra `valueChange` and `statusChange` events and the status of the form should not be affected by these changes.
360
+ */
361
+ updateValue(value, emitEvent = true) {
362
+ var _a, _b;
363
+ if (this._value === value) {
364
+ return;
365
+ }
366
+ const dateValue = this.getDateValue(value);
367
+ const areDatesEqual = this._value instanceof Date &&
368
+ dateValue &&
369
+ dateValue.getTime() === this._value.getTime();
370
+ const isValidDateString = this.isDateStringValid(value);
371
+ // If the string value supplied is malformed, do not set the value to its Date equivalent.
372
+ // (JavaScript's Date parser will convert poorly formatted dates to Date objects, such as "abc 123", which isn't ideal.)
373
+ if (!isValidDateString) {
374
+ this._value = value;
375
+ if (emitEvent) {
376
+ this.onChange(this._value);
377
+ }
378
+ else {
379
+ (_a = this.control) === null || _a === void 0 ? void 0 : _a.setValue(this._value, { emitEvent: false });
380
+ }
381
+ this.datepickerComponent.selectedDate = this._value;
382
+ }
383
+ else if (dateValue !== this._value || !areDatesEqual) {
384
+ this._value = dateValue || value;
385
+ if (emitEvent) {
386
+ this.onChange(this._value);
387
+ }
388
+ else {
389
+ (_b = this.control) === null || _b === void 0 ? void 0 : _b.setValue(this._value, { emitEvent: false });
390
+ }
391
+ this.datepickerComponent.selectedDate = this._value;
392
+ }
393
+ if (dateValue && isValidDateString) {
394
+ const formattedDate = this.dateFormatter.format(dateValue, this.dateFormat);
395
+ this.setInputElementValue(formattedDate);
396
+ }
397
+ else {
398
+ this.setInputElementValue(value || '');
399
+ }
400
+ }
390
401
  }
391
402
  SkyDatepickerInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDatepickerInputDirective, deps: [{ token: i1.SkyDatepickerAdapterService }, { token: i0.ChangeDetectorRef }, { token: i2.SkyDatepickerConfigService }, { token: i0.ElementRef }, { token: i3.SkyAppLocaleProvider }, { token: i0.Renderer2 }, { token: i3.SkyLibResourcesService }, { token: i4.SkyDatepickerComponent, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
392
403
  SkyDatepickerInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyDatepickerInputDirective, selector: "[skyDatepickerInput]", inputs: { dateFormat: "dateFormat", disabled: "disabled", maxDate: "maxDate", minDate: "minDate", skyDatepickerInput: "skyDatepickerInput", skyDatepickerNoValidate: "skyDatepickerNoValidate", startingDay: "startingDay", strict: "strict" }, host: { listeners: { "change": "onInputChange($event)", "blur": "onInputBlur()", "keyup": "onInputKeyup()" } }, providers: [
@@ -1 +1 @@
1
- {"version":3,"file":"datepicker-input.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-input.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,QAAQ,EACR,SAAS,EACT,UAAU,G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E;YAC5B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;SAC/D;IACH,CAAC;;yHApeU,2BAA2B;6GAA3B,2BAA2B,+YAN3B;QACT,6BAA6B;QAC7B,wBAAwB;QACxB,2BAA2B;KAC5B;4FAEU,2BAA2B;kBARvC,SAAS;mBAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,SAAS,EAAE;wBACT,6BAA6B;wBAC7B,wBAAwB;wBACxB,2BAA2B;qBAC5B;iBACF;;0BAgNI,QAAQ;4CAhMA,UAAU;sBADpB,KAAK;gBAsBK,QAAQ;sBADlB,KAAK;gBAwBK,OAAO;sBADjB,KAAK;gBAiBK,OAAO;sBADjB,KAAK;gBAmBK,kBAAkB;sBAD5B,KAAK;gBAoBC,uBAAuB;sBAD7B,KAAK;gBAUK,WAAW;sBADrB,KAAK;gBAqBK,MAAM;sBADhB,KAAK;gBAgJC,aAAa;sBADnB,YAAY;uBAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBA0B3B,WAAW;sBADjB,YAAY;uBAAC,MAAM;gBAMb,YAAY;sBADlB,YAAY;uBAAC,OAAO","sourcesContent":["import {\n AfterContentInit,\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n ElementRef,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Renderer2,\n forwardRef,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\nimport { SkyAppLocaleProvider, SkyLibResourcesService } from '@skyux/i18n';\n\nimport moment from 'moment';\nimport { Subject } from 'rxjs';\nimport { distinctUntilChanged, takeUntil } from 'rxjs/operators';\n\nimport { SkyDateFormatter } from './date-formatter';\nimport { SkyDatepickerAdapterService } from './datepicker-adapter.service';\nimport { SkyDatepickerConfigService } from './datepicker-config.service';\nimport { SkyDatepickerComponent } from './datepicker.component';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_DATEPICKER_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyDatepickerInputDirective),\n multi: true,\n};\n\nconst SKY_DATEPICKER_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyDatepickerInputDirective),\n multi: true,\n};\n// tslint:enable\n\n@Directive({\n selector: '[skyDatepickerInput]',\n providers: [\n SKY_DATEPICKER_VALUE_ACCESSOR,\n SKY_DATEPICKER_VALIDATOR,\n SkyDatepickerAdapterService,\n ],\n})\nexport class SkyDatepickerInputDirective\n implements\n OnInit,\n OnDestroy,\n AfterViewInit,\n AfterContentInit,\n ControlValueAccessor,\n Validator\n{\n /**\n * Specifies the date format for the input. Place this attribute on the `input` element\n * to override the default in the `SkyDatepickerConfigService`.\n * @default \"MM/DD/YYYY\"\n */\n @Input()\n public set dateFormat(value: string) {\n /* istanbul ignore else */\n if (value !== this._dateFormat) {\n this._dateFormat = value;\n this.applyDateFormat();\n }\n }\n\n public get dateFormat(): string {\n return (\n this._dateFormat ||\n this.configService.dateFormat ||\n this.preferredShortDateFormat\n );\n }\n\n /**\n * Indicates whether to disable the datepicker.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n this._disabled = value;\n this.datepickerComponent.disabled = value;\n this.renderer.setProperty(this.elementRef.nativeElement, 'disabled', value);\n }\n\n public get disabled(): boolean {\n return this._disabled || false;\n }\n\n /**\n * @internal\n * Indicates if the input element or any of its children have focus.\n */\n public get inputIsFocused(): boolean {\n return this.adapter.elementIsFocused();\n }\n\n /**\n * Specifies the latest date that is available in the calendar. Place this attribute on\n * the `input` element to override the default in `SkyDatepickerConfigService`.\n */\n @Input()\n public set maxDate(value: Date) {\n this._maxDate = value;\n this.datepickerComponent.maxDate = this.maxDate;\n\n this.onValidatorChange();\n }\n\n public get maxDate(): Date {\n return this._maxDate || this.configService.maxDate;\n }\n\n /**\n * Specifies the earliest date that is available in the calendar. Place this attribute on\n * the `input` element to override the default in `SkyDatepickerConfigService`.\n */\n @Input()\n public set minDate(value: Date) {\n this._minDate = value;\n this.datepickerComponent.minDate = this.minDate;\n\n this.onValidatorChange();\n }\n\n public get minDate(): Date {\n return this._minDate || this.configService.minDate;\n }\n\n /**\n * Creates the datepicker input and calendar. Place this directive on an `input` element,\n * and wrap the input in a `sky-datepicker` component. The value that users select is driven\n * through the `ngModel` attribute specified on the `input` element.\n * @required\n */\n @Input()\n public set skyDatepickerInput(\n value: SkyDatepickerComponent | undefined | ''\n ) {\n if (value) {\n console.warn(\n '[Deprecation warning] You no longer need to provide a template reference variable ' +\n 'to the `skyDatepickerInput` attribute (this will be a breaking change in the next ' +\n 'major version release).\\n' +\n 'Do this instead:\\n' +\n '<sky-datepicker>\\n <input skyDatepickerInput />\\n</sky-datepicker>'\n );\n }\n }\n\n /**\n * Indicates whether to disable date validation on the datepicker input.\n * @default false\n */\n @Input()\n public skyDatepickerNoValidate = false;\n\n /**\n * Specifies the starting day of the week in the calendar, where `0` sets the starting day\n * to Sunday. Place this attribute on the `input` element to override the default\n * in `SkyDatepickerConfigService`.\n * @default 0\n */\n @Input()\n public set startingDay(value: number) {\n this._startingDay = value;\n this.datepickerComponent.startingDay = this.startingDay;\n\n this.onValidatorChange();\n }\n\n public get startingDay(): number {\n return this._startingDay || this.configService.startingDay;\n }\n\n /**\n * Indicates whether the format of the date value must match the format from the `dateFormat` value.\n * If this property is `true` and the datepicker input directive cannot find an exact match, then\n * the input is marked as invalid.\n * If this property is `false` and the datepicker input directive cannot find an exact match, then\n * it attempts to format the string based on the [ISO 8601 standard format](https://www.iso.org/iso-8601-date-and-time-format.html).\n * @default false\n */\n @Input()\n public set strict(value: boolean) {\n this._strict = value;\n }\n\n public get strict(): boolean {\n return this._strict || false;\n }\n\n private get value(): any {\n return this._value;\n }\n\n private set value(value: any) {\n const dateValue = this.getDateValue(value);\n\n const areDatesEqual =\n this._value instanceof Date &&\n dateValue &&\n dateValue.getTime() === this._value.getTime();\n\n const isValidDateString = this.isDateStringValid(value);\n\n // If the string value supplied is malformed, do not set the value to its Date equivalent.\n // (JavaScript's Date parser will convert poorly formatted dates to Date objects, such as \"abc 123\", which isn't ideal.)\n if (!isValidDateString) {\n this._value = value;\n this.notifyUpdatedValue();\n } else if (dateValue !== this._value || !areDatesEqual) {\n this._value = dateValue || value;\n this.notifyUpdatedValue();\n }\n\n if (dateValue && isValidDateString) {\n const formattedDate = this.dateFormatter.format(\n dateValue,\n this.dateFormat\n );\n this.setInputElementValue(formattedDate);\n } else {\n this.setInputElementValue(value || '');\n }\n }\n\n private control: AbstractControl;\n private dateFormatter = new SkyDateFormatter();\n private isFirstChange = true;\n private initialPlaceholder: string;\n private preferredShortDateFormat: string;\n private ngUnsubscribe = new Subject<void>();\n\n private _dateFormat: string;\n private _disabled: boolean;\n private _maxDate: Date;\n private _minDate: Date;\n private _startingDay: number;\n private _strict: boolean;\n private _value: any;\n\n constructor(\n private adapter: SkyDatepickerAdapterService,\n private changeDetector: ChangeDetectorRef,\n private configService: SkyDatepickerConfigService,\n private elementRef: ElementRef,\n private localeProvider: SkyAppLocaleProvider,\n private renderer: Renderer2,\n private resourcesService: SkyLibResourcesService,\n @Optional() private datepickerComponent: SkyDatepickerComponent\n ) {\n this.initialPlaceholder = this.adapter.getPlaceholder(this.elementRef);\n this.updatePlaceholder();\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 this.applyDateFormat();\n });\n }\n\n public ngOnInit(): void {\n if (!this.datepickerComponent) {\n throw new Error(\n 'You must wrap the `skyDatepickerInput` directive within a ' +\n '`<sky-datepicker>` component!'\n );\n }\n\n const element = this.elementRef.nativeElement;\n\n this.renderer.addClass(element, 'sky-form-control');\n\n const hasAriaLabel = element.getAttribute('aria-label');\n\n if (!hasAriaLabel) {\n this.resourcesService\n .getString('skyux_date_field_default_label')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((value: string) => {\n this.renderer.setAttribute(element, 'aria-label', value);\n });\n }\n }\n\n public ngAfterContentInit(): void {\n this.datepickerComponent.dateChange\n .pipe(distinctUntilChanged())\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((value: Date) => {\n this.isFirstChange = false;\n this.value = value;\n this.onTouched();\n });\n }\n\n public ngAfterViewInit(): void {\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 // Of note is the parent check which allows us to determine if the form is reactive.\n // Without this check there is a changed before checked error\n /* istanbul ignore else */\n if (this.control && this.control.parent) {\n setTimeout(() => {\n this.control.setValue(this.value, {\n emitEvent: false,\n });\n\n this.changeDetector.markForCheck();\n });\n }\n\n this.adapter.init(this.elementRef);\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n @HostListener('change', ['$event'])\n public onInputChange(event: any) {\n const value = event.target.value;\n\n if (this.skyDatepickerNoValidate) {\n this.onValueChange(value);\n return;\n }\n\n // Don't try to parse the string value into a Date value if it is malformed.\n if (this.isDateStringValid(value)) {\n this.onValueChange(value);\n return;\n }\n\n this._value = value;\n this.onChange(value);\n\n this.control.setErrors({\n skyDate: {\n invalid: true,\n },\n });\n }\n\n @HostListener('blur')\n public onInputBlur(): void {\n this.onTouched();\n }\n\n @HostListener('keyup')\n public onInputKeyup(): void {\n this.control.markAsDirty();\n }\n\n public writeValue(value: any): void {\n this.value = value;\n }\n\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n if (this.skyDatepickerNoValidate) {\n return;\n }\n\n const value: any = control.value;\n\n if (!value) {\n return;\n }\n\n const dateValue = this.getDateValue(value);\n const isDateValid = dateValue && this.dateFormatter.dateIsValid(dateValue);\n\n if (!isDateValid || !this.isDateStringValid(value)) {\n // Mark the invalid control as touched so that the input's invalid CSS styles appear.\n // (This is only required when the invalid value is set by the FormControl constructor.)\n this.control.markAsTouched();\n\n return {\n skyDate: {\n invalid: value,\n },\n };\n }\n\n const minDate = this.minDate;\n\n if (minDate && this.dateFormatter.dateIsValid(minDate) && value < minDate) {\n return {\n skyDate: {\n minDate,\n },\n };\n }\n\n const maxDate = this.maxDate;\n\n if (maxDate && this.dateFormatter.dateIsValid(maxDate) && value > maxDate) {\n return {\n skyDate: {\n maxDate,\n },\n };\n }\n }\n\n public registerOnChange(fn: (value: any) => void): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => void): 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 this.datepickerComponent.disabled = disabled;\n }\n\n /**\n * Detects changes to the underlying input element's value and updates the ngModel accordingly.\n * This is useful if you need to update the ngModel value before the input element loses focus.\n */\n public detectInputValueChange(): void {\n this.onValueChange(this.elementRef.nativeElement.value);\n }\n\n private applyDateFormat(): void {\n this.updatePlaceholder();\n if (this.value) {\n const formattedDate = this.dateFormatter.format(\n this.value,\n this.dateFormat\n );\n this.setInputElementValue(formattedDate);\n this.changeDetector.markForCheck();\n }\n }\n\n private onValueChange(newValue: string): void {\n this.isFirstChange = false;\n this.value = newValue;\n }\n\n private setInputElementValue(value: string): void {\n this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);\n }\n\n private getDateValue(value: any): Date {\n let dateValue: Date;\n if (value instanceof Date) {\n dateValue = value;\n } else if (typeof value === 'string') {\n const date = this.dateFormatter.getDateFromString(\n value,\n this.dateFormat,\n this.strict\n );\n if (this.dateFormatter.dateIsValid(date)) {\n dateValue = date;\n }\n }\n\n return dateValue;\n }\n\n /**\n * Validates the input value to ensure it is formatted correctly.\n */\n private isDateStringValid(value: string): boolean {\n if (!value || typeof value !== 'string') {\n return true;\n }\n\n // Does the value only include digits, dashes, or slashes?\n const regexp = /^[\\d\\/\\-]+$/;\n const isValid = regexp.test(value);\n\n if (isValid) {\n return true;\n }\n\n // If not, does it conform to the standard ISO format?\n const isValidIso = moment(value, moment.ISO_8601).isValid();\n\n return isValidIso;\n }\n\n private onChange = (_: any) => {};\n /*istanbul ignore next */\n private onTouched = () => {};\n private onValidatorChange = () => {};\n\n private notifyUpdatedValue(): void {\n this.onChange(this._value);\n\n // Do not mark the field as \"dirty\"\n // if the field has been initialized with a value.\n if (this.isFirstChange && this.control) {\n this.control.markAsPristine();\n }\n\n if (this.isFirstChange && this._value) {\n this.isFirstChange = false;\n }\n\n this.datepickerComponent.selectedDate = this._value;\n }\n\n private updatePlaceholder(): void {\n if (!this.initialPlaceholder) {\n this.adapter.setPlaceholder(this.elementRef, this.dateFormat);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"datepicker-input.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/datepicker/datepicker-input.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,QAAQ,EACR,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,aAAa,EACb,iBAAiB,GAGlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,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AC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,SAAS,EAAE;wBACT,6BAA6B;wBAC7B,wBAAwB;wBACxB,2BAA2B;qBAC5B;iBACF;;0BAoLI,QAAQ;4CApKA,UAAU;sBADpB,KAAK;gBAsBK,QAAQ;sBADlB,KAAK;gBAwBK,OAAO;sBADjB,KAAK;gBAiBK,OAAO;sBADjB,KAAK;gBAmBK,kBAAkB;sBAD5B,KAAK;gBAoBC,uBAAuB;sBAD7B,KAAK;gBAUK,WAAW;sBADrB,KAAK;gBAqBK,MAAM;sBADhB,KAAK;gBAmHC,aAAa;sBADnB,YAAY;uBAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBA0B3B,WAAW;sBADjB,YAAY;uBAAC,MAAM;gBAMb,YAAY;sBADlB,YAAY;uBAAC,OAAO","sourcesContent":["import {\n AfterContentInit,\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n ElementRef,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Renderer2,\n forwardRef,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\nimport { SkyAppLocaleProvider, SkyLibResourcesService } from '@skyux/i18n';\n\nimport moment from 'moment';\nimport { Subject } from 'rxjs';\nimport { distinctUntilChanged, takeUntil } from 'rxjs/operators';\n\nimport { SkyDateFormatter } from './date-formatter';\nimport { SkyDatepickerAdapterService } from './datepicker-adapter.service';\nimport { SkyDatepickerConfigService } from './datepicker-config.service';\nimport { SkyDatepickerComponent } from './datepicker.component';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_DATEPICKER_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyDatepickerInputDirective),\n multi: true,\n};\n\nconst SKY_DATEPICKER_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyDatepickerInputDirective),\n multi: true,\n};\n// tslint:enable\n\n@Directive({\n selector: '[skyDatepickerInput]',\n providers: [\n SKY_DATEPICKER_VALUE_ACCESSOR,\n SKY_DATEPICKER_VALIDATOR,\n SkyDatepickerAdapterService,\n ],\n})\nexport class SkyDatepickerInputDirective\n implements\n OnInit,\n OnDestroy,\n AfterViewInit,\n AfterContentInit,\n ControlValueAccessor,\n Validator\n{\n /**\n * Specifies the date format for the input. Place this attribute on the `input` element\n * to override the default in the `SkyDatepickerConfigService`.\n * @default \"MM/DD/YYYY\"\n */\n @Input()\n public set dateFormat(value: string) {\n /* istanbul ignore else */\n if (value !== this._dateFormat) {\n this._dateFormat = value;\n this.applyDateFormat();\n }\n }\n\n public get dateFormat(): string {\n return (\n this._dateFormat ||\n this.configService.dateFormat ||\n this.preferredShortDateFormat\n );\n }\n\n /**\n * Indicates whether to disable the datepicker.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n this._disabled = value;\n this.datepickerComponent.disabled = value;\n this.renderer.setProperty(this.elementRef.nativeElement, 'disabled', value);\n }\n\n public get disabled(): boolean {\n return this._disabled || false;\n }\n\n /**\n * @internal\n * Indicates if the input element or any of its children have focus.\n */\n public get inputIsFocused(): boolean {\n return this.adapter.elementIsFocused();\n }\n\n /**\n * Specifies the latest date that is available in the calendar. Place this attribute on\n * the `input` element to override the default in `SkyDatepickerConfigService`.\n */\n @Input()\n public set maxDate(value: Date) {\n this._maxDate = value;\n this.datepickerComponent.maxDate = this.maxDate;\n\n this.onValidatorChange();\n }\n\n public get maxDate(): Date {\n return this._maxDate || this.configService.maxDate;\n }\n\n /**\n * Specifies the earliest date that is available in the calendar. Place this attribute on\n * the `input` element to override the default in `SkyDatepickerConfigService`.\n */\n @Input()\n public set minDate(value: Date) {\n this._minDate = value;\n this.datepickerComponent.minDate = this.minDate;\n\n this.onValidatorChange();\n }\n\n public get minDate(): Date {\n return this._minDate || this.configService.minDate;\n }\n\n /**\n * Creates the datepicker input and calendar. Place this directive on an `input` element,\n * and wrap the input in a `sky-datepicker` component. The value that users select is driven\n * through the `ngModel` attribute specified on the `input` element.\n * @required\n */\n @Input()\n public set skyDatepickerInput(\n value: SkyDatepickerComponent | undefined | ''\n ) {\n if (value) {\n console.warn(\n '[Deprecation warning] You no longer need to provide a template reference variable ' +\n 'to the `skyDatepickerInput` attribute (this will be a breaking change in the next ' +\n 'major version release).\\n' +\n 'Do this instead:\\n' +\n '<sky-datepicker>\\n <input skyDatepickerInput />\\n</sky-datepicker>'\n );\n }\n }\n\n /**\n * Indicates whether to disable date validation on the datepicker input.\n * @default false\n */\n @Input()\n public skyDatepickerNoValidate = false;\n\n /**\n * Specifies the starting day of the week in the calendar, where `0` sets the starting day\n * to Sunday. Place this attribute on the `input` element to override the default\n * in `SkyDatepickerConfigService`.\n * @default 0\n */\n @Input()\n public set startingDay(value: number) {\n this._startingDay = value;\n this.datepickerComponent.startingDay = this.startingDay;\n\n this.onValidatorChange();\n }\n\n public get startingDay(): number {\n return this._startingDay || this.configService.startingDay;\n }\n\n /**\n * Indicates whether the format of the date value must match the format from the `dateFormat` value.\n * If this property is `true` and the datepicker input directive cannot find an exact match, then\n * the input is marked as invalid.\n * If this property is `false` and the datepicker input directive cannot find an exact match, then\n * it attempts to format the string based on the [ISO 8601 standard format](https://www.iso.org/iso-8601-date-and-time-format.html).\n * @default false\n */\n @Input()\n public set strict(value: boolean) {\n this._strict = value;\n }\n\n public get strict(): boolean {\n return this._strict || false;\n }\n\n private get value(): any {\n return this._value;\n }\n\n private set value(value: any) {\n this.updateValue(value);\n }\n\n private control: AbstractControl;\n private dateFormatter = new SkyDateFormatter();\n private initialPlaceholder: string;\n private preferredShortDateFormat: string;\n private ngUnsubscribe = new Subject<void>();\n\n private _dateFormat: string;\n private _disabled: boolean;\n private _maxDate: Date;\n private _minDate: Date;\n private _startingDay: number;\n private _strict: boolean;\n private _value: any;\n\n constructor(\n private adapter: SkyDatepickerAdapterService,\n private changeDetector: ChangeDetectorRef,\n private configService: SkyDatepickerConfigService,\n private elementRef: ElementRef,\n private localeProvider: SkyAppLocaleProvider,\n private renderer: Renderer2,\n private resourcesService: SkyLibResourcesService,\n @Optional() private datepickerComponent: SkyDatepickerComponent\n ) {\n this.initialPlaceholder = this.adapter.getPlaceholder(this.elementRef);\n this.updatePlaceholder();\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 this.applyDateFormat();\n });\n }\n\n public ngOnInit(): void {\n if (!this.datepickerComponent) {\n throw new Error(\n 'You must wrap the `skyDatepickerInput` directive within a ' +\n '`<sky-datepicker>` component!'\n );\n }\n\n const element = this.elementRef.nativeElement;\n\n this.renderer.addClass(element, 'sky-form-control');\n\n const hasAriaLabel = element.getAttribute('aria-label');\n\n if (!hasAriaLabel) {\n this.resourcesService\n .getString('skyux_date_field_default_label')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((value: string) => {\n this.renderer.setAttribute(element, 'aria-label', value);\n });\n }\n }\n\n public ngAfterContentInit(): void {\n this.datepickerComponent.dateChange\n .pipe(distinctUntilChanged())\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((value: Date) => {\n this.value = value;\n this.onTouched();\n });\n }\n\n public ngAfterViewInit(): void {\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 // Of note is the parent check which allows us to determine if the form is reactive.\n // Without this check there is a changed before checked error\n /* istanbul ignore else */\n if (this.control && this.control.parent) {\n setTimeout(() => {\n this.control.setValue(this.value, {\n emitEvent: false,\n });\n\n this.changeDetector.markForCheck();\n });\n }\n\n this.adapter.init(this.elementRef);\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n @HostListener('change', ['$event'])\n public onInputChange(event: any) {\n const value = event.target.value;\n\n if (this.skyDatepickerNoValidate) {\n this.onValueChange(value);\n return;\n }\n\n // Don't try to parse the string value into a Date value if it is malformed.\n if (this.isDateStringValid(value)) {\n this.onValueChange(value);\n return;\n }\n\n this._value = value;\n this.onChange(value);\n\n this.control.setErrors({\n skyDate: {\n invalid: true,\n },\n });\n }\n\n @HostListener('blur')\n public onInputBlur(): void {\n this.onTouched();\n }\n\n @HostListener('keyup')\n public onInputKeyup(): void {\n this.control.markAsDirty();\n }\n\n public writeValue(value: any): void {\n this.updateValue(value, false);\n }\n\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n if (this.skyDatepickerNoValidate) {\n return;\n }\n\n const value: any = control.value;\n\n if (!value) {\n return;\n }\n\n const dateValue = this.getDateValue(value);\n const isDateValid = dateValue && this.dateFormatter.dateIsValid(dateValue);\n\n if (!isDateValid || !this.isDateStringValid(value)) {\n // Mark the invalid control as touched so that the input's invalid CSS styles appear.\n // (This is only required when the invalid value is set by the FormControl constructor.)\n this.control.markAsTouched();\n\n return {\n skyDate: {\n invalid: value,\n },\n };\n }\n\n const minDate = this.minDate;\n\n if (minDate && this.dateFormatter.dateIsValid(minDate) && value < minDate) {\n return {\n skyDate: {\n minDate,\n },\n };\n }\n\n const maxDate = this.maxDate;\n\n if (maxDate && this.dateFormatter.dateIsValid(maxDate) && value > maxDate) {\n return {\n skyDate: {\n maxDate,\n },\n };\n }\n }\n\n public registerOnChange(fn: (value: any) => void): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => void): 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 this.datepickerComponent.disabled = disabled;\n }\n\n /**\n * Detects changes to the underlying input element's value and updates the ngModel accordingly.\n * This is useful if you need to update the ngModel value before the input element loses focus.\n */\n public detectInputValueChange(): void {\n this.onValueChange(this.elementRef.nativeElement.value);\n }\n\n private applyDateFormat(): void {\n this.updatePlaceholder();\n if (this.value) {\n const formattedDate = this.dateFormatter.format(\n this.value,\n this.dateFormat\n );\n this.setInputElementValue(formattedDate);\n this.changeDetector.markForCheck();\n }\n }\n\n private onValueChange(newValue: string): void {\n this.value = newValue;\n }\n\n private setInputElementValue(value: string): void {\n this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);\n }\n\n private getDateValue(value: any): Date {\n let dateValue: Date;\n if (value instanceof Date) {\n dateValue = value;\n } else if (typeof value === 'string') {\n const date = this.dateFormatter.getDateFromString(\n value,\n this.dateFormat,\n this.strict\n );\n if (this.dateFormatter.dateIsValid(date)) {\n dateValue = date;\n }\n }\n\n return dateValue;\n }\n\n /**\n * Validates the input value to ensure it is formatted correctly.\n */\n private isDateStringValid(value: string): boolean {\n if (!value || typeof value !== 'string') {\n return true;\n }\n\n // Does the value only include digits, dashes, or slashes?\n const regexp = /^[\\d/-]+$/;\n const isValid = regexp.test(value);\n\n if (isValid) {\n return true;\n }\n\n // If not, does it conform to the standard ISO format?\n const isValidIso = moment(value, moment.ISO_8601).isValid();\n\n return isValidIso;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChange = (_: any) => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onTouched = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onValidatorChange = () => {};\n\n private updatePlaceholder(): void {\n if (!this.initialPlaceholder) {\n this.adapter.setPlaceholder(this.elementRef, this.dateFormat);\n }\n }\n\n /**\n * Update the value of the form control and input element\n * @param emitEvent Denotes if we emit an event to the consumer's form control. We do not want to do this if the value is being updated via a `setValue` call or a `patchValue` call as this is already handled by Angular.\n * In these cases we do not want to fire `onChange` as it will cause extra `valueChange` and `statusChange` events and the status of the form should not be affected by these changes.\n */\n private updateValue(value: any, emitEvent = true): void {\n if (this._value === value) {\n return;\n }\n\n const dateValue = this.getDateValue(value);\n\n const areDatesEqual =\n this._value instanceof Date &&\n dateValue &&\n dateValue.getTime() === this._value.getTime();\n\n const isValidDateString = this.isDateStringValid(value);\n\n // If the string value supplied is malformed, do not set the value to its Date equivalent.\n // (JavaScript's Date parser will convert poorly formatted dates to Date objects, such as \"abc 123\", which isn't ideal.)\n if (!isValidDateString) {\n this._value = value;\n if (emitEvent) {\n this.onChange(this._value);\n } else {\n this.control?.setValue(this._value, { emitEvent: false });\n }\n\n this.datepickerComponent.selectedDate = this._value;\n } else if (dateValue !== this._value || !areDatesEqual) {\n this._value = dateValue || value;\n if (emitEvent) {\n this.onChange(this._value);\n } else {\n this.control?.setValue(this._value, { emitEvent: false });\n }\n\n this.datepickerComponent.selectedDate = this._value;\n }\n\n if (dateValue && isValidDateString) {\n const formattedDate = this.dateFormatter.format(\n dateValue,\n this.dateFormat\n );\n this.setInputElementValue(formattedDate);\n } else {\n this.setInputElementValue(value || '');\n }\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * NOTICE: DO NOT MODIFY THIS FILE!
3
3
  * The contents of this file were automatically generated by
4
- * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-datetime' schematic.
4
+ * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-datetime' schematic.
5
5
  * To update this file, simply rerun the command.
6
6
  */
7
7
  import { NgModule } from '@angular/core';
@@ -1 +1 @@
1
- {"version":3,"file":"sky-datetime-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/shared/sky-datetime-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;QACD,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B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Aa;4FASZ,0BAA0B;kBAVtC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,4BAA4B;4BACtC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-datetime' schematic.\n * To update this file, simply rerun the command.\n */\nimport { NgModule } from '@angular/core';\nimport {\n SKY_LIB_RESOURCES_PROVIDERS,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n getLibStringForLocale,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-AU': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-GB': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-NZ': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-US': {\n skyux_date_field_default_label: { message: 'Date' },\n skyux_datepicker_trigger_button_label: { message: 'Select date' },\n skyux_timepicker_button_label: { message: 'Choose time' },\n skyux_timepicker_close: { message: 'Done' },\n skyux_timepicker_input_default_label: { message: 'Time' },\n skyux_date_range_picker_default_label: { message: 'Select a date range' },\n skyux_date_range_picker_format_label_specific_range: {\n message: 'Specific range',\n },\n skyux_date_range_picker_format_label_before: { message: 'Before' },\n skyux_date_range_picker_format_label_after: { message: 'After' },\n skyux_date_range_picker_format_label_any_time: { message: 'At any time' },\n skyux_date_range_picker_format_label_yesterday: { message: 'Yesterday' },\n skyux_date_range_picker_format_label_today: { message: 'Today' },\n skyux_date_range_picker_format_label_tomorrow: { message: 'Tomorrow' },\n skyux_date_range_picker_format_label_last_week: { message: 'Last week' },\n skyux_date_range_picker_format_label_this_week: { message: 'This week' },\n skyux_date_range_picker_format_label_next_week: { message: 'Next week' },\n skyux_date_range_picker_format_label_last_month: { message: 'Last month' },\n skyux_date_range_picker_format_label_this_month: { message: 'This month' },\n skyux_date_range_picker_format_label_next_month: { message: 'Next month' },\n skyux_date_range_picker_format_label_last_quarter: {\n message: 'Last quarter',\n },\n skyux_date_range_picker_format_label_this_quarter: {\n message: 'This quarter',\n },\n skyux_date_range_picker_format_label_next_quarter: {\n message: 'Next quarter',\n },\n skyux_date_range_picker_format_label_last_calendar_year: {\n message: 'Last calendar year',\n },\n skyux_date_range_picker_format_label_this_calendar_year: {\n message: 'This calendar year',\n },\n skyux_date_range_picker_format_label_next_calendar_year: {\n message: 'Next calendar year',\n },\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last fiscal year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This fiscal year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next fiscal year',\n },\n skyux_date_range_picker_start_date_label: { message: 'From date' },\n skyux_date_range_picker_end_date_label: { message: 'To date' },\n skyux_date_range_picker_before_date_label: { message: 'Before date' },\n skyux_date_range_picker_after_date_label: { message: 'After date' },\n },\n};\n\nexport class SkyDatetimeResourcesProvider implements SkyLibResourcesProvider {\n public getString(localeInfo: SkyAppLocaleInfo, name: string): string {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyDatetimeResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyDatetimeResourcesModule {}\n"]}
1
+ {"version":3,"file":"sky-datetime-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/datetime/src/lib/modules/shared/sky-datetime-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;QACD,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;QACD,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;KACF;IACD,OAAO,EAAE;QACP,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;QACD,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;QACD,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;KACF;IACD,OAAO,EAAE;QACP,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;QACD,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;QACD,qDAAqD,EAAE;YACrD,OAAO,EAAE,qBAAqB;SAC/B;KACF;IACD,OAAO,EAAE;QACP,8BAA8B,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACnD,qCAAqC,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;QACjE,6BAA6B,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;QACzD,sBAAsB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3C,oCAAoC,EAAE,EAAE,OAA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AO,EAAE,WAAW,EAAE;QAClE,sCAAsC,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QAC9D,yCAAyC,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;QACrE,wCAAwC,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE;KACpE;CACF,CAAC;AAEF,MAAM,OAAO,4BAA4B;IAChC,SAAS,CACd,UAA4B,EAC5B,IAAY;QAEZ,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;GAEG;AAWH,MAAM,OAAO,0BAA0B;;wHAA1B,0BAA0B;yHAA1B,0BAA0B,YAT3B,aAAa;yHASZ,0BAA0B,aAR1B;QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,4BAA4B;YACtC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,0BAA0B;kBAVtC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,4BAA4B;4BACtC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-datetime' schematic.\n * To update this file, simply rerun the command.\n */\nimport { NgModule } from '@angular/core';\nimport {\n SKY_LIB_RESOURCES_PROVIDERS,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n getLibStringForLocale,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-AU': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-GB': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-NZ': {\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last financial year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This financial year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next financial year',\n },\n },\n 'EN-US': {\n skyux_date_field_default_label: { message: 'Date' },\n skyux_datepicker_trigger_button_label: { message: 'Select date' },\n skyux_timepicker_button_label: { message: 'Choose time' },\n skyux_timepicker_close: { message: 'Done' },\n skyux_timepicker_input_default_label: { message: 'Time' },\n skyux_date_range_picker_default_label: { message: 'Select a date range' },\n skyux_date_range_picker_format_label_specific_range: {\n message: 'Specific range',\n },\n skyux_date_range_picker_format_label_before: { message: 'Before' },\n skyux_date_range_picker_format_label_after: { message: 'After' },\n skyux_date_range_picker_format_label_any_time: { message: 'At any time' },\n skyux_date_range_picker_format_label_yesterday: { message: 'Yesterday' },\n skyux_date_range_picker_format_label_today: { message: 'Today' },\n skyux_date_range_picker_format_label_tomorrow: { message: 'Tomorrow' },\n skyux_date_range_picker_format_label_last_week: { message: 'Last week' },\n skyux_date_range_picker_format_label_this_week: { message: 'This week' },\n skyux_date_range_picker_format_label_next_week: { message: 'Next week' },\n skyux_date_range_picker_format_label_last_month: { message: 'Last month' },\n skyux_date_range_picker_format_label_this_month: { message: 'This month' },\n skyux_date_range_picker_format_label_next_month: { message: 'Next month' },\n skyux_date_range_picker_format_label_last_quarter: {\n message: 'Last quarter',\n },\n skyux_date_range_picker_format_label_this_quarter: {\n message: 'This quarter',\n },\n skyux_date_range_picker_format_label_next_quarter: {\n message: 'Next quarter',\n },\n skyux_date_range_picker_format_label_last_calendar_year: {\n message: 'Last calendar year',\n },\n skyux_date_range_picker_format_label_this_calendar_year: {\n message: 'This calendar year',\n },\n skyux_date_range_picker_format_label_next_calendar_year: {\n message: 'Next calendar year',\n },\n skyux_date_range_picker_format_label_last_fiscal_year: {\n message: 'Last fiscal year',\n },\n skyux_date_range_picker_format_label_this_fiscal_year: {\n message: 'This fiscal year',\n },\n skyux_date_range_picker_format_label_next_fiscal_year: {\n message: 'Next fiscal year',\n },\n skyux_date_range_picker_start_date_label: { message: 'From date' },\n skyux_date_range_picker_end_date_label: { message: 'To date' },\n skyux_date_range_picker_before_date_label: { message: 'Before date' },\n skyux_date_range_picker_after_date_label: { message: 'After date' },\n },\n};\n\nexport class SkyDatetimeResourcesProvider implements SkyLibResourcesProvider {\n public getString(\n localeInfo: SkyAppLocaleInfo,\n name: string\n ): string | undefined {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyDatetimeResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyDatetimeResourcesModule {}\n"]}