@anglr/datetime 9.0.0-beta.20241007073342 → 9.0.0-beta.20250123122641
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/changelog.md +14 -5
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js +3 -3
- package/es2022/moment/src/services/momentDateApi.service.js +3 -3
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js +3 -4
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js.map +1 -1
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js +3 -4
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +3 -4
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +3 -4
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js +3 -4
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js +3 -4
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js +3 -4
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/withNow/withNow.directive.js +3 -4
- package/es2022/src/directives/withNow/withNow.directive.js.map +1 -1
- package/es2022/src/directives/withTime/withTime.directive.js +7 -8
- package/es2022/src/directives/withTime/withTime.directive.js.map +1 -1
- package/es2022/src/directives/withToday/withToday.directive.js +3 -4
- package/es2022/src/directives/withToday/withToday.directive.js.map +1 -1
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js +4 -4
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +1 -1
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js +3 -4
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +1 -1
- package/es2022/src/modules/calendar/modules/monthCalendar.module.js +4 -4
- package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js +3 -3
- package/es2022/src/modules/datePipes.module.js +4 -4
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js +3 -4
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeBase.js +3 -3
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js +3 -4
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +3 -4
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +5 -6
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +5 -6
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +5 -6
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/modules/dateTime.module.js +4 -4
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +11 -10
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +4 -4
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +4 -4
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +6 -7
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +4 -4
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +5 -5
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js +3 -4
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +3 -4
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js +4 -4
- package/es2022/src/pipes/dateConvert.pipe.js +8 -4
- package/es2022/src/pipes/dateConvert.pipe.js.map +1 -1
- package/es2022/src/pipes/dateFormat.pipe.js +9 -6
- package/es2022/src/pipes/dateFormat.pipe.js.map +1 -1
- package/es2022/src/services/datePositionParser/datePositionParser.service.js +3 -3
- package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js +3 -3
- package/es2022/src/services/dateValueProvider/dateValueProvider.service.js +3 -3
- package/package.json +35 -29
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts.map +1 -1
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts.map +1 -1
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/withNow/withNow.directive.d.ts.map +1 -1
- package/src/directives/withTime/withTime.directive.d.ts.map +1 -1
- package/src/directives/withToday/withToday.directive.d.ts.map +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts.map +1 -1
- package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeBase.d.ts +1 -1
- package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts +0 -1
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts.map +1 -1
- package/src/pipes/dateConvert.pipe.d.ts +1 -1
- package/src/pipes/dateConvert.pipe.d.ts.map +1 -1
- package/src/pipes/dateFormat.pipe.d.ts +5 -5
- package/src/pipes/dateFormat.pipe.d.ts.map +1 -1
- package/version.bak +1 -1
- package/lerna.json +0 -4
package/changelog.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## Version 9.0.0 (
|
|
3
|
+
## Version 9.0.0 (2025-01-23)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- fixed `DateConvertPipe` pipe
|
|
8
|
+
- fixed typings, now correctly accepts also `undefined` and `null`
|
|
9
|
+
- works as pre date-fns 4, which returns `null` value for `null` or `undefined` input value
|
|
10
|
+
- fixed `DateFormatPipe` pipe
|
|
11
|
+
- fixed typings, now correctly accepts also `undefined` and `null`
|
|
12
|
+
- works as pre date-fns 4, which returns empty string value for `null` or `undefined` input value
|
|
4
13
|
|
|
5
14
|
### Features
|
|
6
15
|
|
|
@@ -35,12 +44,12 @@
|
|
|
35
44
|
|
|
36
45
|
### BREAKING CHANGES
|
|
37
46
|
|
|
38
|
-
- minimal supported version of `@angular` is `
|
|
39
|
-
- minimal supported version of `@jscrpt/common` is `
|
|
40
|
-
- minimal supported version of `@anglr/common` is `
|
|
47
|
+
- minimal supported version of `@angular` is `19.1.0`
|
|
48
|
+
- minimal supported version of `@jscrpt/common` is `7.0.0`
|
|
49
|
+
- minimal supported version of `@anglr/common` is `22.0.0`
|
|
41
50
|
- minimal supported version of `date-fns` is `4.1.0`
|
|
42
51
|
- minimal supported version of `moment` is `2.30.1`
|
|
43
|
-
- minimal supported version of `tslib` is `2.
|
|
52
|
+
- minimal supported version of `tslib` is `2.8.1`
|
|
44
53
|
- updated all comments, fixed *unix timestamp* for *timestamp*
|
|
45
54
|
- updated `DateTimeValueFormat` enum
|
|
46
55
|
- `UnixTimestamp` now returns value in seconds, use `Timestamp` to get value in miliseconds
|
|
@@ -504,10 +504,10 @@ export class DateFnsDateApi {
|
|
|
504
504
|
isDate(value) {
|
|
505
505
|
return isDate(value);
|
|
506
506
|
}
|
|
507
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
508
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
507
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateFnsDateApi, deps: [{ token: DATE_FNS_LOCALE }, { token: i1.DateTimeRelativeParser }, { token: DATE_API_OBJECT_TYPE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
508
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateFnsDateApi }); }
|
|
509
509
|
}
|
|
510
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateFnsDateApi, decorators: [{
|
|
511
511
|
type: Injectable
|
|
512
512
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
513
513
|
type: Inject,
|
|
@@ -459,10 +459,10 @@ export class MomentDateApi {
|
|
|
459
459
|
isDate(value) {
|
|
460
460
|
return value instanceof moment;
|
|
461
461
|
}
|
|
462
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
463
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
462
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MomentDateApi, deps: [{ token: i1.DateTimeRelativeParser }, { token: DATE_API_OBJECT_TYPE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
463
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MomentDateApi }); }
|
|
464
464
|
}
|
|
465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
465
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MomentDateApi, decorators: [{
|
|
466
466
|
type: Injectable
|
|
467
467
|
}], ctorParameters: () => [{ type: i1.DateTimeRelativeParser }, { type: undefined, decorators: [{
|
|
468
468
|
type: Inject,
|
|
@@ -94,8 +94,8 @@ export class ButtonDateTimeInputDirective extends DateTimeBase {
|
|
|
94
94
|
handleBlur(event) {
|
|
95
95
|
this.blur.emit(event);
|
|
96
96
|
}
|
|
97
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
98
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
97
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: ButtonDateTimeInputDirective, deps: [{ token: i0.ElementRef }, { token: DATE_API }, { token: i1.DateValueProvider }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
98
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: ButtonDateTimeInputDirective, isStandalone: true, selector: "button[dateTime][dateTimeInput],a[dateTime][dateTimeInput]", inputs: { value: "value" }, providers: [
|
|
99
99
|
{
|
|
100
100
|
provide: DATE_TIME_INPUT,
|
|
101
101
|
useExisting: forwardRef(() => ButtonDateTimeInputDirective),
|
|
@@ -114,7 +114,7 @@ __decorate([
|
|
|
114
114
|
__metadata("design:paramtypes", [FocusEvent]),
|
|
115
115
|
__metadata("design:returntype", void 0)
|
|
116
116
|
], ButtonDateTimeInputDirective.prototype, "handleBlur", null);
|
|
117
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: ButtonDateTimeInputDirective, decorators: [{
|
|
118
118
|
type: Directive,
|
|
119
119
|
args: [{
|
|
120
120
|
selector: 'button[dateTime][dateTimeInput],a[dateTime][dateTimeInput]',
|
|
@@ -124,7 +124,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
124
124
|
useExisting: forwardRef(() => ButtonDateTimeInputDirective),
|
|
125
125
|
},
|
|
126
126
|
],
|
|
127
|
-
standalone: true,
|
|
128
127
|
exportAs: 'dateTime',
|
|
129
128
|
}]
|
|
130
129
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttonDateTimeInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAoB,UAAU,EAAE,MAAM,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAC1H,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,gDAAgD,CAAC;AAG5E,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAU,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;;;AAE1D;;GAEG;
|
|
1
|
+
{"version":3,"file":"buttonDateTimeInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAoB,UAAU,EAAE,MAAM,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAC1H,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,gDAAgD,CAAC;AAG5E,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAU,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;;;AAE1D;;GAEG;AAcH,MAAM,OAAO,4BAA8C,SAAQ,YAAmB;IAgBlF;;OAEG;IACH,IACoB,KAAK;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAoB,KAAK,CAAC,KAAqD;QAE3E,+BAA+B;QAC/B,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAE9I,iBAAiB;QACjB,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,EACrC,CAAC;YACG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAC/E,CAAC;aAED,CAAC;YACG,8BAA8B;QAClC,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,IAAI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AAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACtG,CAAC;IAED;;;OAGG;IAEO,WAAW,CAAC,KAAiB;QAEnC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED;;;OAGG;IAEO,UAAU,CAAC,KAAiB;QAElC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;8GA/HQ,4BAA4B,4CA4EjB,QAAQ;kGA5EnB,4BAA4B,qIATrC;YAEI;gBACI,OAAO,EAAE,eAAe;gBACxB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC;aAC9D;SACJ;;AAqHS;IADT,QAAQ;;qCACoB,UAAU;;+DAGtC;AAOS;IADT,QAAQ;;qCACmB,UAAU;;8DAGrC;2FA/HQ,4BAA4B;kBAbxC,SAAS;mBACV;oBACI,QAAQ,EAAE,4DAA4D;oBACtE,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,eAAe;4BACxB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,6BAA6B,CAAC;yBAC9D;qBACJ;oBACD,QAAQ,EAAE,UAAU;iBACvB;;0BA6EgB,MAAM;2BAAC,QAAQ;yEAxDR,KAAK;sBADxB,KAAK;gBA+FI,WAAW,MAUX,UAAU","sourcesContent":["import {Directive, ElementRef, EventEmitter, ExistingProvider, forwardRef, Inject, Input, OnDestroy} from '@angular/core';\nimport {BindThis} from '@jscrpt/common';\n\nimport {DATE_API, DATE_TIME_INPUT} from '../../misc/tokens';\nimport {DateTimeBase} from '../../modules/dateTime/directives/dateTimeBase';\nimport {DateTimeInput} from '../../interfaces';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from '../../misc/types';\nimport {formatDateTime, getInternalValue} from '../../misc/utils';\nimport {DateApi, DateValueProvider} from '../../services';\n\n/**\n * Directive that is used for setting up date time input for button\n */\n@Directive(\n{\n selector: 'button[dateTime][dateTimeInput],a[dateTime][dateTimeInput]',\n providers:\n [\n <ExistingProvider>\n {\n provide: DATE_TIME_INPUT,\n useExisting: forwardRef(() => ButtonDateTimeInputDirective),\n },\n ],\n exportAs: 'dateTime',\n})\nexport class ButtonDateTimeInputDirective<TDate = unknown> extends DateTimeBase<TDate> implements DateTimeInput, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\n\n //######################### public properties - implementation of DateTimeInput #########################\n\n /**\n * @inheritdoc\n */\n public rawValue: string|undefined|null;\n\n /**\n * @inheritdoc\n */\n @Input()\n public override get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public override set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n \n //not range value\n if(!Array.isArray(this.internalValue))\n {\n this.rawValue = this.internalValue?.format(this.dateTimeData.customFormat);\n }\n else\n {\n //TODO: add support for ranges\n }\n\n this.valueSet.next();\n }\n\n /**\n * @inheritdoc\n */\n public get disabled(): boolean\n {\n //TODO: check if anchor\n return this.elementRef.nativeElement.disabled;\n }\n public set disabled(value: boolean)\n {\n this.elementRef.nativeElement.disabled = value;\n }\n\n /**\n * @inheritdoc\n */\n public get element(): HTMLElement\n {\n return this.elementRef.nativeElement;\n }\n\n /**\n * @inheritdoc\n */\n public focus: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n /**\n * @inheritdoc\n */\n public blur: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n //######################### constructors #########################\n constructor(protected elementRef: ElementRef<HTMLButtonElement>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected valueProvider: DateValueProvider<TDate>,)\n {\n super();\n\n this.elementRef.nativeElement.addEventListener('click', this.handleClick);\n this.elementRef.nativeElement.addEventListener('blur', this.handleBlur);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public override ngOnDestroy(): void\n {\n super.ngOnDestroy();\n\n this.elementRef.nativeElement.removeEventListener('click', this.handleClick);\n this.elementRef.nativeElement.removeEventListener('blur', this.handleBlur);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null): void\n {\n this.internalValue = getInternalValue(value, this.dateApi, this.dateTimeData, this.valueProvider);\n }\n\n /**\n * Handles focus event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleClick(event: FocusEvent): void\n {\n this.focus.emit(event);\n }\n\n /**\n * Handles blur event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleBlur(event: FocusEvent): void\n {\n this.blur.emit(event);\n }\n}"]}
|
|
@@ -9,14 +9,13 @@ import * as i3 from "../dateTimeInputHandler/dateTimeInputHandler.directive";
|
|
|
9
9
|
* Directive that combines date picker with date input
|
|
10
10
|
*/
|
|
11
11
|
export class DatePickerInputDirective {
|
|
12
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
13
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DatePickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
13
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: DatePickerInputDirective, isStandalone: true, selector: "input[dateTime][datePickerInput]", hostDirectives: [{ directive: i1.DateTimePickerDirective, inputs: ["withPickerOptions", "withPickerOptions", "pickerOptions", "pickerOptions"] }, { directive: i2.DateTimeInputDirective }, { directive: i3.DateTimeInputHandlerDirective }], ngImport: i0 }); }
|
|
14
14
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DatePickerInputDirective, decorators: [{
|
|
16
16
|
type: Directive,
|
|
17
17
|
args: [{
|
|
18
18
|
selector: 'input[dateTime][datePickerInput]',
|
|
19
|
-
standalone: true,
|
|
20
19
|
hostDirectives: [
|
|
21
20
|
{
|
|
22
21
|
directive: DateTimePickerDirective,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/datePickerInput/datePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,6BAA6B,EAAC,MAAM,wDAAwD,CAAC;;;;;AAErG;;GAEG;
|
|
1
|
+
{"version":3,"file":"datePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/datePickerInput/datePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,6BAA6B,EAAC,MAAM,wDAAwD,CAAC;;;;;AAErG;;GAEG;AAsBH,MAAM,OAAO,wBAAwB;8GAAxB,wBAAwB;kGAAxB,wBAAwB;;2FAAxB,wBAAwB;kBArBpC,SAAS;mBACV;oBACI,QAAQ,EAAE,kCAAkC;oBAC5C,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,uBAAuB;4BAClC,MAAM,EACN;gCACI,mBAAmB;gCACnB,eAAe;6BAClB;yBACJ;wBACD;4BACI,SAAS,EAAE,sBAAsB;yBACpC;wBACD;4BACI,SAAS,EAAE,6BAA6B;yBAC3C;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {DateTimeInputDirective, DateTimePickerDirective} from '../../modules';\nimport {DateTimeInputHandlerDirective} from '../dateTimeInputHandler/dateTimeInputHandler.directive';\n\n/**\n * Directive that combines date picker with date input\n */\n@Directive(\n{\n selector: 'input[dateTime][datePickerInput]',\n hostDirectives:\n [\n {\n directive: DateTimePickerDirective,\n inputs:\n [\n 'withPickerOptions',\n 'pickerOptions',\n ]\n },\n {\n directive: DateTimeInputDirective,\n },\n {\n directive: DateTimeInputHandlerDirective,\n },\n ],\n})\nexport class DatePickerInputDirective\n{\n}"]}
|
|
@@ -277,8 +277,8 @@ export class DateTimeInputHandlerDirective {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
281
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeInputHandlerDirective, deps: [{ token: DATE_TIME_INPUT }, { token: DATE_API }, { token: i1.DateTimeDirective }, { token: i2.DatePositionParserService }, { token: i2.DateValueProvider }, { token: i1.DateTimePickerDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
281
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: DateTimeInputHandlerDirective, isStandalone: true, selector: "[dateTime][withHandler]", ngImport: i0 }); }
|
|
282
282
|
}
|
|
283
283
|
__decorate([
|
|
284
284
|
BindThis,
|
|
@@ -304,11 +304,10 @@ __decorate([
|
|
|
304
304
|
__metadata("design:paramtypes", [KeyboardEvent]),
|
|
305
305
|
__metadata("design:returntype", void 0)
|
|
306
306
|
], DateTimeInputHandlerDirective.prototype, "handleKeyboard", null);
|
|
307
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeInputHandlerDirective, decorators: [{
|
|
308
308
|
type: Directive,
|
|
309
309
|
args: [{
|
|
310
310
|
selector: '[dateTime][withHandler]',
|
|
311
|
-
standalone: true,
|
|
312
311
|
}]
|
|
313
312
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
314
313
|
type: Inject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeInputHandler.directive.js","sourceRoot":"","sources":["../../../../src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAqB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAU,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAC,uBAAuB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAA6C,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;;;;AAExH;;GAEG;AAMH,MAAM,OAAO,6BAA6B;IActC;;OAEG;IACH,IAAc,YAAY;QAEtB,IAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,EACzC,CAAC;YACG,OAAO,IAAI,CAAC,KAAK,CAAC,OAA2B,CAAC;QAClD,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;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CAuCX,YAAY,MAuBZ,WAAW,MAoBX,cAAc,MA+Bd,cAAc","sourcesContent":["import {Directive, Inject, OnDestroy, OnInit, Optional} from '@angular/core';\nimport {Action1, BindThis} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../interfaces';\nimport {DATE_API, DATE_TIME_INPUT} from '../../misc/tokens';\nimport {DateTimeObjectValue} from '../../misc/types';\nimport {parseDateTime, parseRawInput} from '../../misc/utils';\nimport {DateTimePickerDirective, DateTimeDirective} from '../../modules';\nimport {DateApi, DateApiObject, DatePositionParser, DatePositionParserService, DateValueProvider} from '../../services';\n\n/**\n * Directive that adds handler for date time input, which allows navigation using keyboard and checking restriction of value\n */\n@Directive(\n{\n selector: '[dateTime][withHandler]',\n standalone: true,\n})\nexport class DateTimeInputHandlerDirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n /**\n * Instance of parser created for specific format\n */\n protected parser: DatePositionParser;\n\n /**\n * Gets input element as html input\n */\n protected get inputElement(): HTMLInputElement\n {\n if(this.input.element.nodeName == 'INPUT')\n {\n return this.input.element as HTMLInputElement;\n }\n\n throw new Error('You cant use DateTimeInputHandlerDirective without input element!');\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected dateTimeData: DateTimeDirective<TDate>,\n protected parserSvc: DatePositionParserService,\n protected valueProvider: DateValueProvider<TDate>,\n @Optional() protected picker?: DateTimePickerDirective<TDate>,)\n {\n this.parser = parserSvc.createParser(this.dateTimeData.customFormat);\n this.initSubscriptions.add(this.dateTimeData.customFormatChanges.subscribe(() => this.parser = parserSvc.createParser(this.dateTimeData.customFormat)));\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.input.element.addEventListener('keydown', this.handleKeyboard);\n this.input.element.addEventListener('keypress', this.handleKeypress);\n this.input.element.addEventListener('select', this.handleSelect);\n this.input.element.addEventListener('click', this.handleClick);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.initSubscriptions.unsubscribe();\n this.input.element.removeEventListener('keydown', this.handleKeyboard);\n this.input.element.removeEventListener('keypress', this.handleKeypress);\n this.input.element.removeEventListener('select', this.handleSelect);\n this.input.element.removeEventListener('click', this.handleClick);\n }\n\n //######################### protected methods #########################\n\n /**\n * Handles selection of text inside of input\n */\n @BindThis\n protected handleSelect(): void\n {\n this.runWithValue(() =>\n {\n //handles when all text is selected\n if(this.inputElement.selectionStart == 0 && this.inputElement.selectionEnd == this.inputElement.value.length)\n {\n const result = this.parser.parse(this.inputElement.value, this.inputElement.selectionStart);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Handles click event inside of input\n */\n @BindThis\n protected handleClick(): void\n {\n this.runWithValue(() =>\n {\n const result = this.parser.parse(this.inputElement.value, this.inputElement.selectionStart ?? 0);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n protected handleKeypress(event: KeyboardEvent): void\n {\n const selectionStart = this.inputElement.selectionStart ?? 0;\n const selectionEnd = this.inputElement.selectionEnd ?? 0;\n const newRawValueArray = this.inputElement.value.split('');\n newRawValueArray.splice(selectionStart , selectionEnd - selectionStart);\n newRawValueArray.splice(selectionStart, 0, ...event.key);\n const newRawValue = newRawValueArray.join('');\n\n const [parsedValue] = parseRawInput(newRawValue, this.dateApi, this.dateTimeData, this.valueProvider);\n\n this.runWithValue(parsedValue =>\n {\n if(this.minMaxConstraintTest(parsedValue))\n {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n () =>\n {\n //TODO: add support for ranges\n },\n parsedValue);\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n protected handleKeyboard(event: KeyboardEvent): void\n {\n this.runWithValue(parsedValue =>\n {\n const selectionStart = this.inputElement.selectionStart ?? 0;\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n \n const result = event.key == 'ArrowLeft' ? this.parser.previous(this.inputElement.value, selectionStart) : this.parser.next(this.inputElement.value, selectionStart);\n \n if(result)\n {\n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n \n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n \n let result = this.parser.parse(this.inputElement.value, selectionStart);\n const selectionStartNew = result.positionFrom;\n \n this.stepChangeValue(parsedValue, result.part, event.key == 'ArrowUp');\n \n result = this.parser.parse(this.inputElement.value, selectionStartNew);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n \n break;\n }\n case 'Tab':\n {\n const result = event.shiftKey ? this.parser.previous(this.inputElement.value, selectionStart) : this.parser.next(this.inputElement.value, selectionStart);\n \n if(result)\n {\n event.preventDefault();\n event.stopPropagation();\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n \n break;\n }\n case 'a':\n {\n if(event.ctrlKey)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n \n break;\n }\n case 'Backspace':\n {\n this.input.value = null;\n this.input.valueChange.next();\n \n break;\n }\n case 'Escape':\n {\n this.picker?.hidePicker();\n \n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this.picker?.showPicker();\n }\n \n break;\n }\n }\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n * @param value - Value to be tested\n */\n protected minMaxConstraintTest(value: DateApiObject<TDate>): boolean\n {\n return (!!this.dateTimeData.minDateTime && value.isBefore(this.dateTimeData.minDateTime)) ||\n (!!this.dateTimeData.maxDateTime && value.isAfter(this.dateTimeData.maxDateTime));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param value - Value to be used checked for constrains\n * @param code - Code that should be executed which can change current value\n */\n protected withMinMaxConstraint(value: DateApiObject<TDate>, code: () => void): void\n {\n value.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this.minMaxConstraintTest(value))\n {\n value.resetOriginal();\n }\n\n //value has changed, change input value\n if(!value.isSame(value.originalValue))\n {\n this.input.value = value.value;\n this.input.valueChange.next();\n }\n }\n\n /**\n * Runs code for existing and valid value of date time\n * @param singleValueCode - Code to be run when only single value can be inside of date time\n * @param rangeValueCode - Code to be run when range value can be inside of date time\n * @param parsedValueDefault - Default parsed value to be used\n */\n protected runWithValue(singleValueCode: Action1<DateApiObject<TDate>>, rangeValueCode: Action1<[DateApiObject<TDate> | null, DateApiObject<TDate> | null]>, parsedValueDefault?: DateTimeObjectValue<TDate>|undefined|null): void\n {\n const parsedValue = parsedValueDefault ?? parseDateTime(this.input.value, this.dateApi, null, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n\n if(!parsedValue)\n {\n return;\n }\n\n if(Array.isArray(parsedValue))\n {\n rangeValueCode(parsedValue);\n }\n else\n {\n //do nothing for invalid value\n if(!parsedValue.isValid())\n {\n return;\n }\n\n singleValueCode(parsedValue);\n }\n }\n\n /**\n * Changes current value of date for for specified part by single step\n * @param value - Value to be used checked for constrains\n * @param part - Part of date that should be changed\n * @param increment - Indication whether value should be incremented or decremented\n */\n protected stepChangeValue(value: DateApiObject<TDate>, part: string, increment: boolean): void\n {\n switch(part)\n {\n case 'y':\n case 'Y':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addYears(1) : value.subtractYears(1));\n\n break;\n }\n case 'Q':\n {\n break;\n }\n case 'M':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addMonths(1) : value.subtractMonths(1));\n\n break;\n }\n case 'w':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addWeeks(1) : value.subtractWeeks(1));\n\n break;\n }\n case 'd':\n case 'D':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addDays(1) : value.subtractDays(1));\n\n break;\n }\n case 'H':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addHours(1) : value.subtractHours(1));\n\n break;\n }\n case 'm':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addMinutes(1) : value.subtractMinutes(1));\n\n break;\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dateTimeInputHandler.directive.js","sourceRoot":"","sources":["../../../../src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAqB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAU,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAC,uBAAuB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAA6C,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;;;;AAExH;;GAEG;AAKH,MAAM,OAAO,6BAA6B;IActC;;OAEG;IACH,IAAc,YAAY;QAEtB,IAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,EACzC,CAAC;YACG,OAAO,IAAI,CAAC,KAAK,CAAC,OAA2B,CAAC;QAClD,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,C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,WAAW,MAoBX,cAAc,MA+Bd,cAAc","sourcesContent":["import {Directive, Inject, OnDestroy, OnInit, Optional} from '@angular/core';\nimport {Action1, BindThis} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../interfaces';\nimport {DATE_API, DATE_TIME_INPUT} from '../../misc/tokens';\nimport {DateTimeObjectValue} from '../../misc/types';\nimport {parseDateTime, parseRawInput} from '../../misc/utils';\nimport {DateTimePickerDirective, DateTimeDirective} from '../../modules';\nimport {DateApi, DateApiObject, DatePositionParser, DatePositionParserService, DateValueProvider} from '../../services';\n\n/**\n * Directive that adds handler for date time input, which allows navigation using keyboard and checking restriction of value\n */\n@Directive(\n{\n selector: '[dateTime][withHandler]',\n})\nexport class DateTimeInputHandlerDirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n /**\n * Instance of parser created for specific format\n */\n protected parser: DatePositionParser;\n\n /**\n * Gets input element as html input\n */\n protected get inputElement(): HTMLInputElement\n {\n if(this.input.element.nodeName == 'INPUT')\n {\n return this.input.element as HTMLInputElement;\n }\n\n throw new Error('You cant use DateTimeInputHandlerDirective without input element!');\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected dateTimeData: DateTimeDirective<TDate>,\n protected parserSvc: DatePositionParserService,\n protected valueProvider: DateValueProvider<TDate>,\n @Optional() protected picker?: DateTimePickerDirective<TDate>,)\n {\n this.parser = parserSvc.createParser(this.dateTimeData.customFormat);\n this.initSubscriptions.add(this.dateTimeData.customFormatChanges.subscribe(() => this.parser = parserSvc.createParser(this.dateTimeData.customFormat)));\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.input.element.addEventListener('keydown', this.handleKeyboard);\n this.input.element.addEventListener('keypress', this.handleKeypress);\n this.input.element.addEventListener('select', this.handleSelect);\n this.input.element.addEventListener('click', this.handleClick);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.initSubscriptions.unsubscribe();\n this.input.element.removeEventListener('keydown', this.handleKeyboard);\n this.input.element.removeEventListener('keypress', this.handleKeypress);\n this.input.element.removeEventListener('select', this.handleSelect);\n this.input.element.removeEventListener('click', this.handleClick);\n }\n\n //######################### protected methods #########################\n\n /**\n * Handles selection of text inside of input\n */\n @BindThis\n protected handleSelect(): void\n {\n this.runWithValue(() =>\n {\n //handles when all text is selected\n if(this.inputElement.selectionStart == 0 && this.inputElement.selectionEnd == this.inputElement.value.length)\n {\n const result = this.parser.parse(this.inputElement.value, this.inputElement.selectionStart);\n\n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Handles click event inside of input\n */\n @BindThis\n protected handleClick(): void\n {\n this.runWithValue(() =>\n {\n const result = this.parser.parse(this.inputElement.value, this.inputElement.selectionStart ?? 0);\n\n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n protected handleKeypress(event: KeyboardEvent): void\n {\n const selectionStart = this.inputElement.selectionStart ?? 0;\n const selectionEnd = this.inputElement.selectionEnd ?? 0;\n const newRawValueArray = this.inputElement.value.split('');\n newRawValueArray.splice(selectionStart, selectionEnd - selectionStart);\n newRawValueArray.splice(selectionStart, 0, ...event.key);\n const newRawValue = newRawValueArray.join('');\n\n const [parsedValue] = parseRawInput(newRawValue, this.dateApi, this.dateTimeData, this.valueProvider);\n\n this.runWithValue(parsedValue =>\n {\n if(this.minMaxConstraintTest(parsedValue))\n {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n () =>\n {\n //TODO: add support for ranges\n },\n parsedValue);\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n protected handleKeyboard(event: KeyboardEvent): void\n {\n this.runWithValue(parsedValue =>\n {\n const selectionStart = this.inputElement.selectionStart ?? 0;\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n const result = event.key == 'ArrowLeft' ? this.parser.previous(this.inputElement.value, selectionStart) : this.parser.next(this.inputElement.value, selectionStart);\n\n if(result)\n {\n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n let result = this.parser.parse(this.inputElement.value, selectionStart);\n const selectionStartNew = result.positionFrom;\n\n this.stepChangeValue(parsedValue, result.part, event.key == 'ArrowUp');\n\n result = this.parser.parse(this.inputElement.value, selectionStartNew);\n\n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n\n break;\n }\n case 'Tab':\n {\n const result = event.shiftKey ? this.parser.previous(this.inputElement.value, selectionStart) : this.parser.next(this.inputElement.value, selectionStart);\n\n if(result)\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n\n break;\n }\n case 'a':\n {\n if(event.ctrlKey)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n\n break;\n }\n case 'Backspace':\n {\n this.input.value = null;\n this.input.valueChange.next();\n\n break;\n }\n case 'Escape':\n {\n this.picker?.hidePicker();\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this.picker?.showPicker();\n }\n\n break;\n }\n }\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n * @param value - Value to be tested\n */\n protected minMaxConstraintTest(value: DateApiObject<TDate>): boolean\n {\n return (!!this.dateTimeData.minDateTime && value.isBefore(this.dateTimeData.minDateTime)) ||\n (!!this.dateTimeData.maxDateTime && value.isAfter(this.dateTimeData.maxDateTime));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param value - Value to be used checked for constrains\n * @param code - Code that should be executed which can change current value\n */\n protected withMinMaxConstraint(value: DateApiObject<TDate>, code: () => void): void\n {\n value.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this.minMaxConstraintTest(value))\n {\n value.resetOriginal();\n }\n\n //value has changed, change input value\n if(!value.isSame(value.originalValue))\n {\n this.input.value = value.value;\n this.input.valueChange.next();\n }\n }\n\n /**\n * Runs code for existing and valid value of date time\n * @param singleValueCode - Code to be run when only single value can be inside of date time\n * @param rangeValueCode - Code to be run when range value can be inside of date time\n * @param parsedValueDefault - Default parsed value to be used\n */\n protected runWithValue(singleValueCode: Action1<DateApiObject<TDate>>, rangeValueCode: Action1<[DateApiObject<TDate> | null, DateApiObject<TDate> | null]>, parsedValueDefault?: DateTimeObjectValue<TDate>|undefined|null): void\n {\n const parsedValue = parsedValueDefault ?? parseDateTime(this.input.value, this.dateApi, null, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n\n if(!parsedValue)\n {\n return;\n }\n\n if(Array.isArray(parsedValue))\n {\n rangeValueCode(parsedValue);\n }\n else\n {\n //do nothing for invalid value\n if(!parsedValue.isValid())\n {\n return;\n }\n\n singleValueCode(parsedValue);\n }\n }\n\n /**\n * Changes current value of date for for specified part by single step\n * @param value - Value to be used checked for constrains\n * @param part - Part of date that should be changed\n * @param increment - Indication whether value should be incremented or decremented\n */\n protected stepChangeValue(value: DateApiObject<TDate>, part: string, increment: boolean): void\n {\n switch(part)\n {\n case 'y':\n case 'Y':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addYears(1) : value.subtractYears(1));\n\n break;\n }\n case 'Q':\n {\n break;\n }\n case 'M':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addMonths(1) : value.subtractMonths(1));\n\n break;\n }\n case 'w':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addWeeks(1) : value.subtractWeeks(1));\n\n break;\n }\n case 'd':\n case 'D':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addDays(1) : value.subtractDays(1));\n\n break;\n }\n case 'H':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addHours(1) : value.subtractHours(1));\n\n break;\n }\n case 'm':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addMinutes(1) : value.subtractMinutes(1));\n\n break;\n }\n }\n }\n}\n"]}
|
|
@@ -8,14 +8,13 @@ import * as i2 from "../withTime/withTime.directive";
|
|
|
8
8
|
* Directive that combines date time picker with date time input
|
|
9
9
|
*/
|
|
10
10
|
export class DateTimePickerInputDirective {
|
|
11
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
12
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimePickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
12
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: DateTimePickerInputDirective, isStandalone: true, selector: "input[dateTime][dateTimePickerInput]", hostDirectives: [{ directive: i1.DatePickerInputDirective }, { directive: i2.WithTimeDirective }], ngImport: i0 }); }
|
|
13
13
|
}
|
|
14
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimePickerInputDirective, decorators: [{
|
|
15
15
|
type: Directive,
|
|
16
16
|
args: [{
|
|
17
17
|
selector: 'input[dateTime][dateTimePickerInput]',
|
|
18
|
-
standalone: true,
|
|
19
18
|
hostDirectives: [
|
|
20
19
|
{
|
|
21
20
|
directive: DatePickerInputDirective,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/dateTimePickerInput/dateTimePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,wBAAwB,EAAC,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;;;;AAEjE;;GAEG;
|
|
1
|
+
{"version":3,"file":"dateTimePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/dateTimePickerInput/dateTimePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,wBAAwB,EAAC,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;;;;AAEjE;;GAEG;AAcH,MAAM,OAAO,4BAA4B;8GAA5B,4BAA4B;kGAA5B,4BAA4B;;2FAA5B,4BAA4B;kBAbxC,SAAS;mBACV;oBACI,QAAQ,EAAE,sCAAsC;oBAChD,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,wBAAwB;yBACtC;wBACD;4BACI,SAAS,EAAE,iBAAiB;yBAC/B;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {DatePickerInputDirective} from '../datePickerInput/datePickerInput.directive';\nimport {WithTimeDirective} from '../withTime/withTime.directive';\n\n/**\n * Directive that combines date time picker with date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][dateTimePickerInput]',\n hostDirectives:\n [\n {\n directive: DatePickerInputDirective,\n },\n {\n directive: WithTimeDirective,\n },\n ],\n})\nexport class DateTimePickerInputDirective\n{\n}"]}
|
|
@@ -9,14 +9,13 @@ import * as i3 from "../simpleDateTimeInputHandler/simpleDateTimeInputHandler.di
|
|
|
9
9
|
* Directive that combines date picker with simple date input
|
|
10
10
|
*/
|
|
11
11
|
export class SimpleDatePickerInputDirective {
|
|
12
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
13
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SimpleDatePickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
13
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: SimpleDatePickerInputDirective, isStandalone: true, selector: "input[dateTime][simpleDatePickerInput]", hostDirectives: [{ directive: i1.DateTimePickerDirective, inputs: ["withPickerOptions", "withPickerOptions", "pickerOptions", "pickerOptions"] }, { directive: i2.DateTimeInputDirective }, { directive: i3.SimpleDateTimeInputHandlerDirective }], ngImport: i0 }); }
|
|
14
14
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SimpleDatePickerInputDirective, decorators: [{
|
|
16
16
|
type: Directive,
|
|
17
17
|
args: [{
|
|
18
18
|
selector: 'input[dateTime][simpleDatePickerInput]',
|
|
19
|
-
standalone: true,
|
|
20
19
|
hostDirectives: [
|
|
21
20
|
{
|
|
22
21
|
directive: DateTimePickerDirective,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleDatePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,mCAAmC,EAAC,MAAM,oEAAoE,CAAC;;;;;AAEvH;;GAEG;
|
|
1
|
+
{"version":3,"file":"simpleDatePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,mCAAmC,EAAC,MAAM,oEAAoE,CAAC;;;;;AAEvH;;GAEG;AAsBH,MAAM,OAAO,8BAA8B;8GAA9B,8BAA8B;kGAA9B,8BAA8B;;2FAA9B,8BAA8B;kBArB1C,SAAS;mBACV;oBACI,QAAQ,EAAE,wCAAwC;oBAClD,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,uBAAuB;4BAClC,MAAM,EACN;gCACI,mBAAmB;gCACnB,eAAe;6BAClB;yBACJ;wBACD;4BACI,SAAS,EAAE,sBAAsB;yBACpC;wBACD;4BACI,SAAS,EAAE,mCAAmC;yBACjD;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {DateTimeInputDirective, DateTimePickerDirective} from '../../modules';\nimport {SimpleDateTimeInputHandlerDirective} from '../simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive';\n\n/**\n * Directive that combines date picker with simple date input\n */\n@Directive(\n{\n selector: 'input[dateTime][simpleDatePickerInput]',\n hostDirectives:\n [\n {\n directive: DateTimePickerDirective,\n inputs:\n [\n 'withPickerOptions',\n 'pickerOptions',\n ]\n },\n {\n directive: DateTimeInputDirective,\n },\n {\n directive: SimpleDateTimeInputHandlerDirective,\n },\n ],\n})\nexport class SimpleDatePickerInputDirective\n{\n}"]}
|
package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js
CHANGED
|
@@ -109,8 +109,8 @@ export class SimpleDateTimeInputHandlerDirective {
|
|
|
109
109
|
this.input.valueChange.next();
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
113
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
112
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SimpleDateTimeInputHandlerDirective, deps: [{ token: DATE_TIME_INPUT }, { token: DATE_API }, { token: i1.DateTimeDirective }, { token: i1.DateTimePickerDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
113
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: SimpleDateTimeInputHandlerDirective, isStandalone: true, selector: "[dateTime][withSimpleHandler]", ngImport: i0 }); }
|
|
114
114
|
}
|
|
115
115
|
__decorate([
|
|
116
116
|
BindThis,
|
|
@@ -118,11 +118,10 @@ __decorate([
|
|
|
118
118
|
__metadata("design:paramtypes", [KeyboardEvent]),
|
|
119
119
|
__metadata("design:returntype", void 0)
|
|
120
120
|
], SimpleDateTimeInputHandlerDirective.prototype, "handleKeyboard", null);
|
|
121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SimpleDateTimeInputHandlerDirective, decorators: [{
|
|
122
122
|
type: Directive,
|
|
123
123
|
args: [{
|
|
124
124
|
selector: '[dateTime][withSimpleHandler]',
|
|
125
|
-
standalone: true,
|
|
126
125
|
}]
|
|
127
126
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
128
127
|
type: Inject,
|
package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleDateTimeInputHandler.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAqB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,uBAAuB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;;;AAGzE;;GAEG;
|
|
1
|
+
{"version":3,"file":"simpleDateTimeInputHandler.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAqB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,uBAAuB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;;;AAGzE;;GAEG;AAKH,MAAM,OAAO,mCAAmC;IAE5C,iEAAiE;IACjE,YAA+C,KAA2B,EAClC,OAAuB,EACzC,YAAsC,EAC1B,MAAuC;QAH1B,UAAK,GAAL,KAAK,CAAsB;QAClC,YAAO,GAAP,OAAO,CAAgB;QACzC,iBAAY,GAAZ,YAAY,CAA0B;QAC1B,WAAM,GAAN,MAAM,CAAiC;IAEzE,CAAC;IAED,+FAA+F;IAE/F;;OAEG;IACI,QAAQ;QAEX,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gB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IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAClC,CAAC;IACL,CAAC;8GAtIQ,mCAAmC,kBAGxB,eAAe,aACf,QAAQ;kGAJnB,mCAAmC;;AAqCrC;IADN,QAAQ;;qCACoB,aAAa;;yEA8DzC;2FAnGQ,mCAAmC;kBAJ/C,SAAS;mBACV;oBACI,QAAQ,EAAE,+BAA+B;iBAC5C;;0BAIgB,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ;;0BAEf,QAAQ;yCA+Bd,cAAc","sourcesContent":["import {Directive, Inject, OnDestroy, OnInit, Optional} from '@angular/core';\nimport {BindThis} from '@jscrpt/common';\n\nimport {DateTimeInput} from '../../interfaces';\nimport {DATE_TIME_INPUT, DATE_API} from '../../misc/tokens';\nimport {parseDateTime} from '../../misc/utils';\nimport {DateTimePickerDirective, DateTimeDirective} from '../../modules';\nimport {DateApi, DateApiObject} from '../../services';\n\n/**\n * Directive that adds simple handler for date time input, which allows simple navigation using keyboard\n */\n@Directive(\n{\n selector: '[dateTime][withSimpleHandler]',\n})\nexport class SimpleDateTimeInputHandlerDirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected dateTimeData: DateTimeDirective<TDate>,\n @Optional() protected picker?: DateTimePickerDirective<TDate>,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.input.element.addEventListener('keydown', this.handleKeyboard);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.input.element.removeEventListener('keydown', this.handleKeyboard);\n }\n\n //######################### protected methods #########################\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n public handleKeyboard(event: KeyboardEvent): void\n {\n const parsedValue = parseDateTime(this.input.value, this.dateApi, null, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n\n //no value do nothing\n if(!parsedValue)\n {\n return;\n }\n\n //range value\n if(Array.isArray(parsedValue))\n {\n //TODO: finish range support\n }\n else\n {\n //do nothing for invalid date time\n if(!parsedValue.isValid())\n {\n return;\n }\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.withMinMaxConstraint(parsedValue, () => event.key == 'ArrowLeft' ? parsedValue.subtractDays(1) : parsedValue.addDays(1));\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.withMinMaxConstraint(parsedValue, () => event.key == 'ArrowUp' ? parsedValue.subtractWeeks(1) : parsedValue.addWeeks(1));\n\n break;\n }\n case 'Escape':\n {\n this.picker?.hidePicker();\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this.picker?.showPicker();\n }\n\n break;\n }\n }\n }\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n * @param value - Value to be tested\n */\n protected minMaxConstraintTest(value: DateApiObject<TDate>): boolean\n {\n return (!!this.dateTimeData.minDateTime && value.isBefore(this.dateTimeData.minDateTime)) ||\n (!!this.dateTimeData.maxDateTime && value.isAfter(this.dateTimeData.maxDateTime));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param value - Value to be used checked for constrains\n * @param code - Code that should be executed which can change current value\n */\n protected withMinMaxConstraint(value: DateApiObject<TDate>, code: () => void): void\n {\n value.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this.minMaxConstraintTest(value))\n {\n value.resetOriginal();\n }\n\n //value has changed, change input value\n if(!value.isSame(value.originalValue))\n {\n this.input.value = value.value;\n this.input.valueChange.next();\n }\n }\n}\n"]}
|
package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js
CHANGED
|
@@ -8,14 +8,13 @@ import * as i2 from "../withTime/withTime.directive";
|
|
|
8
8
|
* Directive that combines date time picker with simple date time input
|
|
9
9
|
*/
|
|
10
10
|
export class SimpleDateTimePickerInputDirective {
|
|
11
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
12
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SimpleDateTimePickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
12
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: SimpleDateTimePickerInputDirective, isStandalone: true, selector: "input[dateTime][simpleDateTimePickerInput]", hostDirectives: [{ directive: i1.SimpleDatePickerInputDirective }, { directive: i2.WithTimeDirective }], ngImport: i0 }); }
|
|
13
13
|
}
|
|
14
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: SimpleDateTimePickerInputDirective, decorators: [{
|
|
15
15
|
type: Directive,
|
|
16
16
|
args: [{
|
|
17
17
|
selector: 'input[dateTime][simpleDateTimePickerInput]',
|
|
18
|
-
standalone: true,
|
|
19
18
|
hostDirectives: [
|
|
20
19
|
{
|
|
21
20
|
directive: SimpleDatePickerInputDirective,
|
package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleDateTimePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,8BAA8B,EAAC,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;;;;AAEjE;;GAEG;
|
|
1
|
+
{"version":3,"file":"simpleDateTimePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,8BAA8B,EAAC,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;;;;AAEjE;;GAEG;AAcH,MAAM,OAAO,kCAAkC;8GAAlC,kCAAkC;kGAAlC,kCAAkC;;2FAAlC,kCAAkC;kBAb9C,SAAS;mBACV;oBACI,QAAQ,EAAE,4CAA4C;oBACtD,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,8BAA8B;yBAC5C;wBACD;4BACI,SAAS,EAAE,iBAAiB;yBAC/B;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {SimpleDatePickerInputDirective} from '../simpleDatePickerInput/simpleDatePickerInput.directive';\nimport {WithTimeDirective} from '../withTime/withTime.directive';\n\n/**\n * Directive that combines date time picker with simple date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][simpleDateTimePickerInput]',\n hostDirectives:\n [\n {\n directive: SimpleDatePickerInputDirective,\n },\n {\n directive: WithTimeDirective,\n },\n ],\n})\nexport class SimpleDateTimePickerInputDirective\n{\n}"]}
|
|
@@ -28,14 +28,13 @@ export class WithNowDirective {
|
|
|
28
28
|
ngOnDestroy() {
|
|
29
29
|
this.initSubscriptions.unsubscribe();
|
|
30
30
|
}
|
|
31
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
32
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: WithNowDirective, deps: [{ token: i1.DateTimeInputDirective }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
32
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: WithNowDirective, isStandalone: true, selector: "[dateTime][withNow]", ngImport: i0 }); }
|
|
33
33
|
}
|
|
34
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: WithNowDirective, decorators: [{
|
|
35
35
|
type: Directive,
|
|
36
36
|
args: [{
|
|
37
37
|
selector: '[dateTime][withNow]',
|
|
38
|
-
standalone: true,
|
|
39
38
|
}]
|
|
40
39
|
}], ctorParameters: () => [{ type: i1.DateTimeInputDirective }, { type: undefined, decorators: [{
|
|
41
40
|
type: Inject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withNow.directive.js","sourceRoot":"","sources":["../../../../src/directives/withNow/withNow.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;;;AAGrD;;GAEG;
|
|
1
|
+
{"version":3,"file":"withNow.directive.js","sourceRoot":"","sources":["../../../../src/directives/withNow/withNow.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;;;AAGrD;;GAEG;AAKH,MAAM,OAAO,gBAAgB;IASzB,iEAAiE;IACjE,YAAY,KAAoC,EAClB,OAAuB;QATrD,sEAAsE;QAEtE;;WAEG;QACO,sBAAiB,GAAiB,IAAI,YAAY,EAAE,CAAC;QAM3D,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAElD,IAAG,CAAC,KAAK,CAAC,KAAK,EACf,CAAC;gBACG,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;YACtC,CAAC;QACL,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;8GA9BQ,gBAAgB,wDAWL,QAAQ;kGAXnB,gBAAgB;;2FAAhB,gBAAgB;kBAJ5B,SAAS;mBACV;oBACI,QAAQ,EAAE,qBAAqB;iBAClC;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, Inject, OnDestroy} from '@angular/core';\nimport {Subscription} from 'rxjs';\n\nimport {DATE_API} from '../../misc/tokens';\nimport {DateTimeInputDirective} from '../../modules';\nimport {DateApi} from '../../services';\n\n/**\n * Directive that sets current date and time as day and time for empty date time on focus\n */\n@Directive(\n{\n selector: '[dateTime][withNow]',\n})\nexport class WithNowDirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n //######################### constructor #########################\n constructor(input: DateTimeInputDirective<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,)\n {\n this.initSubscriptions.add(input.focus.subscribe(() =>\n {\n if(!input.value)\n {\n input.value = dateApi.now().value;\n }\n }));\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.initSubscriptions.unsubscribe();\n }\n}"]}
|
|
@@ -11,22 +11,21 @@ export class WithTimeDirective {
|
|
|
11
11
|
picker.pickerOptions =
|
|
12
12
|
{
|
|
13
13
|
periodsDefinition: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
time: RollerTimePickerComponent,
|
|
15
|
+
day: DayPickerComponent,
|
|
16
|
+
month: MonthPickerComponent,
|
|
17
|
+
year: YearPickerComponent,
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
dateTime.format = 'dateTime';
|
|
21
21
|
}
|
|
22
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
23
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
22
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: WithTimeDirective, deps: [{ token: i1.DateTimePickerDirective }, { token: i1.DateTimeDirective }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
23
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: WithTimeDirective, isStandalone: true, selector: "[dateTime][withPicker][withTime]", ngImport: i0 }); }
|
|
24
24
|
}
|
|
25
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: WithTimeDirective, decorators: [{
|
|
26
26
|
type: Directive,
|
|
27
27
|
args: [{
|
|
28
28
|
selector: '[dateTime][withPicker][withTime]',
|
|
29
|
-
standalone: true,
|
|
30
29
|
}]
|
|
31
30
|
}], ctorParameters: () => [{ type: i1.DateTimePickerDirective }, { type: i1.DateTimeDirective }] });
|
|
32
31
|
//# sourceMappingURL=withTime.directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTime.directive.js","sourceRoot":"","sources":["../../../../src/directives/withTime/withTime.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,yBAAyB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;;;AAEnK;;GAEG;
|
|
1
|
+
{"version":3,"file":"withTime.directive.js","sourceRoot":"","sources":["../../../../src/directives/withTime/withTime.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,yBAAyB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;;;AAEnK;;GAEG;AAKH,MAAM,OAAO,iBAAiB;IAE1B,iEAAiE;IACjE,YAAY,MAAsC,EACtC,QAAkC;QAE1C,MAAM,CAAC,aAAa;YACpB;gBACI,iBAAiB,EACjB;oBACI,IAAI,EAAE,yBAAyB;oBAC/B,GAAG,EAAE,kBAAkB;oBACvB,KAAK,EAAE,oBAAoB;oBAC3B,IAAI,EAAE,mBAAmB;iBAC5B;aACJ,CAAC;QAEF,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC;IACjC,CAAC;8GAlBQ,iBAAiB;kGAAjB,iBAAiB;;2FAAjB,iBAAiB;kBAJ7B,SAAS;mBACV;oBACI,QAAQ,EAAE,kCAAkC;iBAC/C","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {RollerTimePickerComponent, DateTimePickerDirective, DayPickerComponent, MonthPickerComponent, YearPickerComponent, DateTimeDirective} from '../../modules';\n\n/**\n * Directive that sets up usage of date time picker to use time format and time picker\n */\n@Directive(\n{\n selector: '[dateTime][withPicker][withTime]',\n})\nexport class WithTimeDirective<TDate = unknown>\n{\n //######################### constructor #########################\n constructor(picker: DateTimePickerDirective<TDate>,\n dateTime: DateTimeDirective<TDate>,)\n {\n picker.pickerOptions =\n {\n periodsDefinition:\n {\n time: RollerTimePickerComponent,\n day: DayPickerComponent,\n month: MonthPickerComponent,\n year: YearPickerComponent,\n },\n };\n\n dateTime.format = 'dateTime';\n }\n}"]}
|
|
@@ -28,14 +28,13 @@ export class WithTodayDirective {
|
|
|
28
28
|
ngOnDestroy() {
|
|
29
29
|
this.initSubscriptions.unsubscribe();
|
|
30
30
|
}
|
|
31
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
32
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: WithTodayDirective, deps: [{ token: i1.DateTimeInputDirective }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
32
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: WithTodayDirective, isStandalone: true, selector: "[dateTime][withToday]", ngImport: i0 }); }
|
|
33
33
|
}
|
|
34
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: WithTodayDirective, decorators: [{
|
|
35
35
|
type: Directive,
|
|
36
36
|
args: [{
|
|
37
37
|
selector: '[dateTime][withToday]',
|
|
38
|
-
standalone: true,
|
|
39
38
|
}]
|
|
40
39
|
}], ctorParameters: () => [{ type: i1.DateTimeInputDirective }, { type: undefined, decorators: [{
|
|
41
40
|
type: Inject,
|