@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.
- package/bundles/skyux-datetime.umd.js +488 -162
- package/documentation.json +696 -835
- package/esm2015/lib/modules/date-pipe/date-format-utility.js +0 -2
- package/esm2015/lib/modules/date-pipe/date-format-utility.js.map +1 -1
- package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js +47 -58
- package/esm2015/lib/modules/date-range-picker/date-range-picker.component.js.map +1 -1
- package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js +0 -3
- package/esm2015/lib/modules/date-range-picker/types/date-range-relative-value.js.map +1 -1
- package/esm2015/lib/modules/datepicker/datepicker-calendar-inner.component.js.map +1 -1
- package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js +60 -50
- package/esm2015/lib/modules/datepicker/datepicker-input-fuzzy.directive.js.map +1 -1
- package/esm2015/lib/modules/datepicker/datepicker-input.directive.js +51 -40
- package/esm2015/lib/modules/datepicker/datepicker-input.directive.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-datetime-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-datetime-resources.module.js.map +1 -1
- package/esm2015/lib/modules/timepicker/timepicker.component.js +6 -6
- package/esm2015/lib/modules/timepicker/timepicker.component.js.map +1 -1
- package/esm2015/lib/modules/timepicker/timepicker.directive.js +4 -5
- package/esm2015/lib/modules/timepicker/timepicker.directive.js.map +1 -1
- package/fesm2015/skyux-datetime.js +168 -164
- package/fesm2015/skyux-datetime.js.map +1 -1
- package/lib/modules/date-pipe/date-format-utility.d.ts +0 -1
- package/lib/modules/date-range-picker/date-range-picker.component.d.ts +4 -3
- package/lib/modules/date-range-picker/types/date-range-relative-value.d.ts +0 -1
- package/lib/modules/datepicker/datepicker-calendar-inner.component.d.ts +16 -13
- package/lib/modules/datepicker/datepicker-input-fuzzy.directive.d.ts +6 -1
- package/lib/modules/datepicker/datepicker-input.directive.d.ts +6 -2
- package/lib/modules/shared/sky-datetime-resources.module.d.ts +1 -1
- package/package.json +18 -16
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
import { SkyIntlDateFormatter } from '@skyux/i18n';
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
export class SkyDateFormatUtility {
|
|
8
|
-
/* istanbul ignore next */
|
|
9
|
-
constructor() { }
|
|
10
8
|
static format(locale, value, pattern) {
|
|
11
9
|
let date;
|
|
12
10
|
if (isBlank(value) || value !== value) {
|
|
@@ -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;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,OAAO,oBAAoB;
|
|
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;IAYxB,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;;AA1Cc,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;AAoCJ,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 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,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, Optional, forwardRef, } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, NgZone, 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';
|
|
@@ -43,12 +43,13 @@ let uniqueId = 0;
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export class SkyDateRangePickerComponent {
|
|
46
|
-
constructor(changeDetector, dateRangeService, formBuilder, localeProvider, windowRef, themeSvc) {
|
|
46
|
+
constructor(changeDetector, dateRangeService, formBuilder, localeProvider, windowRef, ngZone, themeSvc) {
|
|
47
47
|
this.changeDetector = changeDetector;
|
|
48
48
|
this.dateRangeService = dateRangeService;
|
|
49
49
|
this.formBuilder = formBuilder;
|
|
50
50
|
this.localeProvider = localeProvider;
|
|
51
51
|
this.windowRef = windowRef;
|
|
52
|
+
this.ngZone = ngZone;
|
|
52
53
|
/**
|
|
53
54
|
* Indicates whether to require users to specify a start date.
|
|
54
55
|
* @default false
|
|
@@ -65,11 +66,11 @@ export class SkyDateRangePickerComponent {
|
|
|
65
66
|
this.showStartDatePicker = false;
|
|
66
67
|
this.ngUnsubscribe = new Subject();
|
|
67
68
|
this._disabled = false;
|
|
68
|
-
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
69
70
|
this.onChange = (_) => { };
|
|
70
|
-
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
71
72
|
this.onTouched = () => { };
|
|
72
|
-
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
73
74
|
this.onValidatorChange = () => { };
|
|
74
75
|
this.localeProvider
|
|
75
76
|
.getLocaleInfo()
|
|
@@ -192,24 +193,27 @@ export class SkyDateRangePickerComponent {
|
|
|
192
193
|
this.updateCalculators().then(() => {
|
|
193
194
|
this.addEventListeners();
|
|
194
195
|
this.isReady = true;
|
|
195
|
-
this.resetFormGroupValue();
|
|
196
196
|
this.showRelevantFormFields();
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
197
|
+
// We need to let Angular be stable and have rendered the components prior to setting the values and form controls. This ensures all initial validation will be ran correctly.
|
|
198
|
+
this.ngZone.onStable.pipe(first()).subscribe(() => {
|
|
199
|
+
// Fill in any unprovided values after the calculators have been initialized.
|
|
200
|
+
// For example, if the control is initialized with only the `calculatorId`,
|
|
201
|
+
// allow the calculator to fill in the missing start and end dates.
|
|
202
|
+
const { startDate, endDate } = this.value;
|
|
203
|
+
const defaultValue = this.selectedCalculator.getValue(startDate, endDate);
|
|
204
|
+
const newValue = Object.assign({}, defaultValue, this.value);
|
|
205
|
+
this.setValue(newValue, false);
|
|
206
|
+
this.resetFormGroupValue();
|
|
207
|
+
// This is needed to address a bug in Angular 4.
|
|
208
|
+
// When a control value is set intially, its value is not represented on the view.
|
|
209
|
+
// See: https://github.com/angular/angular/issues/13792
|
|
210
|
+
/* istanbul ignore else */
|
|
211
|
+
if (this.control) {
|
|
212
|
+
this.control.setValue(this.value, {
|
|
213
|
+
emitEvent: false,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
});
|
|
213
217
|
});
|
|
214
218
|
}
|
|
215
219
|
ngOnChanges(changes) {
|
|
@@ -348,46 +352,26 @@ export class SkyDateRangePickerComponent {
|
|
|
348
352
|
this.changeDetector.markForCheck();
|
|
349
353
|
}
|
|
350
354
|
resetFormGroupValue(value) {
|
|
351
|
-
|
|
352
|
-
// because we're already watching for changes that are triggered by the end user.
|
|
353
|
-
// For example, if we change the value of the form group internally, we don't want the event
|
|
354
|
-
// listeners to be triggered, as those are reserved for user interactions.
|
|
355
|
-
// (See the event listeners listed below.)
|
|
356
|
-
this.formGroup.reset(value || this.value, {
|
|
357
|
-
emitEvent: false,
|
|
358
|
-
});
|
|
355
|
+
this.formGroup.reset(value || this.value);
|
|
359
356
|
}
|
|
360
357
|
addEventListeners() {
|
|
361
|
-
// Detect errors from the date pickers
|
|
362
|
-
// when control is initialized with a value.
|
|
363
|
-
combineLatest([
|
|
364
|
-
this.startDateControl.statusChanges,
|
|
365
|
-
this.endDateControl.statusChanges,
|
|
366
|
-
])
|
|
367
|
-
.pipe(first())
|
|
368
|
-
.subscribe((status) => {
|
|
369
|
-
if (status.indexOf('INVALID') > -1) {
|
|
370
|
-
// Wait for initial validation to complete.
|
|
371
|
-
this.windowRef.nativeWindow.setTimeout(() => {
|
|
372
|
-
this.onValidatorChange();
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
358
|
// Watch for selected calculator change.
|
|
377
359
|
this.calculatorIdControl.valueChanges
|
|
378
360
|
.pipe(takeUntil(this.ngUnsubscribe))
|
|
379
361
|
.subscribe((value) => {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
362
|
+
if (value !== this.value.calculatorId) {
|
|
363
|
+
const id = parseInt(value, 10);
|
|
364
|
+
// if the component is disabled during form creation, null is passed
|
|
365
|
+
// as the value of the calculator id control
|
|
366
|
+
// only handle the value changes if the calculator id is a number
|
|
367
|
+
/* istanbul ignore else */
|
|
368
|
+
if (!isNaN(id)) {
|
|
369
|
+
const calculator = this.getCalculatorById(id);
|
|
370
|
+
const newValue = calculator.getValue();
|
|
371
|
+
this.setValue(newValue);
|
|
372
|
+
this.resetFormGroupValue(newValue);
|
|
373
|
+
this.showRelevantFormFields();
|
|
374
|
+
}
|
|
391
375
|
}
|
|
392
376
|
});
|
|
393
377
|
// Watch for start date value changes.
|
|
@@ -410,6 +394,11 @@ export class SkyDateRangePickerComponent {
|
|
|
410
394
|
.pipe(takeUntil(this.ngUnsubscribe))
|
|
411
395
|
.subscribe(() => {
|
|
412
396
|
this.changeDetector.markForCheck();
|
|
397
|
+
// Wait for initial validation to complete.
|
|
398
|
+
this.ngZone.onStable.pipe(first()).subscribe(() => {
|
|
399
|
+
var _a;
|
|
400
|
+
(_a = this.control) === null || _a === void 0 ? void 0 : _a.updateValueAndValidity({ emitEvent: false });
|
|
401
|
+
});
|
|
413
402
|
});
|
|
414
403
|
}
|
|
415
404
|
updateCalculators() {
|
|
@@ -429,7 +418,7 @@ export class SkyDateRangePickerComponent {
|
|
|
429
418
|
return JSON.stringify(rangeA) === JSON.stringify(rangeB);
|
|
430
419
|
}
|
|
431
420
|
}
|
|
432
|
-
SkyDateRangePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangePickerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.SkyDateRangeService }, { token: i2.FormBuilder }, { token: i3.SkyAppLocaleProvider }, { token: i4.SkyAppWindowRef }, { token: i5.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
421
|
+
SkyDateRangePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDateRangePickerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.SkyDateRangeService }, { token: i2.FormBuilder }, { token: i3.SkyAppLocaleProvider }, { token: i4.SkyAppWindowRef }, { token: i0.NgZone }, { token: i5.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
433
422
|
SkyDateRangePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyDateRangePickerComponent, selector: "sky-date-range-picker", inputs: { calculatorIds: "calculatorIds", dateFormat: "dateFormat", disabled: "disabled", label: "label", startDateRequired: "startDateRequired", endDateRequired: "endDateRequired" }, providers: [
|
|
434
423
|
SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR,
|
|
435
424
|
SKY_DATE_RANGE_PICKER_VALIDATOR,
|
|
@@ -446,7 +435,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
446
435
|
],
|
|
447
436
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
448
437
|
}]
|
|
449
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.SkyDateRangeService }, { type: i2.FormBuilder }, { type: i3.SkyAppLocaleProvider }, { type: i4.SkyAppWindowRef }, { type: i5.SkyThemeService, decorators: [{
|
|
438
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.SkyDateRangeService }, { type: i2.FormBuilder }, { type: i3.SkyAppLocaleProvider }, { type: i4.SkyAppWindowRef }, { type: i0.NgZone }, { type: i5.SkyThemeService, decorators: [{
|
|
450
439
|
type: Optional
|
|
451
440
|
}] }]; }, propDecorators: { calculatorIds: [{
|
|
452
441
|
type: Input
|
|
@@ -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,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;IACtC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA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,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
|
+
{"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,EAC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rC,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,iBAAiB,CACvB,EAA4B;QAE5B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YAC1C,OAAO,UAAU,CAAC,YAAY,KAAK,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,eAAe,CACrB,MAA+B,EAC/B,MAA+B;QAE/B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;;yHApeU,2BAA2B;6GAA3B,2BAA2B,wOAN3B;QACT,oCAAoC;QACpC,+BAA+B;KAChC,+CCxEH,m+EA2EA;4FDAa,2BAA2B;kBAVvC,SAAS;mBAAC;oBACT,QAAQ,EAAE,uBAAuB;oBACjC,WAAW,EAAE,oCAAoC;oBACjD,SAAS,EAAE,CAAC,oCAAoC,CAAC;oBACjD,SAAS,EAAE;wBACT,oCAAoC;wBACpC,+BAA+B;qBAChC;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;;0BA+KI,QAAQ;4CArKA,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 Input,\n NgZone,\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 private ngZone: NgZone,\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.showRelevantFormFields();\n\n // We need to let Angular be stable and have rendered the components prior to setting the values and form controls. This ensures all initial validation will be ran correctly.\n this.ngZone.onStable.pipe(first()).subscribe(() => {\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(\n startDate,\n endDate\n );\n const newValue = Object.assign({}, defaultValue, this.value);\n\n this.setValue(newValue, false);\n\n this.resetFormGroupValue();\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\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 this.formGroup.reset(value || this.value);\n }\n\n private addEventListeners(): void {\n // Watch for selected calculator change.\n this.calculatorIdControl.valueChanges\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((value) => {\n if (value !== this.value.calculatorId) {\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\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 // Wait for initial validation to complete.\n this.ngZone.onStable.pipe(first()).subscribe(() => {\n this.control?.updateValueAndValidity({ emitEvent: false });\n });\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 // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChange = (_: SkyDateRangeCalculation) => {};\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","<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-relative-value.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-relative-value.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAgB,yBAAyB;IAC7C,6CAA6C;IAC7C,0BAA0B;IAC1B,gBAAe,CAAC;IAET,MAAM,KAAK,KAAK;QACrB,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;QAEzB,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,QAAQ;QACxB,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC;QAE5B,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QAEzC,OAAO;YACL,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,QAAQ;SAClB,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,SAA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AC,CAAC;SACpB;aAAM;YACL,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;YACnD,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACtB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACpB;QAED,OAAO;YACL,SAAS;YACT,OAAO;SACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { SkyDateRange } from './date-range';\n\n/**\n * Need to add the following to classes which contain static methods.\n * See: https://github.com/ng-packagr/ng-packagr/issues/641\n * @internal\n * @dynamic\n */\nexport abstract class SkyDateRangeRelativeValue {\n // Abstract classes are not covered properly.\n /* istanbul ignore next */\n constructor() {}\n\n public static get today(): SkyDateRange {\n const today = new Date();\n\n return {\n startDate: today,\n endDate: today,\n };\n }\n\n public static get tomorrow(): SkyDateRange {\n const tomorrow = new Date();\n\n tomorrow.setDate(tomorrow.getDate() + 1);\n\n return {\n startDate: tomorrow,\n endDate: tomorrow,\n };\n }\n\n public static get yesterday(): SkyDateRange {\n const yesterday = new Date();\n\n yesterday.setDate(yesterday.getDate() - 1);\n\n return {\n startDate: yesterday,\n endDate: yesterday,\n };\n }\n\n /**\n * A date range starting with the nearest past Sunday and ending with the following Saturday.\n */\n public static get thisWeek(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(startDate.getDate() - startDate.getDay());\n\n const endDate = new Date();\n endDate.setDate(endDate.getDate() - endDate.getDay() + 6);\n\n return {\n startDate,\n endDate,\n };\n }\n\n /**\n * A date range starting with the nearest upcoming Sunday and ending with the following Saturday.\n */\n public static get nextWeek(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(startDate.getDate() - startDate.getDay() + 7);\n\n const endDate = new Date();\n endDate.setDate(endDate.getDate() - endDate.getDay() + 13);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get lastWeek(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(startDate.getDate() - startDate.getDay() - 7);\n\n const endDate = new Date();\n endDate.setDate(endDate.getDate() - endDate.getDay() - 1);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get thisMonth(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n\n const endDate = new Date();\n endDate.setMonth(endDate.getMonth() + 1);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get nextMonth(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n startDate.setMonth(startDate.getMonth() + 1);\n\n const endDate = new Date();\n endDate.setDate(1);\n endDate.setMonth(endDate.getMonth() + 2);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get lastMonth(): SkyDateRange {\n const startDate = new Date();\n\n // First, set the day of the month to zero,\n // which points to the last day of the previous month.\n startDate.setDate(0);\n\n // Finally, set the day of the month to 1.\n startDate.setDate(1);\n\n const endDate = new Date();\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get thisQuarter(): SkyDateRange {\n const startDate = new Date();\n const endDate = new Date();\n\n const currentMonth = startDate.getMonth();\n const quarterStartMonth =\n SkyDateRangeRelativeValue.getQuarterStartMonth(currentMonth);\n\n startDate.setMonth(quarterStartMonth);\n startDate.setDate(1);\n\n endDate.setMonth(quarterStartMonth + 3);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get nextQuarter(): SkyDateRange {\n const startDate = new Date();\n const endDate = new Date();\n\n const currentMonth = startDate.getMonth();\n const quarterStartMonth =\n SkyDateRangeRelativeValue.getQuarterStartMonth(currentMonth);\n\n startDate.setMonth(quarterStartMonth + 3);\n startDate.setDate(1);\n\n endDate.setMonth(quarterStartMonth + 6);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get lastQuarter(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n\n const endDate = new Date();\n endDate.setDate(1);\n\n const currentMonth = startDate.getMonth();\n const quarterStartMonth =\n SkyDateRangeRelativeValue.getQuarterStartMonth(currentMonth);\n\n startDate.setMonth(quarterStartMonth - 3);\n startDate.setDate(1);\n\n endDate.setMonth(quarterStartMonth);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get thisCalendarYear(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n startDate.setMonth(0);\n\n const endDate = new Date();\n endDate.setDate(1);\n endDate.setMonth(0);\n endDate.setFullYear(endDate.getFullYear() + 1);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get nextCalendarYear(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n startDate.setMonth(0);\n startDate.setFullYear(startDate.getFullYear() + 1);\n\n const endDate = new Date();\n endDate.setDate(1);\n endDate.setMonth(0);\n endDate.setFullYear(startDate.getFullYear() + 1);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get lastCalendarYear(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n startDate.setMonth(0);\n startDate.setFullYear(startDate.getFullYear() - 1);\n\n const endDate = new Date();\n endDate.setDate(1);\n endDate.setMonth(0);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get thisFiscalYear(): SkyDateRange {\n const start = new Date();\n start.setDate(1);\n\n return SkyDateRangeRelativeValue.getClosestFiscalYearRange(start);\n }\n\n public static get nextFiscalYear(): SkyDateRange {\n const start = new Date();\n start.setDate(1);\n start.setFullYear(start.getFullYear() + 1);\n\n return SkyDateRangeRelativeValue.getClosestFiscalYearRange(start);\n }\n\n public static get lastFiscalYear(): SkyDateRange {\n const start = new Date();\n start.setDate(1);\n start.setFullYear(start.getFullYear() - 1);\n\n return SkyDateRangeRelativeValue.getClosestFiscalYearRange(start);\n }\n\n private static getQuarterStartMonth(currentMonth: number): number {\n let month: number;\n if (currentMonth < 3) {\n month = 0;\n } else if (currentMonth < 6) {\n month = 3;\n } else if (currentMonth < 9) {\n month = 6;\n } else {\n month = 9;\n }\n\n return month;\n }\n\n /**\n * Return a fiscal year based on a start date.\n * (The fiscal year starts in October and continues through to next September.)\n */\n private static getClosestFiscalYearRange(startDate: Date): SkyDateRange {\n const endDate = new Date(startDate);\n\n if (startDate.getMonth() >= 9) {\n startDate.setMonth(9);\n endDate.setFullYear(startDate.getFullYear() + 1);\n endDate.setMonth(9);\n endDate.setDate(0);\n } else {\n startDate.setFullYear(startDate.getFullYear() - 1);\n startDate.setMonth(9);\n endDate.setMonth(9);\n endDate.setDate(0);\n }\n\n return {\n startDate,\n endDate,\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"date-range-relative-value.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/datetime/src/lib/modules/date-range-picker/types/date-range-relative-value.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAgB,yBAAyB;IACtC,MAAM,KAAK,KAAK;QACrB,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;QAEzB,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,QAAQ;QACxB,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC;QAE5B,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QAEzC,OAAO;YACL,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,QAAQ;SAClB,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,SAAS;QACzB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAE7B,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QAE3C,OAAO;YACL,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;SACnB,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,M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,CAAC,CAAC;SACpB;QAED,OAAO;YACL,SAAS;YACT,OAAO;SACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { SkyDateRange } from './date-range';\n\n/**\n * Need to add the following to classes which contain static methods.\n * See: https://github.com/ng-packagr/ng-packagr/issues/641\n * @internal\n * @dynamic\n */\nexport abstract class SkyDateRangeRelativeValue {\n public static get today(): SkyDateRange {\n const today = new Date();\n\n return {\n startDate: today,\n endDate: today,\n };\n }\n\n public static get tomorrow(): SkyDateRange {\n const tomorrow = new Date();\n\n tomorrow.setDate(tomorrow.getDate() + 1);\n\n return {\n startDate: tomorrow,\n endDate: tomorrow,\n };\n }\n\n public static get yesterday(): SkyDateRange {\n const yesterday = new Date();\n\n yesterday.setDate(yesterday.getDate() - 1);\n\n return {\n startDate: yesterday,\n endDate: yesterday,\n };\n }\n\n /**\n * A date range starting with the nearest past Sunday and ending with the following Saturday.\n */\n public static get thisWeek(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(startDate.getDate() - startDate.getDay());\n\n const endDate = new Date();\n endDate.setDate(endDate.getDate() - endDate.getDay() + 6);\n\n return {\n startDate,\n endDate,\n };\n }\n\n /**\n * A date range starting with the nearest upcoming Sunday and ending with the following Saturday.\n */\n public static get nextWeek(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(startDate.getDate() - startDate.getDay() + 7);\n\n const endDate = new Date();\n endDate.setDate(endDate.getDate() - endDate.getDay() + 13);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get lastWeek(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(startDate.getDate() - startDate.getDay() - 7);\n\n const endDate = new Date();\n endDate.setDate(endDate.getDate() - endDate.getDay() - 1);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get thisMonth(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n\n const endDate = new Date();\n endDate.setMonth(endDate.getMonth() + 1);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get nextMonth(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n startDate.setMonth(startDate.getMonth() + 1);\n\n const endDate = new Date();\n endDate.setDate(1);\n endDate.setMonth(endDate.getMonth() + 2);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get lastMonth(): SkyDateRange {\n const startDate = new Date();\n\n // First, set the day of the month to zero,\n // which points to the last day of the previous month.\n startDate.setDate(0);\n\n // Finally, set the day of the month to 1.\n startDate.setDate(1);\n\n const endDate = new Date();\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get thisQuarter(): SkyDateRange {\n const startDate = new Date();\n const endDate = new Date();\n\n const currentMonth = startDate.getMonth();\n const quarterStartMonth =\n SkyDateRangeRelativeValue.getQuarterStartMonth(currentMonth);\n\n startDate.setMonth(quarterStartMonth);\n startDate.setDate(1);\n\n endDate.setMonth(quarterStartMonth + 3);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get nextQuarter(): SkyDateRange {\n const startDate = new Date();\n const endDate = new Date();\n\n const currentMonth = startDate.getMonth();\n const quarterStartMonth =\n SkyDateRangeRelativeValue.getQuarterStartMonth(currentMonth);\n\n startDate.setMonth(quarterStartMonth + 3);\n startDate.setDate(1);\n\n endDate.setMonth(quarterStartMonth + 6);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get lastQuarter(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n\n const endDate = new Date();\n endDate.setDate(1);\n\n const currentMonth = startDate.getMonth();\n const quarterStartMonth =\n SkyDateRangeRelativeValue.getQuarterStartMonth(currentMonth);\n\n startDate.setMonth(quarterStartMonth - 3);\n startDate.setDate(1);\n\n endDate.setMonth(quarterStartMonth);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get thisCalendarYear(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n startDate.setMonth(0);\n\n const endDate = new Date();\n endDate.setDate(1);\n endDate.setMonth(0);\n endDate.setFullYear(endDate.getFullYear() + 1);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get nextCalendarYear(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n startDate.setMonth(0);\n startDate.setFullYear(startDate.getFullYear() + 1);\n\n const endDate = new Date();\n endDate.setDate(1);\n endDate.setMonth(0);\n endDate.setFullYear(startDate.getFullYear() + 1);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get lastCalendarYear(): SkyDateRange {\n const startDate = new Date();\n startDate.setDate(1);\n startDate.setMonth(0);\n startDate.setFullYear(startDate.getFullYear() - 1);\n\n const endDate = new Date();\n endDate.setDate(1);\n endDate.setMonth(0);\n endDate.setDate(0);\n\n return {\n startDate,\n endDate,\n };\n }\n\n public static get thisFiscalYear(): SkyDateRange {\n const start = new Date();\n start.setDate(1);\n\n return SkyDateRangeRelativeValue.getClosestFiscalYearRange(start);\n }\n\n public static get nextFiscalYear(): SkyDateRange {\n const start = new Date();\n start.setDate(1);\n start.setFullYear(start.getFullYear() + 1);\n\n return SkyDateRangeRelativeValue.getClosestFiscalYearRange(start);\n }\n\n public static get lastFiscalYear(): SkyDateRange {\n const start = new Date();\n start.setDate(1);\n start.setFullYear(start.getFullYear() - 1);\n\n return SkyDateRangeRelativeValue.getClosestFiscalYearRange(start);\n }\n\n private static getQuarterStartMonth(currentMonth: number): number {\n let month: number;\n if (currentMonth < 3) {\n month = 0;\n } else if (currentMonth < 6) {\n month = 3;\n } else if (currentMonth < 9) {\n month = 6;\n } else {\n month = 9;\n }\n\n return month;\n }\n\n /**\n * Return a fiscal year based on a start date.\n * (The fiscal year starts in October and continues through to next September.)\n */\n private static getClosestFiscalYearRange(startDate: Date): SkyDateRange {\n const endDate = new Date(startDate);\n\n if (startDate.getMonth() >= 9) {\n startDate.setMonth(9);\n endDate.setFullYear(startDate.getFullYear() + 1);\n endDate.setMonth(9);\n endDate.setDate(0);\n } else {\n startDate.setFullYear(startDate.getFullYear() - 1);\n startDate.setMonth(9);\n endDate.setMonth(9);\n endDate.setDate(0);\n }\n\n return {\n startDate,\n endDate,\n };\n }\n}\n"]}
|
|
@@ -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,GAAG,KAAK,CAAC;QAChB,YAAO,GAAG,MAAM,CAAC;QACjB,kBAAa,GAAG,CAAC,CAAC;QAClB,iBAAY,GAAG,CAAC,CAAC;QACjB,mBAAc,GAAG,KAAK,CAAC;QACvB,cAAS,GAAG,EAAE,CAAC;QAEf,cAAS,GAAG,IAAI,CAAC;QACjB,gBAAW,GAAG,MAAM,CAAC;QACrB,eAAU,GAAG,MAAM,CAAC;QACpB,oBAAe,GAAG,IAAI,CAAC;QACvB,mBAAc,GAAG,WAAW,CAAC;QAC7B,qBAAgB,GAAG,MAAM,CAAC;QAE1B,iBAAY,GAAG,kBAAkB,EAAE,gBAAgB,EAAE,CAAC;QAEtD,YAAO,GAAQ,EAAE,CAAC;QAClB,cAAS,GAAQ,EAAE,CAAC;QACpB,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{\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"]}
|
|
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;;;AAOpD,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB;;GAEG;AAOH,MAAM,OAAO,mCAAmC;IANhD;QAk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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,4TChChD,0JAOA;4FDyBa,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\ntype DateComparator = (date1: Date, date2: Date) => number | undefined;\ntype KeyboardEventHandler = (key: string, event: KeyboardEvent) => void;\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: () => void;\n public compareHandlerDay: DateComparator;\n public refreshViewHandlerMonth: () => void;\n public compareHandlerMonth: DateComparator;\n public refreshViewHandlerYear: () => void;\n public compareHandlerYear: DateComparator;\n\n public handleKeydownDay: KeyboardEventHandler;\n public handleKeydownMonth: KeyboardEventHandler;\n public handleKeydownYear: KeyboardEventHandler;\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: DateComparator, 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): undefined | number {\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: () => void, 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: KeyboardEventHandler, 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"]}
|