@skyux/datetime 7.0.0-beta.0 → 7.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation.json +700 -670
- package/esm2020/lib/modules/date-pipe/date-format-utility.mjs +3 -6
- package/esm2020/lib/modules/date-pipe/date.pipe.mjs +22 -15
- package/esm2020/lib/modules/date-pipe/fuzzy-date.pipe.mjs +2 -2
- package/esm2020/lib/modules/datepicker/datepicker-input-fuzzy.directive.mjs +2 -15
- package/fesm2015/skyux-datetime.mjs +26 -34
- package/fesm2015/skyux-datetime.mjs.map +1 -1
- package/fesm2020/skyux-datetime.mjs +25 -34
- package/fesm2020/skyux-datetime.mjs.map +1 -1
- package/lib/modules/date-pipe/date-format-utility.d.ts +1 -1
- package/lib/modules/date-pipe/date.pipe.d.ts +1 -7
- package/lib/modules/datepicker/datepicker-input-fuzzy.directive.d.ts +1 -10
- package/package.json +9 -9
@@ -1,3 +1,4 @@
|
|
1
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
|
1
2
|
import * as i0 from '@angular/core';
|
2
3
|
import { Pipe, NgModule, Injectable, EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ViewChild, ElementRef, TemplateRef, Optional, forwardRef, Directive, HostListener } from '@angular/core';
|
3
4
|
import * as i3 from '@skyux/i18n';
|
@@ -31,7 +32,7 @@ class SkyDateFormatUtility {
|
|
31
32
|
// introduce a breaking change, so we check for it here. This could probably be removed
|
32
33
|
// in a future major version.
|
33
34
|
if (value instanceof Object && !(value instanceof Date)) {
|
34
|
-
|
35
|
+
throw new Error('Invalid value: ' + value);
|
35
36
|
}
|
36
37
|
// Use moment to avoid inconsistencies between browsers interpreting the value differently.
|
37
38
|
const momentDate = moment(value);
|
@@ -39,7 +40,7 @@ class SkyDateFormatUtility {
|
|
39
40
|
date = momentDate.toDate();
|
40
41
|
}
|
41
42
|
else {
|
42
|
-
|
43
|
+
throw new Error('Invalid value: ' + value);
|
43
44
|
}
|
44
45
|
return SkyIntlDateFormatter.format(date, locale, SkyDateFormatUtility._ALIASES[pattern] || pattern);
|
45
46
|
}
|
@@ -57,10 +58,8 @@ SkyDateFormatUtility._ALIASES = {
|
|
57
58
|
function isBlank(obj) {
|
58
59
|
return !obj;
|
59
60
|
}
|
60
|
-
function handleInvalidDate(value) {
|
61
|
-
throw new Error('Invalid value: ' + value);
|
62
|
-
}
|
63
61
|
|
62
|
+
var _SkyDatePipe_defaultFormat, _SkyDatePipe_format, _SkyDatePipe_defaultLocale, _SkyDatePipe_locale, _SkyDatePipe_value, _SkyDatePipe_formattedValue, _SkyDatePipe_ngUnsubscribe;
|
64
63
|
/**
|
65
64
|
* Formats date values according to locale rules.
|
66
65
|
* @example
|
@@ -73,20 +72,24 @@ function handleInvalidDate(value) {
|
|
73
72
|
class SkyDatePipe {
|
74
73
|
constructor(localeProvider) {
|
75
74
|
this.localeProvider = localeProvider;
|
76
|
-
this
|
77
|
-
this
|
78
|
-
this
|
75
|
+
_SkyDatePipe_defaultFormat.set(this, 'short');
|
76
|
+
_SkyDatePipe_format.set(this, void 0);
|
77
|
+
_SkyDatePipe_defaultLocale.set(this, 'en-US');
|
78
|
+
_SkyDatePipe_locale.set(this, void 0);
|
79
|
+
_SkyDatePipe_value.set(this, void 0);
|
80
|
+
_SkyDatePipe_formattedValue.set(this, void 0);
|
81
|
+
_SkyDatePipe_ngUnsubscribe.set(this, new Subject());
|
79
82
|
this.localeProvider
|
80
83
|
.getLocaleInfo()
|
81
|
-
.pipe(takeUntil(this
|
84
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyDatePipe_ngUnsubscribe, "f")))
|
82
85
|
.subscribe((localeInfo) => {
|
83
|
-
this
|
86
|
+
__classPrivateFieldSet(this, _SkyDatePipe_defaultLocale, localeInfo.locale, "f");
|
84
87
|
this.updateFormattedValue();
|
85
88
|
});
|
86
89
|
}
|
87
90
|
ngOnDestroy() {
|
88
|
-
this.
|
89
|
-
this.
|
91
|
+
__classPrivateFieldGet(this, _SkyDatePipe_ngUnsubscribe, "f").next();
|
92
|
+
__classPrivateFieldGet(this, _SkyDatePipe_ngUnsubscribe, "f").complete();
|
90
93
|
}
|
91
94
|
/**
|
92
95
|
* Transforms a date value using locale and format rules.
|
@@ -97,18 +100,19 @@ class SkyDatePipe {
|
|
97
100
|
* @param locale Specifies the locale code to use in the transform.
|
98
101
|
*/
|
99
102
|
transform(value, format, locale) {
|
100
|
-
this
|
101
|
-
this
|
102
|
-
this
|
103
|
+
__classPrivateFieldSet(this, _SkyDatePipe_value, value, "f");
|
104
|
+
__classPrivateFieldSet(this, _SkyDatePipe_format, format, "f");
|
105
|
+
__classPrivateFieldSet(this, _SkyDatePipe_locale, locale, "f");
|
103
106
|
this.updateFormattedValue();
|
104
|
-
return this
|
107
|
+
return __classPrivateFieldGet(this, _SkyDatePipe_formattedValue, "f") ?? '';
|
105
108
|
}
|
106
109
|
updateFormattedValue() {
|
107
|
-
const locale = this
|
108
|
-
const format = this
|
109
|
-
this
|
110
|
+
const locale = __classPrivateFieldGet(this, _SkyDatePipe_locale, "f") || __classPrivateFieldGet(this, _SkyDatePipe_defaultLocale, "f");
|
111
|
+
const format = __classPrivateFieldGet(this, _SkyDatePipe_format, "f") || __classPrivateFieldGet(this, _SkyDatePipe_defaultFormat, "f");
|
112
|
+
__classPrivateFieldSet(this, _SkyDatePipe_formattedValue, SkyDateFormatUtility.format(locale, __classPrivateFieldGet(this, _SkyDatePipe_value, "f"), format), "f");
|
110
113
|
}
|
111
114
|
}
|
115
|
+
_SkyDatePipe_defaultFormat = new WeakMap(), _SkyDatePipe_format = new WeakMap(), _SkyDatePipe_defaultLocale = new WeakMap(), _SkyDatePipe_locale = new WeakMap(), _SkyDatePipe_value = new WeakMap(), _SkyDatePipe_formattedValue = new WeakMap(), _SkyDatePipe_ngUnsubscribe = new WeakMap();
|
112
116
|
SkyDatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatePipe, deps: [{ token: i3.SkyAppLocaleProvider }], target: i0.ɵɵFactoryTarget.Pipe });
|
113
117
|
SkyDatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: SkyDatePipe, name: "skyDate", pure: false });
|
114
118
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyDatePipe, decorators: [{
|
@@ -668,7 +672,7 @@ class SkyFuzzyDatePipe {
|
|
668
672
|
*/
|
669
673
|
transform(value, format, locale) {
|
670
674
|
if (!value) {
|
671
|
-
return
|
675
|
+
return '';
|
672
676
|
}
|
673
677
|
const fuzzyDateFormat = format || this.fuzzyDateService.getLocaleShortFormat(locale);
|
674
678
|
const fuzzyDateLocale = locale || this.fuzzyDateService.getCurrentLocale();
|
@@ -2313,17 +2317,6 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2313
2317
|
get minDate() {
|
2314
2318
|
return this._minDate;
|
2315
2319
|
}
|
2316
|
-
/**
|
2317
|
-
* Creates the fuzzy datepicker input and calendar to let users specify dates that are
|
2318
|
-
* not complete. For example, if users know the year but not the month or day, they can
|
2319
|
-
* enter just the year. Place this directive on an `input` element, and wrap the `input`
|
2320
|
-
* in a `sky-datepicker` component. The value that users select is driven
|
2321
|
-
* through the `ngModel` attribute specified on the `input` element.
|
2322
|
-
* @required
|
2323
|
-
*/
|
2324
|
-
set skyFuzzyDatepickerInput(value) {
|
2325
|
-
// TODO: Remove this property in a future version of SKY UX.
|
2326
|
-
}
|
2327
2320
|
/**
|
2328
2321
|
* Specifies the starting day of the week in the calendar, where `0` sets the starting day
|
2329
2322
|
* to Sunday. Place this attribute on the `input` element to override the default
|
@@ -2603,7 +2596,7 @@ class SkyFuzzyDatepickerInputDirective {
|
|
2603
2596
|
}
|
2604
2597
|
}
|
2605
2598
|
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 });
|
2606
|
-
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",
|
2599
|
+
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: [
|
2607
2600
|
SKY_FUZZY_DATEPICKER_VALUE_ACCESSOR,
|
2608
2601
|
SKY_FUZZY_DATEPICKER_VALIDATOR,
|
2609
2602
|
], ngImport: i0 });
|
@@ -2630,8 +2623,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
2630
2623
|
type: Input
|
2631
2624
|
}], skyDatepickerNoValidate: [{
|
2632
2625
|
type: Input
|
2633
|
-
}], skyFuzzyDatepickerInput: [{
|
2634
|
-
type: Input
|
2635
2626
|
}], startingDay: [{
|
2636
2627
|
type: Input
|
2637
2628
|
}], yearRequired: [{
|