@skyux/datetime 7.0.0-beta.12 → 7.0.0-beta.13
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/documentation.json +1532 -991
- package/esm2020/lib/modules/date-range-picker/date-range-picker-end-date-resource-key.pipe.mjs +20 -0
- package/esm2020/lib/modules/date-range-picker/date-range-picker-start-date-resource-key.pipe.mjs +20 -0
- package/esm2020/lib/modules/date-range-picker/date-range-picker.component.mjs +262 -204
- package/esm2020/lib/modules/date-range-picker/date-range-picker.module.mjs +11 -3
- package/esm2020/lib/modules/date-range-picker/date-range.service.mjs +42 -38
- package/esm2020/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.mjs +1 -1
- package/esm2020/lib/modules/date-range-picker/types/date-range-calculator-validate-function.mjs +1 -1
- package/esm2020/lib/modules/date-range-picker/types/date-range-calculator.mjs +15 -15
- package/esm2020/lib/modules/date-range-picker/types/date-range-default-calculator-configs.mjs +4 -2
- package/esm2020/lib/modules/date-range-picker/types/date-range.mjs +1 -1
- package/esm2020/lib/modules/datepicker/date-formatter.mjs +2 -2
- package/esm2020/lib/modules/datepicker/datepicker-adapter.service.mjs +7 -14
- package/esm2020/lib/modules/datepicker/datepicker-calendar-inner.component.mjs +43 -20
- package/esm2020/lib/modules/datepicker/datepicker-calendar.component.mjs +28 -35
- package/esm2020/lib/modules/datepicker/datepicker-config.service.mjs +1 -1
- package/esm2020/lib/modules/datepicker/datepicker-input-fuzzy.directive.mjs +223 -209
- package/esm2020/lib/modules/datepicker/datepicker-input.directive.mjs +212 -220
- package/esm2020/lib/modules/datepicker/datepicker.component.mjs +117 -138
- package/esm2020/lib/modules/datepicker/daypicker-button.component.mjs +3 -3
- package/esm2020/lib/modules/datepicker/daypicker-cell.component.mjs +61 -59
- package/esm2020/lib/modules/datepicker/daypicker.component.mjs +143 -137
- package/esm2020/lib/modules/datepicker/fuzzy-date.service.mjs +123 -132
- package/esm2020/lib/modules/datepicker/monthpicker.component.mjs +51 -49
- package/esm2020/lib/modules/datepicker/yearpicker.component.mjs +52 -50
- package/esm2020/lib/modules/timepicker/timepicker.component.mjs +104 -88
- package/esm2020/lib/modules/timepicker/timepicker.directive.mjs +105 -98
- package/fesm2015/skyux-datetime.mjs +1642 -1516
- package/fesm2015/skyux-datetime.mjs.map +1 -1
- package/fesm2020/skyux-datetime.mjs +1618 -1510
- package/fesm2020/skyux-datetime.mjs.map +1 -1
- package/lib/modules/date-range-picker/date-range-picker-end-date-resource-key.pipe.d.ts +8 -0
- package/lib/modules/date-range-picker/date-range-picker-start-date-resource-key.pipe.d.ts +8 -0
- package/lib/modules/date-range-picker/date-range-picker.component.d.ts +14 -43
- package/lib/modules/date-range-picker/date-range-picker.module.d.ts +9 -7
- package/lib/modules/date-range-picker/date-range.service.d.ts +1 -5
- package/lib/modules/date-range-picker/types/date-range-calculator-date-range-function.d.ts +1 -1
- package/lib/modules/date-range-picker/types/date-range-calculator-validate-function.d.ts +1 -1
- package/lib/modules/date-range-picker/types/date-range-calculator.d.ts +3 -8
- package/lib/modules/date-range-picker/types/date-range.d.ts +2 -2
- package/lib/modules/datepicker/date-formatter.d.ts +3 -3
- package/lib/modules/datepicker/datepicker-adapter.service.d.ts +1 -5
- package/lib/modules/datepicker/datepicker-calendar-inner.component.d.ts +18 -19
- package/lib/modules/datepicker/datepicker-calendar.component.d.ts +14 -25
- package/lib/modules/datepicker/datepicker-config.service.d.ts +3 -3
- package/lib/modules/datepicker/datepicker-input-fuzzy.directive.d.ts +17 -53
- package/lib/modules/datepicker/datepicker-input.directive.d.ts +13 -68
- package/lib/modules/datepicker/datepicker.component.d.ts +21 -58
- package/lib/modules/datepicker/daypicker-button.component.d.ts +1 -1
- package/lib/modules/datepicker/daypicker-cell.component.d.ts +3 -10
- package/lib/modules/datepicker/daypicker.component.d.ts +4 -16
- package/lib/modules/datepicker/fuzzy-date.service.d.ts +6 -30
- package/lib/modules/datepicker/monthpicker.component.d.ts +1 -4
- package/lib/modules/datepicker/yearpicker.component.d.ts +1 -3
- package/lib/modules/timepicker/timepicker.component.d.ts +14 -32
- package/lib/modules/timepicker/timepicker.directive.d.ts +9 -27
- package/package.json +8 -8
@@ -251,53 +251,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
251
251
|
}]
|
252
252
|
}] });
|
253
253
|
|
254
|
+
var _SkyFuzzyDateService_instances, _SkyFuzzyDateService_currentLocale, _SkyFuzzyDateService_ngUnsubscribe, _SkyFuzzyDateService_getMostRecentLeapYear, _SkyFuzzyDateService_getDateSeparator, _SkyFuzzyDateService_get4DigitYearFromDateString, _SkyFuzzyDateService_isLeapYear, _SkyFuzzyDateService_getMonthNumber, _SkyFuzzyDateService_getDefaultYear, _SkyFuzzyDateService_getDateComponents, _SkyFuzzyDateService_getDateFormatIndexes, _SkyFuzzyDateService_getDateValueIndexes, _SkyFuzzyDateService_isFuzzyDateValid;
|
254
255
|
/**
|
255
256
|
* @internal
|
256
257
|
*/
|
257
258
|
class SkyFuzzyDateService {
|
258
259
|
constructor(localeProvider) {
|
259
|
-
this
|
260
|
-
this
|
261
|
-
this
|
260
|
+
_SkyFuzzyDateService_instances.add(this);
|
261
|
+
_SkyFuzzyDateService_currentLocale.set(this, void 0);
|
262
|
+
_SkyFuzzyDateService_ngUnsubscribe.set(this, new Subject());
|
263
|
+
__classPrivateFieldSet(this, _SkyFuzzyDateService_currentLocale, localeProvider.defaultLocale, "f");
|
264
|
+
localeProvider
|
262
265
|
.getLocaleInfo()
|
263
|
-
.pipe(takeUntil(this
|
266
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFuzzyDateService_ngUnsubscribe, "f")))
|
264
267
|
.subscribe((localeInfo) => {
|
265
|
-
this
|
268
|
+
__classPrivateFieldSet(this, _SkyFuzzyDateService_currentLocale, localeInfo.locale, "f");
|
266
269
|
});
|
267
270
|
}
|
268
271
|
/* istanbul ignore next */
|
269
272
|
ngOnDestroy() {
|
270
|
-
this.
|
271
|
-
this.
|
273
|
+
__classPrivateFieldGet(this, _SkyFuzzyDateService_ngUnsubscribe, "f").next();
|
274
|
+
__classPrivateFieldGet(this, _SkyFuzzyDateService_ngUnsubscribe, "f").complete();
|
272
275
|
}
|
273
276
|
/**
|
274
277
|
* Returns the browser's current locale string.
|
275
278
|
*/
|
276
279
|
getCurrentLocale() {
|
277
|
-
return this
|
280
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDateService_currentLocale, "f");
|
278
281
|
}
|
279
282
|
/**
|
280
283
|
* Returns the short format of the provided locale.
|
281
284
|
* If not provided, the locale will be taken from the browser's default locale.
|
282
285
|
*/
|
283
286
|
getLocaleShortFormat(locale) {
|
284
|
-
return moment.localeData(locale || this
|
287
|
+
return moment.localeData(locale || __classPrivateFieldGet(this, _SkyFuzzyDateService_currentLocale, "f")).longDateFormat('L');
|
285
288
|
}
|
286
289
|
/**
|
287
290
|
* Formats a fuzzy date by using the provided format and locale strings.
|
288
291
|
* If not provided, the locale will be taken from the browser's default locale.
|
289
292
|
*/
|
290
293
|
format(fuzzyDate, format, locale) {
|
291
|
-
if (!this.
|
294
|
+
if (!__classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_isFuzzyDateValid).call(this, fuzzyDate)) {
|
292
295
|
return '';
|
293
296
|
}
|
294
297
|
if (!format) {
|
295
298
|
return '';
|
296
299
|
}
|
297
|
-
const separator = this.
|
300
|
+
const separator = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateSeparator).call(this, format);
|
298
301
|
const dateParts = [];
|
299
|
-
const formatTokens =
|
300
|
-
|
302
|
+
const formatTokens = separator
|
303
|
+
? format.split(separator)
|
304
|
+
: [format];
|
305
|
+
locale = locale || __classPrivateFieldGet(this, _SkyFuzzyDateService_currentLocale, "f");
|
301
306
|
const fuzzyDateMoment = this.getMomentFromFuzzyDate(fuzzyDate).locale(locale);
|
302
307
|
for (let index = 0; index < formatTokens.length; index++) {
|
303
308
|
const token = formatTokens[index];
|
@@ -332,8 +337,8 @@ class SkyFuzzyDateService {
|
|
332
337
|
if (!fuzzyDate) {
|
333
338
|
return;
|
334
339
|
}
|
335
|
-
const year = fuzzyDate.year || this.
|
336
|
-
const month = fuzzyDate.month > 0 ? fuzzyDate.month - 1 : 0;
|
340
|
+
const year = fuzzyDate.year || __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDefaultYear).call(this, fuzzyDate);
|
341
|
+
const month = fuzzyDate.month && fuzzyDate.month > 0 ? fuzzyDate.month - 1 : 0;
|
337
342
|
const day = fuzzyDate.day || 1;
|
338
343
|
return moment([year, month, day]);
|
339
344
|
}
|
@@ -345,8 +350,8 @@ class SkyFuzzyDateService {
|
|
345
350
|
if (!fuzzyDate || !dateFormat) {
|
346
351
|
return;
|
347
352
|
}
|
348
|
-
const separator = this.
|
349
|
-
const dateFormatIndexes = this.
|
353
|
+
const separator = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateSeparator).call(this, dateFormat);
|
354
|
+
const dateFormatIndexes = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateFormatIndexes).call(this, dateFormat);
|
350
355
|
let dateString = '';
|
351
356
|
// Get the components of the date in the order expected of the local format.
|
352
357
|
const dateComponents = [
|
@@ -370,7 +375,7 @@ class SkyFuzzyDateService {
|
|
370
375
|
return;
|
371
376
|
}
|
372
377
|
const fuzzyDate = {};
|
373
|
-
const dateFormatIndexes = this.
|
378
|
+
const dateFormatIndexes = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateFormatIndexes).call(this, dateFormat);
|
374
379
|
if (dateFormatIndexes.yearIndex > -1) {
|
375
380
|
fuzzyDate.year = selectedDate.getFullYear();
|
376
381
|
}
|
@@ -389,8 +394,8 @@ class SkyFuzzyDateService {
|
|
389
394
|
let day;
|
390
395
|
let month;
|
391
396
|
let year;
|
392
|
-
const dateComponents = this.
|
393
|
-
const indexes = this.
|
397
|
+
const dateComponents = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateComponents).call(this, date);
|
398
|
+
const indexes = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateValueIndexes).call(this, date, dateFormat);
|
394
399
|
// Look at the date string's component count:
|
395
400
|
// 3 indicates a full date
|
396
401
|
// 2 indicates a month-year or month-day date
|
@@ -405,7 +410,7 @@ class SkyFuzzyDateService {
|
|
405
410
|
case 2:
|
406
411
|
// First, check for a 4-digit year. If year exists, then we assume the other component
|
407
412
|
// is the month. Otherwise, we can assume the input is mm/dd or mm/yy (2-digit year).
|
408
|
-
year = this.
|
413
|
+
year = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_get4DigitYearFromDateString).call(this, date);
|
409
414
|
if (year) {
|
410
415
|
month =
|
411
416
|
dateComponents[0] === year.toString()
|
@@ -445,7 +450,7 @@ class SkyFuzzyDateService {
|
|
445
450
|
}
|
446
451
|
if (month) {
|
447
452
|
// Check if month is valid.
|
448
|
-
month = this.
|
453
|
+
month = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getMonthNumber).call(this, month);
|
449
454
|
if (month === undefined) {
|
450
455
|
return;
|
451
456
|
}
|
@@ -510,133 +515,118 @@ class SkyFuzzyDateService {
|
|
510
515
|
year: currentDate.year(),
|
511
516
|
};
|
512
517
|
}
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
return returnValue;
|
534
|
-
}
|
535
|
-
get4DigitYearFromDateString(date) {
|
536
|
-
let year;
|
537
|
-
const separator = this.getDateSeparator(date);
|
518
|
+
}
|
519
|
+
_SkyFuzzyDateService_currentLocale = new WeakMap(), _SkyFuzzyDateService_ngUnsubscribe = new WeakMap(), _SkyFuzzyDateService_instances = new WeakSet(), _SkyFuzzyDateService_getMostRecentLeapYear = function _SkyFuzzyDateService_getMostRecentLeapYear() {
|
520
|
+
let leapYear = new Date().getFullYear();
|
521
|
+
while (!__classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_isLeapYear).call(this, leapYear)) {
|
522
|
+
leapYear -= 1;
|
523
|
+
}
|
524
|
+
return leapYear;
|
525
|
+
}, _SkyFuzzyDateService_getDateSeparator = function _SkyFuzzyDateService_getDateSeparator(dateFormat) {
|
526
|
+
let returnValue;
|
527
|
+
const separators = ['/', '.', '-', ' '];
|
528
|
+
separators.forEach((separator) => {
|
529
|
+
if (!returnValue && dateFormat.indexOf(separator) > 0) {
|
530
|
+
returnValue = separator;
|
531
|
+
}
|
532
|
+
});
|
533
|
+
return returnValue;
|
534
|
+
}, _SkyFuzzyDateService_get4DigitYearFromDateString = function _SkyFuzzyDateService_get4DigitYearFromDateString(date) {
|
535
|
+
let year;
|
536
|
+
const separator = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateSeparator).call(this, date);
|
537
|
+
if (separator) {
|
538
538
|
// Find the number value in the string that is 4 digits long.
|
539
539
|
date.split(separator).forEach((dateComponent) => {
|
540
540
|
if (!year && parseInt(dateComponent, 10).toString().length === 4) {
|
541
541
|
year = dateComponent;
|
542
542
|
}
|
543
543
|
});
|
544
|
-
if (year && !isNaN(Number(year))) {
|
545
|
-
return parseInt(year, 10);
|
546
|
-
}
|
547
544
|
}
|
548
|
-
|
549
|
-
return (year
|
550
|
-
}
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
}
|
561
|
-
else {
|
562
|
-
returnValue = monthAsNumber;
|
563
|
-
}
|
564
|
-
// Ensure that the month is between 1 and 12
|
565
|
-
if (!(1 <= returnValue && returnValue <= 12)) {
|
545
|
+
if (year && !isNaN(Number(year))) {
|
546
|
+
return parseInt(year, 10);
|
547
|
+
}
|
548
|
+
return undefined;
|
549
|
+
}, _SkyFuzzyDateService_isLeapYear = function _SkyFuzzyDateService_isLeapYear(year) {
|
550
|
+
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
551
|
+
}, _SkyFuzzyDateService_getMonthNumber = function _SkyFuzzyDateService_getMonthNumber(month) {
|
552
|
+
let returnValue;
|
553
|
+
const monthAsNumber = parseInt(month, 10);
|
554
|
+
// If the month component is a string ("Janaury"), we check to see if it is a valid month
|
555
|
+
if (isNaN(monthAsNumber)) {
|
556
|
+
if (!moment(month, 'MMMM').isValid()) {
|
566
557
|
return;
|
567
558
|
}
|
568
|
-
|
559
|
+
returnValue = parseInt(moment().month(month).format('M'), 10);
|
569
560
|
}
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
561
|
+
else {
|
562
|
+
returnValue = monthAsNumber;
|
563
|
+
}
|
564
|
+
// Ensure that the month is between 1 and 12
|
565
|
+
if (!(1 <= returnValue && returnValue <= 12)) {
|
566
|
+
return;
|
567
|
+
}
|
568
|
+
return returnValue;
|
569
|
+
}, _SkyFuzzyDateService_getDefaultYear = function _SkyFuzzyDateService_getDefaultYear(fuzzyDate) {
|
570
|
+
// Check if we need to return a leap year or the current year.
|
571
|
+
if (fuzzyDate.month === 2 && fuzzyDate.day === 29) {
|
572
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getMostRecentLeapYear).call(this);
|
573
|
+
}
|
574
|
+
else {
|
575
|
+
return new Date().getFullYear();
|
578
576
|
}
|
579
|
-
|
580
|
-
|
577
|
+
}, _SkyFuzzyDateService_getDateComponents = function _SkyFuzzyDateService_getDateComponents(date) {
|
578
|
+
const separator = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateSeparator).call(this, date);
|
579
|
+
if (separator) {
|
581
580
|
return date.split(separator);
|
582
581
|
}
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
582
|
+
else {
|
583
|
+
return [date];
|
584
|
+
}
|
585
|
+
}, _SkyFuzzyDateService_getDateFormatIndexes = function _SkyFuzzyDateService_getDateFormatIndexes(dateFormat) {
|
586
|
+
dateFormat = dateFormat.toLowerCase();
|
587
|
+
return {
|
588
|
+
yearIndex: dateFormat.indexOf('y'),
|
589
|
+
monthIndex: dateFormat.indexOf('m'),
|
590
|
+
dayIndex: dateFormat.indexOf('d'),
|
591
|
+
};
|
592
|
+
}, _SkyFuzzyDateService_getDateValueIndexes = function _SkyFuzzyDateService_getDateValueIndexes(date, dateFormat) {
|
593
|
+
const dateFormatIndexes = __classPrivateFieldGet(this, _SkyFuzzyDateService_instances, "m", _SkyFuzzyDateService_getDateFormatIndexes).call(this, dateFormat);
|
594
|
+
const dateComponentIndexes = [];
|
595
|
+
if (dateFormatIndexes.yearIndex > -1) {
|
596
|
+
dateComponentIndexes.push(dateFormatIndexes.yearIndex);
|
597
|
+
}
|
598
|
+
if (dateFormatIndexes.monthIndex > -1) {
|
599
|
+
dateComponentIndexes.push(dateFormatIndexes.monthIndex);
|
600
|
+
}
|
601
|
+
if (dateFormatIndexes.dayIndex > -1) {
|
602
|
+
dateComponentIndexes.push(dateFormatIndexes.dayIndex);
|
603
|
+
}
|
604
|
+
dateComponentIndexes.sort(function (a, b) {
|
605
|
+
return a - b;
|
606
|
+
});
|
607
|
+
return {
|
608
|
+
yearIndex: dateComponentIndexes.indexOf(dateFormatIndexes.yearIndex),
|
609
|
+
monthIndex: dateComponentIndexes.indexOf(dateFormatIndexes.monthIndex),
|
610
|
+
dayIndex: dateComponentIndexes.indexOf(dateFormatIndexes.dayIndex),
|
611
|
+
};
|
612
|
+
}, _SkyFuzzyDateService_isFuzzyDateValid = function _SkyFuzzyDateService_isFuzzyDateValid(fuzzyDate) {
|
613
|
+
if (!fuzzyDate) {
|
614
|
+
return false;
|
591
615
|
}
|
592
|
-
//
|
593
|
-
|
594
|
-
|
595
|
-
const dateComponentIndexes = [];
|
596
|
-
if (dateFormatIndexes.yearIndex > -1) {
|
597
|
-
dateComponentIndexes.push(dateFormatIndexes.yearIndex);
|
598
|
-
}
|
599
|
-
if (dateFormatIndexes.monthIndex > -1) {
|
600
|
-
dateComponentIndexes.push(dateFormatIndexes.monthIndex);
|
601
|
-
}
|
602
|
-
if (dateFormatIndexes.dayIndex > -1) {
|
603
|
-
dateComponentIndexes.push(dateFormatIndexes.dayIndex);
|
604
|
-
}
|
605
|
-
dateComponentIndexes.sort(function (a, b) {
|
606
|
-
return a - b;
|
607
|
-
});
|
608
|
-
return {
|
609
|
-
yearIndex: dateComponentIndexes.indexOf(dateFormatIndexes.yearIndex),
|
610
|
-
monthIndex: dateComponentIndexes.indexOf(dateFormatIndexes.monthIndex),
|
611
|
-
dayIndex: dateComponentIndexes.indexOf(dateFormatIndexes.dayIndex),
|
612
|
-
};
|
616
|
+
// If none of the dates part are specified, return false.
|
617
|
+
if (!fuzzyDate.day && !fuzzyDate.month && !fuzzyDate.year) {
|
618
|
+
return false;
|
613
619
|
}
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
* month, year
|
618
|
-
* month, day
|
619
|
-
* year only
|
620
|
-
*/
|
621
|
-
isFuzzyDateValid(fuzzyDate) {
|
622
|
-
if (!fuzzyDate) {
|
623
|
-
return false;
|
624
|
-
}
|
625
|
-
// If none of the dates part are specified, return false.
|
626
|
-
if (!fuzzyDate.day && !fuzzyDate.month && !fuzzyDate.year) {
|
627
|
-
return false;
|
628
|
-
}
|
629
|
-
// If only month is specified, return false.
|
630
|
-
if (!fuzzyDate.day && fuzzyDate.month && !fuzzyDate.year) {
|
631
|
-
return false;
|
632
|
-
}
|
633
|
-
// If only day is specified, return false.
|
634
|
-
if (fuzzyDate.day && !fuzzyDate.month && !fuzzyDate.year) {
|
635
|
-
return false;
|
636
|
-
}
|
637
|
-
return true;
|
620
|
+
// If only month is specified, return false.
|
621
|
+
if (!fuzzyDate.day && fuzzyDate.month && !fuzzyDate.year) {
|
622
|
+
return false;
|
638
623
|
}
|
639
|
-
|
624
|
+
// If only day is specified, return false.
|
625
|
+
if (fuzzyDate.day && !fuzzyDate.month && !fuzzyDate.year) {
|
626
|
+
return false;
|
627
|
+
}
|
628
|
+
return true;
|
629
|
+
};
|
640
630
|
SkyFuzzyDateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFuzzyDateService, deps: [{ token: i3.SkyAppLocaleProvider }], target: i0.ɵɵFactoryTarget.Injectable });
|
641
631
|
SkyFuzzyDateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFuzzyDateService, providedIn: 'root' });
|
642
632
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFuzzyDateService, decorators: [{
|
@@ -704,6 +694,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
704
694
|
}]
|
705
695
|
}] });
|
706
696
|
|
697
|
+
var _SkyDateRangeCalculator_instances, _SkyDateRangeCalculator_config, _SkyDateRangeCalculator_parseDateWithoutTime;
|
707
698
|
/**
|
708
699
|
* Represents the calculator.
|
709
700
|
*/
|
@@ -714,7 +705,9 @@ class SkyDateRangeCalculator {
|
|
714
705
|
*/
|
715
706
|
calculatorId, config) {
|
716
707
|
this.calculatorId = calculatorId;
|
717
|
-
this
|
708
|
+
_SkyDateRangeCalculator_instances.add(this);
|
709
|
+
_SkyDateRangeCalculator_config.set(this, void 0);
|
710
|
+
__classPrivateFieldSet(this, _SkyDateRangeCalculator_config, config, "f");
|
718
711
|
this.type = config.type;
|
719
712
|
this.shortDescription = config.shortDescription;
|
720
713
|
}
|
@@ -724,14 +717,14 @@ class SkyDateRangeCalculator {
|
|
724
717
|
* @param endDateInput The end date.
|
725
718
|
*/
|
726
719
|
getValue(startDateInput, endDateInput) {
|
727
|
-
const result = this.
|
720
|
+
const result = __classPrivateFieldGet(this, _SkyDateRangeCalculator_config, "f").getValue(startDateInput, endDateInput);
|
728
721
|
let startDate = null;
|
729
722
|
if (result.startDate instanceof Date) {
|
730
|
-
startDate = this.
|
723
|
+
startDate = __classPrivateFieldGet(this, _SkyDateRangeCalculator_instances, "m", _SkyDateRangeCalculator_parseDateWithoutTime).call(this, result.startDate);
|
731
724
|
}
|
732
725
|
let endDate = null;
|
733
726
|
if (result.endDate instanceof Date) {
|
734
|
-
endDate = this.
|
727
|
+
endDate = __classPrivateFieldGet(this, _SkyDateRangeCalculator_instances, "m", _SkyDateRangeCalculator_parseDateWithoutTime).call(this, result.endDate);
|
735
728
|
}
|
736
729
|
return {
|
737
730
|
calculatorId: this.calculatorId,
|
@@ -743,19 +736,15 @@ class SkyDateRangeCalculator {
|
|
743
736
|
* Performs synchronous validation against the control.
|
744
737
|
*/
|
745
738
|
validate(value) {
|
746
|
-
if (!this.
|
747
|
-
return;
|
739
|
+
if (!__classPrivateFieldGet(this, _SkyDateRangeCalculator_config, "f").validate) {
|
740
|
+
return null;
|
748
741
|
}
|
749
|
-
return this.
|
750
|
-
}
|
751
|
-
/**
|
752
|
-
* Get a date object without time information.
|
753
|
-
* See: https://stackoverflow.com/a/38050824/6178885
|
754
|
-
*/
|
755
|
-
parseDateWithoutTime(date) {
|
756
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
742
|
+
return __classPrivateFieldGet(this, _SkyDateRangeCalculator_config, "f").validate(value);
|
757
743
|
}
|
758
744
|
}
|
745
|
+
_SkyDateRangeCalculator_config = new WeakMap(), _SkyDateRangeCalculator_instances = new WeakSet(), _SkyDateRangeCalculator_parseDateWithoutTime = function _SkyDateRangeCalculator_parseDateWithoutTime(date) {
|
746
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
747
|
+
};
|
759
748
|
|
760
749
|
/**
|
761
750
|
* `SkyDateRangeCalculatorId` values specify calculator objects that return
|
@@ -926,7 +915,7 @@ class SkyDateFormatter {
|
|
926
915
|
return momentValue.toDate();
|
927
916
|
}
|
928
917
|
dateIsValid(date) {
|
929
|
-
return (date &&
|
918
|
+
return !!(date &&
|
930
919
|
date instanceof Date &&
|
931
920
|
!isNaN(date.valueOf()) &&
|
932
921
|
!isNaN(new Date(date).getDate()));
|
@@ -935,14 +924,19 @@ class SkyDateFormatter {
|
|
935
924
|
SkyDateFormatter.defaultLocale = 'en-US';
|
936
925
|
SkyDateFormatter.defaultShortDateFormat = 'MM/DD/YYYY';
|
937
926
|
|
927
|
+
var _SkyDatepickerCalendarInnerComponent_instances, _SkyDatepickerCalendarInnerComponent_ngUnsubscribe, _SkyDatepickerCalendarInnerComponent__selectedDate, _SkyDatepickerCalendarInnerComponent__startingDay, _SkyDatepickerCalendarInnerComponent_getCustomDate;
|
938
928
|
let nextDatepickerId = 0;
|
939
929
|
/**
|
940
930
|
* @internal
|
941
931
|
*/
|
942
932
|
class SkyDatepickerCalendarInnerComponent {
|
943
933
|
constructor() {
|
934
|
+
_SkyDatepickerCalendarInnerComponent_instances.add(this);
|
944
935
|
this.selectedDateChange = new EventEmitter(undefined);
|
945
936
|
this.calendarModeChange = new EventEmitter();
|
937
|
+
// TODO: `activeDate` is very similar to `selectedDate` and at the very least should be able to be undefined. However, this would take considerable refactoring to do and thus has been deferred.
|
938
|
+
this.activeDate = new Date();
|
939
|
+
this.activeDateId = '';
|
946
940
|
this.minMode = 'day';
|
947
941
|
this.maxMode = 'year';
|
948
942
|
this.monthColLimit = 3;
|
@@ -973,16 +967,28 @@ class SkyDatepickerCalendarInnerComponent {
|
|
973
967
|
39: 'right',
|
974
968
|
40: 'down',
|
975
969
|
};
|
976
|
-
this
|
970
|
+
_SkyDatepickerCalendarInnerComponent_ngUnsubscribe.set(this, new Subject());
|
971
|
+
_SkyDatepickerCalendarInnerComponent__selectedDate.set(this, void 0);
|
972
|
+
_SkyDatepickerCalendarInnerComponent__startingDay.set(this, 0);
|
973
|
+
}
|
974
|
+
set startingDay(value) {
|
975
|
+
__classPrivateFieldSet(this, _SkyDatepickerCalendarInnerComponent__startingDay, value || 0, "f");
|
976
|
+
}
|
977
|
+
get startingDay() {
|
978
|
+
return __classPrivateFieldGet(this, _SkyDatepickerCalendarInnerComponent__startingDay, "f");
|
977
979
|
}
|
978
980
|
set selectedDate(value) {
|
979
|
-
if (this.dateFormatter.dateIsValid(value)) {
|
980
|
-
this
|
981
|
+
if (value && this.dateFormatter.dateIsValid(value)) {
|
982
|
+
__classPrivateFieldSet(this, _SkyDatepickerCalendarInnerComponent__selectedDate, value, "f");
|
981
983
|
this.activeDate = value;
|
982
984
|
}
|
985
|
+
else {
|
986
|
+
__classPrivateFieldSet(this, _SkyDatepickerCalendarInnerComponent__selectedDate, undefined, "f");
|
987
|
+
this.activeDate = new Date();
|
988
|
+
}
|
983
989
|
}
|
984
990
|
get selectedDate() {
|
985
|
-
return this
|
991
|
+
return __classPrivateFieldGet(this, _SkyDatepickerCalendarInnerComponent__selectedDate, "f");
|
986
992
|
}
|
987
993
|
ngOnInit() {
|
988
994
|
if (this.selectedDate) {
|
@@ -996,8 +1002,8 @@ class SkyDatepickerCalendarInnerComponent {
|
|
996
1002
|
this.refreshView();
|
997
1003
|
}
|
998
1004
|
ngOnDestroy() {
|
999
|
-
this.
|
1000
|
-
this.
|
1005
|
+
__classPrivateFieldGet(this, _SkyDatepickerCalendarInnerComponent_ngUnsubscribe, "f").next();
|
1006
|
+
__classPrivateFieldGet(this, _SkyDatepickerCalendarInnerComponent_ngUnsubscribe, "f").complete();
|
1001
1007
|
}
|
1002
1008
|
setCompareHandler(handler, type) {
|
1003
1009
|
if (type === 'day') {
|
@@ -1025,6 +1031,8 @@ class SkyDatepickerCalendarInnerComponent {
|
|
1025
1031
|
if (this.datepickerMode === 'year' && this.compareHandlerYear) {
|
1026
1032
|
return this.compareHandlerYear(date1, date2);
|
1027
1033
|
}
|
1034
|
+
/* istanbul ignore next */
|
1035
|
+
return undefined;
|
1028
1036
|
}
|
1029
1037
|
setRefreshViewHandler(handler, type) {
|
1030
1038
|
if (type === 'day') {
|
@@ -1102,11 +1110,11 @@ class SkyDatepickerCalendarInnerComponent {
|
|
1102
1110
|
}
|
1103
1111
|
}
|
1104
1112
|
createDateObject(date, format, isSecondary, id) {
|
1105
|
-
const customDateMatch = this.
|
1113
|
+
const customDateMatch = __classPrivateFieldGet(this, _SkyDatepickerCalendarInnerComponent_instances, "m", _SkyDatepickerCalendarInnerComponent_getCustomDate).call(this, date);
|
1106
1114
|
const dateObject = {
|
1107
1115
|
date: new Date(date.getFullYear(), date.getMonth(), date.getDate()),
|
1108
1116
|
label: this.dateFilter(date, format),
|
1109
|
-
selected: this.compare(date, this.selectedDate) === 0,
|
1117
|
+
selected: !!this.selectedDate && this.compare(date, this.selectedDate) === 0,
|
1110
1118
|
disabled: this.isDisabled(date),
|
1111
1119
|
current: this.compare(date, new Date()) === 0,
|
1112
1120
|
secondary: isSecondary,
|
@@ -1206,19 +1214,22 @@ class SkyDatepickerCalendarInnerComponent {
|
|
1206
1214
|
* 2. Date is marked as disabled in the customDates array.
|
1207
1215
|
*/
|
1208
1216
|
isDisabled(date) {
|
1209
|
-
const customDate = this.
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
if (this.customDates) {
|
1216
|
-
return this.customDates.find((customDate) => {
|
1217
|
-
return customDate.date.getTime() === date.getTime();
|
1218
|
-
});
|
1219
|
-
}
|
1217
|
+
const customDate = __classPrivateFieldGet(this, _SkyDatepickerCalendarInnerComponent_instances, "m", _SkyDatepickerCalendarInnerComponent_getCustomDate).call(this, date);
|
1218
|
+
const minDateCompare = this.compare(date, this.minDate);
|
1219
|
+
const maxDateCompare = this.compare(date, this.maxDate);
|
1220
|
+
return ((minDateCompare !== undefined && minDateCompare < 0) ||
|
1221
|
+
(maxDateCompare !== undefined && maxDateCompare > 0) ||
|
1222
|
+
!!customDate?.disabled);
|
1220
1223
|
}
|
1221
1224
|
}
|
1225
|
+
_SkyDatepickerCalendarInnerComponent_ngUnsubscribe = new WeakMap(), _SkyDatepickerCalendarInnerComponent__selectedDate = new WeakMap(), _SkyDatepickerCalendarInnerComponent__startingDay = new WeakMap(), _SkyDatepickerCalendarInnerComponent_instances = new WeakSet(), _SkyDatepickerCalendarInnerComponent_getCustomDate = function _SkyDatepickerCalendarInnerComponent_getCustomDate(date) {
|
1226
|
+
if (this.customDates) {
|
1227
|
+
return this.customDates.find((customDate) => {
|
1228
|
+
return customDate.date.getTime() === date.getTime();
|
1229
|
+
});
|
1230
|
+
}
|
1231
|
+
return undefined;
|
1232
|
+
};
|
1222
1233
|
SkyDatepickerCalendarInnerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerCalendarInnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1223
1234
|
SkyDatepickerCalendarInnerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDatepickerCalendarInnerComponent, selector: "sky-datepicker-inner", inputs: { customDates: "customDates", startingDay: "startingDay", minDate: "minDate", maxDate: "maxDate", selectedDate: "selectedDate" }, outputs: { selectedDateChange: "selectedDateChange", calendarModeChange: "calendarModeChange" }, usesOnChanges: true, ngImport: i0, template: "<div\n *ngIf=\"datepickerMode\"\n class=\"sky-datepicker-calendar-inner\"\n (keydown)=\"onKeydown($event)\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [".sky-datepicker-calendar-inner{border-radius:5px;background-color:#fff;border-top:1px solid #e2e3e4;border-bottom:1px solid #e2e3e4;border-left:1px solid #e2e3e4;border-right:1px solid #e2e3e4}.sky-datepicker-calendar-inner .sky-btn-default{border-color:transparent;border:2px solid #ffffff}.sky-datepicker-calendar-inner .sky-btn-default:hover{border-color:#eeeeef}.sky-datepicker-calendar-inner .sky-datepicker-center{text-align:center}.sky-datepicker-calendar-inner .sky-datepicker-btn-selected,.sky-datepicker-calendar-inner .sky-btn-default.sky-datepicker-btn-selected:hover{background-color:#c1e8fb;border:2px solid #00b4f1}.sky-datepicker-calendar-inner .sky-btn.sky-btn-active{box-shadow:none}.sky-datepicker-calendar-inner .sky-datepicker-secondary{color:#686c73}.sky-datepicker-calendar-inner .sky-datepicker-btn-date{min-width:100%}.sky-datepicker-calendar-inner .sky-datepicker-calendar-title{width:100%}.sky-datepicker-calendar-inner .sky-datepicker-chevron-modern{display:none}.sky-datepicker-calendar-inner .sky-datepicker-header-left{text-align:left}.sky-datepicker-calendar-inner .sky-datepicker-header-right{text-align:right}.sky-theme-modern .sky-datepicker-calendar-inner{border:none;box-shadow:inset 0 0 0 1px #d2d2d2;border-radius:6px;padding:5px 10px}.sky-theme-modern .sky-datepicker-calendar-inner:focus-within{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d}.sky-theme-modern .sky-datepicker-calendar-inner .sky-btn-default{border:none;box-shadow:inset 0 0 0 1px transparent;padding:5px 7px}.sky-theme-modern .sky-datepicker-calendar-inner .sky-btn-active,.sky-theme-modern .sky-datepicker-calendar-inner .sky-btn-default:hover{border:none;box-shadow:inset 0 0 0 1px #1870b8}.sky-theme-modern .sky-btn-sm.sky-datepicker-btn-date{height:30px;min-width:0;padding:0;width:30px}.sky-theme-modern .sky-datepicker-chevron-default{display:none}.sky-theme-modern .sky-datepicker-chevron-modern{display:inline;font-size:16px}.sky-theme-modern.sky-theme-mode-dark .sky-datepicker-calendar-inner{background-color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-datepicker-calendar-inner:not(:focus-within){border:none;box-shadow:inset 0 0 0 1px #686c73}.sky-theme-modern.sky-theme-mode-dark .sky-datepicker-calendar-inner .sky-datepicker-btn-selected{background-color:#009cd1}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
|
1224
1235
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerCalendarInnerComponent, decorators: [{
|
@@ -1240,31 +1251,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
1240
1251
|
type: Output
|
1241
1252
|
}] } });
|
1242
1253
|
|
1254
|
+
var _SkyDatepickerAdapterService_renderer;
|
1243
1255
|
/**
|
1244
1256
|
* @internal
|
1245
1257
|
*/
|
1246
1258
|
class SkyDatepickerAdapterService {
|
1247
1259
|
constructor(renderer) {
|
1248
|
-
this
|
1249
|
-
|
1250
|
-
init(elRef) {
|
1251
|
-
this.el = elRef.nativeElement;
|
1252
|
-
}
|
1253
|
-
elementIsFocused() {
|
1254
|
-
const focusedEl = document.activeElement;
|
1255
|
-
return this.el.contains(focusedEl);
|
1256
|
-
}
|
1257
|
-
elementIsVisible() {
|
1258
|
-
const styles = this.el && getComputedStyle(this.el);
|
1259
|
-
return styles && styles.visibility === 'visible';
|
1260
|
+
_SkyDatepickerAdapterService_renderer.set(this, void 0);
|
1261
|
+
__classPrivateFieldSet(this, _SkyDatepickerAdapterService_renderer, renderer, "f");
|
1260
1262
|
}
|
1261
1263
|
getPlaceholder(elementRef) {
|
1262
1264
|
return elementRef.nativeElement.getAttribute('placeholder');
|
1263
1265
|
}
|
1264
1266
|
setPlaceholder(elementRef, value) {
|
1265
|
-
this.
|
1267
|
+
__classPrivateFieldGet(this, _SkyDatepickerAdapterService_renderer, "f").setAttribute(elementRef.nativeElement, 'placeholder', value);
|
1266
1268
|
}
|
1267
1269
|
}
|
1270
|
+
_SkyDatepickerAdapterService_renderer = new WeakMap();
|
1268
1271
|
SkyDatepickerAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerAdapterService, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1269
1272
|
SkyDatepickerAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerAdapterService });
|
1270
1273
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerAdapterService, decorators: [{
|
@@ -1317,166 +1320,171 @@ class SkyDayPickerButtonComponent {
|
|
1317
1320
|
}
|
1318
1321
|
}
|
1319
1322
|
SkyDayPickerButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDayPickerButtonComponent, deps: [{ token: SkyDatepickerCalendarInnerComponent }], target: i0.ɵɵFactoryTarget.Component });
|
1320
|
-
SkyDayPickerButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDayPickerButtonComponent, selector: "sky-daypicker-button", inputs: { date: "date" }, ngImport: i0, template: "<button\n class=\"sky-btn sky-btn-sm sky-btn-default sky-datepicker-btn-date\"\n tabindex=\"-1\"\n type=\"button\"\n [disabled]=\"date.disabled\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date),\n 'sky-datepicker-btn-disabled': date.disabled,\n 'sky-datepicker-btn-key-date': date.keyDate\n }\"\n (click)=\"datepicker.selectCalendar($event, date.date, true)\"\n>\n <span [ngClass]=\"{ 'sky-datepicker-secondary': date.secondary }\">\n {{ date.label }}\n </span>\n</button>\n", styles: [".sky-datepicker-btn-disabled{font-style:italic}.sky-datepicker-btn-key-date{position:relative}.sky-datepicker-btn-key-date:before{position:absolute;content:\"\";height:5px;width:5px;background-color:#d93a3d;border-radius:50%;left:15px;top:22px}:host-context(.sky-theme-modern) .sky-datepicker-btn-key-date:before{left:12px}.sky-theme-modern .sky-datepicker-btn-key-date:before{left:12px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
1323
|
+
SkyDayPickerButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDayPickerButtonComponent, selector: "sky-daypicker-button", inputs: { date: "date" }, ngImport: i0, template: "<button\n *ngIf=\"date\"\n class=\"sky-btn sky-btn-sm sky-btn-default sky-datepicker-btn-date\"\n tabindex=\"-1\"\n type=\"button\"\n [disabled]=\"date.disabled\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date),\n 'sky-datepicker-btn-disabled': date.disabled,\n 'sky-datepicker-btn-key-date': date.keyDate\n }\"\n (click)=\"datepicker.selectCalendar($event, date.date, true)\"\n>\n <span [ngClass]=\"{ 'sky-datepicker-secondary': date.secondary }\">\n {{ date.label }}\n </span>\n</button>\n", styles: [".sky-datepicker-btn-disabled{font-style:italic}.sky-datepicker-btn-key-date{position:relative}.sky-datepicker-btn-key-date:before{position:absolute;content:\"\";height:5px;width:5px;background-color:#d93a3d;border-radius:50%;left:15px;top:22px}:host-context(.sky-theme-modern) .sky-datepicker-btn-key-date:before{left:12px}.sky-theme-modern .sky-datepicker-btn-key-date:before{left:12px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
1321
1324
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDayPickerButtonComponent, decorators: [{
|
1322
1325
|
type: Component,
|
1323
|
-
args: [{ selector: 'sky-daypicker-button', template: "<button\n class=\"sky-btn sky-btn-sm sky-btn-default sky-datepicker-btn-date\"\n tabindex=\"-1\"\n type=\"button\"\n [disabled]=\"date.disabled\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date),\n 'sky-datepicker-btn-disabled': date.disabled,\n 'sky-datepicker-btn-key-date': date.keyDate\n }\"\n (click)=\"datepicker.selectCalendar($event, date.date, true)\"\n>\n <span [ngClass]=\"{ 'sky-datepicker-secondary': date.secondary }\">\n {{ date.label }}\n </span>\n</button>\n", styles: [".sky-datepicker-btn-disabled{font-style:italic}.sky-datepicker-btn-key-date{position:relative}.sky-datepicker-btn-key-date:before{position:absolute;content:\"\";height:5px;width:5px;background-color:#d93a3d;border-radius:50%;left:15px;top:22px}:host-context(.sky-theme-modern) .sky-datepicker-btn-key-date:before{left:12px}.sky-theme-modern .sky-datepicker-btn-key-date:before{left:12px}\n"] }]
|
1326
|
+
args: [{ selector: 'sky-daypicker-button', template: "<button\n *ngIf=\"date\"\n class=\"sky-btn sky-btn-sm sky-btn-default sky-datepicker-btn-date\"\n tabindex=\"-1\"\n type=\"button\"\n [disabled]=\"date.disabled\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date),\n 'sky-datepicker-btn-disabled': date.disabled,\n 'sky-datepicker-btn-key-date': date.keyDate\n }\"\n (click)=\"datepicker.selectCalendar($event, date.date, true)\"\n>\n <span [ngClass]=\"{ 'sky-datepicker-secondary': date.secondary }\">\n {{ date.label }}\n </span>\n</button>\n", styles: [".sky-datepicker-btn-disabled{font-style:italic}.sky-datepicker-btn-key-date{position:relative}.sky-datepicker-btn-key-date:before{position:absolute;content:\"\";height:5px;width:5px;background-color:#d93a3d;border-radius:50%;left:15px;top:22px}:host-context(.sky-theme-modern) .sky-datepicker-btn-key-date:before{left:12px}.sky-theme-modern .sky-datepicker-btn-key-date:before{left:12px}\n"] }]
|
1324
1327
|
}], ctorParameters: function () { return [{ type: SkyDatepickerCalendarInnerComponent }]; }, propDecorators: { date: [{
|
1325
1328
|
type: Input
|
1326
1329
|
}] } });
|
1327
1330
|
|
1331
|
+
var _SkyDayPickerCellComponent_instances, _SkyDayPickerCellComponent_activeUid, _SkyDayPickerCellComponent_cancelPopover, _SkyDayPickerCellComponent_popoverOpen, _SkyDayPickerCellComponent_ngUnsubscribe, _SkyDayPickerCellComponent_datepicker, _SkyDayPickerCellComponent_datepickerService, _SkyDayPickerCellComponent_hideTooltip, _SkyDayPickerCellComponent_showTooltip;
|
1328
1332
|
/**
|
1329
1333
|
* @internal
|
1330
1334
|
*/
|
1331
1335
|
class SkyDayPickerCellComponent {
|
1332
1336
|
constructor(datepicker, datepickerService) {
|
1333
|
-
this
|
1334
|
-
this.datepickerService = datepickerService;
|
1337
|
+
_SkyDayPickerCellComponent_instances.add(this);
|
1335
1338
|
this.hasTooltip = false;
|
1336
1339
|
this.popoverController = new Subject();
|
1337
|
-
this
|
1338
|
-
this
|
1339
|
-
this
|
1340
|
-
this
|
1340
|
+
_SkyDayPickerCellComponent_activeUid.set(this, '');
|
1341
|
+
_SkyDayPickerCellComponent_cancelPopover.set(this, false);
|
1342
|
+
_SkyDayPickerCellComponent_popoverOpen.set(this, false);
|
1343
|
+
_SkyDayPickerCellComponent_ngUnsubscribe.set(this, new Subject());
|
1344
|
+
_SkyDayPickerCellComponent_datepicker.set(this, void 0);
|
1345
|
+
_SkyDayPickerCellComponent_datepickerService.set(this, void 0);
|
1346
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_datepicker, datepicker, "f");
|
1347
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_datepickerService, datepickerService, "f");
|
1341
1348
|
}
|
1342
1349
|
ngOnInit() {
|
1343
|
-
this.hasTooltip =
|
1350
|
+
this.hasTooltip = !!(this.date &&
|
1344
1351
|
this.date.keyDate &&
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1352
|
+
this.date.keyDateText &&
|
1353
|
+
this.date.keyDateText.length > 0 &&
|
1354
|
+
this.date.keyDateText[0].length > 0);
|
1348
1355
|
// show the tooltip if this is the active date and is not the
|
1349
1356
|
// initial active date (activeDateHasChanged)
|
1350
|
-
if (this.
|
1357
|
+
if (!!this.date &&
|
1358
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_datepicker, "f").isActive(this.date) &&
|
1351
1359
|
this.activeDateHasChanged &&
|
1352
1360
|
this.hasTooltip) {
|
1353
|
-
this
|
1354
|
-
this.
|
1361
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_activeUid, this.date.uid, "f");
|
1362
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_instances, "m", _SkyDayPickerCellComponent_showTooltip).call(this);
|
1355
1363
|
}
|
1356
1364
|
if (this.hasTooltip) {
|
1357
|
-
this.
|
1358
|
-
.pipe(takeUntil(this
|
1365
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_datepickerService, "f").keyDatePopoverStream
|
1366
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDayPickerCellComponent_ngUnsubscribe, "f")))
|
1359
1367
|
.subscribe((date) => {
|
1360
1368
|
if (date) {
|
1361
|
-
this
|
1369
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_activeUid, date.uid, "f");
|
1362
1370
|
}
|
1363
1371
|
else {
|
1364
|
-
this
|
1372
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_activeUid, '', "f");
|
1365
1373
|
}
|
1366
1374
|
// If this day has an open popover and they have moved off of the day close the popover.
|
1367
|
-
if (this.date
|
1368
|
-
this.
|
1375
|
+
if (this.date?.uid !== __classPrivateFieldGet(this, _SkyDayPickerCellComponent_activeUid, "f")) {
|
1376
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_instances, "m", _SkyDayPickerCellComponent_hideTooltip).call(this);
|
1369
1377
|
}
|
1370
1378
|
});
|
1371
1379
|
}
|
1372
1380
|
}
|
1373
1381
|
ngOnDestroy() {
|
1374
|
-
this.
|
1375
|
-
this.
|
1382
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_ngUnsubscribe, "f").next();
|
1383
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_ngUnsubscribe, "f").complete();
|
1376
1384
|
}
|
1377
1385
|
onDayMouseenter() {
|
1378
|
-
this
|
1386
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_cancelPopover, false, "f");
|
1379
1387
|
if (this.hasTooltip) {
|
1380
|
-
this.
|
1381
|
-
this.
|
1388
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_instances, "m", _SkyDayPickerCellComponent_showTooltip).call(this);
|
1389
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_datepickerService, "f").keyDatePopoverStream.next(this.date);
|
1382
1390
|
}
|
1383
1391
|
}
|
1384
1392
|
onDayMouseleave() {
|
1385
|
-
this
|
1393
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_cancelPopover, true, "f");
|
1386
1394
|
if (this.hasTooltip) {
|
1387
|
-
this.
|
1395
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_instances, "m", _SkyDayPickerCellComponent_hideTooltip).call(this);
|
1388
1396
|
}
|
1389
|
-
this.
|
1397
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_datepickerService, "f").keyDatePopoverStream.next(undefined);
|
1390
1398
|
}
|
1391
1399
|
onPopoverClosed() {
|
1392
|
-
this
|
1400
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_popoverOpen, false, "f");
|
1393
1401
|
}
|
1394
1402
|
onPopoverOpened() {
|
1395
|
-
this
|
1403
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_popoverOpen, true, "f");
|
1396
1404
|
/* istanbul ignore else */
|
1397
|
-
if (this
|
1405
|
+
if (__classPrivateFieldGet(this, _SkyDayPickerCellComponent_cancelPopover, "f")) {
|
1398
1406
|
// If the popover gets opened just as a mouseout event happens, close it.
|
1399
|
-
this.
|
1400
|
-
this
|
1407
|
+
__classPrivateFieldGet(this, _SkyDayPickerCellComponent_instances, "m", _SkyDayPickerCellComponent_hideTooltip).call(this);
|
1408
|
+
__classPrivateFieldSet(this, _SkyDayPickerCellComponent_cancelPopover, false, "f");
|
1401
1409
|
}
|
1402
1410
|
}
|
1403
1411
|
getKeyDateLabel() {
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
else {
|
1408
|
-
return '';
|
1409
|
-
}
|
1410
|
-
}
|
1411
|
-
hideTooltip() {
|
1412
|
-
/* istanbul ignore else */
|
1413
|
-
if (this.popoverOpen) {
|
1414
|
-
this.popoverController.next({ type: SkyPopoverMessageType.Close });
|
1415
|
-
}
|
1416
|
-
}
|
1417
|
-
showTooltip() {
|
1418
|
-
/* istanbul ignore else */
|
1419
|
-
if (this.hasTooltip && !this.popoverOpen) {
|
1420
|
-
/**
|
1421
|
-
* Delay 1/2 second before opening the popover as long as mouse hasn't moved off the date.
|
1422
|
-
*/
|
1423
|
-
setTimeout(() => {
|
1424
|
-
if (!this.cancelPopover && this.activeUid === this.date.uid) {
|
1425
|
-
this.popoverController.next({ type: SkyPopoverMessageType.Open });
|
1426
|
-
}
|
1427
|
-
}, 500);
|
1428
|
-
}
|
1412
|
+
return this.hasTooltip && this.date?.keyDateText
|
1413
|
+
? this.date.keyDateText.join(', ')
|
1414
|
+
: '';
|
1429
1415
|
}
|
1430
1416
|
}
|
1417
|
+
_SkyDayPickerCellComponent_activeUid = new WeakMap(), _SkyDayPickerCellComponent_cancelPopover = new WeakMap(), _SkyDayPickerCellComponent_popoverOpen = new WeakMap(), _SkyDayPickerCellComponent_ngUnsubscribe = new WeakMap(), _SkyDayPickerCellComponent_datepicker = new WeakMap(), _SkyDayPickerCellComponent_datepickerService = new WeakMap(), _SkyDayPickerCellComponent_instances = new WeakSet(), _SkyDayPickerCellComponent_hideTooltip = function _SkyDayPickerCellComponent_hideTooltip() {
|
1418
|
+
/* istanbul ignore else */
|
1419
|
+
if (__classPrivateFieldGet(this, _SkyDayPickerCellComponent_popoverOpen, "f")) {
|
1420
|
+
this.popoverController.next({ type: SkyPopoverMessageType.Close });
|
1421
|
+
}
|
1422
|
+
}, _SkyDayPickerCellComponent_showTooltip = function _SkyDayPickerCellComponent_showTooltip() {
|
1423
|
+
/* istanbul ignore else */
|
1424
|
+
if (this.hasTooltip && !__classPrivateFieldGet(this, _SkyDayPickerCellComponent_popoverOpen, "f")) {
|
1425
|
+
/**
|
1426
|
+
* Delay 1/2 second before opening the popover as long as mouse hasn't moved off the date.
|
1427
|
+
*/
|
1428
|
+
setTimeout(() => {
|
1429
|
+
if (!__classPrivateFieldGet(this, _SkyDayPickerCellComponent_cancelPopover, "f") && __classPrivateFieldGet(this, _SkyDayPickerCellComponent_activeUid, "f") === this.date?.uid) {
|
1430
|
+
this.popoverController.next({ type: SkyPopoverMessageType.Open });
|
1431
|
+
}
|
1432
|
+
}, 500);
|
1433
|
+
}
|
1434
|
+
};
|
1431
1435
|
SkyDayPickerCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDayPickerCellComponent, deps: [{ token: SkyDatepickerCalendarInnerComponent }, { token: SkyDatepickerService }], target: i0.ɵɵFactoryTarget.Component });
|
1432
|
-
SkyDayPickerCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDayPickerCellComponent, selector: "sky-daypicker-cell", inputs: { activeDateHasChanged: "activeDateHasChanged", date: "date" }, ngImport: i0, template: "<div\n *ngIf=\"hasTooltip\"\n class=\"sky-daypicker-cell\"\n [attr.aria-label]=\"getKeyDateLabel()\"\n [skyPopover]=\"dayInfoPopover\"\n skyPopoverPlacement=\"left\"\n [skyPopoverMessageStream]=\"popoverController\"\n (mouseenter)=\"onDayMouseenter()\"\n (mouseleave)=\"onDayMouseleave()\"\n>\n <ng-container *ngTemplateOutlet=\"daypickerButtonTemplateRef\"></ng-container>\n <sky-popover\n (popoverClosed)=\"onPopoverClosed()\"\n (popoverOpened)=\"onPopoverOpened()\"\n #dayInfoPopover\n >\n <div *ngFor=\"let text of date
|
1436
|
+
SkyDayPickerCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDayPickerCellComponent, selector: "sky-daypicker-cell", inputs: { activeDateHasChanged: "activeDateHasChanged", date: "date" }, ngImport: i0, template: "<div\n *ngIf=\"hasTooltip\"\n class=\"sky-daypicker-cell\"\n [attr.aria-label]=\"getKeyDateLabel()\"\n [skyPopover]=\"dayInfoPopover\"\n skyPopoverPlacement=\"left\"\n [skyPopoverMessageStream]=\"popoverController\"\n (mouseenter)=\"onDayMouseenter()\"\n (mouseleave)=\"onDayMouseleave()\"\n>\n <ng-container *ngTemplateOutlet=\"daypickerButtonTemplateRef\"></ng-container>\n <sky-popover\n (popoverClosed)=\"onPopoverClosed()\"\n (popoverOpened)=\"onPopoverOpened()\"\n #dayInfoPopover\n >\n <div *ngFor=\"let text of date?.keyDateText\">\n {{ text }}\n </div>\n </sky-popover>\n</div>\n<div\n *ngIf=\"!hasTooltip\"\n class=\"sky-daypicker-cell\"\n (mouseenter)=\"onDayMouseenter()\"\n (mouseleave)=\"onDayMouseleave()\"\n>\n <ng-container *ngTemplateOutlet=\"daypickerButtonTemplateRef\"></ng-container>\n</div>\n\n<ng-template #daypickerButtonTemplateRef>\n <sky-daypicker-button [date]=\"date\"> </sky-daypicker-button>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i4.λ6, selector: "sky-popover", inputs: ["alignment", "dismissOnBlur", "placement", "popoverTitle", "popoverType"], outputs: ["popoverClosed", "popoverOpened"] }, { kind: "directive", type: i4.λ7, selector: "[skyPopover]", inputs: ["skyPopover", "skyPopoverAlignment", "skyPopoverMessageStream", "skyPopoverPlacement", "skyPopoverTrigger"] }, { kind: "component", type: SkyDayPickerButtonComponent, selector: "sky-daypicker-button", inputs: ["date"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1433
1437
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDayPickerCellComponent, decorators: [{
|
1434
1438
|
type: Component,
|
1435
|
-
args: [{ selector: 'sky-daypicker-cell', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n *ngIf=\"hasTooltip\"\n class=\"sky-daypicker-cell\"\n [attr.aria-label]=\"getKeyDateLabel()\"\n [skyPopover]=\"dayInfoPopover\"\n skyPopoverPlacement=\"left\"\n [skyPopoverMessageStream]=\"popoverController\"\n (mouseenter)=\"onDayMouseenter()\"\n (mouseleave)=\"onDayMouseleave()\"\n>\n <ng-container *ngTemplateOutlet=\"daypickerButtonTemplateRef\"></ng-container>\n <sky-popover\n (popoverClosed)=\"onPopoverClosed()\"\n (popoverOpened)=\"onPopoverOpened()\"\n #dayInfoPopover\n >\n <div *ngFor=\"let text of date
|
1439
|
+
args: [{ selector: 'sky-daypicker-cell', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n *ngIf=\"hasTooltip\"\n class=\"sky-daypicker-cell\"\n [attr.aria-label]=\"getKeyDateLabel()\"\n [skyPopover]=\"dayInfoPopover\"\n skyPopoverPlacement=\"left\"\n [skyPopoverMessageStream]=\"popoverController\"\n (mouseenter)=\"onDayMouseenter()\"\n (mouseleave)=\"onDayMouseleave()\"\n>\n <ng-container *ngTemplateOutlet=\"daypickerButtonTemplateRef\"></ng-container>\n <sky-popover\n (popoverClosed)=\"onPopoverClosed()\"\n (popoverOpened)=\"onPopoverOpened()\"\n #dayInfoPopover\n >\n <div *ngFor=\"let text of date?.keyDateText\">\n {{ text }}\n </div>\n </sky-popover>\n</div>\n<div\n *ngIf=\"!hasTooltip\"\n class=\"sky-daypicker-cell\"\n (mouseenter)=\"onDayMouseenter()\"\n (mouseleave)=\"onDayMouseleave()\"\n>\n <ng-container *ngTemplateOutlet=\"daypickerButtonTemplateRef\"></ng-container>\n</div>\n\n<ng-template #daypickerButtonTemplateRef>\n <sky-daypicker-button [date]=\"date\"> </sky-daypicker-button>\n</ng-template>\n" }]
|
1436
1440
|
}], ctorParameters: function () { return [{ type: SkyDatepickerCalendarInnerComponent }, { type: SkyDatepickerService }]; }, propDecorators: { activeDateHasChanged: [{
|
1437
1441
|
type: Input
|
1438
1442
|
}], date: [{
|
1439
1443
|
type: Input
|
1440
1444
|
}] } });
|
1441
1445
|
|
1446
|
+
var _SkyDayPickerComponent_instances, _SkyDayPickerComponent_daysInMonth, _SkyDayPickerComponent_initialDate, _SkyDayPickerComponent_ngUnsubscribe, _SkyDayPickerComponent_compareDays, _SkyDayPickerComponent_refreshDayView, _SkyDayPickerComponent_keydownDays, _SkyDayPickerComponent_getDaysInMonth, _SkyDayPickerComponent_applyCustomDates, _SkyDayPickerComponent_dateRangeRowsAreEqual, _SkyDayPickerComponent_getDateRange;
|
1442
1447
|
/**
|
1443
1448
|
* @internal
|
1444
1449
|
*/
|
1445
1450
|
class SkyDayPickerComponent {
|
1446
1451
|
constructor(datepicker) {
|
1452
|
+
_SkyDayPickerComponent_instances.add(this);
|
1447
1453
|
this.calendarDateRangeChange = new EventEmitter();
|
1448
1454
|
this.isWaiting = false;
|
1449
1455
|
this.activeDateHasChanged = false;
|
1450
1456
|
this.labels = [];
|
1457
|
+
this.title = '';
|
1451
1458
|
this.rows = [];
|
1452
1459
|
this.weekNumbers = [];
|
1453
|
-
this
|
1460
|
+
_SkyDayPickerComponent_daysInMonth.set(this, [
|
1454
1461
|
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
|
1455
|
-
];
|
1456
|
-
this
|
1462
|
+
]);
|
1463
|
+
_SkyDayPickerComponent_initialDate.set(this, void 0);
|
1464
|
+
_SkyDayPickerComponent_ngUnsubscribe.set(this, new Subject());
|
1457
1465
|
this.datepicker = datepicker;
|
1458
1466
|
}
|
1459
1467
|
set customDates(value) {
|
1460
1468
|
/* istanbul ignore else */
|
1461
1469
|
if (value) {
|
1462
|
-
this.
|
1470
|
+
__classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_applyCustomDates).call(this, value, this.rows);
|
1463
1471
|
}
|
1464
1472
|
}
|
1465
1473
|
ngOnInit() {
|
1466
1474
|
this.datepicker.stepDay = { months: 1 };
|
1467
|
-
this
|
1475
|
+
__classPrivateFieldSet(this, _SkyDayPickerComponent_initialDate, this.datepicker.activeDate.getDate(), "f");
|
1468
1476
|
this.datepicker.setRefreshViewHandler(() => {
|
1469
|
-
this.
|
1477
|
+
__classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_refreshDayView).call(this);
|
1470
1478
|
}, 'day');
|
1471
|
-
this.datepicker.setCompareHandler(this
|
1479
|
+
this.datepicker.setCompareHandler(__classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_compareDays), 'day');
|
1472
1480
|
this.datepicker.setKeydownHandler((key, event) => {
|
1473
|
-
this.
|
1481
|
+
__classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_keydownDays).call(this, key, event);
|
1474
1482
|
}, 'day');
|
1475
1483
|
this.datepicker.refreshView();
|
1476
1484
|
}
|
1477
1485
|
ngOnDestroy() {
|
1478
|
-
this.
|
1479
|
-
this.
|
1486
|
+
__classPrivateFieldGet(this, _SkyDayPickerComponent_ngUnsubscribe, "f").next();
|
1487
|
+
__classPrivateFieldGet(this, _SkyDayPickerComponent_ngUnsubscribe, "f").complete();
|
1480
1488
|
}
|
1481
1489
|
getDates(startDate, n) {
|
1482
1490
|
const dates = new Array(n);
|
@@ -1491,144 +1499,145 @@ class SkyDayPickerComponent {
|
|
1491
1499
|
}
|
1492
1500
|
return dates;
|
1493
1501
|
}
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1502
|
+
}
|
1503
|
+
_SkyDayPickerComponent_daysInMonth = new WeakMap(), _SkyDayPickerComponent_initialDate = new WeakMap(), _SkyDayPickerComponent_ngUnsubscribe = new WeakMap(), _SkyDayPickerComponent_instances = new WeakSet(), _SkyDayPickerComponent_compareDays = function _SkyDayPickerComponent_compareDays(date1, date2) {
|
1504
|
+
const d1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
|
1505
|
+
const d2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
|
1506
|
+
return d1.getTime() - d2.getTime();
|
1507
|
+
}, _SkyDayPickerComponent_refreshDayView = function _SkyDayPickerComponent_refreshDayView() {
|
1508
|
+
const year = this.datepicker.activeDate.getFullYear();
|
1509
|
+
const month = this.datepicker.activeDate.getMonth();
|
1510
|
+
const firstDayOfMonth = new Date(year, month, 1);
|
1511
|
+
const difference = this.datepicker.startingDay - firstDayOfMonth.getDay();
|
1512
|
+
const numDisplayedFromPreviousMonth = difference > 0 ? 7 - difference : -difference;
|
1513
|
+
const firstDate = new Date(firstDayOfMonth.getTime());
|
1514
|
+
if (this.datepicker.activeDate.getDate() !== __classPrivateFieldGet(this, _SkyDayPickerComponent_initialDate, "f")) {
|
1515
|
+
this.activeDateHasChanged = true;
|
1516
|
+
}
|
1517
|
+
/* istanbul ignore else */
|
1518
|
+
/* sanity check */
|
1519
|
+
if (numDisplayedFromPreviousMonth > 0) {
|
1520
|
+
firstDate.setDate(-numDisplayedFromPreviousMonth + 1);
|
1521
|
+
}
|
1522
|
+
// 42 is the number of days on a six-week calendar
|
1523
|
+
const days = this.getDates(firstDate, 42);
|
1524
|
+
const pickerDates = [];
|
1525
|
+
for (let i = 0; i < 42; i++) {
|
1526
|
+
const _dateObject = this.datepicker.createDateObject(days[i], this.datepicker.formatDay, days[i].getMonth() !== month, this.datepicker.datepickerId + '-' + i);
|
1527
|
+
pickerDates[i] = _dateObject;
|
1528
|
+
}
|
1529
|
+
this.labels = [];
|
1530
|
+
for (let j = 0; j < 7; j++) {
|
1531
|
+
this.labels[j] = {};
|
1532
|
+
this.labels[j].abbr = this.datepicker.dateFilter(pickerDates[j].date, this.datepicker.formatDayHeader);
|
1533
|
+
this.labels[j].full = this.datepicker.dateFilter(pickerDates[j].date, 'EEEE');
|
1534
|
+
}
|
1535
|
+
this.title = this.datepicker.dateFilter(this.datepicker.activeDate, this.datepicker.formatDayTitle);
|
1536
|
+
const oldDateRange = __classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_getDateRange).call(this, this.rows);
|
1537
|
+
this.rows = this.datepicker.createCalendarRows(pickerDates, 7);
|
1538
|
+
const newDateRange = __classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_getDateRange).call(this, this.rows);
|
1539
|
+
if (!__classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_dateRangeRowsAreEqual).call(this, oldDateRange, newDateRange)) {
|
1540
|
+
// Safety check
|
1509
1541
|
/* istanbul ignore else */
|
1510
|
-
|
1511
|
-
if (numDisplayedFromPreviousMonth > 0) {
|
1512
|
-
firstDate.setDate(-numDisplayedFromPreviousMonth + 1);
|
1513
|
-
}
|
1514
|
-
// 42 is the number of days on a six-week calendar
|
1515
|
-
const days = this.getDates(firstDate, 42);
|
1516
|
-
const pickerDates = [];
|
1517
|
-
for (let i = 0; i < 42; i++) {
|
1518
|
-
const _dateObject = this.datepicker.createDateObject(days[i], this.datepicker.formatDay, days[i].getMonth() !== month, this.datepicker.datepickerId + '-' + i);
|
1519
|
-
pickerDates[i] = _dateObject;
|
1520
|
-
}
|
1521
|
-
this.labels = [];
|
1522
|
-
for (let j = 0; j < 7; j++) {
|
1523
|
-
this.labels[j] = {};
|
1524
|
-
this.labels[j].abbr = this.datepicker.dateFilter(pickerDates[j].date, this.datepicker.formatDayHeader);
|
1525
|
-
this.labels[j].full = this.datepicker.dateFilter(pickerDates[j].date, 'EEEE');
|
1526
|
-
}
|
1527
|
-
this.title = this.datepicker.dateFilter(this.datepicker.activeDate, this.datepicker.formatDayTitle);
|
1528
|
-
const oldDateRange = this.getDateRange(this.rows);
|
1529
|
-
this.rows = this.datepicker.createCalendarRows(pickerDates, 7);
|
1530
|
-
const newDateRange = this.getDateRange(this.rows);
|
1531
|
-
if (!this.dateRangeRowsAreEqual(oldDateRange, newDateRange)) {
|
1542
|
+
if (newDateRange) {
|
1532
1543
|
this.calendarDateRangeChange.next({
|
1533
1544
|
startDate: newDateRange.startDate,
|
1534
1545
|
endDate: newDateRange.endDate,
|
1535
1546
|
});
|
1536
1547
|
}
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
dateIndex
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
};
|
1604
|
-
row[dateIndex] = newDate;
|
1605
|
-
}
|
1548
|
+
else {
|
1549
|
+
this.calendarDateRangeChange.next(undefined);
|
1550
|
+
}
|
1551
|
+
}
|
1552
|
+
}, _SkyDayPickerComponent_keydownDays = function _SkyDayPickerComponent_keydownDays(key, event) {
|
1553
|
+
let date = this.datepicker.activeDate.getDate();
|
1554
|
+
/* istanbul ignore else */
|
1555
|
+
/* sanity check */
|
1556
|
+
if (key === 'left') {
|
1557
|
+
date = date - 1;
|
1558
|
+
}
|
1559
|
+
else if (key === 'up') {
|
1560
|
+
date = date - 7;
|
1561
|
+
}
|
1562
|
+
else if (key === 'right') {
|
1563
|
+
date = date + 1;
|
1564
|
+
}
|
1565
|
+
else if (key === 'down') {
|
1566
|
+
date = date + 7;
|
1567
|
+
}
|
1568
|
+
else if (key === 'pageup' || key === 'pagedown') {
|
1569
|
+
const month = this.datepicker.activeDate.getMonth() + (key === 'pageup' ? -1 : 1);
|
1570
|
+
this.datepicker.activeDate.setMonth(month, 1);
|
1571
|
+
date = Math.min(__classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_getDaysInMonth).call(this, this.datepicker.activeDate.getFullYear(), this.datepicker.activeDate.getMonth()), date);
|
1572
|
+
}
|
1573
|
+
else if (key === 'home') {
|
1574
|
+
date = 1;
|
1575
|
+
}
|
1576
|
+
else if (key === 'end') {
|
1577
|
+
date = __classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_getDaysInMonth).call(this, this.datepicker.activeDate.getFullYear(), this.datepicker.activeDate.getMonth());
|
1578
|
+
}
|
1579
|
+
this.datepicker.activeDate.setDate(date);
|
1580
|
+
}, _SkyDayPickerComponent_getDaysInMonth = function _SkyDayPickerComponent_getDaysInMonth(year, month) {
|
1581
|
+
return month === 1 &&
|
1582
|
+
year % 4 === 0 &&
|
1583
|
+
(year % 400 === 0 || year % 100 !== 0)
|
1584
|
+
? 29
|
1585
|
+
: __classPrivateFieldGet(this, _SkyDayPickerComponent_daysInMonth, "f")[month];
|
1586
|
+
}, _SkyDayPickerComponent_applyCustomDates = function _SkyDayPickerComponent_applyCustomDates(customDates, dateRows) {
|
1587
|
+
let date;
|
1588
|
+
let newDate;
|
1589
|
+
let dateIndex;
|
1590
|
+
/* istanbul ignore else */
|
1591
|
+
if (customDates && dateRows) {
|
1592
|
+
customDates.forEach((customDate) => {
|
1593
|
+
dateIndex = -1;
|
1594
|
+
dateRows.forEach((row) => {
|
1595
|
+
if (dateIndex === -1) {
|
1596
|
+
dateIndex = row.findIndex((d) => {
|
1597
|
+
return d.date.getTime() === customDate.date.getTime();
|
1598
|
+
});
|
1599
|
+
if (dateIndex > -1) {
|
1600
|
+
date = row[dateIndex];
|
1601
|
+
// Replace the date with a new instance so the display gets updated.
|
1602
|
+
newDate = {
|
1603
|
+
current: date.current,
|
1604
|
+
date: date.date,
|
1605
|
+
disabled: !!date.disabled || !!customDate.disabled,
|
1606
|
+
keyDate: !!customDate.keyDate || !!date.keyDate,
|
1607
|
+
keyDateText: customDate.keyDateText || date.keyDateText,
|
1608
|
+
label: date.label,
|
1609
|
+
secondary: date.secondary,
|
1610
|
+
selected: date.selected,
|
1611
|
+
uid: date.uid,
|
1612
|
+
};
|
1613
|
+
row[dateIndex] = newDate;
|
1606
1614
|
}
|
1607
|
-
}
|
1615
|
+
}
|
1608
1616
|
});
|
1609
|
-
}
|
1617
|
+
});
|
1610
1618
|
}
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
}
|
1616
|
-
else if ((rangeA && !rangeB) || (!rangeA && rangeB)) {
|
1617
|
-
return false;
|
1618
|
-
}
|
1619
|
-
return (this.compareDays(rangeA.startDate, rangeB.startDate) === 0 &&
|
1620
|
-
this.compareDays(rangeA.endDate, rangeB.endDate) === 0);
|
1619
|
+
}, _SkyDayPickerComponent_dateRangeRowsAreEqual = function _SkyDayPickerComponent_dateRangeRowsAreEqual(rangeA, rangeB) {
|
1620
|
+
/* istanbul ignore if */
|
1621
|
+
if (!rangeA && !rangeB) {
|
1622
|
+
return true;
|
1621
1623
|
}
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
return {
|
1626
|
-
startDate: rows[0][0].date,
|
1627
|
-
endDate: rows[rows.length - 1][rows[rows.length - 1].length - 1].date,
|
1628
|
-
};
|
1629
|
-
}
|
1624
|
+
else if (rangeA && rangeB) {
|
1625
|
+
return (__classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_compareDays).call(this, rangeA.startDate, rangeB.startDate) === 0 &&
|
1626
|
+
__classPrivateFieldGet(this, _SkyDayPickerComponent_instances, "m", _SkyDayPickerComponent_compareDays).call(this, rangeA.endDate, rangeB.endDate) === 0);
|
1630
1627
|
}
|
1631
|
-
|
1628
|
+
else {
|
1629
|
+
return false;
|
1630
|
+
}
|
1631
|
+
}, _SkyDayPickerComponent_getDateRange = function _SkyDayPickerComponent_getDateRange(rows) {
|
1632
|
+
/* istanbul ignore else */
|
1633
|
+
if (rows && rows.length > 0) {
|
1634
|
+
return {
|
1635
|
+
startDate: rows[0][0].date,
|
1636
|
+
endDate: rows[rows.length - 1][rows[rows.length - 1].length - 1].date,
|
1637
|
+
};
|
1638
|
+
}
|
1639
|
+
return undefined;
|
1640
|
+
};
|
1632
1641
|
SkyDayPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDayPickerComponent, deps: [{ token: SkyDatepickerCalendarInnerComponent }], target: i0.ɵɵFactoryTarget.Component });
|
1633
1642
|
SkyDayPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDayPickerComponent, selector: "sky-daypicker", inputs: { customDates: "customDates", isWaiting: "isWaiting" }, outputs: { calendarDateRangeChange: "calendarDateRangeChange" }, ngImport: i0, template: "<div *ngIf=\"datepicker.datepickerMode === 'day'\" class=\"sky-daypicker-wrapper\">\n <table\n class=\"sky-daypicker-table\"\n role=\"grid\"\n [attr.aria-labelledby]=\"datepicker.datepickerId + '-title'\"\n >\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\" scope=\"col\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th scope=\"col\" [attr.colspan]=\"5\">\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === datepicker.maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled':\n datepicker.datepickerMode === datepicker.maxMode\n }\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\" scope=\"col\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let label of labels\"\n class=\"sky-datepicker-center sky-datepicker-weekdays\"\n >\n <small [attr.aria-label]=\"label.full\">\n <b>{{ label.abbr }}</b>\n </small>\n </th>\n </tr>\n </thead>\n <tbody>\n <!-- Wait indicator for async custom date stream -->\n <sky-wait [isWaiting]=\"isWaiting\"> </sky-wait>\n <ng-template ngFor [ngForOf]=\"rows\" let-row=\"$implicit\" let-index=\"index\">\n <tr role=\"row\">\n <td\n *ngFor=\"let date of row\"\n class=\"sky-datepicker-center\"\n role=\"gridcell\"\n [id]=\"date.uid\"\n >\n <sky-daypicker-cell\n [activeDateHasChanged]=\"activeDateHasChanged\"\n [date]=\"date\"\n >\n </sky-daypicker-cell>\n </td>\n </tr>\n </ng-template>\n </tbody>\n </table>\n</div>\n", styles: [":host-context(.sky-theme-modern) :host:focus{outline:none}.sky-theme-modern :host:focus{outline:none}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "component", type: i3$1.λ14, selector: "sky-wait", inputs: ["ariaLabel", "isWaiting", "isFullPage", "isNonBlocking"] }, { kind: "component", type: SkyDayPickerCellComponent, selector: "sky-daypicker-cell", inputs: ["activeDateHasChanged", "date"] }] });
|
1634
1643
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDayPickerComponent, decorators: [{
|
@@ -1642,12 +1651,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
1642
1651
|
type: Input
|
1643
1652
|
}] } });
|
1644
1653
|
|
1654
|
+
var _SkyMonthPickerComponent_instances, _SkyMonthPickerComponent_compareMonth, _SkyMonthPickerComponent_refreshMonthView, _SkyMonthPickerComponent_keydownMonths;
|
1645
1655
|
/**
|
1646
1656
|
* @internal
|
1647
1657
|
*/
|
1648
1658
|
class SkyMonthPickerComponent {
|
1649
1659
|
constructor(datepicker) {
|
1660
|
+
_SkyMonthPickerComponent_instances.add(this);
|
1650
1661
|
this.rows = [];
|
1662
|
+
this.title = '';
|
1651
1663
|
this.datepicker = datepicker;
|
1652
1664
|
}
|
1653
1665
|
ngOnInit() {
|
@@ -1655,83 +1667,84 @@ class SkyMonthPickerComponent {
|
|
1655
1667
|
years: 1,
|
1656
1668
|
};
|
1657
1669
|
this.datepicker.setRefreshViewHandler(() => {
|
1658
|
-
this.
|
1670
|
+
__classPrivateFieldGet(this, _SkyMonthPickerComponent_instances, "m", _SkyMonthPickerComponent_refreshMonthView).call(this);
|
1659
1671
|
}, 'month');
|
1660
|
-
this.datepicker.setCompareHandler(this
|
1672
|
+
this.datepicker.setCompareHandler(__classPrivateFieldGet(this, _SkyMonthPickerComponent_instances, "m", _SkyMonthPickerComponent_compareMonth), 'month');
|
1661
1673
|
this.datepicker.refreshView();
|
1662
1674
|
this.datepicker.setKeydownHandler((key, event) => {
|
1663
|
-
this.
|
1675
|
+
__classPrivateFieldGet(this, _SkyMonthPickerComponent_instances, "m", _SkyMonthPickerComponent_keydownMonths).call(this, key, event);
|
1664
1676
|
}, 'month');
|
1665
1677
|
}
|
1666
|
-
compareMonth(date1, date2) {
|
1667
|
-
const d1 = new Date(date1.getFullYear(), date1.getMonth());
|
1668
|
-
const d2 = new Date(date2.getFullYear(), date2.getMonth());
|
1669
|
-
return d1.getTime() - d2.getTime();
|
1670
|
-
}
|
1671
|
-
refreshMonthView() {
|
1672
|
-
const months = new Array(12);
|
1673
|
-
const year = this.datepicker.activeDate.getFullYear();
|
1674
|
-
let date;
|
1675
|
-
for (let i = 0; i < 12; i++) {
|
1676
|
-
date = new Date(year, i, 1);
|
1677
|
-
date = this.datepicker.fixTimeZone(date);
|
1678
|
-
months[i] = this.datepicker.createDateObject(date, this.datepicker.formatMonth, false, this.datepicker.datepickerId + '-' + i);
|
1679
|
-
}
|
1680
|
-
this.title = this.datepicker.dateFilter(this.datepicker.activeDate, this.datepicker.formatMonthTitle);
|
1681
|
-
this.rows = this.datepicker.createCalendarRows(months, this.datepicker.monthColLimit);
|
1682
|
-
}
|
1683
|
-
keydownMonths(key, event) {
|
1684
|
-
let date = this.datepicker.activeDate.getMonth();
|
1685
|
-
/* istanbul ignore else */
|
1686
|
-
/* sanity check */
|
1687
|
-
if (key === 'left') {
|
1688
|
-
date = date - 1;
|
1689
|
-
}
|
1690
|
-
else if (key === 'up') {
|
1691
|
-
date = date - this.datepicker.monthColLimit;
|
1692
|
-
}
|
1693
|
-
else if (key === 'right') {
|
1694
|
-
date = date + 1;
|
1695
|
-
}
|
1696
|
-
else if (key === 'down') {
|
1697
|
-
date = date + this.datepicker.monthColLimit;
|
1698
|
-
}
|
1699
|
-
else if (key === 'pageup' || key === 'pagedown') {
|
1700
|
-
const year = this.datepicker.activeDate.getFullYear() + (key === 'pageup' ? -1 : 1);
|
1701
|
-
this.datepicker.activeDate.setFullYear(year);
|
1702
|
-
}
|
1703
|
-
else if (key === 'home') {
|
1704
|
-
date = 0;
|
1705
|
-
}
|
1706
|
-
else if (key === 'end') {
|
1707
|
-
date = 11;
|
1708
|
-
}
|
1709
|
-
this.datepicker.activeDate.setMonth(date);
|
1710
|
-
}
|
1711
1678
|
}
|
1679
|
+
_SkyMonthPickerComponent_instances = new WeakSet(), _SkyMonthPickerComponent_compareMonth = function _SkyMonthPickerComponent_compareMonth(date1, date2) {
|
1680
|
+
const d1 = new Date(date1.getFullYear(), date1.getMonth());
|
1681
|
+
const d2 = new Date(date2.getFullYear(), date2.getMonth());
|
1682
|
+
return d1.getTime() - d2.getTime();
|
1683
|
+
}, _SkyMonthPickerComponent_refreshMonthView = function _SkyMonthPickerComponent_refreshMonthView() {
|
1684
|
+
const months = new Array(12);
|
1685
|
+
const year = this.datepicker.activeDate.getFullYear();
|
1686
|
+
let date;
|
1687
|
+
for (let i = 0; i < 12; i++) {
|
1688
|
+
date = new Date(year, i, 1);
|
1689
|
+
date = this.datepicker.fixTimeZone(date);
|
1690
|
+
months[i] = this.datepicker.createDateObject(date, this.datepicker.formatMonth, false, this.datepicker.datepickerId + '-' + i);
|
1691
|
+
}
|
1692
|
+
this.title = this.datepicker.dateFilter(this.datepicker.activeDate, this.datepicker.formatMonthTitle);
|
1693
|
+
this.rows = this.datepicker.createCalendarRows(months, this.datepicker.monthColLimit);
|
1694
|
+
}, _SkyMonthPickerComponent_keydownMonths = function _SkyMonthPickerComponent_keydownMonths(key, event) {
|
1695
|
+
let date = this.datepicker.activeDate.getMonth();
|
1696
|
+
/* istanbul ignore else */
|
1697
|
+
/* sanity check */
|
1698
|
+
if (key === 'left') {
|
1699
|
+
date = date - 1;
|
1700
|
+
}
|
1701
|
+
else if (key === 'up') {
|
1702
|
+
date = date - this.datepicker.monthColLimit;
|
1703
|
+
}
|
1704
|
+
else if (key === 'right') {
|
1705
|
+
date = date + 1;
|
1706
|
+
}
|
1707
|
+
else if (key === 'down') {
|
1708
|
+
date = date + this.datepicker.monthColLimit;
|
1709
|
+
}
|
1710
|
+
else if (key === 'pageup' || key === 'pagedown') {
|
1711
|
+
const year = this.datepicker.activeDate.getFullYear() + (key === 'pageup' ? -1 : 1);
|
1712
|
+
this.datepicker.activeDate.setFullYear(year);
|
1713
|
+
}
|
1714
|
+
else if (key === 'home') {
|
1715
|
+
date = 0;
|
1716
|
+
}
|
1717
|
+
else if (key === 'end') {
|
1718
|
+
date = 11;
|
1719
|
+
}
|
1720
|
+
this.datepicker.activeDate.setMonth(date);
|
1721
|
+
};
|
1712
1722
|
SkyMonthPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyMonthPickerComponent, deps: [{ token: SkyDatepickerCalendarInnerComponent }], target: i0.ɵɵFactoryTarget.Component });
|
1713
|
-
SkyMonthPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyMonthPickerComponent, selector: "sky-monthpicker", ngImport: i0, template: "<table *ngIf=\"datepicker.datepickerMode === 'month'\" role=\"grid\">\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th\n [attr.colspan]=\"\n datepicker.monthColLimit - 2 <= 0 ? 1 : datepicker.monthColLimit - 2\n \"\n >\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled': datepicker.datepickerMode === maxMode\n }\"\n tabindex=\"-1\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of rows\">\n <td\n *ngFor=\"let date of row\"\n class=\"text-center\"\n role=\"gridcell\"\n id=\"{{ date.uid }}\"\n >\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-datepicker-btn-date\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date)\n }\"\n [disabled]=\"date.disabled\"\n (click)=\"datepicker.selectCalendar($event, date.date)\"\n tabindex=\"-1\"\n >\n <span [ngClass]=\"{ 'sky-datepicker-current': date.current }\">{{\n date.label\n }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", styles: [":host-context(.sky-theme-modern) :host:focus{outline:none}.sky-theme-modern :host:focus{outline:none}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }] });
|
1723
|
+
SkyMonthPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyMonthPickerComponent, selector: "sky-monthpicker", ngImport: i0, template: "<table *ngIf=\"datepicker.datepickerMode === 'month'\" role=\"grid\">\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th\n [attr.colspan]=\"\n datepicker.monthColLimit - 2 <= 0 ? 1 : datepicker.monthColLimit - 2\n \"\n >\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === datepicker.maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled': datepicker.datepickerMode === datepicker.maxMode\n }\"\n tabindex=\"-1\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of rows\">\n <td\n *ngFor=\"let date of row\"\n class=\"text-center\"\n role=\"gridcell\"\n id=\"{{ date.uid }}\"\n >\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-datepicker-btn-date\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date)\n }\"\n [disabled]=\"date.disabled\"\n (click)=\"datepicker.selectCalendar($event, date.date)\"\n tabindex=\"-1\"\n >\n <span [ngClass]=\"{ 'sky-datepicker-current': date.current }\">{{\n date.label\n }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", styles: [":host-context(.sky-theme-modern) :host:focus{outline:none}.sky-theme-modern :host:focus{outline:none}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }] });
|
1714
1724
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyMonthPickerComponent, decorators: [{
|
1715
1725
|
type: Component,
|
1716
|
-
args: [{ selector: 'sky-monthpicker', template: "<table *ngIf=\"datepicker.datepickerMode === 'month'\" role=\"grid\">\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th\n [attr.colspan]=\"\n datepicker.monthColLimit - 2 <= 0 ? 1 : datepicker.monthColLimit - 2\n \"\n >\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled': datepicker.datepickerMode === maxMode\n }\"\n tabindex=\"-1\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of rows\">\n <td\n *ngFor=\"let date of row\"\n class=\"text-center\"\n role=\"gridcell\"\n id=\"{{ date.uid }}\"\n >\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-datepicker-btn-date\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date)\n }\"\n [disabled]=\"date.disabled\"\n (click)=\"datepicker.selectCalendar($event, date.date)\"\n tabindex=\"-1\"\n >\n <span [ngClass]=\"{ 'sky-datepicker-current': date.current }\">{{\n date.label\n }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", styles: [":host-context(.sky-theme-modern) :host:focus{outline:none}.sky-theme-modern :host:focus{outline:none}\n"] }]
|
1726
|
+
args: [{ selector: 'sky-monthpicker', template: "<table *ngIf=\"datepicker.datepickerMode === 'month'\" role=\"grid\">\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th\n [attr.colspan]=\"\n datepicker.monthColLimit - 2 <= 0 ? 1 : datepicker.monthColLimit - 2\n \"\n >\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === datepicker.maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled': datepicker.datepickerMode === datepicker.maxMode\n }\"\n tabindex=\"-1\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of rows\">\n <td\n *ngFor=\"let date of row\"\n class=\"text-center\"\n role=\"gridcell\"\n id=\"{{ date.uid }}\"\n >\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-datepicker-btn-date\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date)\n }\"\n [disabled]=\"date.disabled\"\n (click)=\"datepicker.selectCalendar($event, date.date)\"\n tabindex=\"-1\"\n >\n <span [ngClass]=\"{ 'sky-datepicker-current': date.current }\">{{\n date.label\n }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", styles: [":host-context(.sky-theme-modern) :host:focus{outline:none}.sky-theme-modern :host:focus{outline:none}\n"] }]
|
1717
1727
|
}], ctorParameters: function () { return [{ type: SkyDatepickerCalendarInnerComponent }]; } });
|
1718
1728
|
|
1729
|
+
var _SkyYearPickerComponent_instances, _SkyYearPickerComponent_compareYears, _SkyYearPickerComponent_refreshYearView, _SkyYearPickerComponent_keydownYears;
|
1719
1730
|
/**
|
1720
1731
|
* @internal
|
1721
1732
|
*/
|
1722
1733
|
class SkyYearPickerComponent {
|
1723
1734
|
constructor(datepicker) {
|
1735
|
+
_SkyYearPickerComponent_instances.add(this);
|
1724
1736
|
this.rows = [];
|
1737
|
+
this.title = '';
|
1725
1738
|
this.datepicker = datepicker;
|
1726
1739
|
}
|
1727
1740
|
ngOnInit() {
|
1728
1741
|
this.datepicker.stepYear = { years: this.datepicker.yearRange };
|
1729
1742
|
this.datepicker.setRefreshViewHandler(() => {
|
1730
|
-
this.
|
1743
|
+
__classPrivateFieldGet(this, _SkyYearPickerComponent_instances, "m", _SkyYearPickerComponent_refreshYearView).call(this);
|
1731
1744
|
}, 'year');
|
1732
|
-
this.datepicker.setCompareHandler(this
|
1745
|
+
this.datepicker.setCompareHandler(__classPrivateFieldGet(this, _SkyYearPickerComponent_instances, "m", _SkyYearPickerComponent_compareYears), 'year');
|
1733
1746
|
this.datepicker.setKeydownHandler((key, event) => {
|
1734
|
-
this.
|
1747
|
+
__classPrivateFieldGet(this, _SkyYearPickerComponent_instances, "m", _SkyYearPickerComponent_keydownYears).call(this, key, event);
|
1735
1748
|
}, 'year');
|
1736
1749
|
this.datepicker.refreshView();
|
1737
1750
|
}
|
@@ -1740,55 +1753,53 @@ class SkyYearPickerComponent {
|
|
1740
1753
|
this.datepicker.yearRange +
|
1741
1754
|
1);
|
1742
1755
|
}
|
1743
|
-
compareYears(date1, date2) {
|
1744
|
-
return date1.getFullYear() - date2.getFullYear();
|
1745
|
-
}
|
1746
|
-
refreshYearView() {
|
1747
|
-
const years = new Array(this.datepicker.yearRange);
|
1748
|
-
let date;
|
1749
|
-
const start = this.getStartingYear(this.datepicker.activeDate.getFullYear());
|
1750
|
-
for (let i = 0; i < this.datepicker.yearRange; i++) {
|
1751
|
-
date = new Date(this.datepicker.activeDate);
|
1752
|
-
date.setFullYear(start + i, 0, 1);
|
1753
|
-
years[i] = this.datepicker.createDateObject(date, this.datepicker.formatYear, false, this.datepicker.datepickerId + '-' + i);
|
1754
|
-
}
|
1755
|
-
this.title = [
|
1756
|
-
years[0].label,
|
1757
|
-
years[this.datepicker.yearRange - 1].label,
|
1758
|
-
].join(' - ');
|
1759
|
-
this.rows = this.datepicker.createCalendarRows(years, this.datepicker.yearColLimit);
|
1760
|
-
}
|
1761
|
-
keydownYears(key, event) {
|
1762
|
-
let date = this.datepicker.activeDate.getFullYear();
|
1763
|
-
/* istanbul ignore else */
|
1764
|
-
/* sanity check */
|
1765
|
-
if (key === 'left') {
|
1766
|
-
date = date - 1;
|
1767
|
-
}
|
1768
|
-
else if (key === 'up') {
|
1769
|
-
date = date - this.datepicker.yearColLimit;
|
1770
|
-
}
|
1771
|
-
else if (key === 'right') {
|
1772
|
-
date = date + 1;
|
1773
|
-
}
|
1774
|
-
else if (key === 'down') {
|
1775
|
-
date = date + this.datepicker.yearColLimit;
|
1776
|
-
}
|
1777
|
-
else if (key === 'pageup' || key === 'pagedown') {
|
1778
|
-
date += (key === 'pageup' ? -1 : 1) * this.datepicker.yearRange;
|
1779
|
-
}
|
1780
|
-
else if (key === 'home') {
|
1781
|
-
date = this.getStartingYear(this.datepicker.activeDate.getFullYear());
|
1782
|
-
}
|
1783
|
-
else if (key === 'end') {
|
1784
|
-
date =
|
1785
|
-
this.getStartingYear(this.datepicker.activeDate.getFullYear()) +
|
1786
|
-
this.datepicker.yearRange -
|
1787
|
-
1;
|
1788
|
-
}
|
1789
|
-
this.datepicker.activeDate.setFullYear(date);
|
1790
|
-
}
|
1791
1756
|
}
|
1757
|
+
_SkyYearPickerComponent_instances = new WeakSet(), _SkyYearPickerComponent_compareYears = function _SkyYearPickerComponent_compareYears(date1, date2) {
|
1758
|
+
return date1.getFullYear() - date2.getFullYear();
|
1759
|
+
}, _SkyYearPickerComponent_refreshYearView = function _SkyYearPickerComponent_refreshYearView() {
|
1760
|
+
const years = new Array(this.datepicker.yearRange);
|
1761
|
+
let date;
|
1762
|
+
const start = this.getStartingYear(this.datepicker.activeDate.getFullYear());
|
1763
|
+
for (let i = 0; i < this.datepicker.yearRange; i++) {
|
1764
|
+
date = new Date(this.datepicker.activeDate);
|
1765
|
+
date.setFullYear(start + i, 0, 1);
|
1766
|
+
years[i] = this.datepicker.createDateObject(date, this.datepicker.formatYear, false, this.datepicker.datepickerId + '-' + i);
|
1767
|
+
}
|
1768
|
+
this.title = [
|
1769
|
+
years[0].label,
|
1770
|
+
years[this.datepicker.yearRange - 1].label,
|
1771
|
+
].join(' - ');
|
1772
|
+
this.rows = this.datepicker.createCalendarRows(years, this.datepicker.yearColLimit);
|
1773
|
+
}, _SkyYearPickerComponent_keydownYears = function _SkyYearPickerComponent_keydownYears(key, event) {
|
1774
|
+
let date = this.datepicker.activeDate.getFullYear();
|
1775
|
+
/* istanbul ignore else */
|
1776
|
+
/* sanity check */
|
1777
|
+
if (key === 'left') {
|
1778
|
+
date = date - 1;
|
1779
|
+
}
|
1780
|
+
else if (key === 'up') {
|
1781
|
+
date = date - this.datepicker.yearColLimit;
|
1782
|
+
}
|
1783
|
+
else if (key === 'right') {
|
1784
|
+
date = date + 1;
|
1785
|
+
}
|
1786
|
+
else if (key === 'down') {
|
1787
|
+
date = date + this.datepicker.yearColLimit;
|
1788
|
+
}
|
1789
|
+
else if (key === 'pageup' || key === 'pagedown') {
|
1790
|
+
date += (key === 'pageup' ? -1 : 1) * this.datepicker.yearRange;
|
1791
|
+
}
|
1792
|
+
else if (key === 'home') {
|
1793
|
+
date = this.getStartingYear(this.datepicker.activeDate.getFullYear());
|
1794
|
+
}
|
1795
|
+
else if (key === 'end') {
|
1796
|
+
date =
|
1797
|
+
this.getStartingYear(this.datepicker.activeDate.getFullYear()) +
|
1798
|
+
this.datepicker.yearRange -
|
1799
|
+
1;
|
1800
|
+
}
|
1801
|
+
this.datepicker.activeDate.setFullYear(date);
|
1802
|
+
};
|
1792
1803
|
SkyYearPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyYearPickerComponent, deps: [{ token: SkyDatepickerCalendarInnerComponent }], target: i0.ɵɵFactoryTarget.Component });
|
1793
1804
|
SkyYearPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyYearPickerComponent, selector: "sky-yearpicker", ngImport: i0, template: "<table *ngIf=\"datepicker.datepickerMode === 'year'\" role=\"grid\">\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th\n [attr.colspan]=\"\n datepicker.yearColLimit - 2 <= 0 ? 1 : datepicker.yearColLimit - 2\n \"\n >\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n role=\"heading\"\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === datepicker.maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled': datepicker.datepickerMode === datepicker.maxMode\n }\"\n tabindex=\"-1\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of rows\">\n <td *ngFor=\"let date of row\" class=\"sky-datepicker-row\" role=\"gridcell\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-datepicker-btn-date\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date)\n }\"\n [disabled]=\"date.disabled\"\n (click)=\"datepicker.selectCalendar($event, date.date)\"\n tabindex=\"-1\"\n >\n <span [ngClass]=\"{ 'sky-datepicker-current': date.current }\">{{\n date.label\n }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", styles: [":host-context(.sky-theme-modern) :host:focus{outline:none}.sky-theme-modern :host:focus{outline:none}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }] });
|
1794
1805
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyYearPickerComponent, decorators: [{
|
@@ -1796,40 +1807,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
1796
1807
|
args: [{ selector: 'sky-yearpicker', template: "<table *ngIf=\"datepicker.datepickerMode === 'year'\" role=\"grid\">\n <thead>\n <tr>\n <th class=\"sky-datepicker-header-left\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-previous\"\n (click)=\"datepicker.moveCalendar($event, -1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-left\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-left\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n <th\n [attr.colspan]=\"\n datepicker.yearColLimit - 2 <= 0 ? 1 : datepicker.yearColLimit - 2\n \"\n >\n <button\n [id]=\"datepicker.datepickerId + '-title'\"\n role=\"heading\"\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-calendar-title\"\n (click)=\"datepicker.toggleModeCalendar($event)\"\n [disabled]=\"datepicker.datepickerMode === datepicker.maxMode\"\n [ngClass]=\"{\n 'sky-btn-disabled': datepicker.datepickerMode === datepicker.maxMode\n }\"\n tabindex=\"-1\"\n >\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th class=\"sky-datepicker-header-right\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-btn-sm sky-datepicker-btn-next\"\n (click)=\"datepicker.moveCalendar($event, 1)\"\n tabindex=\"-1\"\n >\n <sky-icon\n class=\"sky-datepicker-chevron-default\"\n icon=\"chevron-right\"\n ></sky-icon>\n <sky-icon\n class=\"sky-datepicker-chevron-modern\"\n icon=\"chevron-right\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of rows\">\n <td *ngFor=\"let date of row\" class=\"sky-datepicker-row\" role=\"gridcell\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-datepicker-btn-date\"\n [ngClass]=\"{\n 'sky-datepicker-btn-selected': date.selected,\n 'sky-btn-disabled': date.disabled,\n 'sky-btn-active': datepicker.isActive(date)\n }\"\n [disabled]=\"date.disabled\"\n (click)=\"datepicker.selectCalendar($event, date.date)\"\n tabindex=\"-1\"\n >\n <span [ngClass]=\"{ 'sky-datepicker-current': date.current }\">{{\n date.label\n }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", styles: [":host-context(.sky-theme-modern) :host:focus{outline:none}.sky-theme-modern :host:focus{outline:none}\n"] }]
|
1797
1808
|
}], ctorParameters: function () { return [{ type: SkyDatepickerCalendarInnerComponent }]; } });
|
1798
1809
|
|
1810
|
+
var _SkyDatepickerCalendarComponent_formatter, _SkyDatepickerCalendarComponent__startingDay, _SkyDatepickerCalendarComponent_config;
|
1799
1811
|
/**
|
1800
1812
|
* @internal
|
1801
1813
|
*/
|
1802
1814
|
class SkyDatepickerCalendarComponent {
|
1803
|
-
constructor(
|
1804
|
-
this.adapter = adapter;
|
1805
|
-
this.config = config;
|
1806
|
-
this.elementRef = elementRef;
|
1815
|
+
constructor(config) {
|
1807
1816
|
this.calendarDateRangeChange = new EventEmitter();
|
1808
1817
|
this.calendarModeChange = new EventEmitter();
|
1809
1818
|
this.selectedDateChange = new EventEmitter(undefined);
|
1810
1819
|
this._now = new Date();
|
1811
|
-
this
|
1820
|
+
_SkyDatepickerCalendarComponent_formatter.set(this, new SkyDateFormatter());
|
1821
|
+
_SkyDatepickerCalendarComponent__startingDay.set(this, 0);
|
1822
|
+
_SkyDatepickerCalendarComponent_config.set(this, void 0);
|
1823
|
+
__classPrivateFieldSet(this, _SkyDatepickerCalendarComponent_config, config, "f");
|
1812
1824
|
this.configureOptions();
|
1813
1825
|
}
|
1814
1826
|
/** starting day of the week from 0-6 (0=Sunday, ..., 6=Saturday) */
|
1815
1827
|
set startingDay(start) {
|
1816
|
-
this
|
1828
|
+
__classPrivateFieldSet(this, _SkyDatepickerCalendarComponent__startingDay, start ?? 0, "f");
|
1817
1829
|
}
|
1818
1830
|
get startingDay() {
|
1819
|
-
return this
|
1820
|
-
}
|
1821
|
-
/**
|
1822
|
-
* @internal
|
1823
|
-
* Indicates if the calendar element's visibility property is 'visible'.
|
1824
|
-
*/
|
1825
|
-
get isVisible() {
|
1826
|
-
return this.adapter.elementIsVisible();
|
1827
|
-
}
|
1828
|
-
ngAfterViewInit() {
|
1829
|
-
this.adapter.init(this.elementRef);
|
1831
|
+
return __classPrivateFieldGet(this, _SkyDatepickerCalendarComponent__startingDay, "f");
|
1830
1832
|
}
|
1831
1833
|
configureOptions() {
|
1832
|
-
Object.assign(this, this
|
1834
|
+
Object.assign(this, __classPrivateFieldGet(this, _SkyDatepickerCalendarComponent_config, "f"));
|
1833
1835
|
}
|
1834
1836
|
onCalendarDateRangeChange(event) {
|
1835
1837
|
this.calendarDateRangeChange.next(event);
|
@@ -1842,27 +1844,29 @@ class SkyDatepickerCalendarComponent {
|
|
1842
1844
|
}
|
1843
1845
|
writeValue(value) {
|
1844
1846
|
if (value !== undefined &&
|
1845
|
-
this.
|
1847
|
+
__classPrivateFieldGet(this, _SkyDatepickerCalendarComponent_formatter, "f").dateIsValid(value) &&
|
1846
1848
|
this.selectedDate !== undefined &&
|
1847
|
-
this.
|
1849
|
+
this.datepicker?.compareHandlerDay &&
|
1850
|
+
this.datepicker.compareHandlerDay(value, this.selectedDate) === 0) {
|
1848
1851
|
return;
|
1849
1852
|
}
|
1850
|
-
if (this.
|
1853
|
+
if (value && __classPrivateFieldGet(this, _SkyDatepickerCalendarComponent_formatter, "f").dateIsValid(value)) {
|
1851
1854
|
this.selectedDate = value;
|
1852
|
-
this.
|
1855
|
+
this.datepicker?.select(value, false);
|
1853
1856
|
}
|
1854
1857
|
else {
|
1855
1858
|
this.selectedDate = new Date();
|
1856
|
-
this.
|
1859
|
+
this.datepicker?.select(new Date(), false);
|
1857
1860
|
}
|
1858
1861
|
}
|
1859
1862
|
}
|
1860
|
-
|
1861
|
-
SkyDatepickerCalendarComponent.ɵ
|
1863
|
+
_SkyDatepickerCalendarComponent_formatter = new WeakMap(), _SkyDatepickerCalendarComponent__startingDay = new WeakMap(), _SkyDatepickerCalendarComponent_config = new WeakMap();
|
1864
|
+
SkyDatepickerCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerCalendarComponent, deps: [{ token: SkyDatepickerConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
1865
|
+
SkyDatepickerCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDatepickerCalendarComponent, selector: "sky-datepicker-calendar", inputs: { customDates: "customDates", isDaypickerWaiting: "isDaypickerWaiting", minDate: "minDate", maxDate: "maxDate", selectedDate: "selectedDate", startingDay: "startingDay" }, outputs: { calendarDateRangeChange: "calendarDateRangeChange", calendarModeChange: "calendarModeChange", selectedDateChange: "selectedDateChange" }, providers: [SkyDatepickerAdapterService], viewQueries: [{ propertyName: "datepicker", first: true, predicate: SkyDatepickerCalendarInnerComponent, descendants: true, read: SkyDatepickerCalendarInnerComponent, static: true }], ngImport: i0, template: "<div class=\"sky-datepicker-calendar\">\n <sky-datepicker-inner\n [customDates]=\"customDates\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selectedDate]=\"selectedDate\"\n [startingDay]=\"startingDay\"\n (calendarModeChange)=\"onCalendarModeChange($event)\"\n (selectedDateChange)=\"onSelectedDateChange($event)\"\n >\n <sky-daypicker\n tabindex=\"0\"\n [customDates]=\"customDates\"\n [isWaiting]=\"isDaypickerWaiting\"\n (calendarDateRangeChange)=\"onCalendarDateRangeChange($event)\"\n ></sky-daypicker>\n <sky-monthpicker tabindex=\"0\"></sky-monthpicker>\n <sky-yearpicker tabindex=\"0\"></sky-yearpicker>\n </sky-datepicker-inner>\n</div>\n", styles: [".sky-datepicker-calendar{display:block}\n"], dependencies: [{ kind: "component", type: SkyDatepickerCalendarInnerComponent, selector: "sky-datepicker-inner", inputs: ["customDates", "startingDay", "minDate", "maxDate", "selectedDate"], outputs: ["selectedDateChange", "calendarModeChange"] }, { kind: "component", type: SkyDayPickerComponent, selector: "sky-daypicker", inputs: ["customDates", "isWaiting"], outputs: ["calendarDateRangeChange"] }, { kind: "component", type: SkyMonthPickerComponent, selector: "sky-monthpicker" }, { kind: "component", type: SkyYearPickerComponent, selector: "sky-yearpicker" }] });
|
1862
1866
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerCalendarComponent, decorators: [{
|
1863
1867
|
type: Component,
|
1864
1868
|
args: [{ selector: 'sky-datepicker-calendar', providers: [SkyDatepickerAdapterService], template: "<div class=\"sky-datepicker-calendar\">\n <sky-datepicker-inner\n [customDates]=\"customDates\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selectedDate]=\"selectedDate\"\n [startingDay]=\"startingDay\"\n (calendarModeChange)=\"onCalendarModeChange($event)\"\n (selectedDateChange)=\"onSelectedDateChange($event)\"\n >\n <sky-daypicker\n tabindex=\"0\"\n [customDates]=\"customDates\"\n [isWaiting]=\"isDaypickerWaiting\"\n (calendarDateRangeChange)=\"onCalendarDateRangeChange($event)\"\n ></sky-daypicker>\n <sky-monthpicker tabindex=\"0\"></sky-monthpicker>\n <sky-yearpicker tabindex=\"0\"></sky-yearpicker>\n </sky-datepicker-inner>\n</div>\n", styles: [".sky-datepicker-calendar{display:block}\n"] }]
|
1865
|
-
}], ctorParameters: function () { return [{ type:
|
1869
|
+
}], ctorParameters: function () { return [{ type: SkyDatepickerConfigService }]; }, propDecorators: { customDates: [{
|
1866
1870
|
type: Input
|
1867
1871
|
}], isDaypickerWaiting: [{
|
1868
1872
|
type: Input
|
@@ -1880,7 +1884,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
1880
1884
|
type: Output
|
1881
1885
|
}], selectedDateChange: [{
|
1882
1886
|
type: Output
|
1883
|
-
}],
|
1887
|
+
}], datepicker: [{
|
1884
1888
|
type: ViewChild,
|
1885
1889
|
args: [SkyDatepickerCalendarInnerComponent, {
|
1886
1890
|
read: SkyDatepickerCalendarInnerComponent,
|
@@ -1888,6 +1892,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
1888
1892
|
}]
|
1889
1893
|
}] } });
|
1890
1894
|
|
1895
|
+
var _SkyDatepickerComponent_instances, _SkyDatepickerComponent_affixer, _SkyDatepickerComponent_calendarUnsubscribe, _SkyDatepickerComponent_customDatesSubscription, _SkyDatepickerComponent_ngUnsubscribe, _SkyDatepickerComponent_overlay, _SkyDatepickerComponent_overlayKeydownListner, _SkyDatepickerComponent__calendarRef, _SkyDatepickerComponent__disabled, _SkyDatepickerComponent__selectedDate, _SkyDatepickerComponent_affixService, _SkyDatepickerComponent_changeDetector, _SkyDatepickerComponent_coreAdapter, _SkyDatepickerComponent_overlayService, _SkyDatepickerComponent_closePicker, _SkyDatepickerComponent_openPicker, _SkyDatepickerComponent_createAffixer, _SkyDatepickerComponent_destroyAffixer, _SkyDatepickerComponent_createOverlay, _SkyDatepickerComponent_destroyOverlay, _SkyDatepickerComponent_addKeydownListener, _SkyDatepickerComponent_removePickerEventListeners, _SkyDatepickerComponent_cancelCustomDatesSubscription;
|
1891
1896
|
let nextId$1 = 0;
|
1892
1897
|
/**
|
1893
1898
|
* Creates the datepicker button and calendar.
|
@@ -1895,11 +1900,8 @@ let nextId$1 = 0;
|
|
1895
1900
|
*/
|
1896
1901
|
class SkyDatepickerComponent {
|
1897
1902
|
constructor(affixService, changeDetector, coreAdapter, overlayService, inputBoxHostService, themeSvc) {
|
1898
|
-
this.affixService = affixService;
|
1899
|
-
this.changeDetector = changeDetector;
|
1900
|
-
this.coreAdapter = coreAdapter;
|
1901
|
-
this.overlayService = overlayService;
|
1902
1903
|
this.inputBoxHostService = inputBoxHostService;
|
1904
|
+
_SkyDatepickerComponent_instances.add(this);
|
1903
1905
|
/**
|
1904
1906
|
* Adds a class to the datepicker.
|
1905
1907
|
* @default ""
|
@@ -1915,86 +1917,74 @@ class SkyDatepickerComponent {
|
|
1915
1917
|
this.isDaypickerWaiting = false;
|
1916
1918
|
this.isOpen = false;
|
1917
1919
|
this.isVisible = false;
|
1918
|
-
this
|
1919
|
-
this
|
1920
|
+
_SkyDatepickerComponent_affixer.set(this, void 0);
|
1921
|
+
_SkyDatepickerComponent_calendarUnsubscribe.set(this, new Subject());
|
1922
|
+
_SkyDatepickerComponent_customDatesSubscription.set(this, void 0);
|
1923
|
+
_SkyDatepickerComponent_ngUnsubscribe.set(this, new Subject());
|
1924
|
+
_SkyDatepickerComponent_overlay.set(this, void 0);
|
1925
|
+
_SkyDatepickerComponent_overlayKeydownListner.set(this, void 0);
|
1926
|
+
_SkyDatepickerComponent__calendarRef.set(this, void 0);
|
1927
|
+
_SkyDatepickerComponent__disabled.set(this, false);
|
1928
|
+
_SkyDatepickerComponent__selectedDate.set(this, void 0);
|
1929
|
+
_SkyDatepickerComponent_affixService.set(this, void 0);
|
1930
|
+
_SkyDatepickerComponent_changeDetector.set(this, void 0);
|
1931
|
+
_SkyDatepickerComponent_coreAdapter.set(this, void 0);
|
1932
|
+
_SkyDatepickerComponent_overlayService.set(this, void 0);
|
1933
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_affixService, affixService, "f");
|
1934
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_changeDetector, changeDetector, "f");
|
1935
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_coreAdapter, coreAdapter, "f");
|
1936
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_overlayService, overlayService, "f");
|
1920
1937
|
const uniqueId = nextId$1++;
|
1921
1938
|
this.calendarId = `sky-datepicker-calendar-${uniqueId}`;
|
1922
1939
|
this.triggerButtonId = `sky-datepicker-button-${uniqueId}`;
|
1923
1940
|
// Update icons when theme changes.
|
1924
1941
|
themeSvc?.settingsChange
|
1925
|
-
.pipe(takeUntil(this
|
1942
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDatepickerComponent_ngUnsubscribe, "f")))
|
1926
1943
|
.subscribe(() => {
|
1927
|
-
this.
|
1944
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").markForCheck();
|
1928
1945
|
});
|
1929
1946
|
}
|
1930
|
-
/**
|
1931
|
-
* @internal
|
1932
|
-
* Indicates if the calendar button element or any of its children have focus.
|
1933
|
-
* @deprecated This property will be removed in the next major version release.
|
1934
|
-
*/
|
1935
|
-
get buttonIsFocused() {
|
1936
|
-
/* sanity check */
|
1937
|
-
/* istanbul ignore if */
|
1938
|
-
if (!this.triggerButtonRef) {
|
1939
|
-
return false;
|
1940
|
-
}
|
1941
|
-
const activeEl = document.activeElement;
|
1942
|
-
return this.triggerButtonRef.nativeElement === activeEl;
|
1943
|
-
}
|
1944
|
-
/**
|
1945
|
-
* @internal
|
1946
|
-
* Indicates if the calendar element or any of its children have focus.
|
1947
|
-
* @deprecated This property will be removed in the next major version release.
|
1948
|
-
*/
|
1949
|
-
get calendarIsFocused() {
|
1950
|
-
if (!this.calendarRef) {
|
1951
|
-
return false;
|
1952
|
-
}
|
1953
|
-
const focusedEl = document.activeElement;
|
1954
|
-
return this.calendarRef.nativeElement.contains(focusedEl);
|
1955
|
-
}
|
1956
|
-
/**
|
1957
|
-
* @internal
|
1958
|
-
* Indicates if the calendar element's visiblity property is 'visible'.
|
1959
|
-
* @deprecated This property will be removed in the next major version release.
|
1960
|
-
*/
|
1961
|
-
get calendarIsVisible() {
|
1962
|
-
return this.calendar ? this.calendar.isVisible : false;
|
1963
|
-
}
|
1964
1947
|
get disabled() {
|
1965
|
-
return this
|
1948
|
+
return __classPrivateFieldGet(this, _SkyDatepickerComponent__disabled, "f");
|
1966
1949
|
}
|
1967
1950
|
set disabled(value) {
|
1968
|
-
this
|
1969
|
-
this.
|
1951
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent__disabled, value, "f");
|
1952
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").markForCheck();
|
1970
1953
|
}
|
1971
1954
|
set selectedDate(value) {
|
1972
|
-
this
|
1955
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent__selectedDate, value, "f");
|
1973
1956
|
if (this.calendar) {
|
1974
|
-
this.calendar.writeValue(
|
1957
|
+
this.calendar.writeValue(value);
|
1975
1958
|
}
|
1976
1959
|
}
|
1960
|
+
get selectedDate() {
|
1961
|
+
return __classPrivateFieldGet(this, _SkyDatepickerComponent__selectedDate, "f");
|
1962
|
+
}
|
1977
1963
|
set calendarRef(value) {
|
1978
1964
|
if (value) {
|
1979
|
-
this
|
1965
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent__calendarRef, value, "f");
|
1980
1966
|
// Wait for the calendar component to render before gauging dimensions.
|
1981
1967
|
setTimeout(() => {
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1968
|
+
if (this.calendarRef) {
|
1969
|
+
this.calendar?.writeValue(this.selectedDate);
|
1970
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_destroyAffixer).call(this);
|
1971
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_createAffixer).call(this);
|
1972
|
+
setTimeout(() => {
|
1973
|
+
if (this.calendarRef) {
|
1974
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_coreAdapter, "f").getFocusableChildrenAndApplyFocus(this.calendarRef, '.sky-datepicker-calendar-inner', false);
|
1975
|
+
this.isVisible = true;
|
1976
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").markForCheck();
|
1977
|
+
}
|
1978
|
+
});
|
1979
|
+
}
|
1990
1980
|
});
|
1991
1981
|
}
|
1992
1982
|
}
|
1993
1983
|
get calendarRef() {
|
1994
|
-
return this
|
1984
|
+
return __classPrivateFieldGet(this, _SkyDatepickerComponent__calendarRef, "f");
|
1995
1985
|
}
|
1996
1986
|
ngOnInit() {
|
1997
|
-
if (this.inputBoxHostService) {
|
1987
|
+
if (this.inputBoxHostService && this.inputTemplateRef) {
|
1998
1988
|
this.inputBoxHostService.populate({
|
1999
1989
|
inputTemplate: this.inputTemplateRef,
|
2000
1990
|
buttonsTemplate: this.triggerButtonTemplateRef,
|
@@ -2003,34 +1993,34 @@ class SkyDatepickerComponent {
|
|
2003
1993
|
}
|
2004
1994
|
ngOnDestroy() {
|
2005
1995
|
this.dateChange.complete();
|
2006
|
-
this.
|
2007
|
-
this.
|
2008
|
-
this.
|
2009
|
-
this.
|
2010
|
-
this.
|
1996
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_ngUnsubscribe, "f").next();
|
1997
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_ngUnsubscribe, "f").complete();
|
1998
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_removePickerEventListeners).call(this);
|
1999
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_destroyAffixer).call(this);
|
2000
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_destroyOverlay).call(this);
|
2011
2001
|
}
|
2012
2002
|
onCalendarModeChange() {
|
2013
2003
|
// Let the calendar populate in the DOM before recalculating placement.
|
2014
2004
|
setTimeout(() => {
|
2015
|
-
this
|
2005
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_affixer, "f")?.reaffix();
|
2016
2006
|
});
|
2017
2007
|
}
|
2018
2008
|
onSelectedDateChange(value) {
|
2019
2009
|
this.dateChange.emit(value);
|
2020
|
-
this.
|
2010
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_closePicker).call(this);
|
2021
2011
|
}
|
2022
2012
|
onTriggerButtonClick() {
|
2023
2013
|
if (this.isOpen) {
|
2024
|
-
this.
|
2014
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_closePicker).call(this);
|
2025
2015
|
}
|
2026
2016
|
else {
|
2027
|
-
this.
|
2017
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_openPicker).call(this);
|
2028
2018
|
}
|
2029
2019
|
}
|
2030
2020
|
onCalendarDateRangeChange(event) {
|
2031
2021
|
/* istanbul ignore else */
|
2032
2022
|
if (event) {
|
2033
|
-
this.
|
2023
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_cancelCustomDatesSubscription).call(this);
|
2034
2024
|
const args = {
|
2035
2025
|
startDate: event.startDate,
|
2036
2026
|
endDate: event.endDate,
|
@@ -2042,15 +2032,15 @@ class SkyDatepickerComponent {
|
|
2042
2032
|
if (args.customDates) {
|
2043
2033
|
this.isDaypickerWaiting = true;
|
2044
2034
|
// Avoid an ExpressionChangedAfterItHasBeenCheckedError.
|
2045
|
-
this.
|
2046
|
-
this
|
2035
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").detectChanges();
|
2036
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_customDatesSubscription, args.customDates
|
2047
2037
|
.pipe(debounceTime(250))
|
2048
2038
|
.subscribe((result) => {
|
2049
2039
|
this.customDates = result;
|
2050
2040
|
this.isDaypickerWaiting = false;
|
2051
2041
|
// Trigger change detection in child components to show changes in the calendar.
|
2052
|
-
this.
|
2053
|
-
});
|
2042
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").markForCheck();
|
2043
|
+
}), "f");
|
2054
2044
|
}
|
2055
2045
|
else {
|
2056
2046
|
// If consumer returns an undefined value after custom dates have
|
@@ -2058,36 +2048,35 @@ class SkyDatepickerComponent {
|
|
2058
2048
|
if (this.customDates) {
|
2059
2049
|
this.customDates = undefined;
|
2060
2050
|
// Avoid an ExpressionChangedAfterItHasBeenCheckedError.
|
2061
|
-
this.
|
2051
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").detectChanges();
|
2062
2052
|
}
|
2063
2053
|
}
|
2064
2054
|
}
|
2065
2055
|
}
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
const affixer = this.affixService.createAffixer(this.calendarRef);
|
2056
|
+
}
|
2057
|
+
_SkyDatepickerComponent_affixer = new WeakMap(), _SkyDatepickerComponent_calendarUnsubscribe = new WeakMap(), _SkyDatepickerComponent_customDatesSubscription = new WeakMap(), _SkyDatepickerComponent_ngUnsubscribe = new WeakMap(), _SkyDatepickerComponent_overlay = new WeakMap(), _SkyDatepickerComponent_overlayKeydownListner = new WeakMap(), _SkyDatepickerComponent__calendarRef = new WeakMap(), _SkyDatepickerComponent__disabled = new WeakMap(), _SkyDatepickerComponent__selectedDate = new WeakMap(), _SkyDatepickerComponent_affixService = new WeakMap(), _SkyDatepickerComponent_changeDetector = new WeakMap(), _SkyDatepickerComponent_coreAdapter = new WeakMap(), _SkyDatepickerComponent_overlayService = new WeakMap(), _SkyDatepickerComponent_instances = new WeakSet(), _SkyDatepickerComponent_closePicker = function _SkyDatepickerComponent_closePicker() {
|
2058
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_destroyAffixer).call(this);
|
2059
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_destroyOverlay).call(this);
|
2060
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_removePickerEventListeners).call(this);
|
2061
|
+
this.triggerButtonRef?.nativeElement.focus();
|
2062
|
+
this.isOpen = false;
|
2063
|
+
}, _SkyDatepickerComponent_openPicker = function _SkyDatepickerComponent_openPicker() {
|
2064
|
+
this.isVisible = false;
|
2065
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").markForCheck();
|
2066
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_removePickerEventListeners).call(this);
|
2067
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_destroyOverlay).call(this);
|
2068
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_createOverlay).call(this);
|
2069
|
+
this.isOpen = true;
|
2070
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").markForCheck();
|
2071
|
+
}, _SkyDatepickerComponent_createAffixer = function _SkyDatepickerComponent_createAffixer() {
|
2072
|
+
if (this.calendarRef && this.triggerButtonRef) {
|
2073
|
+
const affixer = __classPrivateFieldGet(this, _SkyDatepickerComponent_affixService, "f").createAffixer(this.calendarRef);
|
2085
2074
|
// Hide calendar when trigger button is scrolled off screen.
|
2086
2075
|
affixer.placementChange
|
2087
|
-
.pipe(takeUntil(this
|
2076
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDatepickerComponent_calendarUnsubscribe, "f")))
|
2088
2077
|
.subscribe((change) => {
|
2089
2078
|
this.isVisible = change.placement !== null;
|
2090
|
-
this.
|
2079
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_changeDetector, "f").markForCheck();
|
2091
2080
|
});
|
2092
2081
|
affixer.affixTo(this.triggerButtonRef.nativeElement, {
|
2093
2082
|
autoFitContext: SkyAffixAutoFitContext.Viewport,
|
@@ -2096,66 +2085,59 @@ class SkyDatepickerComponent {
|
|
2096
2085
|
isSticky: true,
|
2097
2086
|
placement: 'below',
|
2098
2087
|
});
|
2099
|
-
this
|
2088
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_affixer, affixer, "f");
|
2100
2089
|
}
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
}
|
2090
|
+
}, _SkyDatepickerComponent_destroyAffixer = function _SkyDatepickerComponent_destroyAffixer() {
|
2091
|
+
/*istanbul ignore else*/
|
2092
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerComponent_affixer, "f")) {
|
2093
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_affixer, "f").destroy();
|
2094
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_affixer, undefined, "f");
|
2107
2095
|
}
|
2108
|
-
|
2109
|
-
|
2096
|
+
}, _SkyDatepickerComponent_createOverlay = function _SkyDatepickerComponent_createOverlay() {
|
2097
|
+
if (this.calendarTemplateRef) {
|
2098
|
+
const overlay = __classPrivateFieldGet(this, _SkyDatepickerComponent_overlayService, "f").create({
|
2110
2099
|
wrapperClass: this.pickerClass,
|
2111
2100
|
enableClose: false,
|
2112
2101
|
enablePointerEvents: false,
|
2113
2102
|
});
|
2114
2103
|
overlay.backdropClick
|
2115
|
-
.pipe(takeUntil(this
|
2104
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDatepickerComponent_calendarUnsubscribe, "f")))
|
2116
2105
|
.subscribe(() => {
|
2117
2106
|
/* istanbul ignore else */
|
2118
2107
|
if (this.isOpen) {
|
2119
|
-
this.
|
2108
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_closePicker).call(this);
|
2120
2109
|
}
|
2121
2110
|
});
|
2122
|
-
this.
|
2111
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_addKeydownListener).call(this);
|
2123
2112
|
overlay.attachTemplate(this.calendarTemplateRef);
|
2124
|
-
this
|
2125
|
-
}
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
this.overlayKeydownListner?.unsubscribe();
|
2113
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_overlay, overlay, "f");
|
2114
|
+
}
|
2115
|
+
}, _SkyDatepickerComponent_destroyOverlay = function _SkyDatepickerComponent_destroyOverlay() {
|
2116
|
+
/*istanbul ignore else*/
|
2117
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerComponent_overlay, "f")) {
|
2118
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_overlayService, "f").close(__classPrivateFieldGet(this, _SkyDatepickerComponent_overlay, "f"));
|
2119
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_overlay, undefined, "f");
|
2120
|
+
}
|
2121
|
+
}, _SkyDatepickerComponent_addKeydownListener = function _SkyDatepickerComponent_addKeydownListener() {
|
2122
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_overlayKeydownListner, fromEvent(window.document, 'keydown')
|
2123
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDatepickerComponent_ngUnsubscribe, "f")))
|
2124
|
+
.subscribe((event) => {
|
2125
|
+
const key = event.key?.toLowerCase();
|
2126
|
+
if (key === 'escape' && this.isOpen) {
|
2127
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_instances, "m", _SkyDatepickerComponent_closePicker).call(this);
|
2128
|
+
}
|
2129
|
+
}), "f");
|
2130
|
+
}, _SkyDatepickerComponent_removePickerEventListeners = function _SkyDatepickerComponent_removePickerEventListeners() {
|
2131
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_calendarUnsubscribe, "f").next();
|
2132
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_calendarUnsubscribe, "f").complete();
|
2133
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_calendarUnsubscribe, new Subject(), "f");
|
2134
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_overlayKeydownListner, "f")?.unsubscribe();
|
2135
|
+
}, _SkyDatepickerComponent_cancelCustomDatesSubscription = function _SkyDatepickerComponent_cancelCustomDatesSubscription() {
|
2136
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerComponent_customDatesSubscription, "f")) {
|
2137
|
+
__classPrivateFieldGet(this, _SkyDatepickerComponent_customDatesSubscription, "f").unsubscribe();
|
2138
|
+
__classPrivateFieldSet(this, _SkyDatepickerComponent_customDatesSubscription, undefined, "f");
|
2151
2139
|
}
|
2152
|
-
|
2153
|
-
if (this.customDatesSubscription) {
|
2154
|
-
this.customDatesSubscription.unsubscribe();
|
2155
|
-
this.customDatesSubscription = undefined;
|
2156
|
-
}
|
2157
|
-
}
|
2158
|
-
}
|
2140
|
+
};
|
2159
2141
|
SkyDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerComponent, deps: [{ token: i1.SkyAffixService }, { token: i0.ChangeDetectorRef }, { token: i1.SkyCoreAdapterService }, { token: i1.SkyOverlayService }, { token: i2$1.SkyInputBoxHostService, optional: true }, { token: i3$2.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
2160
2142
|
SkyDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDatepickerComponent, selector: "sky-datepicker", inputs: { pickerClass: "pickerClass" }, outputs: { calendarDateRangeChange: "calendarDateRangeChange" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: SkyDatepickerCalendarComponent, descendants: true }, { propertyName: "calendarRef", first: true, predicate: ["calendarRef"], descendants: true, read: ElementRef }, { propertyName: "calendarTemplateRef", first: true, predicate: ["calendarTemplateRef"], descendants: true, read: TemplateRef }, { propertyName: "triggerButtonRef", first: true, predicate: ["triggerButtonRef"], descendants: true, read: ElementRef }, { propertyName: "inputTemplateRef", first: true, predicate: ["inputTemplateRef"], descendants: true, read: TemplateRef, static: true }, { propertyName: "triggerButtonTemplateRef", first: true, predicate: ["triggerButtonTemplateRef"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<div class=\"sky-datepicker\">\n <ng-container *ngIf=\"!inputBoxHostService\">\n <div class=\"sky-input-group\">\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n <ng-container *ngTemplateOutlet=\"triggerButtonTemplateRef\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n<ng-template #inputTemplateRef>\n <ng-content></ng-content>\n</ng-template>\n\n<ng-template #triggerButtonTemplateRef>\n <div class=\"sky-input-group-btn\">\n <button\n aria-haspopup=\"dialog\"\n class=\"sky-btn sky-btn-default sky-input-group-datepicker-btn\"\n type=\"button\"\n [attr.aria-controls]=\"isOpen ? calendarId : null\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-label]=\"\n 'skyux_datepicker_trigger_button_label' | skyLibResources\n \"\n [attr.id]=\"triggerButtonId\"\n [attr.title]=\"'skyux_datepicker_trigger_button_label' | skyLibResources\"\n [disabled]=\"disabled\"\n (click)=\"onTriggerButtonClick()\"\n #triggerButtonRef\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"calendar\" size=\"lg\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"calendar\"\n size=\"lg\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </div>\n</ng-template>\n\n<ng-template #calendarTemplateRef>\n <div\n class=\"sky-datepicker-calendar-container sky-shadow sky-elevation-4\"\n role=\"dialog\"\n [attr.aria-labelledby]=\"triggerButtonId\"\n [attr.id]=\"calendarId\"\n [class.sky-datepicker-hidden]=\"!isVisible\"\n #calendarRef\n >\n <sky-datepicker-calendar\n [customDates]=\"customDates\"\n [isDaypickerWaiting]=\"isDaypickerWaiting\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [startingDay]=\"startingDay\"\n (calendarDateRangeChange)=\"onCalendarDateRangeChange($event)\"\n (calendarModeChange)=\"onCalendarModeChange()\"\n (selectedDateChange)=\"onSelectedDateChange($event)\"\n >\n </sky-datepicker-calendar>\n </div>\n</ng-template>\n", styles: [".sky-datepicker-calendar-container{position:fixed;border-radius:5px}.sky-datepicker-hidden{visibility:hidden}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i3$2.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "component", type: SkyDatepickerCalendarComponent, selector: "sky-datepicker-calendar", inputs: ["customDates", "isDaypickerWaiting", "minDate", "maxDate", "selectedDate", "startingDay"], outputs: ["calendarDateRangeChange", "calendarModeChange", "selectedDateChange"] }, { kind: "pipe", type: i3.SkyLibResourcesPipe, name: "skyLibResources" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
2161
2143
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerComponent, decorators: [{
|
@@ -2201,6 +2183,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
2201
2183
|
}]
|
2202
2184
|
}] } });
|
2203
2185
|
|
2186
|
+
var _SkyFuzzyDatepickerInputDirective_instances, _SkyFuzzyDatepickerInputDirective_value_get, _SkyFuzzyDatepickerInputDirective_value_set, _SkyFuzzyDatepickerInputDirective_control, _SkyFuzzyDatepickerInputDirective_dateFormatter, _SkyFuzzyDatepickerInputDirective_locale, _SkyFuzzyDatepickerInputDirective_preferredShortDateFormat, _SkyFuzzyDatepickerInputDirective_ngUnsubscribe, _SkyFuzzyDatepickerInputDirective__futureDisabled, _SkyFuzzyDatepickerInputDirective__dateFormat, _SkyFuzzyDatepickerInputDirective__disabled, _SkyFuzzyDatepickerInputDirective__maxDate, _SkyFuzzyDatepickerInputDirective__minDate, _SkyFuzzyDatepickerInputDirective__startingDay, _SkyFuzzyDatepickerInputDirective__value, _SkyFuzzyDatepickerInputDirective__yearRequired, _SkyFuzzyDatepickerInputDirective_changeDetector, _SkyFuzzyDatepickerInputDirective_configService, _SkyFuzzyDatepickerInputDirective_elementRef, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, _SkyFuzzyDatepickerInputDirective_renderer, _SkyFuzzyDatepickerInputDirective_resourcesService, _SkyFuzzyDatepickerInputDirective_datepickerComponent, _SkyFuzzyDatepickerInputDirective_onValueChange, _SkyFuzzyDatepickerInputDirective_setInputElementValue, _SkyFuzzyDatepickerInputDirective_getMaxDate, _SkyFuzzyDatepickerInputDirective_getMinDate, _SkyFuzzyDatepickerInputDirective_fuzzyDatesEqual, _SkyFuzzyDatepickerInputDirective_onChange, _SkyFuzzyDatepickerInputDirective_onTouched, _SkyFuzzyDatepickerInputDirective_onValidatorChange, _SkyFuzzyDatepickerInputDirective_updateValue;
|
2204
2187
|
const SKY_FUZZY_DATEPICKER_VALUE_ACCESSOR = {
|
2205
2188
|
provide: NG_VALUE_ACCESSOR,
|
2206
2189
|
useExisting: forwardRef(() => SkyFuzzyDatepickerInputDirective),
|
@@ -2213,38 +2196,60 @@ const SKY_FUZZY_DATEPICKER_VALIDATOR = {
|
|
2213
2196
|
};
|
2214
2197
|
class SkyFuzzyDatepickerInputDirective {
|
2215
2198
|
constructor(changeDetector, configService, elementRef, fuzzyDateService, localeProvider, renderer, resourcesService, datepickerComponent) {
|
2216
|
-
this
|
2217
|
-
this.configService = configService;
|
2218
|
-
this.elementRef = elementRef;
|
2219
|
-
this.fuzzyDateService = fuzzyDateService;
|
2220
|
-
this.localeProvider = localeProvider;
|
2221
|
-
this.renderer = renderer;
|
2222
|
-
this.resourcesService = resourcesService;
|
2223
|
-
this.datepickerComponent = datepickerComponent;
|
2199
|
+
_SkyFuzzyDatepickerInputDirective_instances.add(this);
|
2224
2200
|
/**
|
2225
2201
|
* Indicates whether to disable date validation on the fuzzy datepicker input.
|
2226
2202
|
* @default false
|
2227
2203
|
*/
|
2228
2204
|
this.skyDatepickerNoValidate = false;
|
2229
|
-
this
|
2230
|
-
this
|
2231
|
-
this
|
2232
|
-
this
|
2233
|
-
this
|
2205
|
+
_SkyFuzzyDatepickerInputDirective_control.set(this, void 0);
|
2206
|
+
_SkyFuzzyDatepickerInputDirective_dateFormatter.set(this, new SkyDateFormatter());
|
2207
|
+
_SkyFuzzyDatepickerInputDirective_locale.set(this, void 0);
|
2208
|
+
_SkyFuzzyDatepickerInputDirective_preferredShortDateFormat.set(this, void 0);
|
2209
|
+
_SkyFuzzyDatepickerInputDirective_ngUnsubscribe.set(this, new Subject());
|
2210
|
+
_SkyFuzzyDatepickerInputDirective__futureDisabled.set(this, false);
|
2211
|
+
_SkyFuzzyDatepickerInputDirective__dateFormat.set(this, void 0);
|
2212
|
+
_SkyFuzzyDatepickerInputDirective__disabled.set(this, false);
|
2213
|
+
_SkyFuzzyDatepickerInputDirective__maxDate.set(this, void 0);
|
2214
|
+
_SkyFuzzyDatepickerInputDirective__minDate.set(this, void 0);
|
2215
|
+
_SkyFuzzyDatepickerInputDirective__startingDay.set(this, void 0);
|
2216
|
+
_SkyFuzzyDatepickerInputDirective__value.set(this, void 0);
|
2217
|
+
_SkyFuzzyDatepickerInputDirective__yearRequired.set(this, false);
|
2218
|
+
_SkyFuzzyDatepickerInputDirective_changeDetector.set(this, void 0);
|
2219
|
+
_SkyFuzzyDatepickerInputDirective_configService.set(this, void 0);
|
2220
|
+
_SkyFuzzyDatepickerInputDirective_elementRef.set(this, void 0);
|
2221
|
+
_SkyFuzzyDatepickerInputDirective_fuzzyDateService.set(this, void 0);
|
2222
|
+
_SkyFuzzyDatepickerInputDirective_renderer.set(this, void 0);
|
2223
|
+
_SkyFuzzyDatepickerInputDirective_resourcesService.set(this, void 0);
|
2224
|
+
_SkyFuzzyDatepickerInputDirective_datepickerComponent.set(this, void 0);
|
2234
2225
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
2235
|
-
|
2226
|
+
// istanbul ignore next
|
2227
|
+
_SkyFuzzyDatepickerInputDirective_onChange.set(this, (_) => { });
|
2236
2228
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
2237
|
-
|
2229
|
+
// istanbul ignore next
|
2230
|
+
_SkyFuzzyDatepickerInputDirective_onTouched.set(this, () => { });
|
2238
2231
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
2239
|
-
|
2240
|
-
this
|
2232
|
+
// istanbul ignore next
|
2233
|
+
_SkyFuzzyDatepickerInputDirective_onValidatorChange.set(this, () => { });
|
2234
|
+
if (!datepickerComponent) {
|
2235
|
+
throw new Error('You must wrap the `skyFuzzyDatepickerInput` directive within a ' +
|
2236
|
+
'`<sky-datepicker>` component!');
|
2237
|
+
}
|
2238
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_changeDetector, changeDetector, "f");
|
2239
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_configService, configService, "f");
|
2240
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_elementRef, elementRef, "f");
|
2241
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, fuzzyDateService, "f");
|
2242
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_renderer, renderer, "f");
|
2243
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_resourcesService, resourcesService, "f");
|
2244
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_datepickerComponent, datepickerComponent, "f");
|
2245
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_locale, localeProvider.defaultLocale, "f");
|
2246
|
+
localeProvider
|
2241
2247
|
.getLocaleInfo()
|
2242
|
-
.pipe(takeUntil(this
|
2248
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_ngUnsubscribe, "f")))
|
2243
2249
|
.subscribe((localeInfo) => {
|
2244
|
-
this
|
2245
|
-
SkyDateFormatter.setLocale(this
|
2246
|
-
this.
|
2247
|
-
SkyDateFormatter.getPreferredShortDateFormat();
|
2250
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_locale, localeInfo.locale, "f");
|
2251
|
+
SkyDateFormatter.setLocale(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_locale, "f"));
|
2252
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_preferredShortDateFormat, SkyDateFormatter.getPreferredShortDateFormat(), "f");
|
2248
2253
|
});
|
2249
2254
|
}
|
2250
2255
|
/**
|
@@ -2253,29 +2258,30 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2253
2258
|
* @default "MM/DD/YYYY"
|
2254
2259
|
*/
|
2255
2260
|
set dateFormat(value) {
|
2256
|
-
this
|
2257
|
-
if (this
|
2258
|
-
const formattedDate = this.
|
2259
|
-
this.
|
2260
|
-
this.
|
2261
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective__dateFormat, value, "f");
|
2262
|
+
if (__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "a", _SkyFuzzyDatepickerInputDirective_value_get)) {
|
2263
|
+
const formattedDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").format(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "a", _SkyFuzzyDatepickerInputDirective_value_get), this.dateFormat, __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_locale, "f"));
|
2264
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_setInputElementValue).call(this, formattedDate);
|
2265
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_changeDetector, "f").markForCheck();
|
2261
2266
|
}
|
2262
2267
|
}
|
2268
|
+
// TODO: Refactor to not have getter logic
|
2263
2269
|
get dateFormat() {
|
2264
|
-
return (this
|
2265
|
-
this.
|
2266
|
-
this
|
2270
|
+
return (__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__dateFormat, "f") ||
|
2271
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_configService, "f").dateFormat ||
|
2272
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_preferredShortDateFormat, "f"));
|
2267
2273
|
}
|
2268
2274
|
/**
|
2269
2275
|
* Indicates whether to disable the datepicker.
|
2270
2276
|
* @default false
|
2271
2277
|
*/
|
2272
2278
|
set disabled(value) {
|
2273
|
-
this
|
2274
|
-
this.
|
2275
|
-
this.
|
2279
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective__disabled, value, "f");
|
2280
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_datepickerComponent, "f").disabled = value;
|
2281
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_renderer, "f").setProperty(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_elementRef, "f").nativeElement, 'disabled', value);
|
2276
2282
|
}
|
2277
2283
|
get disabled() {
|
2278
|
-
return this
|
2284
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__disabled, "f");
|
2279
2285
|
}
|
2280
2286
|
/**
|
2281
2287
|
* Indicates whether to prevent users from specifying dates that are in the future.
|
@@ -2283,11 +2289,11 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2283
2289
|
* @default false
|
2284
2290
|
*/
|
2285
2291
|
set futureDisabled(value) {
|
2286
|
-
this
|
2287
|
-
this.
|
2292
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective__futureDisabled, value, "f");
|
2293
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_onValidatorChange, "f").call(this);
|
2288
2294
|
}
|
2289
2295
|
get futureDisabled() {
|
2290
|
-
return this
|
2296
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__futureDisabled, "f");
|
2291
2297
|
}
|
2292
2298
|
/**
|
2293
2299
|
* Specifies the latest fuzzy date allowed. Place this attribute on the `input` element
|
@@ -2296,12 +2302,12 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2296
2302
|
* For example: `{ month: 1, day: 1, year: 2027 }`.
|
2297
2303
|
*/
|
2298
2304
|
set maxDate(value) {
|
2299
|
-
this
|
2300
|
-
this.
|
2301
|
-
this.
|
2305
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective__maxDate, value, "f");
|
2306
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_datepickerComponent, "f").maxDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_getMaxDate).call(this);
|
2307
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_onValidatorChange, "f").call(this);
|
2302
2308
|
}
|
2303
2309
|
get maxDate() {
|
2304
|
-
return this
|
2310
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__maxDate, "f");
|
2305
2311
|
}
|
2306
2312
|
/**
|
2307
2313
|
* Specifies the earliest fuzzy date allowed. Place this attribute on the `input` element
|
@@ -2310,12 +2316,12 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2310
2316
|
* For example: `{ month: 1, day: 1, year: 2007 }`.
|
2311
2317
|
*/
|
2312
2318
|
set minDate(value) {
|
2313
|
-
this
|
2314
|
-
this.
|
2315
|
-
this.
|
2319
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective__minDate, value, "f");
|
2320
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_datepickerComponent, "f").minDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_getMinDate).call(this);
|
2321
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_onValidatorChange, "f").call(this);
|
2316
2322
|
}
|
2317
2323
|
get minDate() {
|
2318
|
-
return this
|
2324
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__minDate, "f");
|
2319
2325
|
}
|
2320
2326
|
/**
|
2321
2327
|
* Specifies the starting day of the week in the calendar, where `0` sets the starting day
|
@@ -2324,59 +2330,50 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2324
2330
|
* @default 0
|
2325
2331
|
*/
|
2326
2332
|
set startingDay(value) {
|
2327
|
-
this
|
2328
|
-
this.
|
2329
|
-
this.
|
2333
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective__startingDay, value, "f");
|
2334
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_datepickerComponent, "f").startingDay = this.startingDay;
|
2335
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_onValidatorChange, "f").call(this);
|
2330
2336
|
}
|
2337
|
+
// TODO: Refactor to not have getter logic
|
2331
2338
|
get startingDay() {
|
2332
|
-
return this
|
2339
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__startingDay, "f") || __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_configService, "f").startingDay;
|
2333
2340
|
}
|
2334
2341
|
/**
|
2335
2342
|
* Indicates whether to require the year in fuzzy dates.
|
2336
2343
|
* @default false
|
2337
2344
|
*/
|
2338
2345
|
set yearRequired(value) {
|
2339
|
-
this
|
2340
|
-
this.
|
2346
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective__yearRequired, value, "f");
|
2347
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_onValidatorChange, "f").call(this);
|
2341
2348
|
}
|
2342
2349
|
get yearRequired() {
|
2343
|
-
return this
|
2344
|
-
}
|
2345
|
-
get value() {
|
2346
|
-
return this._value;
|
2347
|
-
}
|
2348
|
-
set value(value) {
|
2349
|
-
this.updateValue(value);
|
2350
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__yearRequired, "f");
|
2350
2351
|
}
|
2351
2352
|
ngOnInit() {
|
2352
2353
|
if (this.yearRequired) {
|
2353
|
-
if (this.dateFormat
|
2354
|
+
if (this.dateFormat?.toLowerCase().indexOf('y') === -1) {
|
2354
2355
|
throw new Error('You have configured conflicting settings. Year is required and dateFormat does not include year.');
|
2355
2356
|
}
|
2356
2357
|
}
|
2357
|
-
|
2358
|
-
|
2359
|
-
'`<sky-datepicker>` component!');
|
2360
|
-
}
|
2361
|
-
const element = this.elementRef.nativeElement;
|
2362
|
-
this.renderer.addClass(element, 'sky-form-control');
|
2358
|
+
const element = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_elementRef, "f").nativeElement;
|
2359
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_renderer, "f").addClass(element, 'sky-form-control');
|
2363
2360
|
const hasAriaLabel = element.getAttribute('aria-label');
|
2364
2361
|
/* istanbul ignore else */
|
2365
2362
|
if (!hasAriaLabel) {
|
2366
|
-
this
|
2363
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_resourcesService, "f")
|
2367
2364
|
.getString('skyux_date_field_default_label')
|
2368
|
-
.pipe(takeUntil(this
|
2365
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_ngUnsubscribe, "f")))
|
2369
2366
|
.subscribe((value) => {
|
2370
|
-
this.
|
2367
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_renderer, "f").setAttribute(element, 'aria-label', value);
|
2371
2368
|
});
|
2372
2369
|
}
|
2373
2370
|
}
|
2374
2371
|
ngAfterContentInit() {
|
2375
|
-
this.
|
2376
|
-
.pipe(distinctUntilChanged(), takeUntil(this
|
2372
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_datepickerComponent, "f").dateChange
|
2373
|
+
.pipe(distinctUntilChanged(), takeUntil(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_ngUnsubscribe, "f")))
|
2377
2374
|
.subscribe((value) => {
|
2378
|
-
this
|
2379
|
-
this.
|
2375
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_instances, value, "a", _SkyFuzzyDatepickerInputDirective_value_set);
|
2376
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_onTouched, "f").call(this);
|
2380
2377
|
});
|
2381
2378
|
}
|
2382
2379
|
ngAfterViewInit() {
|
@@ -2386,50 +2383,50 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2386
2383
|
// Of note is the parent check which allows us to determine if the form is reactive.
|
2387
2384
|
// Without this check there is a changed before checked error
|
2388
2385
|
/* istanbul ignore else */
|
2389
|
-
if (this
|
2386
|
+
if (__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f") && __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f").parent) {
|
2390
2387
|
setTimeout(() => {
|
2391
|
-
this
|
2388
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f")?.setValue(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "a", _SkyFuzzyDatepickerInputDirective_value_get), {
|
2392
2389
|
emitEvent: false,
|
2393
2390
|
});
|
2394
|
-
this.
|
2391
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_changeDetector, "f").markForCheck();
|
2395
2392
|
});
|
2396
2393
|
}
|
2397
2394
|
}
|
2398
2395
|
ngOnDestroy() {
|
2399
|
-
this.
|
2400
|
-
this.
|
2396
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_ngUnsubscribe, "f").next();
|
2397
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_ngUnsubscribe, "f").complete();
|
2401
2398
|
}
|
2402
2399
|
onInputChange(event) {
|
2403
|
-
this.
|
2400
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_onValueChange).call(this, event.target.value);
|
2404
2401
|
}
|
2405
2402
|
onInputBlur() {
|
2406
|
-
this.
|
2407
|
-
const formattedDate = this.
|
2408
|
-
if (this
|
2409
|
-
this.
|
2403
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_onTouched, "f").call(this);
|
2404
|
+
const formattedDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").format(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "a", _SkyFuzzyDatepickerInputDirective_value_get), this.dateFormat, __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_locale, "f"));
|
2405
|
+
if (__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f")?.valid) {
|
2406
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_setInputElementValue).call(this, formattedDate);
|
2410
2407
|
}
|
2411
2408
|
}
|
2412
2409
|
onInput() {
|
2413
|
-
this
|
2410
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f")?.markAsDirty();
|
2414
2411
|
}
|
2415
2412
|
writeValue(value) {
|
2416
|
-
this.
|
2413
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_updateValue).call(this, value, false);
|
2417
2414
|
}
|
2418
2415
|
validate(control) {
|
2419
|
-
if (!this
|
2420
|
-
this
|
2416
|
+
if (!__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f")) {
|
2417
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_control, control, "f");
|
2421
2418
|
}
|
2422
2419
|
if (this.skyDatepickerNoValidate) {
|
2423
|
-
return;
|
2420
|
+
return null;
|
2424
2421
|
}
|
2425
|
-
if (!this.
|
2426
|
-
return;
|
2422
|
+
if (!__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f").value) {
|
2423
|
+
return null;
|
2427
2424
|
}
|
2428
2425
|
const value = control.value;
|
2429
2426
|
let fuzzyDate;
|
2430
|
-
let validationError;
|
2427
|
+
let validationError = null;
|
2431
2428
|
if (typeof value === 'string') {
|
2432
|
-
fuzzyDate = this.
|
2429
|
+
fuzzyDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getFuzzyDateFromString(value, this.dateFormat);
|
2433
2430
|
}
|
2434
2431
|
else {
|
2435
2432
|
fuzzyDate = value;
|
@@ -2441,160 +2438,158 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2441
2438
|
},
|
2442
2439
|
};
|
2443
2440
|
}
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
if (!validationError && fuzzyDate.year) {
|
2452
|
-
let fuzzyDateRange;
|
2453
|
-
if (this.maxDate) {
|
2454
|
-
fuzzyDateRange = this.fuzzyDateService.getFuzzyDateRange(fuzzyDate, this.maxDate);
|
2455
|
-
if (!fuzzyDateRange.valid) {
|
2456
|
-
validationError = {
|
2457
|
-
skyFuzzyDate: {
|
2458
|
-
maxDate: value,
|
2459
|
-
},
|
2460
|
-
};
|
2461
|
-
}
|
2441
|
+
else {
|
2442
|
+
if (!fuzzyDate.year && this.yearRequired) {
|
2443
|
+
validationError = {
|
2444
|
+
skyFuzzyDate: {
|
2445
|
+
yearRequired: value,
|
2446
|
+
},
|
2447
|
+
};
|
2462
2448
|
}
|
2463
|
-
if (!validationError &&
|
2464
|
-
fuzzyDateRange
|
2465
|
-
if (
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2449
|
+
if (!validationError && fuzzyDate.year) {
|
2450
|
+
let fuzzyDateRange;
|
2451
|
+
if (this.maxDate) {
|
2452
|
+
fuzzyDateRange = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getFuzzyDateRange(fuzzyDate, this.maxDate);
|
2453
|
+
if (!fuzzyDateRange.valid) {
|
2454
|
+
validationError = {
|
2455
|
+
skyFuzzyDate: {
|
2456
|
+
maxDate: value,
|
2457
|
+
},
|
2458
|
+
};
|
2459
|
+
}
|
2471
2460
|
}
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
|
2479
|
-
}
|
2480
|
-
}
|
2461
|
+
if (!validationError && this.minDate) {
|
2462
|
+
fuzzyDateRange = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getFuzzyDateRange(this.minDate, fuzzyDate);
|
2463
|
+
if (!fuzzyDateRange.valid) {
|
2464
|
+
validationError = {
|
2465
|
+
skyFuzzyDate: {
|
2466
|
+
minDate: value,
|
2467
|
+
},
|
2468
|
+
};
|
2469
|
+
}
|
2470
|
+
}
|
2471
|
+
if (!validationError && this.futureDisabled) {
|
2472
|
+
fuzzyDateRange = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getFuzzyDateRange(fuzzyDate, __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getCurrentFuzzyDate());
|
2473
|
+
if (!fuzzyDateRange.valid) {
|
2474
|
+
validationError = {
|
2475
|
+
skyFuzzyDate: {
|
2476
|
+
futureDisabled: value,
|
2477
|
+
},
|
2478
|
+
};
|
2479
|
+
}
|
2481
2480
|
}
|
2482
2481
|
}
|
2483
2482
|
}
|
2484
2483
|
if (validationError) {
|
2485
2484
|
// Mark the invalid control as touched so that the input's invalid CSS styles appear.
|
2486
2485
|
// (This is only required when the invalid value is set by the FormControl constructor.)
|
2487
|
-
this.
|
2486
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f").markAsTouched();
|
2488
2487
|
}
|
2489
2488
|
return validationError;
|
2490
2489
|
}
|
2491
2490
|
registerOnChange(fn) {
|
2492
|
-
this
|
2491
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_onChange, fn, "f");
|
2493
2492
|
}
|
2494
2493
|
registerOnTouched(fn) {
|
2495
|
-
this
|
2494
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_onTouched, fn, "f");
|
2496
2495
|
}
|
2497
2496
|
registerOnValidatorChange(fn) {
|
2498
|
-
this
|
2497
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_onValidatorChange, fn, "f");
|
2499
2498
|
}
|
2500
2499
|
setDisabledState(disabled) {
|
2501
2500
|
this.disabled = disabled;
|
2502
|
-
this.
|
2501
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_datepickerComponent, "f").disabled = disabled;
|
2503
2502
|
}
|
2504
2503
|
/**
|
2505
2504
|
* Detects changes to the underlying input element's value and updates the ngModel accordingly.
|
2506
2505
|
* This is useful if you need to update the ngModel value before the input element loses focus.
|
2507
2506
|
*/
|
2508
2507
|
detectInputValueChange() {
|
2509
|
-
this.
|
2510
|
-
}
|
2511
|
-
onValueChange(newValue) {
|
2512
|
-
this.value = newValue;
|
2513
|
-
}
|
2514
|
-
setInputElementValue(value) {
|
2515
|
-
this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
|
2516
|
-
}
|
2517
|
-
getMaxDate() {
|
2518
|
-
if (this.maxDate) {
|
2519
|
-
const maxDate = this.fuzzyDateService.getMomentFromFuzzyDate(this.maxDate);
|
2520
|
-
if (maxDate.isValid()) {
|
2521
|
-
return maxDate.toDate();
|
2522
|
-
}
|
2523
|
-
}
|
2524
|
-
else if (this.futureDisabled) {
|
2525
|
-
return new Date();
|
2526
|
-
}
|
2527
|
-
return this.configService.maxDate;
|
2528
|
-
}
|
2529
|
-
getMinDate() {
|
2530
|
-
if (this.minDate) {
|
2531
|
-
const minDate = this.fuzzyDateService.getMomentFromFuzzyDate(this.minDate);
|
2532
|
-
if (minDate.isValid()) {
|
2533
|
-
return minDate.toDate();
|
2534
|
-
}
|
2535
|
-
}
|
2536
|
-
return this.configService.minDate;
|
2537
|
-
}
|
2538
|
-
/* istanbul ignore next */
|
2539
|
-
fuzzyDatesEqual(dateA, dateB) {
|
2540
|
-
return (dateA &&
|
2541
|
-
dateB &&
|
2542
|
-
((!dateA.day && !dateB.day) || dateA.day === dateB.day) &&
|
2543
|
-
((!dateA.month && !dateB.month) || dateA.month === dateB.month) &&
|
2544
|
-
((!dateA.year && !dateB.year) || dateA.year === dateB.year));
|
2508
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_onValueChange).call(this, __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_elementRef, "f").nativeElement.value);
|
2545
2509
|
}
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2510
|
+
}
|
2511
|
+
_SkyFuzzyDatepickerInputDirective_control = new WeakMap(), _SkyFuzzyDatepickerInputDirective_dateFormatter = new WeakMap(), _SkyFuzzyDatepickerInputDirective_locale = new WeakMap(), _SkyFuzzyDatepickerInputDirective_preferredShortDateFormat = new WeakMap(), _SkyFuzzyDatepickerInputDirective_ngUnsubscribe = new WeakMap(), _SkyFuzzyDatepickerInputDirective__futureDisabled = new WeakMap(), _SkyFuzzyDatepickerInputDirective__dateFormat = new WeakMap(), _SkyFuzzyDatepickerInputDirective__disabled = new WeakMap(), _SkyFuzzyDatepickerInputDirective__maxDate = new WeakMap(), _SkyFuzzyDatepickerInputDirective__minDate = new WeakMap(), _SkyFuzzyDatepickerInputDirective__startingDay = new WeakMap(), _SkyFuzzyDatepickerInputDirective__value = new WeakMap(), _SkyFuzzyDatepickerInputDirective__yearRequired = new WeakMap(), _SkyFuzzyDatepickerInputDirective_changeDetector = new WeakMap(), _SkyFuzzyDatepickerInputDirective_configService = new WeakMap(), _SkyFuzzyDatepickerInputDirective_elementRef = new WeakMap(), _SkyFuzzyDatepickerInputDirective_fuzzyDateService = new WeakMap(), _SkyFuzzyDatepickerInputDirective_renderer = new WeakMap(), _SkyFuzzyDatepickerInputDirective_resourcesService = new WeakMap(), _SkyFuzzyDatepickerInputDirective_datepickerComponent = new WeakMap(), _SkyFuzzyDatepickerInputDirective_onChange = new WeakMap(), _SkyFuzzyDatepickerInputDirective_onTouched = new WeakMap(), _SkyFuzzyDatepickerInputDirective_onValidatorChange = new WeakMap(), _SkyFuzzyDatepickerInputDirective_instances = new WeakSet(), _SkyFuzzyDatepickerInputDirective_value_get = function _SkyFuzzyDatepickerInputDirective_value_get() {
|
2512
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__value, "f");
|
2513
|
+
}, _SkyFuzzyDatepickerInputDirective_value_set = function _SkyFuzzyDatepickerInputDirective_value_set(value) {
|
2514
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_updateValue).call(this, value);
|
2515
|
+
}, _SkyFuzzyDatepickerInputDirective_onValueChange = function _SkyFuzzyDatepickerInputDirective_onValueChange(newValue) {
|
2516
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective_instances, newValue, "a", _SkyFuzzyDatepickerInputDirective_value_set);
|
2517
|
+
}, _SkyFuzzyDatepickerInputDirective_setInputElementValue = function _SkyFuzzyDatepickerInputDirective_setInputElementValue(value) {
|
2518
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_renderer, "f").setProperty(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_elementRef, "f").nativeElement, 'value', value);
|
2519
|
+
}, _SkyFuzzyDatepickerInputDirective_getMaxDate = function _SkyFuzzyDatepickerInputDirective_getMaxDate() {
|
2520
|
+
if (this.maxDate) {
|
2521
|
+
const maxDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getMomentFromFuzzyDate(this.maxDate);
|
2522
|
+
if (maxDate.isValid()) {
|
2523
|
+
return maxDate.toDate();
|
2524
|
+
}
|
2525
|
+
}
|
2526
|
+
else if (this.futureDisabled) {
|
2527
|
+
return new Date();
|
2528
|
+
}
|
2529
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_configService, "f").maxDate;
|
2530
|
+
}, _SkyFuzzyDatepickerInputDirective_getMinDate = function _SkyFuzzyDatepickerInputDirective_getMinDate() {
|
2531
|
+
if (this.minDate) {
|
2532
|
+
const minDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getMomentFromFuzzyDate(this.minDate);
|
2533
|
+
if (minDate.isValid()) {
|
2534
|
+
return minDate.toDate();
|
2535
|
+
}
|
2536
|
+
}
|
2537
|
+
return __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_configService, "f").minDate;
|
2538
|
+
}, _SkyFuzzyDatepickerInputDirective_fuzzyDatesEqual = function _SkyFuzzyDatepickerInputDirective_fuzzyDatesEqual(dateA, dateB) {
|
2539
|
+
return (dateA !== undefined &&
|
2540
|
+
dateB !== undefined &&
|
2541
|
+
((!dateA.day && !dateB.day) || dateA.day === dateB.day) &&
|
2542
|
+
((!dateA.month && !dateB.month) || dateA.month === dateB.month) &&
|
2543
|
+
((!dateA.year && !dateB.year) || dateA.year === dateB.year));
|
2544
|
+
}, _SkyFuzzyDatepickerInputDirective_updateValue = function _SkyFuzzyDatepickerInputDirective_updateValue(value, emitEvent = true) {
|
2545
|
+
if (__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__value, "f") === value ||
|
2546
|
+
(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__value, "f") === undefined && value === null)) {
|
2547
|
+
return;
|
2548
|
+
}
|
2549
|
+
let fuzzyDate;
|
2550
|
+
let fuzzyMoment;
|
2551
|
+
let dateValue;
|
2552
|
+
let formattedDate;
|
2553
|
+
if (value instanceof Date) {
|
2554
|
+
dateValue = value;
|
2555
|
+
formattedDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_dateFormatter, "f").format(value, this.dateFormat);
|
2556
|
+
fuzzyDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getFuzzyDateFromSelectedDate(value, this.dateFormat);
|
2557
|
+
}
|
2558
|
+
else if (typeof value === 'string') {
|
2559
|
+
fuzzyDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getFuzzyDateFromString(value, this.dateFormat);
|
2560
|
+
if (fuzzyDate) {
|
2561
|
+
formattedDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").format(fuzzyDate, this.dateFormat, __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_locale, "f"));
|
2562
|
+
}
|
2563
|
+
if (!formattedDate) {
|
2564
|
+
formattedDate = value;
|
2565
|
+
}
|
2566
|
+
fuzzyMoment = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getMomentFromFuzzyDate(fuzzyDate);
|
2567
|
+
if (fuzzyMoment) {
|
2568
|
+
dateValue = fuzzyMoment.toDate();
|
2569
|
+
}
|
2570
|
+
}
|
2571
|
+
else {
|
2572
|
+
fuzzyDate = value;
|
2573
|
+
formattedDate = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").format(fuzzyDate, this.dateFormat, __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_locale, "f"));
|
2574
|
+
fuzzyMoment = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_fuzzyDateService, "f").getMomentFromFuzzyDate(fuzzyDate);
|
2575
|
+
if (fuzzyMoment) {
|
2576
|
+
dateValue = fuzzyMoment.toDate();
|
2577
|
+
}
|
2578
|
+
}
|
2579
|
+
const areFuzzyDatesEqual = __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_fuzzyDatesEqual).call(this, __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__value, "f"), fuzzyDate);
|
2580
|
+
const isNewValue = fuzzyDate !== __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__value, "f") || !areFuzzyDatesEqual;
|
2581
|
+
__classPrivateFieldSet(this, _SkyFuzzyDatepickerInputDirective__value, fuzzyDate || value, "f");
|
2582
|
+
if (isNewValue) {
|
2583
|
+
if (emitEvent) {
|
2584
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_onChange, "f").call(this, __classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__value, "f"));
|
2574
2585
|
}
|
2575
2586
|
else {
|
2576
|
-
|
2577
|
-
formattedDate = this.fuzzyDateService.format(fuzzyDate, this.dateFormat, this.locale);
|
2578
|
-
fuzzyMoment = this.fuzzyDateService.getMomentFromFuzzyDate(fuzzyDate);
|
2579
|
-
if (fuzzyMoment) {
|
2580
|
-
dateValue = fuzzyMoment.toDate();
|
2581
|
-
}
|
2582
|
-
}
|
2583
|
-
const areFuzzyDatesEqual = this.fuzzyDatesEqual(this._value, fuzzyDate);
|
2584
|
-
const isNewValue = fuzzyDate !== this._value || !areFuzzyDatesEqual;
|
2585
|
-
this._value = fuzzyDate || value;
|
2586
|
-
if (isNewValue) {
|
2587
|
-
if (emitEvent) {
|
2588
|
-
this.onChange(this._value);
|
2589
|
-
}
|
2590
|
-
else {
|
2591
|
-
this.control?.setValue(this._value, { emitEvent: false });
|
2592
|
-
}
|
2593
|
-
this.datepickerComponent.selectedDate = dateValue;
|
2587
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_control, "f")?.setValue(__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective__value, "f"), { emitEvent: false });
|
2594
2588
|
}
|
2595
|
-
this.
|
2589
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_datepickerComponent, "f").selectedDate = dateValue;
|
2596
2590
|
}
|
2597
|
-
|
2591
|
+
__classPrivateFieldGet(this, _SkyFuzzyDatepickerInputDirective_instances, "m", _SkyFuzzyDatepickerInputDirective_setInputElementValue).call(this, formattedDate || '');
|
2592
|
+
};
|
2598
2593
|
SkyFuzzyDatepickerInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFuzzyDatepickerInputDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: SkyDatepickerConfigService }, { token: i0.ElementRef }, { token: SkyFuzzyDateService }, { token: i3.SkyAppLocaleProvider }, { token: i0.Renderer2 }, { token: i3.SkyLibResourcesService }, { token: SkyDatepickerComponent, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
2599
2594
|
SkyFuzzyDatepickerInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: SkyFuzzyDatepickerInputDirective, selector: "[skyFuzzyDatepickerInput]", inputs: { dateFormat: "dateFormat", disabled: "disabled", futureDisabled: "futureDisabled", maxDate: "maxDate", minDate: "minDate", skyDatepickerNoValidate: "skyDatepickerNoValidate", startingDay: "startingDay", yearRequired: "yearRequired" }, host: { listeners: { "change": "onInputChange($event)", "blur": "onInputBlur()", "input": "onInput()" } }, providers: [
|
2600
2595
|
SKY_FUZZY_DATEPICKER_VALUE_ACCESSOR,
|
@@ -2638,6 +2633,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
2638
2633
|
args: ['input']
|
2639
2634
|
}] } });
|
2640
2635
|
|
2636
|
+
var _SkyDatepickerInputDirective_instances, _SkyDatepickerInputDirective_value_get, _SkyDatepickerInputDirective_value_set, _SkyDatepickerInputDirective_control, _SkyDatepickerInputDirective_dateFormatter, _SkyDatepickerInputDirective_initialPlaceholder, _SkyDatepickerInputDirective_preferredShortDateFormat, _SkyDatepickerInputDirective_ngUnsubscribe, _SkyDatepickerInputDirective__dateFormat, _SkyDatepickerInputDirective__disabled, _SkyDatepickerInputDirective__maxDate, _SkyDatepickerInputDirective__minDate, _SkyDatepickerInputDirective__startingDay, _SkyDatepickerInputDirective__strict, _SkyDatepickerInputDirective__value, _SkyDatepickerInputDirective_adapter, _SkyDatepickerInputDirective_changeDetector, _SkyDatepickerInputDirective_configService, _SkyDatepickerInputDirective_elementRef, _SkyDatepickerInputDirective_localeProvider, _SkyDatepickerInputDirective_renderer, _SkyDatepickerInputDirective_resourcesService, _SkyDatepickerInputDirective_datepickerComponent, _SkyDatepickerInputDirective_applyDateFormat, _SkyDatepickerInputDirective_onValueChange, _SkyDatepickerInputDirective_setInputElementValue, _SkyDatepickerInputDirective_getDateValue, _SkyDatepickerInputDirective_getShortcutOrDateValue, _SkyDatepickerInputDirective_isDateStringValid, _SkyDatepickerInputDirective_onChange, _SkyDatepickerInputDirective_onTouched, _SkyDatepickerInputDirective_onValidatorChange, _SkyDatepickerInputDirective_updatePlaceholder, _SkyDatepickerInputDirective_updateValue;
|
2641
2637
|
const SKY_DATEPICKER_VALUE_ACCESSOR = {
|
2642
2638
|
provide: NG_VALUE_ACCESSOR,
|
2643
2639
|
useExisting: forwardRef(() => SkyDatepickerInputDirective),
|
@@ -2650,40 +2646,62 @@ const SKY_DATEPICKER_VALIDATOR = {
|
|
2650
2646
|
};
|
2651
2647
|
class SkyDatepickerInputDirective {
|
2652
2648
|
constructor(adapter, changeDetector, configService, elementRef, localeProvider, renderer, resourcesService, datepickerComponent) {
|
2653
|
-
this
|
2654
|
-
this.changeDetector = changeDetector;
|
2655
|
-
this.configService = configService;
|
2656
|
-
this.elementRef = elementRef;
|
2657
|
-
this.localeProvider = localeProvider;
|
2658
|
-
this.renderer = renderer;
|
2659
|
-
this.resourcesService = resourcesService;
|
2660
|
-
this.datepickerComponent = datepickerComponent;
|
2649
|
+
_SkyDatepickerInputDirective_instances.add(this);
|
2661
2650
|
/**
|
2662
2651
|
* Indicates whether to disable date validation on the datepicker input.
|
2663
2652
|
* @default false
|
2664
2653
|
*/
|
2665
2654
|
this.skyDatepickerNoValidate = false;
|
2666
|
-
this
|
2667
|
-
this
|
2655
|
+
_SkyDatepickerInputDirective_control.set(this, void 0);
|
2656
|
+
_SkyDatepickerInputDirective_dateFormatter.set(this, new SkyDateFormatter());
|
2657
|
+
_SkyDatepickerInputDirective_initialPlaceholder.set(this, void 0);
|
2658
|
+
_SkyDatepickerInputDirective_preferredShortDateFormat.set(this, void 0);
|
2659
|
+
_SkyDatepickerInputDirective_ngUnsubscribe.set(this, new Subject());
|
2660
|
+
_SkyDatepickerInputDirective__dateFormat.set(this, void 0);
|
2661
|
+
_SkyDatepickerInputDirective__disabled.set(this, false);
|
2662
|
+
_SkyDatepickerInputDirective__maxDate.set(this, void 0);
|
2663
|
+
_SkyDatepickerInputDirective__minDate.set(this, void 0);
|
2664
|
+
_SkyDatepickerInputDirective__startingDay.set(this, void 0);
|
2665
|
+
_SkyDatepickerInputDirective__strict.set(this, false);
|
2666
|
+
_SkyDatepickerInputDirective__value.set(this, void 0);
|
2667
|
+
_SkyDatepickerInputDirective_adapter.set(this, void 0);
|
2668
|
+
_SkyDatepickerInputDirective_changeDetector.set(this, void 0);
|
2669
|
+
_SkyDatepickerInputDirective_configService.set(this, void 0);
|
2670
|
+
_SkyDatepickerInputDirective_elementRef.set(this, void 0);
|
2671
|
+
_SkyDatepickerInputDirective_localeProvider.set(this, void 0);
|
2672
|
+
_SkyDatepickerInputDirective_renderer.set(this, void 0);
|
2673
|
+
_SkyDatepickerInputDirective_resourcesService.set(this, void 0);
|
2674
|
+
_SkyDatepickerInputDirective_datepickerComponent.set(this, void 0);
|
2668
2675
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
2669
2676
|
// istanbul ignore next
|
2670
|
-
this
|
2677
|
+
_SkyDatepickerInputDirective_onChange.set(this, (_) => { });
|
2671
2678
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
2672
2679
|
// istanbul ignore next
|
2673
|
-
this
|
2680
|
+
_SkyDatepickerInputDirective_onTouched.set(this, () => { });
|
2674
2681
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
2675
2682
|
// istanbul ignore next
|
2676
|
-
this
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2683
|
+
_SkyDatepickerInputDirective_onValidatorChange.set(this, () => { });
|
2684
|
+
if (!datepickerComponent) {
|
2685
|
+
throw new Error('You must wrap the `skyDatepickerInput` directive within a ' +
|
2686
|
+
'`<sky-datepicker>` component!');
|
2687
|
+
}
|
2688
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_adapter, adapter, "f");
|
2689
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_changeDetector, changeDetector, "f");
|
2690
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_configService, configService, "f");
|
2691
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_elementRef, elementRef, "f");
|
2692
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_localeProvider, localeProvider, "f");
|
2693
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_renderer, renderer, "f");
|
2694
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_resourcesService, resourcesService, "f");
|
2695
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_datepickerComponent, datepickerComponent, "f");
|
2696
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_initialPlaceholder, __classPrivateFieldGet(this, _SkyDatepickerInputDirective_adapter, "f").getPlaceholder(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_elementRef, "f")), "f");
|
2697
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_updatePlaceholder).call(this);
|
2698
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_localeProvider, "f")
|
2680
2699
|
.getLocaleInfo()
|
2681
|
-
.pipe(takeUntil(this
|
2700
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_ngUnsubscribe, "f")))
|
2682
2701
|
.subscribe((localeInfo) => {
|
2683
2702
|
SkyDateFormatter.setLocale(localeInfo.locale);
|
2684
|
-
this.
|
2685
|
-
|
2686
|
-
this.applyDateFormat();
|
2703
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_preferredShortDateFormat, SkyDateFormatter.getPreferredShortDateFormat(), "f");
|
2704
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_applyDateFormat).call(this);
|
2687
2705
|
});
|
2688
2706
|
}
|
2689
2707
|
/**
|
@@ -2693,58 +2711,54 @@ class SkyDatepickerInputDirective {
|
|
2693
2711
|
*/
|
2694
2712
|
set dateFormat(value) {
|
2695
2713
|
/* istanbul ignore else */
|
2696
|
-
if (value !== this
|
2697
|
-
this
|
2698
|
-
this.
|
2714
|
+
if (value !== __classPrivateFieldGet(this, _SkyDatepickerInputDirective__dateFormat, "f")) {
|
2715
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__dateFormat, value, "f");
|
2716
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_applyDateFormat).call(this);
|
2699
2717
|
}
|
2700
2718
|
}
|
2719
|
+
// TODO: Refactor to not have getter logic
|
2701
2720
|
get dateFormat() {
|
2702
|
-
return (this
|
2703
|
-
this.
|
2704
|
-
this
|
2721
|
+
return (__classPrivateFieldGet(this, _SkyDatepickerInputDirective__dateFormat, "f") ||
|
2722
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_configService, "f").dateFormat ||
|
2723
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_preferredShortDateFormat, "f"));
|
2705
2724
|
}
|
2706
2725
|
/**
|
2707
2726
|
* Indicates whether to disable the datepicker.
|
2708
2727
|
* @default false
|
2709
2728
|
*/
|
2710
2729
|
set disabled(value) {
|
2711
|
-
this
|
2712
|
-
this.
|
2713
|
-
this.
|
2730
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__disabled, value || false, "f");
|
2731
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_datepickerComponent, "f").disabled = value;
|
2732
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_renderer, "f").setProperty(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_elementRef, "f").nativeElement, 'disabled', value);
|
2714
2733
|
}
|
2715
2734
|
get disabled() {
|
2716
|
-
return this
|
2717
|
-
}
|
2718
|
-
/**
|
2719
|
-
* @internal
|
2720
|
-
* Indicates if the input element or any of its children have focus.
|
2721
|
-
*/
|
2722
|
-
get inputIsFocused() {
|
2723
|
-
return this.adapter.elementIsFocused();
|
2735
|
+
return __classPrivateFieldGet(this, _SkyDatepickerInputDirective__disabled, "f");
|
2724
2736
|
}
|
2725
2737
|
/**
|
2726
2738
|
* Specifies the latest date that is available in the calendar. Place this attribute on
|
2727
2739
|
* the `input` element to override the default in `SkyDatepickerConfigService`.
|
2728
2740
|
*/
|
2729
2741
|
set maxDate(value) {
|
2730
|
-
this
|
2731
|
-
this.
|
2732
|
-
this.
|
2742
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__maxDate, value, "f");
|
2743
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_datepickerComponent, "f").maxDate = this.maxDate;
|
2744
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_onValidatorChange, "f").call(this);
|
2733
2745
|
}
|
2746
|
+
// TODO: Refactor to not have getter logic
|
2734
2747
|
get maxDate() {
|
2735
|
-
return this
|
2748
|
+
return __classPrivateFieldGet(this, _SkyDatepickerInputDirective__maxDate, "f") || __classPrivateFieldGet(this, _SkyDatepickerInputDirective_configService, "f").maxDate;
|
2736
2749
|
}
|
2737
2750
|
/**
|
2738
2751
|
* Specifies the earliest date that is available in the calendar. Place this attribute on
|
2739
2752
|
* the `input` element to override the default in `SkyDatepickerConfigService`.
|
2740
2753
|
*/
|
2741
2754
|
set minDate(value) {
|
2742
|
-
this
|
2743
|
-
this.
|
2744
|
-
this.
|
2755
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__minDate, value, "f");
|
2756
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_datepickerComponent, "f").minDate = this.minDate;
|
2757
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_onValidatorChange, "f").call(this);
|
2745
2758
|
}
|
2759
|
+
// TODO: Refactor to not have getter logic
|
2746
2760
|
get minDate() {
|
2747
|
-
return this
|
2761
|
+
return __classPrivateFieldGet(this, _SkyDatepickerInputDirective__minDate, "f") || __classPrivateFieldGet(this, _SkyDatepickerInputDirective_configService, "f").minDate;
|
2748
2762
|
}
|
2749
2763
|
/**
|
2750
2764
|
* Creates the datepicker input and calendar. Place this directive on an `input` element,
|
@@ -2768,12 +2782,13 @@ class SkyDatepickerInputDirective {
|
|
2768
2782
|
* @default 0
|
2769
2783
|
*/
|
2770
2784
|
set startingDay(value) {
|
2771
|
-
this
|
2772
|
-
this.
|
2773
|
-
this.
|
2785
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__startingDay, value, "f");
|
2786
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_datepickerComponent, "f").startingDay = this.startingDay;
|
2787
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_onValidatorChange, "f").call(this);
|
2774
2788
|
}
|
2789
|
+
// TODO: Refactor to not have getter logic
|
2775
2790
|
get startingDay() {
|
2776
|
-
return this
|
2791
|
+
return __classPrivateFieldGet(this, _SkyDatepickerInputDirective__startingDay, "f") || __classPrivateFieldGet(this, _SkyDatepickerInputDirective_configService, "f").startingDay;
|
2777
2792
|
}
|
2778
2793
|
/**
|
2779
2794
|
* Indicates whether the format of the date value must match the format from the `dateFormat` value.
|
@@ -2784,41 +2799,31 @@ class SkyDatepickerInputDirective {
|
|
2784
2799
|
* @default false
|
2785
2800
|
*/
|
2786
2801
|
set strict(value) {
|
2787
|
-
this
|
2802
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__strict, value || false, "f");
|
2788
2803
|
}
|
2789
2804
|
get strict() {
|
2790
|
-
return this
|
2791
|
-
}
|
2792
|
-
get value() {
|
2793
|
-
return this._value;
|
2794
|
-
}
|
2795
|
-
set value(value) {
|
2796
|
-
this.updateValue(value);
|
2805
|
+
return __classPrivateFieldGet(this, _SkyDatepickerInputDirective__strict, "f");
|
2797
2806
|
}
|
2798
2807
|
ngOnInit() {
|
2799
|
-
|
2800
|
-
|
2801
|
-
'`<sky-datepicker>` component!');
|
2802
|
-
}
|
2803
|
-
const element = this.elementRef.nativeElement;
|
2804
|
-
this.renderer.addClass(element, 'sky-form-control');
|
2808
|
+
const element = __classPrivateFieldGet(this, _SkyDatepickerInputDirective_elementRef, "f").nativeElement;
|
2809
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_renderer, "f").addClass(element, 'sky-form-control');
|
2805
2810
|
const hasAriaLabel = element.getAttribute('aria-label');
|
2806
2811
|
if (!hasAriaLabel) {
|
2807
|
-
this
|
2812
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_resourcesService, "f")
|
2808
2813
|
.getString('skyux_date_field_default_label')
|
2809
|
-
.pipe(takeUntil(this
|
2814
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_ngUnsubscribe, "f")))
|
2810
2815
|
.subscribe((value) => {
|
2811
|
-
this.
|
2816
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_renderer, "f").setAttribute(element, 'aria-label', value);
|
2812
2817
|
});
|
2813
2818
|
}
|
2814
2819
|
}
|
2815
2820
|
ngAfterContentInit() {
|
2816
|
-
this.
|
2821
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_datepickerComponent, "f").dateChange
|
2817
2822
|
.pipe(distinctUntilChanged())
|
2818
|
-
.pipe(takeUntil(this
|
2823
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_ngUnsubscribe, "f")))
|
2819
2824
|
.subscribe((value) => {
|
2820
|
-
this
|
2821
|
-
this.
|
2825
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_instances, value, "a", _SkyDatepickerInputDirective_value_set);
|
2826
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_onTouched, "f").call(this);
|
2822
2827
|
});
|
2823
2828
|
}
|
2824
2829
|
ngAfterViewInit() {
|
@@ -2828,69 +2833,68 @@ class SkyDatepickerInputDirective {
|
|
2828
2833
|
// Of note is the parent check which allows us to determine if the form is reactive.
|
2829
2834
|
// Without this check there is a changed before checked error
|
2830
2835
|
/* istanbul ignore else */
|
2831
|
-
if (this
|
2836
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f") && __classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f").parent) {
|
2832
2837
|
setTimeout(() => {
|
2833
|
-
this
|
2838
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f")?.setValue(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "a", _SkyDatepickerInputDirective_value_get), {
|
2834
2839
|
emitEvent: false,
|
2835
2840
|
});
|
2836
|
-
this.
|
2841
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_changeDetector, "f").markForCheck();
|
2837
2842
|
});
|
2838
2843
|
}
|
2839
|
-
this.adapter.init(this.elementRef);
|
2840
2844
|
}
|
2841
2845
|
ngOnDestroy() {
|
2842
|
-
this.
|
2843
|
-
this.
|
2846
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_ngUnsubscribe, "f").next();
|
2847
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_ngUnsubscribe, "f").complete();
|
2844
2848
|
}
|
2845
2849
|
onInputChange(event) {
|
2846
2850
|
const value = event.target.value;
|
2847
2851
|
if (this.skyDatepickerNoValidate) {
|
2848
|
-
this.
|
2852
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_onValueChange).call(this, value);
|
2849
2853
|
return;
|
2850
2854
|
}
|
2851
2855
|
// Don't try to parse the string value into a Date value if it is malformed.
|
2852
|
-
if (this.
|
2853
|
-
this.
|
2856
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_isDateStringValid).call(this, value)) {
|
2857
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_onValueChange).call(this, value);
|
2854
2858
|
return;
|
2855
2859
|
}
|
2856
|
-
this
|
2857
|
-
this.
|
2858
|
-
this
|
2860
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__value, value, "f");
|
2861
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_onChange, "f").call(this, value);
|
2862
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f")?.setErrors({
|
2859
2863
|
skyDate: {
|
2860
2864
|
invalid: true,
|
2861
2865
|
},
|
2862
2866
|
});
|
2863
2867
|
}
|
2864
2868
|
onInputBlur() {
|
2865
|
-
this.
|
2869
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_onTouched, "f").call(this);
|
2866
2870
|
}
|
2867
2871
|
onInput() {
|
2868
|
-
this
|
2872
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f")?.markAsDirty();
|
2869
2873
|
}
|
2870
2874
|
writeValue(value) {
|
2871
|
-
this.
|
2875
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_updateValue).call(this, value, false);
|
2872
2876
|
}
|
2873
2877
|
validate(control) {
|
2874
|
-
if (!this
|
2875
|
-
this
|
2878
|
+
if (!__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f")) {
|
2879
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_control, control, "f");
|
2876
2880
|
// Account for any date conversion that may have occurred prior to validation.
|
2877
|
-
if (this.
|
2878
|
-
this.
|
2881
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f").value !== __classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "a", _SkyDatepickerInputDirective_value_get)) {
|
2882
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f").patchValue(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "a", _SkyDatepickerInputDirective_value_get), { emitEvent: false });
|
2879
2883
|
}
|
2880
2884
|
}
|
2881
2885
|
if (this.skyDatepickerNoValidate) {
|
2882
|
-
return;
|
2886
|
+
return null;
|
2883
2887
|
}
|
2884
2888
|
const value = control.value;
|
2885
2889
|
if (!value) {
|
2886
|
-
return;
|
2890
|
+
return null;
|
2887
2891
|
}
|
2888
2892
|
if (value instanceof Date) {
|
2889
|
-
const isDateValid = this.
|
2893
|
+
const isDateValid = __classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").dateIsValid(value);
|
2890
2894
|
if (!isDateValid) {
|
2891
2895
|
// Mark the invalid control as touched so that the input's invalid CSS styles appear.
|
2892
2896
|
// (This is only required when the invalid value is set by the FormControl constructor.)
|
2893
|
-
this.
|
2897
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f").markAsTouched();
|
2894
2898
|
return {
|
2895
2899
|
skyDate: {
|
2896
2900
|
invalid: value,
|
@@ -2899,7 +2903,7 @@ class SkyDatepickerInputDirective {
|
|
2899
2903
|
}
|
2900
2904
|
const minDate = this.minDate;
|
2901
2905
|
if (minDate &&
|
2902
|
-
this.
|
2906
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").dateIsValid(minDate) &&
|
2903
2907
|
value < minDate) {
|
2904
2908
|
return {
|
2905
2909
|
skyDate: {
|
@@ -2909,7 +2913,7 @@ class SkyDatepickerInputDirective {
|
|
2909
2913
|
}
|
2910
2914
|
const maxDate = this.maxDate;
|
2911
2915
|
if (maxDate &&
|
2912
|
-
this.
|
2916
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").dateIsValid(maxDate) &&
|
2913
2917
|
value > maxDate) {
|
2914
2918
|
return {
|
2915
2919
|
skyDate: {
|
@@ -2921,169 +2925,151 @@ class SkyDatepickerInputDirective {
|
|
2921
2925
|
else {
|
2922
2926
|
// Mark the invalid control as touched so that the input's invalid CSS styles appear.
|
2923
2927
|
// (This is only required when the invalid value is set by the FormControl constructor.)
|
2924
|
-
this.
|
2928
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f").markAsTouched();
|
2925
2929
|
return {
|
2926
2930
|
skyDate: {
|
2927
2931
|
invalid: value,
|
2928
2932
|
},
|
2929
2933
|
};
|
2930
2934
|
}
|
2935
|
+
return null;
|
2931
2936
|
}
|
2932
2937
|
registerOnChange(fn) {
|
2933
|
-
this
|
2938
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_onChange, fn, "f");
|
2934
2939
|
}
|
2935
2940
|
registerOnTouched(fn) {
|
2936
|
-
this
|
2941
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_onTouched, fn, "f");
|
2937
2942
|
}
|
2938
2943
|
registerOnValidatorChange(fn) {
|
2939
|
-
this
|
2944
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_onValidatorChange, fn, "f");
|
2940
2945
|
}
|
2941
2946
|
setDisabledState(disabled) {
|
2942
2947
|
this.disabled = disabled;
|
2943
|
-
this.
|
2948
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_datepickerComponent, "f").disabled = disabled;
|
2944
2949
|
}
|
2945
2950
|
/**
|
2946
2951
|
* Detects changes to the underlying input element's value and updates the ngModel accordingly.
|
2947
2952
|
* This is useful if you need to update the ngModel value before the input element loses focus.
|
2948
2953
|
*/
|
2949
2954
|
detectInputValueChange() {
|
2950
|
-
this.
|
2951
|
-
}
|
2952
|
-
applyDateFormat() {
|
2953
|
-
this.updatePlaceholder();
|
2954
|
-
if (this.value) {
|
2955
|
-
const formattedDate = this.dateFormatter.format(this.value, this.dateFormat);
|
2956
|
-
this.setInputElementValue(formattedDate);
|
2957
|
-
this.changeDetector.markForCheck();
|
2958
|
-
}
|
2959
|
-
}
|
2960
|
-
onValueChange(newValue) {
|
2961
|
-
this.value = newValue;
|
2955
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_onValueChange).call(this, __classPrivateFieldGet(this, _SkyDatepickerInputDirective_elementRef, "f").nativeElement.value);
|
2962
2956
|
}
|
2963
|
-
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
2978
|
-
|
2979
|
-
|
2980
|
-
|
2981
|
-
|
2982
|
-
|
2983
|
-
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2957
|
+
}
|
2958
|
+
_SkyDatepickerInputDirective_control = new WeakMap(), _SkyDatepickerInputDirective_dateFormatter = new WeakMap(), _SkyDatepickerInputDirective_initialPlaceholder = new WeakMap(), _SkyDatepickerInputDirective_preferredShortDateFormat = new WeakMap(), _SkyDatepickerInputDirective_ngUnsubscribe = new WeakMap(), _SkyDatepickerInputDirective__dateFormat = new WeakMap(), _SkyDatepickerInputDirective__disabled = new WeakMap(), _SkyDatepickerInputDirective__maxDate = new WeakMap(), _SkyDatepickerInputDirective__minDate = new WeakMap(), _SkyDatepickerInputDirective__startingDay = new WeakMap(), _SkyDatepickerInputDirective__strict = new WeakMap(), _SkyDatepickerInputDirective__value = new WeakMap(), _SkyDatepickerInputDirective_adapter = new WeakMap(), _SkyDatepickerInputDirective_changeDetector = new WeakMap(), _SkyDatepickerInputDirective_configService = new WeakMap(), _SkyDatepickerInputDirective_elementRef = new WeakMap(), _SkyDatepickerInputDirective_localeProvider = new WeakMap(), _SkyDatepickerInputDirective_renderer = new WeakMap(), _SkyDatepickerInputDirective_resourcesService = new WeakMap(), _SkyDatepickerInputDirective_datepickerComponent = new WeakMap(), _SkyDatepickerInputDirective_onChange = new WeakMap(), _SkyDatepickerInputDirective_onTouched = new WeakMap(), _SkyDatepickerInputDirective_onValidatorChange = new WeakMap(), _SkyDatepickerInputDirective_instances = new WeakSet(), _SkyDatepickerInputDirective_value_get = function _SkyDatepickerInputDirective_value_get() {
|
2959
|
+
return __classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f");
|
2960
|
+
}, _SkyDatepickerInputDirective_value_set = function _SkyDatepickerInputDirective_value_set(value) {
|
2961
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_updateValue).call(this, value);
|
2962
|
+
}, _SkyDatepickerInputDirective_applyDateFormat = function _SkyDatepickerInputDirective_applyDateFormat() {
|
2963
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_updatePlaceholder).call(this);
|
2964
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "a", _SkyDatepickerInputDirective_value_get)) {
|
2965
|
+
const formattedDate = __classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").format(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "a", _SkyDatepickerInputDirective_value_get), this.dateFormat);
|
2966
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_setInputElementValue).call(this, formattedDate);
|
2967
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_changeDetector, "f").markForCheck();
|
2968
|
+
}
|
2969
|
+
}, _SkyDatepickerInputDirective_onValueChange = function _SkyDatepickerInputDirective_onValueChange(newValue) {
|
2970
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective_instances, newValue, "a", _SkyDatepickerInputDirective_value_set);
|
2971
|
+
}, _SkyDatepickerInputDirective_setInputElementValue = function _SkyDatepickerInputDirective_setInputElementValue(value) {
|
2972
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_renderer, "f").setProperty(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_elementRef, "f").nativeElement, 'value', value);
|
2973
|
+
}, _SkyDatepickerInputDirective_getDateValue = function _SkyDatepickerInputDirective_getDateValue(value) {
|
2974
|
+
if (value instanceof Date) {
|
2975
|
+
return value;
|
2976
|
+
}
|
2977
|
+
else if (typeof value === 'string') {
|
2978
|
+
return __classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_getShortcutOrDateValue).call(this, value);
|
2979
|
+
}
|
2980
|
+
return undefined;
|
2981
|
+
}, _SkyDatepickerInputDirective_getShortcutOrDateValue = function _SkyDatepickerInputDirective_getShortcutOrDateValue(value) {
|
2982
|
+
const num = Number(value);
|
2983
|
+
if (Number.isInteger(num)) {
|
2984
|
+
// We require 8 digits in order to know that we have all information needed to determine what part of the number is the month (2), day (2), and year (4).
|
2985
|
+
if (value.length === 8) {
|
2986
|
+
const regex = new RegExp(/\b(MM)\b|\b(DD)\b|\b(YY)\b|\b(YYYY)\b/, 'g');
|
2987
|
+
const formatTokensOnly = this.dateFormat
|
2988
|
+
?.match(regex)
|
2989
|
+
?.join('')
|
2990
|
+
.replace(new RegExp(/Y+/), 'YYYY');
|
2991
|
+
if (formatTokensOnly && formatTokensOnly.length === 8) {
|
2992
|
+
const date = __classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").getDateFromString(value, formatTokensOnly, true);
|
2993
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").dateIsValid(date)) {
|
2994
|
+
return date;
|
2999
2995
|
}
|
3000
2996
|
}
|
3001
|
-
const now = new Date();
|
3002
|
-
const shortcutDate = new Date(now.getFullYear(), now.getMonth(), num);
|
3003
|
-
const daysInMonth = shortcutDate.getDate();
|
3004
|
-
if (num > 0 && num <= daysInMonth) {
|
3005
|
-
return shortcutDate;
|
3006
|
-
}
|
3007
2997
|
}
|
3008
|
-
|
3009
|
-
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
2998
|
+
const now = new Date();
|
2999
|
+
const shortcutDate = new Date(now.getFullYear(), now.getMonth(), num);
|
3000
|
+
const daysInMonth = shortcutDate.getDate();
|
3001
|
+
if (num > 0 && num <= daysInMonth) {
|
3002
|
+
return shortcutDate;
|
3013
3003
|
}
|
3014
3004
|
}
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
if (!value || typeof value !== 'string') {
|
3020
|
-
return true;
|
3021
|
-
}
|
3022
|
-
// Does the value only include digits, dashes, or slashes?
|
3023
|
-
const regexp = /^[\d/-]+$/;
|
3024
|
-
const isValid = regexp.test(value);
|
3025
|
-
if (isValid) {
|
3026
|
-
return true;
|
3005
|
+
else {
|
3006
|
+
const date = __classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").getDateFromString(value, this.dateFormat, this.strict);
|
3007
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").dateIsValid(date)) {
|
3008
|
+
return date;
|
3027
3009
|
}
|
3028
|
-
// If not, does it conform to the standard ISO format?
|
3029
|
-
const isValidIso = moment(value, moment.ISO_8601).isValid();
|
3030
|
-
return isValidIso;
|
3031
3010
|
}
|
3032
|
-
|
3033
|
-
|
3034
|
-
|
3035
|
-
|
3011
|
+
return undefined;
|
3012
|
+
}, _SkyDatepickerInputDirective_isDateStringValid = function _SkyDatepickerInputDirective_isDateStringValid(value) {
|
3013
|
+
if (!value || typeof value !== 'string') {
|
3014
|
+
return true;
|
3036
3015
|
}
|
3037
|
-
|
3038
|
-
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
|
3016
|
+
// Does the value only include digits, dashes, or slashes?
|
3017
|
+
const regexp = /^[\d/-]+$/;
|
3018
|
+
const isValid = regexp.test(value);
|
3019
|
+
if (isValid) {
|
3020
|
+
return true;
|
3021
|
+
}
|
3022
|
+
// If not, does it conform to the standard ISO format?
|
3023
|
+
const isValidIso = moment(value, moment.ISO_8601).isValid();
|
3024
|
+
return isValidIso;
|
3025
|
+
}, _SkyDatepickerInputDirective_updatePlaceholder = function _SkyDatepickerInputDirective_updatePlaceholder() {
|
3026
|
+
if (!__classPrivateFieldGet(this, _SkyDatepickerInputDirective_initialPlaceholder, "f") && this.dateFormat) {
|
3027
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_adapter, "f").setPlaceholder(__classPrivateFieldGet(this, _SkyDatepickerInputDirective_elementRef, "f"), this.dateFormat);
|
3028
|
+
}
|
3029
|
+
}, _SkyDatepickerInputDirective_updateValue = function _SkyDatepickerInputDirective_updateValue(value, emitEvent = true) {
|
3030
|
+
if (__classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f") === value) {
|
3031
|
+
return;
|
3032
|
+
}
|
3033
|
+
const isValidDateString = __classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_isDateStringValid).call(this, value);
|
3034
|
+
// If the string value supplied is malformed, do not set the value to its Date equivalent.
|
3035
|
+
// (JavaScript's Date parser will convert poorly formatted dates to Date objects, such as "abc 123", which isn't ideal.)
|
3036
|
+
if (!isValidDateString) {
|
3037
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__value, value, "f");
|
3038
|
+
if (emitEvent) {
|
3039
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_onChange, "f").call(this, __classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f"));
|
3045
3040
|
}
|
3046
|
-
|
3047
|
-
|
3048
|
-
|
3049
|
-
|
3050
|
-
|
3041
|
+
else {
|
3042
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f")?.setValue(__classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f"), { emitEvent: false });
|
3043
|
+
}
|
3044
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_datepickerComponent, "f").selectedDate = __classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f");
|
3045
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_setInputElementValue).call(this, value);
|
3046
|
+
}
|
3047
|
+
else {
|
3048
|
+
// This value represents the date value for the input if possible.
|
3049
|
+
// This value will take into account all shortcut functionality.
|
3050
|
+
const dateValue = __classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_getDateValue).call(this, value);
|
3051
|
+
const areDatesEqual = __classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f") instanceof Date &&
|
3052
|
+
dateValue &&
|
3053
|
+
dateValue.getTime() === __classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f").getTime();
|
3054
|
+
if (dateValue !== __classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f") || !areDatesEqual) {
|
3055
|
+
__classPrivateFieldSet(this, _SkyDatepickerInputDirective__value, dateValue || value, "f");
|
3051
3056
|
if (emitEvent) {
|
3052
|
-
this.
|
3057
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_onChange, "f").call(this, __classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f"));
|
3053
3058
|
}
|
3054
3059
|
else {
|
3055
|
-
this
|
3060
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_control, "f")?.setValue(__classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f"), { emitEvent: false });
|
3056
3061
|
}
|
3057
|
-
this.
|
3058
|
-
|
3062
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_datepickerComponent, "f").selectedDate = __classPrivateFieldGet(this, _SkyDatepickerInputDirective__value, "f");
|
3063
|
+
}
|
3064
|
+
if (dateValue) {
|
3065
|
+
const formattedDateString = __classPrivateFieldGet(this, _SkyDatepickerInputDirective_dateFormatter, "f").format(dateValue, this.dateFormat);
|
3066
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_setInputElementValue).call(this, formattedDateString);
|
3059
3067
|
}
|
3060
3068
|
else {
|
3061
|
-
|
3062
|
-
// This value will take into account all shortcut functionality.
|
3063
|
-
const dateValue = this.getDateValue(value);
|
3064
|
-
const areDatesEqual = this._value instanceof Date &&
|
3065
|
-
dateValue &&
|
3066
|
-
dateValue.getTime() === this._value.getTime();
|
3067
|
-
if (dateValue !== this._value || !areDatesEqual) {
|
3068
|
-
this._value = dateValue || value;
|
3069
|
-
if (emitEvent) {
|
3070
|
-
this.onChange(this._value);
|
3071
|
-
}
|
3072
|
-
else {
|
3073
|
-
this.control?.setValue(this._value, { emitEvent: false });
|
3074
|
-
}
|
3075
|
-
this.datepickerComponent.selectedDate = this._value;
|
3076
|
-
}
|
3077
|
-
if (dateValue) {
|
3078
|
-
const formattedDateString = this.dateFormatter.format(dateValue, this.dateFormat);
|
3079
|
-
this.setInputElementValue(formattedDateString);
|
3080
|
-
}
|
3081
|
-
else {
|
3082
|
-
this.setInputElementValue(value || '');
|
3083
|
-
}
|
3069
|
+
__classPrivateFieldGet(this, _SkyDatepickerInputDirective_instances, "m", _SkyDatepickerInputDirective_setInputElementValue).call(this, value || '');
|
3084
3070
|
}
|
3085
3071
|
}
|
3086
|
-
}
|
3072
|
+
};
|
3087
3073
|
SkyDatepickerInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatepickerInputDirective, deps: [{ token: SkyDatepickerAdapterService }, { token: i0.ChangeDetectorRef }, { token: SkyDatepickerConfigService }, { token: i0.ElementRef }, { token: i3.SkyAppLocaleProvider }, { token: i0.Renderer2 }, { token: i3.SkyLibResourcesService }, { token: SkyDatepickerComponent, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
3088
3074
|
SkyDatepickerInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", 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()", "input": "onInput()" } }, providers: [
|
3089
3075
|
SKY_DATEPICKER_VALUE_ACCESSOR,
|
@@ -3201,6 +3187,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
3201
3187
|
}]
|
3202
3188
|
}] });
|
3203
3189
|
|
3190
|
+
class SkyDateRangePickerEndDateResourceKeyPipe {
|
3191
|
+
transform(calculatorType) {
|
3192
|
+
if (calculatorType === SkyDateRangeCalculatorType.Range) {
|
3193
|
+
return 'skyux_date_range_picker_end_date_label';
|
3194
|
+
}
|
3195
|
+
return 'skyux_date_range_picker_before_date_label';
|
3196
|
+
}
|
3197
|
+
}
|
3198
|
+
SkyDateRangePickerEndDateResourceKeyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerEndDateResourceKeyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
3199
|
+
SkyDateRangePickerEndDateResourceKeyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerEndDateResourceKeyPipe, name: "skyDateRangePickerEndDateResourceKey" });
|
3200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerEndDateResourceKeyPipe, decorators: [{
|
3201
|
+
type: Pipe,
|
3202
|
+
args: [{
|
3203
|
+
name: 'skyDateRangePickerEndDateResourceKey',
|
3204
|
+
}]
|
3205
|
+
}] });
|
3206
|
+
|
3207
|
+
class SkyDateRangePickerStartDateResourceKeyPipe {
|
3208
|
+
transform(calculatorType) {
|
3209
|
+
if (calculatorType === SkyDateRangeCalculatorType.Range) {
|
3210
|
+
return 'skyux_date_range_picker_start_date_label';
|
3211
|
+
}
|
3212
|
+
return 'skyux_date_range_picker_after_date_label';
|
3213
|
+
}
|
3214
|
+
}
|
3215
|
+
SkyDateRangePickerStartDateResourceKeyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerStartDateResourceKeyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
3216
|
+
SkyDateRangePickerStartDateResourceKeyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerStartDateResourceKeyPipe, name: "skyDateRangePickerStartDateResourceKey" });
|
3217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerStartDateResourceKeyPipe, decorators: [{
|
3218
|
+
type: Pipe,
|
3219
|
+
args: [{
|
3220
|
+
name: 'skyDateRangePickerStartDateResourceKey',
|
3221
|
+
}]
|
3222
|
+
}] });
|
3223
|
+
|
3204
3224
|
/**
|
3205
3225
|
* Need to add the following to classes which contain static methods.
|
3206
3226
|
* See: https://github.com/ng-packagr/ng-packagr/issues/641
|
@@ -3475,13 +3495,15 @@ const SKY_DEFAULT_CALCULATOR_CONFIGS = [
|
|
3475
3495
|
shortDescriptionResourceKey: 'skyux_date_range_picker_format_label_specific_range',
|
3476
3496
|
getValue: (startDate, endDate) => ({ startDate, endDate }),
|
3477
3497
|
validate: (value) => {
|
3478
|
-
if (value
|
3498
|
+
if (value &&
|
3499
|
+
value.startDate &&
|
3479
3500
|
value.endDate &&
|
3480
3501
|
value.startDate > value.endDate) {
|
3481
3502
|
return {
|
3482
3503
|
endDateBeforeStartDate: true,
|
3483
3504
|
};
|
3484
3505
|
}
|
3506
|
+
return null;
|
3485
3507
|
},
|
3486
3508
|
},
|
3487
3509
|
{
|
@@ -3594,16 +3616,19 @@ const SKY_DEFAULT_CALCULATOR_CONFIGS = [
|
|
3594
3616
|
},
|
3595
3617
|
];
|
3596
3618
|
|
3619
|
+
var _SkyDateRangeService_instances, _SkyDateRangeService_calculatorReadyStream, _SkyDateRangeService_calculatorConfigs, _SkyDateRangeService_calculators, _SkyDateRangeService_resourcesService, _SkyDateRangeService_createDefaultCalculators;
|
3597
3620
|
/**
|
3598
3621
|
* Creates and manages `SkyDateRangeCalculator` instances.
|
3599
3622
|
*/
|
3600
3623
|
class SkyDateRangeService {
|
3601
3624
|
constructor(resourcesService) {
|
3602
|
-
this
|
3603
|
-
this
|
3604
|
-
this
|
3605
|
-
this
|
3606
|
-
|
3625
|
+
_SkyDateRangeService_instances.add(this);
|
3626
|
+
_SkyDateRangeService_calculatorReadyStream.set(this, new BehaviorSubject(false));
|
3627
|
+
_SkyDateRangeService_calculatorConfigs.set(this, {});
|
3628
|
+
_SkyDateRangeService_calculators.set(this, []);
|
3629
|
+
_SkyDateRangeService_resourcesService.set(this, void 0);
|
3630
|
+
__classPrivateFieldSet(this, _SkyDateRangeService_resourcesService, resourcesService, "f");
|
3631
|
+
__classPrivateFieldGet(this, _SkyDateRangeService_instances, "m", _SkyDateRangeService_createDefaultCalculators).call(this);
|
3607
3632
|
}
|
3608
3633
|
/**
|
3609
3634
|
* Creates a custom date range calculator.
|
@@ -3612,7 +3637,7 @@ class SkyDateRangeService {
|
|
3612
3637
|
createCalculator(config) {
|
3613
3638
|
const newId = SkyDateRangeService.lastId++;
|
3614
3639
|
const calculator = new SkyDateRangeCalculator(newId, config);
|
3615
|
-
this.
|
3640
|
+
__classPrivateFieldGet(this, _SkyDateRangeService_calculators, "f").push(calculator);
|
3616
3641
|
return calculator;
|
3617
3642
|
}
|
3618
3643
|
/**
|
@@ -3631,7 +3656,7 @@ class SkyDateRangeService {
|
|
3631
3656
|
*/
|
3632
3657
|
getCalculatorById(id) {
|
3633
3658
|
const calculatorId = parseInt(id, 10);
|
3634
|
-
const found = this.
|
3659
|
+
const found = __classPrivateFieldGet(this, _SkyDateRangeService_calculators, "f").find((calculator) => {
|
3635
3660
|
return calculator.calculatorId === calculatorId;
|
3636
3661
|
});
|
3637
3662
|
return new Promise((resolve, reject) => {
|
@@ -3639,41 +3664,41 @@ class SkyDateRangeService {
|
|
3639
3664
|
reject(new Error(`A calculator with the ID ${id} was not found.`));
|
3640
3665
|
return;
|
3641
3666
|
}
|
3642
|
-
this.
|
3667
|
+
__classPrivateFieldGet(this, _SkyDateRangeService_calculatorReadyStream, "f").pipe(first()).subscribe(() => {
|
3643
3668
|
resolve(found);
|
3644
3669
|
});
|
3645
3670
|
});
|
3646
3671
|
}
|
3647
|
-
createDefaultCalculators() {
|
3648
|
-
const tasks = [];
|
3649
|
-
// Get resource strings for short descriptions.
|
3650
|
-
SKY_DEFAULT_CALCULATOR_CONFIGS.forEach((defaultConfig) => {
|
3651
|
-
const config = {
|
3652
|
-
getValue: defaultConfig.getValue,
|
3653
|
-
validate: defaultConfig.validate,
|
3654
|
-
shortDescription: '',
|
3655
|
-
type: defaultConfig.type,
|
3656
|
-
};
|
3657
|
-
tasks.push(this.resourcesService
|
3658
|
-
.getString(defaultConfig.shortDescriptionResourceKey)
|
3659
|
-
.pipe(first(), map((value) => {
|
3660
|
-
config.shortDescription = value;
|
3661
|
-
})));
|
3662
|
-
this.calculatorConfigs[defaultConfig.calculatorId] = config;
|
3663
|
-
});
|
3664
|
-
forkJoin(tasks)
|
3665
|
-
.pipe(first())
|
3666
|
-
.subscribe(() => {
|
3667
|
-
const calculatorIds = Object.keys(this.calculatorConfigs);
|
3668
|
-
const calculators = calculatorIds.map((calculatorId) => {
|
3669
|
-
const id = parseInt(calculatorId, 10);
|
3670
|
-
return new SkyDateRangeCalculator(id, this.calculatorConfigs[id]);
|
3671
|
-
});
|
3672
|
-
this.calculators = calculators;
|
3673
|
-
this.calculatorReadyStream.next(true);
|
3674
|
-
});
|
3675
|
-
}
|
3676
3672
|
}
|
3673
|
+
_SkyDateRangeService_calculatorReadyStream = new WeakMap(), _SkyDateRangeService_calculatorConfigs = new WeakMap(), _SkyDateRangeService_calculators = new WeakMap(), _SkyDateRangeService_resourcesService = new WeakMap(), _SkyDateRangeService_instances = new WeakSet(), _SkyDateRangeService_createDefaultCalculators = function _SkyDateRangeService_createDefaultCalculators() {
|
3674
|
+
const tasks = [];
|
3675
|
+
// Get resource strings for short descriptions.
|
3676
|
+
SKY_DEFAULT_CALCULATOR_CONFIGS.forEach((defaultConfig) => {
|
3677
|
+
const config = {
|
3678
|
+
getValue: defaultConfig.getValue,
|
3679
|
+
validate: defaultConfig.validate,
|
3680
|
+
shortDescription: '',
|
3681
|
+
type: defaultConfig.type,
|
3682
|
+
};
|
3683
|
+
tasks.push(__classPrivateFieldGet(this, _SkyDateRangeService_resourcesService, "f")
|
3684
|
+
.getString(defaultConfig.shortDescriptionResourceKey)
|
3685
|
+
.pipe(first(), map((value) => {
|
3686
|
+
config.shortDescription = value;
|
3687
|
+
})));
|
3688
|
+
__classPrivateFieldGet(this, _SkyDateRangeService_calculatorConfigs, "f")[defaultConfig.calculatorId] = config;
|
3689
|
+
});
|
3690
|
+
forkJoin(tasks)
|
3691
|
+
.pipe(first())
|
3692
|
+
.subscribe(() => {
|
3693
|
+
const calculatorIds = Object.keys(__classPrivateFieldGet(this, _SkyDateRangeService_calculatorConfigs, "f"));
|
3694
|
+
const calculators = calculatorIds.map((calculatorId) => {
|
3695
|
+
const id = parseInt(calculatorId, 10);
|
3696
|
+
return new SkyDateRangeCalculator(id, __classPrivateFieldGet(this, _SkyDateRangeService_calculatorConfigs, "f")[id]);
|
3697
|
+
});
|
3698
|
+
__classPrivateFieldSet(this, _SkyDateRangeService_calculators, calculators, "f");
|
3699
|
+
__classPrivateFieldGet(this, _SkyDateRangeService_calculatorReadyStream, "f").next(true);
|
3700
|
+
});
|
3701
|
+
};
|
3677
3702
|
// Start the count higher than the number of available values
|
3678
3703
|
// provided in the SkyDateRangeCalculatorId enum.
|
3679
3704
|
SkyDateRangeService.lastId = 1000;
|
@@ -3683,6 +3708,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
3683
3708
|
type: Injectable
|
3684
3709
|
}], ctorParameters: function () { return [{ type: i3.SkyLibResourcesService }]; } });
|
3685
3710
|
|
3711
|
+
var _SkyDateRangePickerComponent_instances, _SkyDateRangePickerComponent_calculatorIdControl_get, _SkyDateRangePickerComponent_defaultCalculator_get, _SkyDateRangePickerComponent_defaultValue_get, _SkyDateRangePickerComponent_endDateControl_get, _SkyDateRangePickerComponent_startDateControl_get, _SkyDateRangePickerComponent_value, _SkyDateRangePickerComponent_valueOrDefault_set, _SkyDateRangePickerComponent_valueOrDefault_get, _SkyDateRangePickerComponent_control, _SkyDateRangePickerComponent_preferredShortDateFormat, _SkyDateRangePickerComponent_ngUnsubscribe, _SkyDateRangePickerComponent__calculatorIds, _SkyDateRangePickerComponent__dateFormat, _SkyDateRangePickerComponent__disabled, _SkyDateRangePickerComponent__valueOrDefault, _SkyDateRangePickerComponent_changeDetector, _SkyDateRangePickerComponent_dateRangeService, _SkyDateRangePickerComponent_formBuilder, _SkyDateRangePickerComponent_localeProvider, _SkyDateRangePickerComponent_ngZone, _SkyDateRangePickerComponent_setValue, _SkyDateRangePickerComponent_patchValue, _SkyDateRangePickerComponent_createForm, _SkyDateRangePickerComponent_showRelevantFormFields, _SkyDateRangePickerComponent_resetFormGroupValue, _SkyDateRangePickerComponent_addEventListeners, _SkyDateRangePickerComponent_updateBasedOnControls, _SkyDateRangePickerComponent_updateCalculators, _SkyDateRangePickerComponent_getCalculatorById, _SkyDateRangePickerComponent_dateRangesEqual, _SkyDateRangePickerComponent_updateSelectedCalculator, _SkyDateRangePickerComponent_onChange, _SkyDateRangePickerComponent_onTouched;
|
3686
3712
|
const SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR = {
|
3687
3713
|
provide: NG_VALUE_ACCESSOR,
|
3688
3714
|
useExisting: forwardRef(() => SkyDateRangePickerComponent),
|
@@ -3706,11 +3732,7 @@ let uniqueId = 0;
|
|
3706
3732
|
*/
|
3707
3733
|
class SkyDateRangePickerComponent {
|
3708
3734
|
constructor(changeDetector, dateRangeService, formBuilder, localeProvider, ngZone, themeSvc) {
|
3709
|
-
this
|
3710
|
-
this.dateRangeService = dateRangeService;
|
3711
|
-
this.formBuilder = formBuilder;
|
3712
|
-
this.localeProvider = localeProvider;
|
3713
|
-
this.ngZone = ngZone;
|
3735
|
+
_SkyDateRangePickerComponent_instances.add(this);
|
3714
3736
|
/**
|
3715
3737
|
* Indicates whether to require users to specify a start date.
|
3716
3738
|
* @default false
|
@@ -3722,29 +3744,73 @@ class SkyDateRangePickerComponent {
|
|
3722
3744
|
*/
|
3723
3745
|
this.endDateRequired = false;
|
3724
3746
|
this.dateRangePickerId = `sky-date-range-picker-${uniqueId++}`;
|
3747
|
+
this.calculators = [];
|
3725
3748
|
this.isReady = false;
|
3726
3749
|
this.showEndDatePicker = false;
|
3727
3750
|
this.showStartDatePicker = false;
|
3728
|
-
this
|
3729
|
-
this
|
3730
|
-
|
3731
|
-
this
|
3751
|
+
_SkyDateRangePickerComponent_value.set(this, void 0);
|
3752
|
+
_SkyDateRangePickerComponent_control.set(this, void 0);
|
3753
|
+
_SkyDateRangePickerComponent_preferredShortDateFormat.set(this, void 0);
|
3754
|
+
_SkyDateRangePickerComponent_ngUnsubscribe.set(this, new Subject());
|
3755
|
+
_SkyDateRangePickerComponent__calculatorIds.set(this, [
|
3756
|
+
SkyDateRangeCalculatorId.AnyTime,
|
3757
|
+
SkyDateRangeCalculatorId.Before,
|
3758
|
+
SkyDateRangeCalculatorId.After,
|
3759
|
+
SkyDateRangeCalculatorId.SpecificRange,
|
3760
|
+
SkyDateRangeCalculatorId.Yesterday,
|
3761
|
+
SkyDateRangeCalculatorId.Today,
|
3762
|
+
SkyDateRangeCalculatorId.Tomorrow,
|
3763
|
+
SkyDateRangeCalculatorId.LastWeek,
|
3764
|
+
SkyDateRangeCalculatorId.ThisWeek,
|
3765
|
+
SkyDateRangeCalculatorId.NextWeek,
|
3766
|
+
SkyDateRangeCalculatorId.LastMonth,
|
3767
|
+
SkyDateRangeCalculatorId.ThisMonth,
|
3768
|
+
SkyDateRangeCalculatorId.NextMonth,
|
3769
|
+
SkyDateRangeCalculatorId.LastQuarter,
|
3770
|
+
SkyDateRangeCalculatorId.ThisQuarter,
|
3771
|
+
SkyDateRangeCalculatorId.NextQuarter,
|
3772
|
+
SkyDateRangeCalculatorId.LastCalendarYear,
|
3773
|
+
SkyDateRangeCalculatorId.ThisCalendarYear,
|
3774
|
+
SkyDateRangeCalculatorId.NextCalendarYear,
|
3775
|
+
SkyDateRangeCalculatorId.LastFiscalYear,
|
3776
|
+
SkyDateRangeCalculatorId.ThisFiscalYear,
|
3777
|
+
SkyDateRangeCalculatorId.NextFiscalYear,
|
3778
|
+
]);
|
3779
|
+
_SkyDateRangePickerComponent__dateFormat.set(this, void 0);
|
3780
|
+
_SkyDateRangePickerComponent__disabled.set(this, false);
|
3781
|
+
_SkyDateRangePickerComponent__valueOrDefault.set(this, void 0);
|
3782
|
+
_SkyDateRangePickerComponent_changeDetector.set(this, void 0);
|
3783
|
+
_SkyDateRangePickerComponent_dateRangeService.set(this, void 0);
|
3784
|
+
_SkyDateRangePickerComponent_formBuilder.set(this, void 0);
|
3785
|
+
_SkyDateRangePickerComponent_localeProvider.set(this, void 0);
|
3786
|
+
_SkyDateRangePickerComponent_ngZone.set(this, void 0);
|
3787
|
+
/* istanbul ignore next */
|
3788
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
|
3789
|
+
_SkyDateRangePickerComponent_onChange.set(this, (_) => { });
|
3790
|
+
/* istanbul ignore next */
|
3732
3791
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
3733
|
-
this
|
3734
|
-
this
|
3792
|
+
_SkyDateRangePickerComponent_onTouched.set(this, () => { });
|
3793
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_changeDetector, changeDetector, "f");
|
3794
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_dateRangeService, dateRangeService, "f");
|
3795
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_formBuilder, formBuilder, "f");
|
3796
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_localeProvider, localeProvider, "f");
|
3797
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_ngZone, ngZone, "f");
|
3798
|
+
this.dateFormatOrDefault = this.dateFormat;
|
3799
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_localeProvider, "f")
|
3735
3800
|
.getLocaleInfo()
|
3736
|
-
.pipe(takeUntil(this
|
3801
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f")))
|
3737
3802
|
.subscribe((localeInfo) => {
|
3738
3803
|
SkyDateFormatter.setLocale(localeInfo.locale);
|
3739
|
-
this.
|
3740
|
-
|
3804
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_preferredShortDateFormat, SkyDateFormatter.getPreferredShortDateFormat(), "f");
|
3805
|
+
this.dateFormatOrDefault =
|
3806
|
+
this.dateFormat || __classPrivateFieldGet(this, _SkyDateRangePickerComponent_preferredShortDateFormat, "f");
|
3741
3807
|
});
|
3742
3808
|
// Update icons when theme changes.
|
3743
3809
|
/* istanbul ignore next */
|
3744
3810
|
themeSvc?.settingsChange
|
3745
|
-
.pipe(takeUntil(this
|
3811
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f")))
|
3746
3812
|
.subscribe(() => {
|
3747
|
-
this.
|
3813
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_changeDetector, "f").markForCheck();
|
3748
3814
|
});
|
3749
3815
|
}
|
3750
3816
|
/**
|
@@ -3753,10 +3819,7 @@ class SkyDateRangePickerComponent {
|
|
3753
3819
|
* By default, this property includes all `SkyDateRangeCalculatorId` values.
|
3754
3820
|
*/
|
3755
3821
|
set calculatorIds(value) {
|
3756
|
-
this
|
3757
|
-
}
|
3758
|
-
get calculatorIds() {
|
3759
|
-
return (this._calculatorIds || [
|
3822
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent__calculatorIds, value || [
|
3760
3823
|
SkyDateRangeCalculatorId.AnyTime,
|
3761
3824
|
SkyDateRangeCalculatorId.Before,
|
3762
3825
|
SkyDateRangeCalculatorId.After,
|
@@ -3779,7 +3842,10 @@ class SkyDateRangePickerComponent {
|
|
3779
3842
|
SkyDateRangeCalculatorId.LastFiscalYear,
|
3780
3843
|
SkyDateRangeCalculatorId.ThisFiscalYear,
|
3781
3844
|
SkyDateRangeCalculatorId.NextFiscalYear,
|
3782
|
-
]);
|
3845
|
+
], "f");
|
3846
|
+
}
|
3847
|
+
get calculatorIds() {
|
3848
|
+
return __classPrivateFieldGet(this, _SkyDateRangePickerComponent__calculatorIds, "f");
|
3783
3849
|
}
|
3784
3850
|
/**
|
3785
3851
|
* Specifies a date format for
|
@@ -3789,88 +3855,55 @@ class SkyDateRangePickerComponent {
|
|
3789
3855
|
* @default "MM/DD/YYYY"
|
3790
3856
|
*/
|
3791
3857
|
set dateFormat(value) {
|
3792
|
-
this
|
3858
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent__dateFormat, value, "f");
|
3859
|
+
this.dateFormatOrDefault = value || __classPrivateFieldGet(this, _SkyDateRangePickerComponent_preferredShortDateFormat, "f");
|
3793
3860
|
}
|
3794
3861
|
get dateFormat() {
|
3795
|
-
return this
|
3862
|
+
return __classPrivateFieldGet(this, _SkyDateRangePickerComponent__dateFormat, "f");
|
3796
3863
|
}
|
3797
3864
|
/**
|
3798
3865
|
* Indicates whether to disable the date range picker.
|
3799
3866
|
* @default false
|
3800
3867
|
*/
|
3801
3868
|
set disabled(value) {
|
3802
|
-
this
|
3869
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent__disabled, value, "f");
|
3803
3870
|
if (this.formGroup) {
|
3804
|
-
if (this
|
3871
|
+
if (__classPrivateFieldGet(this, _SkyDateRangePickerComponent__disabled, "f")) {
|
3805
3872
|
this.formGroup.disable();
|
3806
3873
|
}
|
3807
3874
|
else {
|
3808
3875
|
this.formGroup.enable();
|
3809
3876
|
}
|
3810
3877
|
}
|
3811
|
-
this.
|
3878
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_changeDetector, "f").markForCheck();
|
3812
3879
|
}
|
3813
3880
|
get disabled() {
|
3814
|
-
return this
|
3815
|
-
}
|
3816
|
-
get startDateLabelResourceKey() {
|
3817
|
-
if (this.selectedCalculator.type === SkyDateRangeCalculatorType.Range) {
|
3818
|
-
return 'skyux_date_range_picker_start_date_label';
|
3819
|
-
}
|
3820
|
-
return 'skyux_date_range_picker_after_date_label';
|
3821
|
-
}
|
3822
|
-
get endDateLabelResourceKey() {
|
3823
|
-
if (this.selectedCalculator.type === SkyDateRangeCalculatorType.Range) {
|
3824
|
-
return 'skyux_date_range_picker_end_date_label';
|
3825
|
-
}
|
3826
|
-
return 'skyux_date_range_picker_before_date_label';
|
3827
|
-
}
|
3828
|
-
get selectedCalculator() {
|
3829
|
-
return this.getCalculatorById(this.value.calculatorId);
|
3830
|
-
}
|
3831
|
-
get calculatorIdControl() {
|
3832
|
-
return this.formGroup.get('calculatorId');
|
3833
|
-
}
|
3834
|
-
get defaultCalculator() {
|
3835
|
-
return this.calculators[0];
|
3836
|
-
}
|
3837
|
-
get defaultValue() {
|
3838
|
-
return this.defaultCalculator.getValue();
|
3839
|
-
}
|
3840
|
-
get endDateControl() {
|
3841
|
-
return this.formGroup.get('endDate');
|
3842
|
-
}
|
3843
|
-
get startDateControl() {
|
3844
|
-
return this.formGroup.get('startDate');
|
3845
|
-
}
|
3846
|
-
get value() {
|
3847
|
-
if (this._value && this._value.calculatorId !== undefined) {
|
3848
|
-
return this._value;
|
3849
|
-
}
|
3850
|
-
return this.defaultValue;
|
3881
|
+
return __classPrivateFieldGet(this, _SkyDateRangePickerComponent__disabled, "f");
|
3851
3882
|
}
|
3852
3883
|
ngOnInit() {
|
3853
|
-
this.
|
3854
|
-
this.
|
3855
|
-
this
|
3884
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_createForm).call(this);
|
3885
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_updateCalculators).call(this).then(() => {
|
3886
|
+
if (!__classPrivateFieldGet(this, _SkyDateRangePickerComponent_value, "f") || !__classPrivateFieldGet(this, _SkyDateRangePickerComponent_value, "f").calculatorId) {
|
3887
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_instances, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_defaultValue_get), "a", _SkyDateRangePickerComponent_valueOrDefault_set);
|
3888
|
+
}
|
3889
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_addEventListeners).call(this);
|
3856
3890
|
this.isReady = true;
|
3857
|
-
this.
|
3891
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_showRelevantFormFields).call(this);
|
3858
3892
|
// 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.
|
3859
|
-
this.
|
3893
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngZone, "f").onStable.pipe(first()).subscribe(() => {
|
3860
3894
|
// Fill in any unprovided values after the calculators have been initialized.
|
3861
3895
|
// For example, if the control is initialized with only the `calculatorId`,
|
3862
3896
|
// allow the calculator to fill in the missing start and end dates.
|
3863
|
-
const
|
3864
|
-
const
|
3865
|
-
|
3866
|
-
this
|
3867
|
-
this.resetFormGroupValue();
|
3897
|
+
const defaultValue = this.selectedCalculator?.getValue(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get)?.startDate, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get)?.endDate);
|
3898
|
+
const newValue = Object.assign({}, defaultValue, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get));
|
3899
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_setValue).call(this, newValue, false);
|
3900
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_resetFormGroupValue).call(this);
|
3868
3901
|
// This is needed to address a bug in Angular 4.
|
3869
3902
|
// When a control value is set intially, its value is not represented on the view.
|
3870
3903
|
// See: https://github.com/angular/angular/issues/13792
|
3871
3904
|
/* istanbul ignore else */
|
3872
|
-
if (this
|
3873
|
-
this.
|
3905
|
+
if (__classPrivateFieldGet(this, _SkyDateRangePickerComponent_control, "f")) {
|
3906
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_control, "f").setValue(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get), {
|
3874
3907
|
emitEvent: false,
|
3875
3908
|
});
|
3876
3909
|
}
|
@@ -3879,8 +3912,8 @@ class SkyDateRangePickerComponent {
|
|
3879
3912
|
}
|
3880
3913
|
ngOnChanges(changes) {
|
3881
3914
|
if (changes.calculatorIds && changes.calculatorIds.firstChange === false) {
|
3882
|
-
this.
|
3883
|
-
const id = this
|
3915
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_updateCalculators).call(this).then(() => {
|
3916
|
+
const id = __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_calculatorIdControl_get)?.value;
|
3884
3917
|
// Maintain the currently selected values if the calculators change after
|
3885
3918
|
// a value has been chosen.
|
3886
3919
|
const found = this.calculators.find((calculator) => {
|
@@ -3888,203 +3921,250 @@ class SkyDateRangePickerComponent {
|
|
3888
3921
|
});
|
3889
3922
|
/* istanbul ignore else */
|
3890
3923
|
if (!found) {
|
3891
|
-
const newValue = this
|
3892
|
-
this.
|
3893
|
-
this.
|
3894
|
-
this.
|
3924
|
+
const newValue = __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_defaultCalculator_get)?.getValue();
|
3925
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_setValue).call(this, newValue);
|
3926
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_resetFormGroupValue).call(this, newValue);
|
3927
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_showRelevantFormFields).call(this);
|
3895
3928
|
}
|
3896
3929
|
});
|
3897
3930
|
}
|
3898
3931
|
}
|
3899
3932
|
ngOnDestroy() {
|
3900
|
-
this.
|
3901
|
-
this.
|
3933
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f").next();
|
3934
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f").complete();
|
3902
3935
|
}
|
3903
3936
|
onFieldBlur() {
|
3904
|
-
this.
|
3937
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_onTouched, "f").call(this);
|
3905
3938
|
}
|
3906
3939
|
writeValue(value) {
|
3907
3940
|
// Only update the underlying controls when the calculators are ready.
|
3908
3941
|
const notifyChange = false;
|
3909
3942
|
// (We still need to save the initial value set by the consumer's form, however.)
|
3910
|
-
this.
|
3943
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_setValue).call(this, value, notifyChange);
|
3911
3944
|
if (this.isReady) {
|
3912
3945
|
// When the control's value is set to `null`,
|
3913
3946
|
// set it to the default value.
|
3914
3947
|
if (!value) {
|
3915
|
-
this.
|
3948
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_onChange, "f").call(this, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_defaultValue_get));
|
3916
3949
|
}
|
3917
|
-
this.
|
3918
|
-
this.
|
3950
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_resetFormGroupValue).call(this);
|
3951
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_showRelevantFormFields).call(this);
|
3919
3952
|
}
|
3920
3953
|
}
|
3921
3954
|
validate(control) {
|
3922
|
-
if (!this
|
3923
|
-
this
|
3955
|
+
if (!__classPrivateFieldGet(this, _SkyDateRangePickerComponent_control, "f")) {
|
3956
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_control, control, "f");
|
3924
3957
|
}
|
3925
3958
|
if (!this.isReady) {
|
3926
|
-
return;
|
3959
|
+
return null;
|
3927
3960
|
}
|
3928
3961
|
const value = control.value;
|
3929
|
-
const idControl = this
|
3930
|
-
const result = this.selectedCalculator
|
3931
|
-
let errors;
|
3962
|
+
const idControl = __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_calculatorIdControl_get);
|
3963
|
+
const result = this.selectedCalculator?.validate(value);
|
3964
|
+
let errors = null;
|
3932
3965
|
if (result) {
|
3933
3966
|
errors = {
|
3934
3967
|
skyDateRange: {
|
3935
|
-
calculatorId: idControl
|
3968
|
+
calculatorId: idControl?.value,
|
3936
3969
|
errors: result,
|
3937
3970
|
},
|
3938
3971
|
};
|
3939
3972
|
}
|
3940
3973
|
else {
|
3941
|
-
|
3974
|
+
let startErrors = null;
|
3975
|
+
let endErrors = null;
|
3976
|
+
if (__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_startDateControl_get)) {
|
3977
|
+
startErrors = __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_startDateControl_get).errors;
|
3978
|
+
}
|
3979
|
+
if (__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_endDateControl_get)) {
|
3980
|
+
endErrors = __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_endDateControl_get).errors;
|
3981
|
+
}
|
3982
|
+
errors = startErrors || endErrors;
|
3942
3983
|
}
|
3943
3984
|
if (!errors) {
|
3944
3985
|
// Clear any errors on the calculator select.
|
3945
|
-
idControl
|
3946
|
-
return;
|
3986
|
+
idControl?.setErrors(null);
|
3987
|
+
return null;
|
3947
3988
|
}
|
3948
|
-
idControl
|
3949
|
-
idControl
|
3950
|
-
idControl
|
3989
|
+
idControl?.setErrors(errors);
|
3990
|
+
idControl?.markAsTouched();
|
3991
|
+
idControl?.markAsDirty();
|
3951
3992
|
// Need to mark the control as touched for the error messages to appear.
|
3952
|
-
this.
|
3993
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_control, "f").markAsTouched();
|
3953
3994
|
// Notify the view to display any errors.
|
3954
|
-
this.
|
3995
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_changeDetector, "f").markForCheck();
|
3955
3996
|
return errors;
|
3956
3997
|
}
|
3957
3998
|
registerOnChange(fn) {
|
3958
|
-
this
|
3999
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_onChange, fn, "f");
|
3959
4000
|
}
|
3960
4001
|
registerOnTouched(fn) {
|
3961
|
-
this
|
4002
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_onTouched, fn, "f");
|
3962
4003
|
}
|
3963
4004
|
setDisabledState(disabled) {
|
3964
4005
|
this.disabled = disabled;
|
3965
4006
|
}
|
3966
|
-
|
3967
|
-
|
3968
|
-
|
3969
|
-
|
3970
|
-
|
3971
|
-
|
3972
|
-
|
3973
|
-
|
3974
|
-
|
3975
|
-
|
3976
|
-
|
3977
|
-
|
3978
|
-
|
3979
|
-
|
3980
|
-
|
3981
|
-
|
3982
|
-
|
3983
|
-
|
3984
|
-
|
3985
|
-
|
3986
|
-
|
3987
|
-
|
3988
|
-
}
|
3989
|
-
showRelevantFormFields() {
|
3990
|
-
const calculator = this.selectedCalculator;
|
3991
|
-
let showEndDatePicker = false;
|
3992
|
-
let showStartDatePicker = false;
|
3993
|
-
switch (calculator.type) {
|
3994
|
-
case SkyDateRangeCalculatorType.Before:
|
3995
|
-
showEndDatePicker = true;
|
3996
|
-
break;
|
3997
|
-
case SkyDateRangeCalculatorType.After:
|
3998
|
-
showStartDatePicker = true;
|
3999
|
-
break;
|
4000
|
-
case SkyDateRangeCalculatorType.Range:
|
4001
|
-
showEndDatePicker = true;
|
4002
|
-
showStartDatePicker = true;
|
4003
|
-
break;
|
4004
|
-
default:
|
4005
|
-
break;
|
4007
|
+
}
|
4008
|
+
_SkyDateRangePickerComponent_value = new WeakMap(), _SkyDateRangePickerComponent_control = new WeakMap(), _SkyDateRangePickerComponent_preferredShortDateFormat = new WeakMap(), _SkyDateRangePickerComponent_ngUnsubscribe = new WeakMap(), _SkyDateRangePickerComponent__calculatorIds = new WeakMap(), _SkyDateRangePickerComponent__dateFormat = new WeakMap(), _SkyDateRangePickerComponent__disabled = new WeakMap(), _SkyDateRangePickerComponent__valueOrDefault = new WeakMap(), _SkyDateRangePickerComponent_changeDetector = new WeakMap(), _SkyDateRangePickerComponent_dateRangeService = new WeakMap(), _SkyDateRangePickerComponent_formBuilder = new WeakMap(), _SkyDateRangePickerComponent_localeProvider = new WeakMap(), _SkyDateRangePickerComponent_ngZone = new WeakMap(), _SkyDateRangePickerComponent_onChange = new WeakMap(), _SkyDateRangePickerComponent_onTouched = new WeakMap(), _SkyDateRangePickerComponent_instances = new WeakSet(), _SkyDateRangePickerComponent_calculatorIdControl_get = function _SkyDateRangePickerComponent_calculatorIdControl_get() {
|
4009
|
+
return this.formGroup?.get('calculatorId');
|
4010
|
+
}, _SkyDateRangePickerComponent_defaultCalculator_get = function _SkyDateRangePickerComponent_defaultCalculator_get() {
|
4011
|
+
return this.calculators[0];
|
4012
|
+
}, _SkyDateRangePickerComponent_defaultValue_get = function _SkyDateRangePickerComponent_defaultValue_get() {
|
4013
|
+
return __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_defaultCalculator_get)?.getValue();
|
4014
|
+
}, _SkyDateRangePickerComponent_endDateControl_get = function _SkyDateRangePickerComponent_endDateControl_get() {
|
4015
|
+
return this.formGroup?.get('endDate');
|
4016
|
+
}, _SkyDateRangePickerComponent_startDateControl_get = function _SkyDateRangePickerComponent_startDateControl_get() {
|
4017
|
+
return this.formGroup?.get('startDate');
|
4018
|
+
}, _SkyDateRangePickerComponent_valueOrDefault_set = function _SkyDateRangePickerComponent_valueOrDefault_set(value) {
|
4019
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent__valueOrDefault, value, "f");
|
4020
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_updateSelectedCalculator).call(this);
|
4021
|
+
}, _SkyDateRangePickerComponent_valueOrDefault_get = function _SkyDateRangePickerComponent_valueOrDefault_get() {
|
4022
|
+
return __classPrivateFieldGet(this, _SkyDateRangePickerComponent__valueOrDefault, "f");
|
4023
|
+
}, _SkyDateRangePickerComponent_setValue = function _SkyDateRangePickerComponent_setValue(value, notifyChange = true) {
|
4024
|
+
const isNewValue = !__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_dateRangesEqual).call(this, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_value, "f"), value);
|
4025
|
+
if (isNewValue) {
|
4026
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_value, value, "f");
|
4027
|
+
if (!value || value.calculatorId === undefined) {
|
4028
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_instances, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_defaultValue_get), "a", _SkyDateRangePickerComponent_valueOrDefault_set);
|
4006
4029
|
}
|
4007
|
-
|
4008
|
-
|
4009
|
-
|
4010
|
-
|
4011
|
-
|
4012
|
-
|
4013
|
-
}
|
4014
|
-
|
4015
|
-
|
4016
|
-
|
4017
|
-
|
4018
|
-
|
4019
|
-
|
4020
|
-
|
4021
|
-
|
4022
|
-
|
4023
|
-
|
4024
|
-
|
4025
|
-
|
4026
|
-
|
4027
|
-
|
4028
|
-
|
4029
|
-
|
4030
|
-
|
4031
|
-
|
4030
|
+
else {
|
4031
|
+
__classPrivateFieldSet(this, _SkyDateRangePickerComponent_instances, value, "a", _SkyDateRangePickerComponent_valueOrDefault_set);
|
4032
|
+
}
|
4033
|
+
if (notifyChange) {
|
4034
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_onChange, "f").call(this, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get));
|
4035
|
+
}
|
4036
|
+
}
|
4037
|
+
}, _SkyDateRangePickerComponent_patchValue = function _SkyDateRangePickerComponent_patchValue(value) {
|
4038
|
+
const newValue = Object.assign({}, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get), value);
|
4039
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_setValue).call(this, newValue);
|
4040
|
+
}, _SkyDateRangePickerComponent_createForm = function _SkyDateRangePickerComponent_createForm() {
|
4041
|
+
this.formGroup = __classPrivateFieldGet(this, _SkyDateRangePickerComponent_formBuilder, "f").group({
|
4042
|
+
calculatorId: new UntypedFormControl(),
|
4043
|
+
startDate: new UntypedFormControl(),
|
4044
|
+
endDate: new UntypedFormControl(),
|
4045
|
+
});
|
4046
|
+
if (this.disabled) {
|
4047
|
+
this.formGroup.disable();
|
4048
|
+
}
|
4049
|
+
}, _SkyDateRangePickerComponent_showRelevantFormFields = function _SkyDateRangePickerComponent_showRelevantFormFields() {
|
4050
|
+
const calculator = this.selectedCalculator;
|
4051
|
+
let showEndDatePicker = false;
|
4052
|
+
let showStartDatePicker = false;
|
4053
|
+
switch (calculator?.type) {
|
4054
|
+
case SkyDateRangeCalculatorType.Before:
|
4055
|
+
showEndDatePicker = true;
|
4056
|
+
break;
|
4057
|
+
case SkyDateRangeCalculatorType.After:
|
4058
|
+
showStartDatePicker = true;
|
4059
|
+
break;
|
4060
|
+
case SkyDateRangeCalculatorType.Range:
|
4061
|
+
showEndDatePicker = true;
|
4062
|
+
showStartDatePicker = true;
|
4063
|
+
break;
|
4064
|
+
default:
|
4065
|
+
break;
|
4066
|
+
}
|
4067
|
+
this.showEndDatePicker = showEndDatePicker;
|
4068
|
+
this.showStartDatePicker = showStartDatePicker;
|
4069
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_changeDetector, "f").markForCheck();
|
4070
|
+
}, _SkyDateRangePickerComponent_resetFormGroupValue = function _SkyDateRangePickerComponent_resetFormGroupValue(value) {
|
4071
|
+
this.formGroup?.reset(value || __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get));
|
4072
|
+
}, _SkyDateRangePickerComponent_addEventListeners = function _SkyDateRangePickerComponent_addEventListeners() {
|
4073
|
+
// Watch for selected calculator change.
|
4074
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_calculatorIdControl_get)?.valueChanges
|
4075
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f")))
|
4076
|
+
.subscribe((value) => {
|
4077
|
+
if (value !== __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get)?.calculatorId) {
|
4078
|
+
const id = parseInt(value, 10);
|
4079
|
+
// if the component is disabled during form creation, null is passed
|
4080
|
+
// as the value of the calculator id control
|
4081
|
+
// only handle the value changes if the calculator id is a number
|
4082
|
+
/* istanbul ignore else */
|
4083
|
+
if (!isNaN(id)) {
|
4084
|
+
const calculator = __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_getCalculatorById).call(this, id);
|
4085
|
+
const newValue = calculator?.getValue();
|
4086
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_setValue).call(this, newValue);
|
4087
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_resetFormGroupValue).call(this, newValue);
|
4088
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_showRelevantFormFields).call(this);
|
4032
4089
|
}
|
4033
|
-
}
|
4034
|
-
|
4035
|
-
|
4036
|
-
|
4037
|
-
|
4038
|
-
|
4039
|
-
});
|
4040
|
-
|
4041
|
-
|
4042
|
-
|
4043
|
-
|
4044
|
-
|
4045
|
-
});
|
4090
|
+
}
|
4091
|
+
});
|
4092
|
+
// Watch for start date value changes.
|
4093
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_startDateControl_get)?.valueChanges
|
4094
|
+
.pipe(distinctUntilChanged(), takeUntil(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f")))
|
4095
|
+
.subscribe((startDate) => {
|
4096
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_patchValue).call(this, { startDate });
|
4097
|
+
});
|
4098
|
+
// Watch for end date value changes.
|
4099
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_endDateControl_get)?.valueChanges
|
4100
|
+
.pipe(distinctUntilChanged(), takeUntil(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f")))
|
4101
|
+
.subscribe((endDate) => {
|
4102
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_patchValue).call(this, { endDate });
|
4103
|
+
});
|
4104
|
+
// Safety check
|
4105
|
+
/* istanbul ignore else */
|
4106
|
+
if (__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_startDateControl_get) && __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_endDateControl_get)) {
|
4046
4107
|
// Detect errors from the date inputs and update ng- classes on picker.
|
4047
4108
|
combineLatest([
|
4048
|
-
this.
|
4049
|
-
this.
|
4109
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_startDateControl_get).statusChanges,
|
4110
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_endDateControl_get).statusChanges,
|
4050
4111
|
])
|
4051
|
-
.pipe(takeUntil(this
|
4112
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f")))
|
4052
4113
|
.subscribe(() => {
|
4053
|
-
this.
|
4054
|
-
// Wait for initial validation to complete.
|
4055
|
-
this.ngZone.onStable.pipe(first()).subscribe(() => {
|
4056
|
-
this.control?.updateValueAndValidity({ emitEvent: false });
|
4057
|
-
});
|
4114
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_updateBasedOnControls).call(this);
|
4058
4115
|
});
|
4059
4116
|
}
|
4060
|
-
|
4061
|
-
|
4062
|
-
.
|
4063
|
-
.
|
4064
|
-
this
|
4065
|
-
this.changeDetector.markForCheck();
|
4117
|
+
else if (__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_startDateControl_get)) {
|
4118
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_startDateControl_get).statusChanges
|
4119
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f")))
|
4120
|
+
.subscribe(() => {
|
4121
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_updateBasedOnControls).call(this);
|
4066
4122
|
});
|
4067
4123
|
}
|
4068
|
-
|
4069
|
-
|
4070
|
-
|
4124
|
+
else if (__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_endDateControl_get)) {
|
4125
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_endDateControl_get).statusChanges
|
4126
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngUnsubscribe, "f")))
|
4127
|
+
.subscribe(() => {
|
4128
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_updateBasedOnControls).call(this);
|
4071
4129
|
});
|
4072
4130
|
}
|
4073
|
-
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4131
|
+
}, _SkyDateRangePickerComponent_updateBasedOnControls = function _SkyDateRangePickerComponent_updateBasedOnControls() {
|
4132
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_changeDetector, "f").markForCheck();
|
4133
|
+
// Wait for initial validation to complete.
|
4134
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_ngZone, "f").onStable.pipe(first()).subscribe(() => {
|
4135
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_control, "f")?.updateValueAndValidity({ emitEvent: false });
|
4136
|
+
});
|
4137
|
+
}, _SkyDateRangePickerComponent_updateCalculators = function _SkyDateRangePickerComponent_updateCalculators() {
|
4138
|
+
return __classPrivateFieldGet(this, _SkyDateRangePickerComponent_dateRangeService, "f")
|
4139
|
+
.getCalculators(this.calculatorIds)
|
4140
|
+
.then((calculators) => {
|
4141
|
+
this.calculators = calculators;
|
4142
|
+
// Ensure that any previously set value is used to determine the selected calculator
|
4143
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_updateSelectedCalculator).call(this);
|
4144
|
+
__classPrivateFieldGet(this, _SkyDateRangePickerComponent_changeDetector, "f").markForCheck();
|
4145
|
+
});
|
4146
|
+
}, _SkyDateRangePickerComponent_getCalculatorById = function _SkyDateRangePickerComponent_getCalculatorById(id) {
|
4147
|
+
return this.calculators.find((calculator) => {
|
4148
|
+
return calculator.calculatorId === id;
|
4149
|
+
});
|
4150
|
+
}, _SkyDateRangePickerComponent_dateRangesEqual = function _SkyDateRangePickerComponent_dateRangesEqual(rangeA, rangeB) {
|
4151
|
+
return (!!rangeA && !!rangeB && JSON.stringify(rangeA) === JSON.stringify(rangeB));
|
4152
|
+
}, _SkyDateRangePickerComponent_updateSelectedCalculator = function _SkyDateRangePickerComponent_updateSelectedCalculator() {
|
4153
|
+
this.selectedCalculator = __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get)
|
4154
|
+
? __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "m", _SkyDateRangePickerComponent_getCalculatorById).call(this, __classPrivateFieldGet(this, _SkyDateRangePickerComponent_instances, "a", _SkyDateRangePickerComponent_valueOrDefault_get).calculatorId)
|
4155
|
+
: undefined;
|
4156
|
+
};
|
4077
4157
|
SkyDateRangePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: SkyDateRangeService }, { token: i2$2.UntypedFormBuilder }, { token: i3.SkyAppLocaleProvider }, { token: i0.NgZone }, { token: i3$2.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
4078
4158
|
SkyDateRangePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyDateRangePickerComponent, selector: "sky-date-range-picker", inputs: { calculatorIds: "calculatorIds", dateFormat: "dateFormat", disabled: "disabled", label: "label", startDateRequired: "startDateRequired", endDateRequired: "endDateRequired" }, providers: [
|
4079
4159
|
SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR,
|
4080
4160
|
SKY_DATE_RANGE_PICKER_VALIDATOR,
|
4081
|
-
], usesOnChanges: true, ngImport: i0, template: "<div
|
4161
|
+
], usesOnChanges: true, ngImport: i0, template: "<div\n *ngIf=\"isReady && formGroup\"\n class=\"sky-date-range-picker\"\n [formGroup]=\"formGroup\"\n>\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 {{\n selectedCalculator?.type\n | skyDateRangePickerStartDateResourceKey\n | skyLibResources\n }}\n </label>\n\n <sky-datepicker>\n <input\n formControlName=\"startDate\"\n [attr.aria-label]=\"\n selectedCalculator?.type\n | skyDateRangePickerStartDateResourceKey\n | skyLibResources\n \"\n [attr.id]=\"dateRangePickerId + '-start-date'\"\n [attr.placeholder]=\"dateFormatOrDefault\"\n [required]=\"!!startDateRequired\"\n [dateFormat]=\"dateFormatOrDefault\"\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 {{\n selectedCalculator?.type\n | skyDateRangePickerEndDateResourceKey\n | skyLibResources\n }}\n </label>\n\n <sky-datepicker>\n <input\n formControlName=\"endDate\"\n skyDatepickerInput\n [attr.aria-label]=\"\n selectedCalculator?.type\n | skyDateRangePickerEndDateResourceKey\n | skyLibResources\n \"\n [attr.id]=\"dateRangePickerId + '-end-date'\"\n [attr.placeholder]=\"dateFormatOrDefault\"\n [dateFormat]=\"dateFormatOrDefault\"\n [required]=\"!!endDateRequired\"\n (blur)=\"onFieldBlur()\"\n />\n </sky-datepicker>\n </sky-input-box>\n </div>\n</div>\n", styles: [".sky-date-range-picker{display:flex}.sky-date-range-picker-form-group:last-child{margin-bottom:0}:host .sky-date-range-picker{flex-direction:column}:host .sky-date-range-picker-form-group{flex-basis:100%}:host .sky-date-range-picker-form-group:not(:first-of-type){padding-left:initial}:host .sky-date-range-picker-form-group:not(:last-of-type){padding-right:initial}:host-context(.sky-responsive-container-xs) .sky-date-range-picker,:host-context(.sky-responsive-container-sm) .sky-date-range-picker,:host-context(.sky-responsive-container-md) .sky-date-range-picker,:host-context(.sky-responsive-container-lg) .sky-date-range-picker{flex-direction:column}:host-context(.sky-responsive-container-xs) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group{flex-basis:100%}:host-context(.sky-responsive-container-xs) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group:not(:first-of-type){padding-left:initial}:host-context(.sky-responsive-container-xs) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group:not(:last-of-type){padding-right:initial}@media (min-width: 768px){:host .sky-date-range-picker{flex-direction:initial}:host .sky-date-range-picker-form-group{flex-basis:33.3333333333%;margin-bottom:0}:host .sky-date-range-picker-form-group:not(:first-of-type){padding-left:5px}:host .sky-date-range-picker-form-group:not(:last-of-type){padding-right:5px}}:host-context(.sky-responsive-container-sm) .sky-date-range-picker,:host-context(.sky-responsive-container-md) .sky-date-range-picker,:host-context(.sky-responsive-container-lg) .sky-date-range-picker{flex-direction:initial}:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group{flex-basis:33.3333333333%;margin-bottom:0}:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group:not(:first-of-type){padding-left:5px}:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group:not(:last-of-type){padding-right:5px}:host-context(.sky-theme-modern) .sky-date-range-picker-form-group{padding:0;margin:0 0 20px}@media (min-width: 768px){:host-context(.sky-theme-modern) .sky-date-range-picker-form-group{margin:0 20px 0 0}}.sky-theme-modern .sky-date-range-picker-form-group{padding:0;margin:0 0 20px}@media (min-width: 768px){.sky-theme-modern .sky-date-range-picker-form-group{margin:0 20px 0 0}}:host-context(.sky-theme-modern .sky-responsive-container-xs) .sky-date-range-picker-form-group{margin:0 0 20px}:host-context(.sky-theme-modern .sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-theme-modern .sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-theme-modern .sky-responsive-container-lg) .sky-date-range-picker-form-group{margin:0 20px 0 0}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: SkyDatepickerComponent, selector: "sky-datepicker", inputs: ["pickerClass"], outputs: ["calendarDateRangeChange"] }, { kind: "directive", type: SkyDatepickerInputDirective, selector: "[skyDatepickerInput]", inputs: ["dateFormat", "disabled", "maxDate", "minDate", "skyDatepickerInput", "skyDatepickerNoValidate", "startingDay", "strict"] }, { kind: "component", type: i2$1.λ10, selector: "sky-input-box", inputs: ["hasErrors", "disabled"] }, { kind: "pipe", type: i3.SkyLibResourcesPipe, name: "skyLibResources" }, { kind: "pipe", type: SkyDateRangePickerEndDateResourceKeyPipe, name: "skyDateRangePickerEndDateResourceKey" }, { kind: "pipe", type: SkyDateRangePickerStartDateResourceKeyPipe, name: "skyDateRangePickerStartDateResourceKey" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
4082
4162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerComponent, decorators: [{
|
4083
4163
|
type: Component,
|
4084
4164
|
args: [{ selector: 'sky-date-range-picker', providers: [
|
4085
4165
|
SKY_DATE_RANGE_PICKER_VALUE_ACCESSOR,
|
4086
4166
|
SKY_DATE_RANGE_PICKER_VALIDATOR,
|
4087
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div
|
4167
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n *ngIf=\"isReady && formGroup\"\n class=\"sky-date-range-picker\"\n [formGroup]=\"formGroup\"\n>\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 {{\n selectedCalculator?.type\n | skyDateRangePickerStartDateResourceKey\n | skyLibResources\n }}\n </label>\n\n <sky-datepicker>\n <input\n formControlName=\"startDate\"\n [attr.aria-label]=\"\n selectedCalculator?.type\n | skyDateRangePickerStartDateResourceKey\n | skyLibResources\n \"\n [attr.id]=\"dateRangePickerId + '-start-date'\"\n [attr.placeholder]=\"dateFormatOrDefault\"\n [required]=\"!!startDateRequired\"\n [dateFormat]=\"dateFormatOrDefault\"\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 {{\n selectedCalculator?.type\n | skyDateRangePickerEndDateResourceKey\n | skyLibResources\n }}\n </label>\n\n <sky-datepicker>\n <input\n formControlName=\"endDate\"\n skyDatepickerInput\n [attr.aria-label]=\"\n selectedCalculator?.type\n | skyDateRangePickerEndDateResourceKey\n | skyLibResources\n \"\n [attr.id]=\"dateRangePickerId + '-end-date'\"\n [attr.placeholder]=\"dateFormatOrDefault\"\n [dateFormat]=\"dateFormatOrDefault\"\n [required]=\"!!endDateRequired\"\n (blur)=\"onFieldBlur()\"\n />\n </sky-datepicker>\n </sky-input-box>\n </div>\n</div>\n", styles: [".sky-date-range-picker{display:flex}.sky-date-range-picker-form-group:last-child{margin-bottom:0}:host .sky-date-range-picker{flex-direction:column}:host .sky-date-range-picker-form-group{flex-basis:100%}:host .sky-date-range-picker-form-group:not(:first-of-type){padding-left:initial}:host .sky-date-range-picker-form-group:not(:last-of-type){padding-right:initial}:host-context(.sky-responsive-container-xs) .sky-date-range-picker,:host-context(.sky-responsive-container-sm) .sky-date-range-picker,:host-context(.sky-responsive-container-md) .sky-date-range-picker,:host-context(.sky-responsive-container-lg) .sky-date-range-picker{flex-direction:column}:host-context(.sky-responsive-container-xs) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group{flex-basis:100%}:host-context(.sky-responsive-container-xs) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group:not(:first-of-type){padding-left:initial}:host-context(.sky-responsive-container-xs) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group:not(:last-of-type){padding-right:initial}@media (min-width: 768px){:host .sky-date-range-picker{flex-direction:initial}:host .sky-date-range-picker-form-group{flex-basis:33.3333333333%;margin-bottom:0}:host .sky-date-range-picker-form-group:not(:first-of-type){padding-left:5px}:host .sky-date-range-picker-form-group:not(:last-of-type){padding-right:5px}}:host-context(.sky-responsive-container-sm) .sky-date-range-picker,:host-context(.sky-responsive-container-md) .sky-date-range-picker,:host-context(.sky-responsive-container-lg) .sky-date-range-picker{flex-direction:initial}:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group{flex-basis:33.3333333333%;margin-bottom:0}:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group:not(:first-of-type),:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group:not(:first-of-type){padding-left:5px}:host-context(.sky-responsive-container-sm) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-md) .sky-date-range-picker-form-group:not(:last-of-type),:host-context(.sky-responsive-container-lg) .sky-date-range-picker-form-group:not(:last-of-type){padding-right:5px}:host-context(.sky-theme-modern) .sky-date-range-picker-form-group{padding:0;margin:0 0 20px}@media (min-width: 768px){:host-context(.sky-theme-modern) .sky-date-range-picker-form-group{margin:0 20px 0 0}}.sky-theme-modern .sky-date-range-picker-form-group{padding:0;margin:0 0 20px}@media (min-width: 768px){.sky-theme-modern .sky-date-range-picker-form-group{margin:0 20px 0 0}}:host-context(.sky-theme-modern .sky-responsive-container-xs) .sky-date-range-picker-form-group{margin:0 0 20px}:host-context(.sky-theme-modern .sky-responsive-container-sm) .sky-date-range-picker-form-group,:host-context(.sky-theme-modern .sky-responsive-container-md) .sky-date-range-picker-form-group,:host-context(.sky-theme-modern .sky-responsive-container-lg) .sky-date-range-picker-form-group{margin:0 20px 0 0}\n"] }]
|
4088
4168
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: SkyDateRangeService }, { type: i2$2.UntypedFormBuilder }, { type: i3.SkyAppLocaleProvider }, { type: i0.NgZone }, { type: i3$2.SkyThemeService, decorators: [{
|
4089
4169
|
type: Optional
|
4090
4170
|
}] }]; }, propDecorators: { calculatorIds: [{
|
@@ -4104,7 +4184,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
4104
4184
|
class SkyDateRangePickerModule {
|
4105
4185
|
}
|
4106
4186
|
SkyDateRangePickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
4107
|
-
SkyDateRangePickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerModule, declarations: [SkyDateRangePickerComponent
|
4187
|
+
SkyDateRangePickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerModule, declarations: [SkyDateRangePickerComponent,
|
4188
|
+
SkyDateRangePickerEndDateResourceKeyPipe,
|
4189
|
+
SkyDateRangePickerStartDateResourceKeyPipe], imports: [CommonModule,
|
4108
4190
|
FormsModule,
|
4109
4191
|
ReactiveFormsModule,
|
4110
4192
|
SkyI18nModule,
|
@@ -4121,7 +4203,11 @@ SkyDateRangePickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0"
|
|
4121
4203
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDateRangePickerModule, decorators: [{
|
4122
4204
|
type: NgModule,
|
4123
4205
|
args: [{
|
4124
|
-
declarations: [
|
4206
|
+
declarations: [
|
4207
|
+
SkyDateRangePickerComponent,
|
4208
|
+
SkyDateRangePickerEndDateResourceKeyPipe,
|
4209
|
+
SkyDateRangePickerStartDateResourceKeyPipe,
|
4210
|
+
],
|
4125
4211
|
imports: [
|
4126
4212
|
CommonModule,
|
4127
4213
|
FormsModule,
|
@@ -4136,6 +4222,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
4136
4222
|
}]
|
4137
4223
|
}] });
|
4138
4224
|
|
4225
|
+
var _SkyTimepickerComponent_instances, _SkyTimepickerComponent_affixer, _SkyTimepickerComponent_timepickerUnsubscribe, _SkyTimepickerComponent_ngUnsubscribe, _SkyTimepickerComponent_overlay, _SkyTimepickerComponent_overlayKeydownListner, _SkyTimepickerComponent__disabled, _SkyTimepickerComponent__timepickerRef, _SkyTimepickerComponent_affixService, _SkyTimepickerComponent_changeDetector, _SkyTimepickerComponent_coreAdapter, _SkyTimepickerComponent_overlayService, _SkyTimepickerComponent_closePicker, _SkyTimepickerComponent_openPicker, _SkyTimepickerComponent_createAffixer, _SkyTimepickerComponent_destroyAffixer, _SkyTimepickerComponent_createOverlay, _SkyTimepickerComponent_destroyOverlay, _SkyTimepickerComponent_addKeydownListener, _SkyTimepickerComponent_removePickerEventListeners;
|
4139
4226
|
let nextId = 0;
|
4140
4227
|
/**
|
4141
4228
|
* Creates a SKY UX-themed replacement for the HTML `input` element with `type="time"`.
|
@@ -4145,34 +4232,51 @@ let nextId = 0;
|
|
4145
4232
|
*/
|
4146
4233
|
class SkyTimepickerComponent {
|
4147
4234
|
constructor(affixService, changeDetector, coreAdapter, overlayService, inputBoxHostService, themeSvc) {
|
4148
|
-
this.affixService = affixService;
|
4149
|
-
this.changeDetector = changeDetector;
|
4150
|
-
this.coreAdapter = coreAdapter;
|
4151
|
-
this.overlayService = overlayService;
|
4152
4235
|
this.inputBoxHostService = inputBoxHostService;
|
4236
|
+
_SkyTimepickerComponent_instances.add(this);
|
4153
4237
|
/**
|
4154
4238
|
* Fires when the value in the timepicker input changes.
|
4155
4239
|
*/
|
4156
4240
|
this.selectedTimeChanged = new EventEmitter();
|
4241
|
+
this.activeTime = new Date();
|
4242
|
+
this.hours = [];
|
4157
4243
|
this.is8601 = false;
|
4244
|
+
this.isOpen = false;
|
4245
|
+
this.isVisible = false;
|
4246
|
+
this.localeFormat = 'h:mm A';
|
4247
|
+
this.minutes = [];
|
4158
4248
|
this.timeFormat = 'hh';
|
4159
|
-
this
|
4249
|
+
_SkyTimepickerComponent_affixer.set(this, void 0);
|
4250
|
+
_SkyTimepickerComponent_timepickerUnsubscribe.set(this, new Subject());
|
4251
|
+
_SkyTimepickerComponent_ngUnsubscribe.set(this, new Subject());
|
4252
|
+
_SkyTimepickerComponent_overlay.set(this, void 0);
|
4253
|
+
_SkyTimepickerComponent_overlayKeydownListner.set(this, void 0);
|
4254
|
+
_SkyTimepickerComponent__disabled.set(this, false);
|
4255
|
+
_SkyTimepickerComponent__timepickerRef.set(this, void 0);
|
4256
|
+
_SkyTimepickerComponent_affixService.set(this, void 0);
|
4257
|
+
_SkyTimepickerComponent_changeDetector.set(this, void 0);
|
4258
|
+
_SkyTimepickerComponent_coreAdapter.set(this, void 0);
|
4259
|
+
_SkyTimepickerComponent_overlayService.set(this, void 0);
|
4260
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_affixService, affixService, "f");
|
4261
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_changeDetector, changeDetector, "f");
|
4262
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_coreAdapter, coreAdapter, "f");
|
4263
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_overlayService, overlayService, "f");
|
4160
4264
|
const uniqueId = nextId++;
|
4161
4265
|
this.timepickerId = `sky-timepicker-${uniqueId}`;
|
4162
4266
|
this.triggerButtonId = `sky-timepicker-button-${uniqueId}`;
|
4163
4267
|
// Update icons when theme changes.
|
4164
4268
|
themeSvc?.settingsChange
|
4165
|
-
.pipe(takeUntil(this
|
4269
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTimepickerComponent_ngUnsubscribe, "f")))
|
4166
4270
|
.subscribe(() => {
|
4167
|
-
this.
|
4271
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_changeDetector, "f").markForCheck();
|
4168
4272
|
});
|
4169
4273
|
}
|
4170
4274
|
set disabled(value) {
|
4171
|
-
this
|
4172
|
-
this.
|
4275
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent__disabled, value, "f");
|
4276
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_changeDetector, "f").markForCheck();
|
4173
4277
|
}
|
4174
4278
|
get disabled() {
|
4175
|
-
return this
|
4279
|
+
return __classPrivateFieldGet(this, _SkyTimepickerComponent__disabled, "f");
|
4176
4280
|
}
|
4177
4281
|
set selectedHour(setHour) {
|
4178
4282
|
let hourOffset = 0;
|
@@ -4197,8 +4301,7 @@ class SkyTimepickerComponent {
|
|
4197
4301
|
/* istanbul ignore next */
|
4198
4302
|
return parseInt(moment(this.activeTime).format('h'), 0) || 1;
|
4199
4303
|
}
|
4200
|
-
|
4201
|
-
if (this.is8601) {
|
4304
|
+
else {
|
4202
4305
|
return moment(this.activeTime).hour() + 0;
|
4203
4306
|
}
|
4204
4307
|
}
|
@@ -4233,7 +4336,7 @@ class SkyTimepickerComponent {
|
|
4233
4336
|
/* istanbul ignore else */
|
4234
4337
|
if (newTime.local !== 'Invalid date') {
|
4235
4338
|
this.activeTime = newTime.iso8601;
|
4236
|
-
this.
|
4339
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_changeDetector, "f").markForCheck();
|
4237
4340
|
}
|
4238
4341
|
}
|
4239
4342
|
}
|
@@ -4253,26 +4356,28 @@ class SkyTimepickerComponent {
|
|
4253
4356
|
}
|
4254
4357
|
set timepickerRef(value) {
|
4255
4358
|
if (value) {
|
4256
|
-
this
|
4359
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent__timepickerRef, value, "f");
|
4257
4360
|
// Wait for the timepicker component to render before guaging dimensions.
|
4258
4361
|
setTimeout(() => {
|
4259
|
-
this.
|
4260
|
-
this.
|
4362
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_destroyAffixer).call(this);
|
4363
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_createAffixer).call(this);
|
4261
4364
|
setTimeout(() => {
|
4262
|
-
|
4365
|
+
if (this.timepickerRef) {
|
4366
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_coreAdapter, "f").getFocusableChildrenAndApplyFocus(this.timepickerRef, '.sky-timepicker-content', false);
|
4367
|
+
}
|
4263
4368
|
this.isVisible = true;
|
4264
|
-
this.
|
4369
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_changeDetector, "f").markForCheck();
|
4265
4370
|
});
|
4266
4371
|
});
|
4267
4372
|
}
|
4268
4373
|
}
|
4269
4374
|
get timepickerRef() {
|
4270
|
-
return this
|
4375
|
+
return __classPrivateFieldGet(this, _SkyTimepickerComponent__timepickerRef, "f");
|
4271
4376
|
}
|
4272
4377
|
ngOnInit() {
|
4273
4378
|
this.setFormat(this.timeFormat);
|
4274
|
-
this.
|
4275
|
-
if (this.inputBoxHostService) {
|
4379
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_addKeydownListener).call(this);
|
4380
|
+
if (this.inputBoxHostService && this.inputTemplateRef) {
|
4276
4381
|
this.inputBoxHostService.populate({
|
4277
4382
|
inputTemplate: this.inputTemplateRef,
|
4278
4383
|
buttonsTemplate: this.triggerButtonTemplateRef,
|
@@ -4280,11 +4385,11 @@ class SkyTimepickerComponent {
|
|
4280
4385
|
}
|
4281
4386
|
}
|
4282
4387
|
ngOnDestroy() {
|
4283
|
-
this.
|
4284
|
-
this.
|
4285
|
-
this.
|
4286
|
-
this.
|
4287
|
-
this.
|
4388
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_ngUnsubscribe, "f").next();
|
4389
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_ngUnsubscribe, "f").complete();
|
4390
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_removePickerEventListeners).call(this);
|
4391
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_destroyAffixer).call(this);
|
4392
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_destroyOverlay).call(this);
|
4288
4393
|
}
|
4289
4394
|
setFormat(format) {
|
4290
4395
|
let h = 12;
|
@@ -4332,7 +4437,7 @@ class SkyTimepickerComponent {
|
|
4332
4437
|
this.minuteMultiplier = data.minuteMultiplier;
|
4333
4438
|
}
|
4334
4439
|
onCloseButtonCick() {
|
4335
|
-
this.
|
4440
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_closePicker).call(this);
|
4336
4441
|
}
|
4337
4442
|
setTime(event) {
|
4338
4443
|
/* istanbul ignore else */
|
@@ -4353,33 +4458,32 @@ class SkyTimepickerComponent {
|
|
4353
4458
|
}
|
4354
4459
|
}
|
4355
4460
|
onTriggerButtonClick() {
|
4356
|
-
this.
|
4357
|
-
}
|
4358
|
-
closePicker() {
|
4359
|
-
this.destroyAffixer();
|
4360
|
-
this.destroyOverlay();
|
4361
|
-
this.removePickerEventListeners();
|
4362
|
-
this.triggerButtonRef.nativeElement.focus();
|
4363
|
-
this.isOpen = false;
|
4461
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_openPicker).call(this);
|
4364
4462
|
}
|
4365
|
-
|
4366
|
-
|
4367
|
-
|
4368
|
-
|
4369
|
-
|
4370
|
-
|
4371
|
-
|
4372
|
-
|
4373
|
-
|
4374
|
-
|
4375
|
-
|
4376
|
-
|
4463
|
+
}
|
4464
|
+
_SkyTimepickerComponent_affixer = new WeakMap(), _SkyTimepickerComponent_timepickerUnsubscribe = new WeakMap(), _SkyTimepickerComponent_ngUnsubscribe = new WeakMap(), _SkyTimepickerComponent_overlay = new WeakMap(), _SkyTimepickerComponent_overlayKeydownListner = new WeakMap(), _SkyTimepickerComponent__disabled = new WeakMap(), _SkyTimepickerComponent__timepickerRef = new WeakMap(), _SkyTimepickerComponent_affixService = new WeakMap(), _SkyTimepickerComponent_changeDetector = new WeakMap(), _SkyTimepickerComponent_coreAdapter = new WeakMap(), _SkyTimepickerComponent_overlayService = new WeakMap(), _SkyTimepickerComponent_instances = new WeakSet(), _SkyTimepickerComponent_closePicker = function _SkyTimepickerComponent_closePicker() {
|
4465
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_destroyAffixer).call(this);
|
4466
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_destroyOverlay).call(this);
|
4467
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_removePickerEventListeners).call(this);
|
4468
|
+
this.triggerButtonRef?.nativeElement.focus();
|
4469
|
+
this.isOpen = false;
|
4470
|
+
}, _SkyTimepickerComponent_openPicker = function _SkyTimepickerComponent_openPicker() {
|
4471
|
+
this.isVisible = false;
|
4472
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_changeDetector, "f").markForCheck();
|
4473
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_removePickerEventListeners).call(this);
|
4474
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_destroyOverlay).call(this);
|
4475
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_createOverlay).call(this);
|
4476
|
+
this.isOpen = true;
|
4477
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_changeDetector, "f").markForCheck();
|
4478
|
+
}, _SkyTimepickerComponent_createAffixer = function _SkyTimepickerComponent_createAffixer() {
|
4479
|
+
if (this.timepickerRef && this.triggerButtonRef) {
|
4480
|
+
const affixer = __classPrivateFieldGet(this, _SkyTimepickerComponent_affixService, "f").createAffixer(this.timepickerRef);
|
4377
4481
|
// Hide timepicker when trigger button is scrolled off screen.
|
4378
4482
|
affixer.placementChange
|
4379
|
-
.pipe(takeUntil(this
|
4483
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTimepickerComponent_timepickerUnsubscribe, "f")))
|
4380
4484
|
.subscribe((change) => {
|
4381
4485
|
this.isVisible = change.placement !== null;
|
4382
|
-
this.
|
4486
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_changeDetector, "f").markForCheck();
|
4383
4487
|
});
|
4384
4488
|
affixer.affixTo(this.triggerButtonRef.nativeElement, {
|
4385
4489
|
autoFitContext: SkyAffixAutoFitContext.Viewport,
|
@@ -4388,61 +4492,58 @@ class SkyTimepickerComponent {
|
|
4388
4492
|
isSticky: true,
|
4389
4493
|
placement: 'below',
|
4390
4494
|
});
|
4391
|
-
this
|
4495
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_affixer, affixer, "f");
|
4392
4496
|
}
|
4393
|
-
|
4394
|
-
|
4395
|
-
|
4396
|
-
|
4397
|
-
|
4398
|
-
}
|
4497
|
+
}, _SkyTimepickerComponent_destroyAffixer = function _SkyTimepickerComponent_destroyAffixer() {
|
4498
|
+
/*istanbul ignore else*/
|
4499
|
+
if (__classPrivateFieldGet(this, _SkyTimepickerComponent_affixer, "f")) {
|
4500
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_affixer, "f").destroy();
|
4501
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_affixer, undefined, "f");
|
4399
4502
|
}
|
4400
|
-
|
4401
|
-
|
4503
|
+
}, _SkyTimepickerComponent_createOverlay = function _SkyTimepickerComponent_createOverlay() {
|
4504
|
+
if (this.timepickerTemplateRef) {
|
4505
|
+
const overlay = __classPrivateFieldGet(this, _SkyTimepickerComponent_overlayService, "f").create({
|
4402
4506
|
enableClose: false,
|
4403
4507
|
enablePointerEvents: false,
|
4404
4508
|
});
|
4405
4509
|
overlay.backdropClick
|
4406
|
-
.pipe(takeUntil(this
|
4510
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTimepickerComponent_timepickerUnsubscribe, "f")))
|
4407
4511
|
.subscribe(() => {
|
4408
4512
|
/* istanbul ignore else */
|
4409
4513
|
if (this.isOpen) {
|
4410
|
-
this.
|
4514
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_closePicker).call(this);
|
4411
4515
|
}
|
4412
4516
|
});
|
4413
|
-
this.
|
4517
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_addKeydownListener).call(this);
|
4414
4518
|
overlay.attachTemplate(this.timepickerTemplateRef);
|
4415
|
-
this
|
4416
|
-
}
|
4417
|
-
|
4418
|
-
|
4419
|
-
|
4420
|
-
|
4421
|
-
|
4422
|
-
|
4423
|
-
|
4424
|
-
|
4425
|
-
|
4426
|
-
|
4427
|
-
|
4428
|
-
const key = event.key?.toLowerCase();
|
4429
|
-
/* istanbul ignore else */
|
4430
|
-
if (key === 'escape' && this.isOpen) {
|
4431
|
-
this.closePicker();
|
4432
|
-
}
|
4433
|
-
});
|
4434
|
-
}
|
4435
|
-
removePickerEventListeners() {
|
4519
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_overlay, overlay, "f");
|
4520
|
+
}
|
4521
|
+
}, _SkyTimepickerComponent_destroyOverlay = function _SkyTimepickerComponent_destroyOverlay() {
|
4522
|
+
/*istanbul ignore else*/
|
4523
|
+
if (__classPrivateFieldGet(this, _SkyTimepickerComponent_overlay, "f")) {
|
4524
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_overlayService, "f").close(__classPrivateFieldGet(this, _SkyTimepickerComponent_overlay, "f"));
|
4525
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_overlay, undefined, "f");
|
4526
|
+
}
|
4527
|
+
}, _SkyTimepickerComponent_addKeydownListener = function _SkyTimepickerComponent_addKeydownListener() {
|
4528
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_overlayKeydownListner, fromEvent(window.document, 'keydown')
|
4529
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTimepickerComponent_ngUnsubscribe, "f")))
|
4530
|
+
.subscribe((event) => {
|
4531
|
+
const key = event.key?.toLowerCase();
|
4436
4532
|
/* istanbul ignore else */
|
4437
|
-
if (this.
|
4438
|
-
this.
|
4439
|
-
this.timepickerUnsubscribe.complete();
|
4440
|
-
this.timepickerUnsubscribe = undefined;
|
4533
|
+
if (key === 'escape' && this.isOpen) {
|
4534
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_instances, "m", _SkyTimepickerComponent_closePicker).call(this);
|
4441
4535
|
}
|
4442
|
-
|
4443
|
-
|
4536
|
+
}), "f");
|
4537
|
+
}, _SkyTimepickerComponent_removePickerEventListeners = function _SkyTimepickerComponent_removePickerEventListeners() {
|
4538
|
+
/* istanbul ignore else */
|
4539
|
+
if (__classPrivateFieldGet(this, _SkyTimepickerComponent_timepickerUnsubscribe, "f")) {
|
4540
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_timepickerUnsubscribe, "f").next();
|
4541
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_timepickerUnsubscribe, "f").complete();
|
4542
|
+
__classPrivateFieldSet(this, _SkyTimepickerComponent_timepickerUnsubscribe, new Subject(), "f");
|
4444
4543
|
}
|
4445
|
-
|
4544
|
+
/* istanbul ignore next */
|
4545
|
+
__classPrivateFieldGet(this, _SkyTimepickerComponent_overlayKeydownListner, "f")?.unsubscribe();
|
4546
|
+
};
|
4446
4547
|
SkyTimepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyTimepickerComponent, deps: [{ token: i1.SkyAffixService }, { token: i0.ChangeDetectorRef }, { token: i1.SkyCoreAdapterService }, { token: i1.SkyOverlayService }, { token: i2$1.SkyInputBoxHostService, optional: true }, { token: i3$2.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
4447
4548
|
SkyTimepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyTimepickerComponent, selector: "sky-timepicker", outputs: { selectedTimeChanged: "selectedTimeChanged" }, viewQueries: [{ propertyName: "timepickerRef", first: true, predicate: ["timepickerRef"], descendants: true, read: ElementRef }, { propertyName: "timepickerTemplateRef", first: true, predicate: ["timepickerTemplateRef"], descendants: true, read: TemplateRef }, { propertyName: "triggerButtonRef", first: true, predicate: ["triggerButtonRef"], descendants: true, read: ElementRef }, { propertyName: "inputTemplateRef", first: true, predicate: ["inputTemplateRef"], descendants: true, read: TemplateRef, static: true }, { propertyName: "triggerButtonTemplateRef", first: true, predicate: ["triggerButtonTemplateRef"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<div class=\"sky-timepicker\">\n <ng-container *ngIf=\"!inputBoxHostService\">\n <div class=\"sky-input-group\">\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n <ng-container *ngTemplateOutlet=\"triggerButtonTemplateRef\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n<ng-template #inputTemplateRef>\n <ng-content></ng-content>\n</ng-template>\n\n<ng-template #triggerButtonTemplateRef>\n <div class=\"sky-input-group-btn\">\n <button\n aria-haspopup=\"dialog\"\n class=\"sky-btn sky-btn-default sky-input-group-timepicker-btn\"\n type=\"button\"\n [attr.aria-controls]=\"isOpen ? timepickerId : null\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-label]=\"'skyux_timepicker_button_label' | skyLibResources\"\n [attr.id]=\"triggerButtonId\"\n [attr.title]=\"'skyux_timepicker_button_label' | skyLibResources\"\n [disabled]=\"disabled\"\n (click)=\"onTriggerButtonClick()\"\n #triggerButtonRef\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"clock-o\" size=\"lg\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"clock\"\n size=\"lg\"\n iconType=\"skyux\"\n ></sky-icon>\n </button>\n </div>\n</ng-template>\n\n<ng-template #timepickerTemplateRef>\n <div\n class=\"sky-timepicker-container sky-shadow sky-box sky-elevation-4\"\n role=\"dialog\"\n [attr.aria-labelledby]=\"triggerButtonId\"\n [attr.id]=\"timepickerId\"\n [class.sky-timepicker-hidden]=\"!isVisible\"\n #timepickerRef\n >\n <div class=\"sky-timepicker-content\">\n <section\n class=\"sky-timepicker-column\"\n [ngClass]=\"{ 'sky-timepicker-24hour': is8601 }\"\n >\n <ol>\n <li *ngFor=\"let hour of hours\">\n <button\n name=\"hour\"\n type=\"button\"\n [ngClass]=\"{ 'sky-btn-active': selectedHour === hour }\"\n (click)=\"setTime($event)\"\n >\n {{ hour }}\n </button>\n </li>\n </ol>\n </section>\n <section class=\"sky-timepicker-column\">\n <ol>\n <li *ngFor=\"let minute of minutes\">\n <button\n name=\"minute\"\n type=\"button\"\n [ngClass]=\"{ 'sky-btn-active': selectedMinute === minute }\"\n (click)=\"setTime($event)\"\n >\n {{ '00'.substring(0, 2 - minute.toString().length) + minute }}\n </button>\n </li>\n </ol>\n </section>\n <section *ngIf=\"!is8601\" class=\"sky-timepicker-column\">\n <ol>\n <li>\n <button\n name=\"meridie\"\n type=\"button\"\n [ngClass]=\"{ 'sky-btn-active': selectedMeridies === 'AM' }\"\n (click)=\"setTime($event)\"\n >\n AM\n </button>\n </li>\n <li>\n <button\n name=\"meridie\"\n type=\"button\"\n [ngClass]=\"{ 'sky-btn-active': selectedMeridies === 'PM' }\"\n (click)=\"setTime($event)\"\n >\n PM\n </button>\n </li>\n </ol>\n </section>\n </div>\n <div class=\"sky-timepicker-footer\">\n <section class=\"sky-timepicker-column\">\n <button\n class=\"sky-btn sky-btn-primary\"\n type=\"button\"\n (click)=\"onCloseButtonCick()\"\n >\n {{ 'skyux_timepicker_close' | skyLibResources }}\n </button>\n </section>\n </div>\n </div>\n</ng-template>\n", styles: [".sky-timepicker-container{position:fixed;font-size:15px;padding:5px;background-color:#eeeeef;border-radius:5px}.sky-timepicker-container :last-child ol{display:flex;flex-direction:column;height:100%}.sky-timepicker-container :last-child ol li{border-bottom:1px solid #e2e3e4;flex:1}.sky-timepicker-column{margin:5px}.sky-timepicker-column ol{border-top:1px solid #e2e3e4;border-right:1px solid #e2e3e4;border-bottom:1px solid #e2e3e4;border-left:1px solid #e2e3e4;column-gap:1px;columns:2;list-style-type:none;margin:0;padding:0}.sky-timepicker-column ol li{text-align:center;cursor:pointer;margin:0}.sky-timepicker-column ol li button{cursor:pointer}.sky-timepicker-column ol li button:focus{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.sky-timepicker-column ol li button:hover{background-color:#eeeeef}.sky-timepicker-column ol li button:active{background-color:#e2e3e4}.sky-timepicker-column ol li button.sky-btn-active:hover{background-color:#c1e8fb}.sky-timepicker-column ol .sky-btn-active{background-color:#c1e8fb;box-shadow:inset 0 0 0 2px #00b4f1;border-radius:3px}.sky-timepicker-column.sky-timepicker-24hour ol{columns:4}.sky-timepicker-column.sky-timepicker-24hour ol li{border-bottom-width:0}.sky-timepicker-content{display:flex}.sky-timepicker-content button{background-color:#fff;border-width:0;padding:5px 15px;width:100%;height:100%}.sky-timepicker-footer{margin:0;padding:0 5px}.sky-timepicker-footer .sky-timepicker-column{margin-left:0;margin-right:0;width:100%}.sky-timepicker-hidden{visibility:hidden}.sky-timepicker-clock-icon-modern,.sky-theme-modern .sky-timepicker-clock-icon-default{display:none}.sky-theme-modern .sky-timepicker-clock-icon-modern{display:inline}.sky-theme-modern .sky-timepicker-container{background-color:#fff;border:solid 1px #cdcfd2;border-radius:6px;font-size:16px}.sky-theme-modern .sky-timepicker-container:focus-within{border:solid 2px #1870B8;padding:4px}.sky-theme-modern .sky-timepicker-container:last-child ol li{border-bottom:none}.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol .sky-btn-default{border-width:1px;border-color:transparent;padding:4px 6px;outline:none}.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol button:hover:not(.sky-btn-active){background-color:transparent}.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol .sky-btn-active,.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol button:hover{box-shadow:inset 0 0 0 1px #00b4f1;border-radius:6px}.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol button:active,.sky-theme-modern .sky-timepicker-container .sky-timepicker-column ol button:focus{outline:none;border-radius:6px;box-shadow:inset 0 0 0 2px #1870b8}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-container{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-container:not(:focus-within){border-color:#686c73}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-column ol{border-color:#686c73}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-column ol button{background-color:transparent;color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-timepicker-column ol .sky-btn-active{background-color:#009cd1}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i3$2.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "pipe", type: i3.SkyLibResourcesPipe, name: "skyLibResources" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
4448
4549
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyTimepickerComponent, decorators: [{
|
@@ -4483,6 +4584,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
4483
4584
|
}]
|
4484
4585
|
}] } });
|
4485
4586
|
|
4587
|
+
var _SkyTimepickerInputDirective_instances, _SkyTimepickerInputDirective__timeFormat, _SkyTimepickerInputDirective_modelValue_get, _SkyTimepickerInputDirective_modelValue_set, _SkyTimepickerInputDirective_control, _SkyTimepickerInputDirective__disabled, _SkyTimepickerInputDirective__modelValue, _SkyTimepickerInputDirective__skyTimepickerInput, _SkyTimepickerInputDirective_renderer, _SkyTimepickerInputDirective_elRef, _SkyTimepickerInputDirective_resourcesService, _SkyTimepickerInputDirective_changeDetector, _SkyTimepickerInputDirective_setInputValue, _SkyTimepickerInputDirective_formatter, _SkyTimepickerInputDirective_updateTimepickerInput, _SkyTimepickerInputDirective__onChange, _SkyTimepickerInputDirective__onTouched, _SkyTimepickerInputDirective__validatorChange;
|
4486
4588
|
const SKY_TIMEPICKER_VALUE_ACCESSOR = {
|
4487
4589
|
provide: NG_VALUE_ACCESSOR,
|
4488
4590
|
useExisting: forwardRef(() => SkyTimepickerInputDirective),
|
@@ -4495,18 +4597,31 @@ const SKY_TIMEPICKER_VALIDATOR = {
|
|
4495
4597
|
};
|
4496
4598
|
class SkyTimepickerInputDirective {
|
4497
4599
|
constructor(renderer, elRef, resourcesService, changeDetector) {
|
4498
|
-
this
|
4499
|
-
this
|
4500
|
-
this
|
4501
|
-
this
|
4502
|
-
this
|
4503
|
-
|
4504
|
-
this
|
4600
|
+
_SkyTimepickerInputDirective_instances.add(this);
|
4601
|
+
_SkyTimepickerInputDirective__timeFormat.set(this, 'hh');
|
4602
|
+
_SkyTimepickerInputDirective_control.set(this, void 0);
|
4603
|
+
_SkyTimepickerInputDirective__disabled.set(this, false);
|
4604
|
+
_SkyTimepickerInputDirective__modelValue.set(this, void 0);
|
4605
|
+
_SkyTimepickerInputDirective__skyTimepickerInput.set(this, void 0);
|
4606
|
+
_SkyTimepickerInputDirective_renderer.set(this, void 0);
|
4607
|
+
_SkyTimepickerInputDirective_elRef.set(this, void 0);
|
4608
|
+
_SkyTimepickerInputDirective_resourcesService.set(this, void 0);
|
4609
|
+
_SkyTimepickerInputDirective_changeDetector.set(this, void 0);
|
4610
|
+
/* istanbul ignore next */
|
4611
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
4612
|
+
_SkyTimepickerInputDirective__onChange.set(this, (_) => { });
|
4613
|
+
/* istanbul ignore next */
|
4505
4614
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
4506
|
-
this
|
4615
|
+
_SkyTimepickerInputDirective__onTouched.set(this, () => { });
|
4616
|
+
/* istanbul ignore next */
|
4507
4617
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
4508
|
-
this
|
4618
|
+
_SkyTimepickerInputDirective__validatorChange.set(this, () => { });
|
4619
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective_renderer, renderer, "f");
|
4620
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective_elRef, elRef, "f");
|
4621
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective_resourcesService, resourcesService, "f");
|
4622
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective_changeDetector, changeDetector, "f");
|
4509
4623
|
}
|
4624
|
+
// TODO: In a future breaking change - grab the parent component through dependency injection and remove this setter.
|
4510
4625
|
/**
|
4511
4626
|
* Creates the timepicker input field and picker. Place this attribute on an `input` element,
|
4512
4627
|
* and wrap the input in a `sky-timepicker` component.
|
@@ -4514,70 +4629,59 @@ class SkyTimepickerInputDirective {
|
|
4514
4629
|
* @required
|
4515
4630
|
*/
|
4516
4631
|
get skyTimepickerInput() {
|
4517
|
-
return this
|
4632
|
+
return __classPrivateFieldGet(this, _SkyTimepickerInputDirective__skyTimepickerInput, "f");
|
4518
4633
|
}
|
4519
4634
|
set skyTimepickerInput(value) {
|
4520
|
-
this
|
4521
|
-
this.
|
4635
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective__skyTimepickerInput, value, "f");
|
4636
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_instances, "m", _SkyTimepickerInputDirective_updateTimepickerInput).call(this);
|
4522
4637
|
}
|
4638
|
+
// TODO: In a future breaking change - make this more specific than "string"
|
4523
4639
|
/**
|
4524
4640
|
* Specifies the 12-hour `hh` or 24-hour `HH` time format for the input.
|
4525
4641
|
* @default "hh"
|
4526
4642
|
*/
|
4527
4643
|
set timeFormat(value) {
|
4528
|
-
this
|
4644
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective__timeFormat, value || 'hh', "f");
|
4529
4645
|
}
|
4530
4646
|
get timeFormat() {
|
4531
|
-
return this
|
4647
|
+
return __classPrivateFieldGet(this, _SkyTimepickerInputDirective__timeFormat, "f");
|
4532
4648
|
}
|
4533
4649
|
/**
|
4534
4650
|
* Indicates whether to disable the timepicker.
|
4535
4651
|
* @default false
|
4536
4652
|
*/
|
4537
4653
|
get disabled() {
|
4538
|
-
return this
|
4654
|
+
return __classPrivateFieldGet(this, _SkyTimepickerInputDirective__disabled, "f");
|
4539
4655
|
}
|
4540
4656
|
set disabled(value) {
|
4541
|
-
this
|
4542
|
-
this.
|
4543
|
-
this.
|
4544
|
-
}
|
4545
|
-
get modelValue() {
|
4546
|
-
return this._modelValue;
|
4547
|
-
}
|
4548
|
-
set modelValue(value) {
|
4549
|
-
if (value !== this._modelValue) {
|
4550
|
-
this._modelValue = value;
|
4551
|
-
this.updateTimepickerInput();
|
4552
|
-
this.setInputValue(value);
|
4553
|
-
this._validatorChange();
|
4554
|
-
this._onChange(value);
|
4555
|
-
}
|
4657
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective__disabled, value || false, "f");
|
4658
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_instances, "m", _SkyTimepickerInputDirective_updateTimepickerInput).call(this);
|
4659
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_renderer, "f").setProperty(__classPrivateFieldGet(this, _SkyTimepickerInputDirective_elRef, "f").nativeElement, 'disabled', value);
|
4556
4660
|
}
|
4557
4661
|
ngOnInit() {
|
4558
|
-
this.
|
4662
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_renderer, "f").addClass(__classPrivateFieldGet(this, _SkyTimepickerInputDirective_elRef, "f").nativeElement, 'sky-form-control');
|
4559
4663
|
this.pickerChangedSubscription =
|
4560
|
-
this.skyTimepickerInput
|
4664
|
+
this.skyTimepickerInput?.selectedTimeChanged.subscribe((newTime) => {
|
4561
4665
|
this.writeValue(newTime);
|
4562
|
-
this.
|
4666
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective__onTouched, "f").call(this);
|
4563
4667
|
});
|
4564
4668
|
/* istanbul ignore else */
|
4565
|
-
if (!this.
|
4566
|
-
this
|
4669
|
+
if (!__classPrivateFieldGet(this, _SkyTimepickerInputDirective_elRef, "f").nativeElement.getAttribute('aria-label')) {
|
4670
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_resourcesService, "f")
|
4567
4671
|
.getString('skyux_timepicker_input_default_label')
|
4568
4672
|
.subscribe((value) => {
|
4569
|
-
this.
|
4673
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_renderer, "f").setAttribute(__classPrivateFieldGet(this, _SkyTimepickerInputDirective_elRef, "f").nativeElement, 'aria-label', value);
|
4570
4674
|
});
|
4571
4675
|
}
|
4572
4676
|
}
|
4573
4677
|
ngAfterContentInit() {
|
4574
4678
|
// Watch for the control to be added and initialize the value immediately.
|
4575
4679
|
/* istanbul ignore else */
|
4576
|
-
if (this
|
4577
|
-
this.
|
4680
|
+
if (__classPrivateFieldGet(this, _SkyTimepickerInputDirective_control, "f") && __classPrivateFieldGet(this, _SkyTimepickerInputDirective_control, "f").parent) {
|
4681
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_control, "f").setValue(__classPrivateFieldGet(this, _SkyTimepickerInputDirective_instances, "a", _SkyTimepickerInputDirective_modelValue_get), {
|
4578
4682
|
emitEvent: false,
|
4579
4683
|
});
|
4580
|
-
this.
|
4684
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_changeDetector, "f").markForCheck();
|
4581
4685
|
}
|
4582
4686
|
}
|
4583
4687
|
ngOnDestroy() {
|
@@ -4587,38 +4691,40 @@ class SkyTimepickerInputDirective {
|
|
4587
4691
|
}
|
4588
4692
|
}
|
4589
4693
|
ngOnChanges() {
|
4590
|
-
this.skyTimepickerInput
|
4591
|
-
|
4694
|
+
if (this.skyTimepickerInput) {
|
4695
|
+
this.skyTimepickerInput.setFormat(this.timeFormat);
|
4696
|
+
this.skyTimepickerInput.returnFormat = this.returnFormat;
|
4697
|
+
}
|
4592
4698
|
}
|
4593
4699
|
onChange(event) {
|
4594
4700
|
this.writeValue(event.target.value);
|
4595
4701
|
}
|
4596
4702
|
/* istanbul ignore next */
|
4597
4703
|
onBlur() {
|
4598
|
-
this.
|
4704
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective__onTouched, "f").call(this);
|
4599
4705
|
}
|
4600
4706
|
registerOnChange(fn) {
|
4601
|
-
this
|
4707
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective__onChange, fn, "f");
|
4602
4708
|
}
|
4603
4709
|
registerOnTouched(fn) {
|
4604
|
-
this
|
4710
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective__onTouched, fn, "f");
|
4605
4711
|
}
|
4606
4712
|
registerOnValidatorChange(fn) {
|
4607
|
-
this
|
4713
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective__validatorChange, fn, "f");
|
4608
4714
|
}
|
4609
4715
|
setDisabledState(isDisabled) {
|
4610
4716
|
this.disabled = isDisabled;
|
4611
4717
|
}
|
4612
4718
|
writeValue(value) {
|
4613
|
-
this
|
4719
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective_instances, __classPrivateFieldGet(this, _SkyTimepickerInputDirective_instances, "m", _SkyTimepickerInputDirective_formatter).call(this, value), "a", _SkyTimepickerInputDirective_modelValue_set);
|
4614
4720
|
}
|
4615
4721
|
validate(control) {
|
4616
|
-
if (!this
|
4617
|
-
this
|
4722
|
+
if (!__classPrivateFieldGet(this, _SkyTimepickerInputDirective_control, "f")) {
|
4723
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective_control, control, "f");
|
4618
4724
|
}
|
4619
4725
|
const value = control.value;
|
4620
4726
|
if (!value) {
|
4621
|
-
return
|
4727
|
+
return null;
|
4622
4728
|
}
|
4623
4729
|
/* istanbul ignore next */
|
4624
4730
|
if (value.local === 'Invalid date') {
|
@@ -4628,59 +4734,61 @@ class SkyTimepickerInputDirective {
|
|
4628
4734
|
},
|
4629
4735
|
};
|
4630
4736
|
}
|
4631
|
-
return
|
4737
|
+
return null;
|
4632
4738
|
}
|
4633
|
-
|
4634
|
-
|
4635
|
-
|
4636
|
-
|
4637
|
-
|
4638
|
-
|
4639
|
-
|
4640
|
-
|
4739
|
+
}
|
4740
|
+
_SkyTimepickerInputDirective__timeFormat = new WeakMap(), _SkyTimepickerInputDirective_control = new WeakMap(), _SkyTimepickerInputDirective__disabled = new WeakMap(), _SkyTimepickerInputDirective__modelValue = new WeakMap(), _SkyTimepickerInputDirective__skyTimepickerInput = new WeakMap(), _SkyTimepickerInputDirective_renderer = new WeakMap(), _SkyTimepickerInputDirective_elRef = new WeakMap(), _SkyTimepickerInputDirective_resourcesService = new WeakMap(), _SkyTimepickerInputDirective_changeDetector = new WeakMap(), _SkyTimepickerInputDirective__onChange = new WeakMap(), _SkyTimepickerInputDirective__onTouched = new WeakMap(), _SkyTimepickerInputDirective__validatorChange = new WeakMap(), _SkyTimepickerInputDirective_instances = new WeakSet(), _SkyTimepickerInputDirective_modelValue_get = function _SkyTimepickerInputDirective_modelValue_get() {
|
4741
|
+
return __classPrivateFieldGet(this, _SkyTimepickerInputDirective__modelValue, "f");
|
4742
|
+
}, _SkyTimepickerInputDirective_modelValue_set = function _SkyTimepickerInputDirective_modelValue_set(value) {
|
4743
|
+
if (value !== __classPrivateFieldGet(this, _SkyTimepickerInputDirective__modelValue, "f")) {
|
4744
|
+
__classPrivateFieldSet(this, _SkyTimepickerInputDirective__modelValue, value, "f");
|
4745
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_instances, "m", _SkyTimepickerInputDirective_updateTimepickerInput).call(this);
|
4746
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_instances, "m", _SkyTimepickerInputDirective_setInputValue).call(this, value);
|
4747
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective__validatorChange, "f").call(this);
|
4748
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective__onChange, "f").call(this, value);
|
4749
|
+
}
|
4750
|
+
}, _SkyTimepickerInputDirective_setInputValue = function _SkyTimepickerInputDirective_setInputValue(value) {
|
4751
|
+
let formattedValue = '';
|
4752
|
+
if (value) {
|
4753
|
+
const output = moment(value).format(value.customFormat);
|
4754
|
+
/* istanbul ignore else */
|
4755
|
+
if (output !== 'Invalid date') {
|
4756
|
+
formattedValue = output;
|
4641
4757
|
}
|
4642
|
-
this.renderer.setProperty(this.elRef.nativeElement, 'value', formattedValue);
|
4643
4758
|
}
|
4644
|
-
|
4645
|
-
|
4646
|
-
|
4647
|
-
|
4648
|
-
|
4649
|
-
|
4650
|
-
|
4651
|
-
|
4652
|
-
let currentFormat;
|
4653
|
-
if (this.timeFormat === 'hh') {
|
4654
|
-
currentFormat = 'h:mm A';
|
4655
|
-
}
|
4656
|
-
if (this.timeFormat === 'HH') {
|
4657
|
-
currentFormat = 'H:mm';
|
4658
|
-
}
|
4659
|
-
if (typeof this.returnFormat === 'undefined') {
|
4660
|
-
this.returnFormat = currentFormat;
|
4661
|
-
}
|
4662
|
-
const formatTime = {
|
4663
|
-
hour: moment(time, currentFormat).hour(),
|
4664
|
-
minute: moment(time, currentFormat).minute(),
|
4665
|
-
meridie: moment(time, currentFormat).format('A'),
|
4666
|
-
timezone: parseInt(moment(time, currentFormat).format('Z'), 10),
|
4667
|
-
iso8601: moment(time, currentFormat).toDate(),
|
4668
|
-
local: moment(time, currentFormat).format(currentFormat),
|
4669
|
-
customFormat: this.returnFormat,
|
4670
|
-
};
|
4671
|
-
return formatTime;
|
4759
|
+
__classPrivateFieldGet(this, _SkyTimepickerInputDirective_renderer, "f").setProperty(__classPrivateFieldGet(this, _SkyTimepickerInputDirective_elRef, "f").nativeElement, 'value', formattedValue);
|
4760
|
+
}, _SkyTimepickerInputDirective_formatter = function _SkyTimepickerInputDirective_formatter(time) {
|
4761
|
+
if (time && typeof time !== 'string' && 'local' in time) {
|
4762
|
+
return time;
|
4763
|
+
}
|
4764
|
+
if (typeof time === 'string') {
|
4765
|
+
if (time.length === 0) {
|
4766
|
+
return '';
|
4672
4767
|
}
|
4768
|
+
const currentFormat = this.timeFormat === 'HH' ? 'H:mm' : 'h:mm A';
|
4769
|
+
if (typeof this.returnFormat === 'undefined') {
|
4770
|
+
this.returnFormat = currentFormat;
|
4771
|
+
}
|
4772
|
+
const formatTime = {
|
4773
|
+
hour: moment(time, currentFormat).hour(),
|
4774
|
+
minute: moment(time, currentFormat).minute(),
|
4775
|
+
meridie: moment(time, currentFormat).format('A'),
|
4776
|
+
timezone: parseInt(moment(time, currentFormat).format('Z'), 10),
|
4777
|
+
iso8601: moment(time, currentFormat).toDate(),
|
4778
|
+
local: moment(time, currentFormat).format(currentFormat),
|
4779
|
+
customFormat: this.returnFormat,
|
4780
|
+
};
|
4781
|
+
return formatTime;
|
4673
4782
|
}
|
4674
|
-
|
4675
|
-
|
4676
|
-
|
4677
|
-
|
4678
|
-
|
4679
|
-
|
4680
|
-
}
|
4783
|
+
}, _SkyTimepickerInputDirective_updateTimepickerInput = function _SkyTimepickerInputDirective_updateTimepickerInput() {
|
4784
|
+
if (this.skyTimepickerInput) {
|
4785
|
+
this.skyTimepickerInput.disabled = this.disabled;
|
4786
|
+
/* istanbul ignore else */
|
4787
|
+
if (this.skyTimepickerInput.selectedTime !== __classPrivateFieldGet(this, _SkyTimepickerInputDirective_instances, "a", _SkyTimepickerInputDirective_modelValue_get)) {
|
4788
|
+
this.skyTimepickerInput.selectedTime = __classPrivateFieldGet(this, _SkyTimepickerInputDirective_instances, "a", _SkyTimepickerInputDirective_modelValue_get);
|
4681
4789
|
}
|
4682
4790
|
}
|
4683
|
-
}
|
4791
|
+
};
|
4684
4792
|
SkyTimepickerInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyTimepickerInputDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.SkyLibResourcesService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
4685
4793
|
SkyTimepickerInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: SkyTimepickerInputDirective, selector: "[skyTimepickerInput]", inputs: { skyTimepickerInput: "skyTimepickerInput", timeFormat: "timeFormat", returnFormat: "returnFormat", disabled: "disabled" }, host: { listeners: { "change": "onChange($event)", "blur": "onBlur()" } }, providers: [SKY_TIMEPICKER_VALUE_ACCESSOR, SKY_TIMEPICKER_VALIDATOR], usesOnChanges: true, ngImport: i0 });
|
4686
4794
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyTimepickerInputDirective, decorators: [{
|