@anglr/datetime 5.0.0-beta.20221017112052 → 5.0.0-beta.20221018102923
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 +46 -8
- package/es2015/src/index.js +0 -3
- package/es2015/src/index.js.map +1 -1
- package/es2015/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
- package/es2015/src/legacy/selector/components/inputDateTime/inputDateTime.component.js +4 -6
- package/es2015/src/legacy/selector/components/inputDateTime/inputDateTime.component.js.map +1 -1
- package/es2015/src/legacy/selector/components/selector/selector.component.js +2 -2
- package/es2015/src/legacy/selector/components/selector/selector.component.js.map +1 -1
- package/es2015/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +2 -2
- package/es2015/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +1 -1
- package/es2015/src/misc/enums.js +1 -1
- package/es2015/src/misc/enums.js.map +1 -1
- package/es2015/src/misc/types.js.map +1 -1
- package/es2015/src/misc/utils.js +10 -0
- package/es2015/src/misc/utils.js.map +1 -1
- package/es2015/src/misc/validators.js +79 -2
- package/es2015/src/misc/validators.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/dateTimeBase.js +77 -0
- package/es2015/src/modules/dateTime/directives/dateTimeBase.js.map +1 -0
- package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +12 -59
- package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +72 -0
- package/es2015/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -0
- package/es2015/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +71 -0
- package/es2015/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -0
- package/es2015/src/modules/dateTime/directives/dateTimeRestrictedBase.js +152 -0
- package/es2015/src/modules/dateTime/directives/dateTimeRestrictedBase.js.map +1 -0
- package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +17 -6
- package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/index.js +4 -0
- package/es2015/src/modules/dateTime/directives/index.js.map +1 -1
- package/es2015/src/modules/dateTime/modules/dateTime.module.js +9 -1
- package/es2015/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
- package/es2015/src/services/{datePositionParser.interface.js → datePositionParser/datePositionParser.interface.js} +0 -0
- package/es2015/src/services/datePositionParser/datePositionParser.interface.js.map +1 -0
- package/es2015/src/services/{datePositionParser.service.js → datePositionParser/datePositionParser.service.js} +0 -0
- package/es2015/src/services/datePositionParser/datePositionParser.service.js.map +1 -0
- package/es2015/src/services/{dateTimeRelativeParser.service.js → dateTimeRelativeParser/dateTimeRelativeParser.service.js} +8 -8
- package/es2015/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +1 -0
- package/es2015/src/services/{dateValueProvider.service.js → dateValueProvider/dateValueProvider.service.js} +1 -1
- package/es2015/src/services/dateValueProvider/dateValueProvider.service.js.map +1 -0
- package/es2015/src/services/index.js +4 -1
- package/es2015/src/services/index.js.map +1 -1
- package/es2020/src/index.js +0 -3
- package/es2020/src/index.js.map +1 -1
- package/es2020/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
- package/es2020/src/legacy/selector/components/inputDateTime/inputDateTime.component.js +4 -6
- package/es2020/src/legacy/selector/components/inputDateTime/inputDateTime.component.js.map +1 -1
- package/es2020/src/legacy/selector/components/selector/selector.component.js +2 -2
- package/es2020/src/legacy/selector/components/selector/selector.component.js.map +1 -1
- package/es2020/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +2 -2
- package/es2020/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +1 -1
- package/es2020/src/misc/enums.js +1 -1
- package/es2020/src/misc/enums.js.map +1 -1
- package/es2020/src/misc/types.js.map +1 -1
- package/es2020/src/misc/utils.js +10 -0
- package/es2020/src/misc/utils.js.map +1 -1
- package/es2020/src/misc/validators.js +79 -2
- package/es2020/src/misc/validators.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/dateTimeBase.js +77 -0
- package/es2020/src/modules/dateTime/directives/dateTimeBase.js.map +1 -0
- package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +12 -59
- package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +72 -0
- package/es2020/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -0
- package/es2020/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +71 -0
- package/es2020/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -0
- package/es2020/src/modules/dateTime/directives/dateTimeRestrictedBase.js +149 -0
- package/es2020/src/modules/dateTime/directives/dateTimeRestrictedBase.js.map +1 -0
- package/es2020/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +17 -6
- package/es2020/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/index.js +4 -0
- package/es2020/src/modules/dateTime/directives/index.js.map +1 -1
- package/es2020/src/modules/dateTime/modules/dateTime.module.js +9 -1
- package/es2020/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
- package/es2020/src/services/{datePositionParser.interface.js → datePositionParser/datePositionParser.interface.js} +0 -0
- package/es2020/src/services/datePositionParser/datePositionParser.interface.js.map +1 -0
- package/es2020/src/services/{datePositionParser.service.js → datePositionParser/datePositionParser.service.js} +0 -0
- package/es2020/src/services/datePositionParser/datePositionParser.service.js.map +1 -0
- package/es2020/src/services/{dateTimeRelativeParser.service.js → dateTimeRelativeParser/dateTimeRelativeParser.service.js} +8 -8
- package/es2020/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +1 -0
- package/es2020/src/services/{dateValueProvider.service.js → dateValueProvider/dateValueProvider.service.js} +1 -1
- package/es2020/src/services/dateValueProvider/dateValueProvider.service.js.map +1 -0
- package/es2020/src/services/index.js +4 -1
- package/es2020/src/services/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +0 -3
- package/src/index.d.ts.map +1 -1
- package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts +14 -9
- package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts.map +1 -1
- package/src/legacy/selector/components/inputDateTime/inputDateTime.component.d.ts +1 -3
- package/src/legacy/selector/components/inputDateTime/inputDateTime.component.d.ts.map +1 -1
- package/src/legacy/selector/components/selector/selector.component.d.ts +1 -2
- package/src/legacy/selector/components/selector/selector.component.d.ts.map +1 -1
- package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts +1 -2
- package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts.map +1 -1
- package/src/misc/enums.d.ts +1 -1
- package/src/misc/types.d.ts +1 -1
- package/src/misc/types.d.ts.map +1 -1
- package/src/misc/utils.d.ts +5 -0
- package/src/misc/utils.d.ts.map +1 -1
- package/src/misc/validators.d.ts +17 -0
- package/src/misc/validators.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeBase.d.ts +56 -0
- package/src/modules/dateTime/directives/dateTimeBase.d.ts.map +1 -0
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts +3 -39
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts +33 -0
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -0
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts +33 -0
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -0
- package/src/modules/dateTime/directives/dateTimeRestrictedBase.d.ts +74 -0
- package/src/modules/dateTime/directives/dateTimeRestrictedBase.d.ts.map +1 -0
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts +9 -2
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/index.d.ts +4 -0
- package/src/modules/dateTime/directives/index.d.ts.map +1 -1
- package/src/modules/dateTime/modules/dateTime.module.d.ts +4 -2
- package/src/modules/dateTime/modules/dateTime.module.d.ts.map +1 -1
- package/src/services/{datePositionParser.interface.d.ts → datePositionParser/datePositionParser.interface.d.ts} +0 -0
- package/src/services/{datePositionParser.interface.d.ts.map → datePositionParser/datePositionParser.interface.d.ts.map} +0 -0
- package/src/services/{datePositionParser.service.d.ts → datePositionParser/datePositionParser.service.d.ts} +0 -0
- package/src/services/{datePositionParser.service.d.ts.map → datePositionParser/datePositionParser.service.d.ts.map} +0 -0
- package/src/services/{dateTimeRelativeParser.service.d.ts → dateTimeRelativeParser/dateTimeRelativeParser.service.d.ts} +3 -3
- package/src/services/{dateTimeRelativeParser.service.d.ts.map → dateTimeRelativeParser/dateTimeRelativeParser.service.d.ts.map} +1 -1
- package/src/services/{dateValueProvider.service.d.ts → dateValueProvider/dateValueProvider.service.d.ts} +2 -2
- package/src/services/{dateValueProvider.service.d.ts.map → dateValueProvider/dateValueProvider.service.d.ts.map} +1 -1
- package/src/services/index.d.ts +4 -1
- package/src/services/index.d.ts.map +1 -1
- package/version.bak +1 -1
- package/es2015/src/services/datePositionParser.interface.js.map +0 -1
- package/es2015/src/services/datePositionParser.service.js.map +0 -1
- package/es2015/src/services/dateTimeRelativeParser.service.js.map +0 -1
- package/es2015/src/services/dateValueProvider.service.js.map +0 -1
- package/es2020/src/services/datePositionParser.interface.js.map +0 -1
- package/es2020/src/services/datePositionParser.service.js.map +0 -1
- package/es2020/src/services/dateTimeRelativeParser.service.js.map +0 -1
- package/es2020/src/services/dateValueProvider.service.js.map +0 -1
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import { ElementRef, EventEmitter, OnDestroy } from '@angular/core';
|
|
2
2
|
import { DateTimeInput, FormatProvider } from '../../../../interfaces';
|
|
3
|
-
import { DateTimeValueFormat } from '../../../../misc/enums';
|
|
4
3
|
import { DateTimeInputOutputValue, DateTimeObjectValue } from '../../../../misc/types';
|
|
5
4
|
import { DateApi } from '../../../../services';
|
|
5
|
+
import { DateTimeBase } from '../dateTimeBase';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* Directive that is used for setting up date time input
|
|
9
9
|
*/
|
|
10
|
-
export declare class DateTimeInputDirective<TDate = unknown> implements DateTimeInput, OnDestroy {
|
|
10
|
+
export declare class DateTimeInputDirective<TDate = unknown> extends DateTimeBase<TDate> implements DateTimeInput, OnDestroy {
|
|
11
11
|
protected element: ElementRef<HTMLInputElement>;
|
|
12
|
-
protected dateApi: DateApi<TDate>;
|
|
13
|
-
protected formatProvider: FormatProvider;
|
|
14
|
-
/**
|
|
15
|
-
* Date time value format which is being worked with in this date time
|
|
16
|
-
*/
|
|
17
|
-
private _valueFormat;
|
|
18
|
-
/**
|
|
19
|
-
* Value of date time
|
|
20
|
-
*/
|
|
21
|
-
private _value;
|
|
22
|
-
/**
|
|
23
|
-
* Format of string representation of date
|
|
24
|
-
*/
|
|
25
|
-
private _format;
|
|
26
12
|
/**
|
|
27
13
|
* Internal representation of current date time value
|
|
28
14
|
*/
|
|
@@ -42,10 +28,6 @@ export declare class DateTimeInputDirective<TDate = unknown> implements DateTime
|
|
|
42
28
|
*/
|
|
43
29
|
get disabled(): boolean;
|
|
44
30
|
set disabled(value: boolean);
|
|
45
|
-
/**
|
|
46
|
-
* @inheritdoc
|
|
47
|
-
*/
|
|
48
|
-
valueChange: EventEmitter<void>;
|
|
49
31
|
/**
|
|
50
32
|
* @inheritdoc
|
|
51
33
|
*/
|
|
@@ -54,20 +36,6 @@ export declare class DateTimeInputDirective<TDate = unknown> implements DateTime
|
|
|
54
36
|
* @inheritdoc
|
|
55
37
|
*/
|
|
56
38
|
blur: EventEmitter<FocusEvent>;
|
|
57
|
-
/**
|
|
58
|
-
* Gets or sets date time value format which is being worked with in this date time
|
|
59
|
-
*/
|
|
60
|
-
get valueFormat(): DateTimeValueFormat;
|
|
61
|
-
set valueFormat(value: DateTimeValueFormat);
|
|
62
|
-
/**
|
|
63
|
-
* Gets or sets format of string representation of date
|
|
64
|
-
*/
|
|
65
|
-
get format(): keyof FormatProvider;
|
|
66
|
-
set format(value: keyof FormatProvider);
|
|
67
|
-
/**
|
|
68
|
-
* Custom format string representation of date
|
|
69
|
-
*/
|
|
70
|
-
customFormat: string;
|
|
71
39
|
constructor(element: ElementRef<HTMLInputElement>, dateApi: DateApi<TDate>, formatProvider: FormatProvider);
|
|
72
40
|
/**
|
|
73
41
|
* Called when component is destroyed
|
|
@@ -87,11 +55,7 @@ export declare class DateTimeInputDirective<TDate = unknown> implements DateTime
|
|
|
87
55
|
* @param event - Event that occured
|
|
88
56
|
*/
|
|
89
57
|
protected handleBlur(event: FocusEvent): void;
|
|
90
|
-
/**
|
|
91
|
-
* Custom input type for `valueFormat` input
|
|
92
|
-
*/
|
|
93
|
-
static ngAcceptInputType_valueFormat: keyof typeof DateTimeValueFormat | DateTimeValueFormat;
|
|
94
58
|
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimeInputDirective<any>, never>;
|
|
95
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DateTimeInputDirective<any>, "input[dateTime][dateTimeInput]",
|
|
59
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DateTimeInputDirective<any>, "input[dateTime][dateTimeInput]", ["dateTime"], {}, {}, never, never, false>;
|
|
96
60
|
}
|
|
97
61
|
//# sourceMappingURL=dateTimeInput.directive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeInput.directive.d.ts","sourceRoot":"","sources":["dateTimeInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,UAAU,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"dateTimeInput.directive.d.ts","sourceRoot":"","sources":["dateTimeInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,UAAU,EAAE,YAAY,EAAwC,SAAS,EAAC,MAAM,eAAe,CAAC;AAGnH,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAErE,OAAO,EAAC,wBAAwB,EAAE,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAErF,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAI7C;;GAEG;AACH,qBAaa,sBAAsB,CAAC,KAAK,GAAG,OAAO,CAAE,SAAQ,YAAY,CAAC,KAAK,CAAE,YAAW,aAAa,EAAE,SAAS;IAuEpG,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;IAnE3D;;OAEG;IACH,SAAS,CAAC,aAAa,EAAE,mBAAmB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,CAAC;IAInE;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,GAAC,SAAS,GAAC,IAAI,CAG3C;IACD,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAC,SAAS,GAAC,IAAI,EAG/C;IAED;;OAEG;IACH,IAAoB,KAAK,IAAI,wBAAwB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,CAG1E;IACD,IAAoB,KAAK,CAAC,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,EAgB9E;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,OAAO,CAG7B;IACD,IAAW,QAAQ,CAAC,KAAK,EAAE,OAAO,EAGjC;IAED;;OAEG;IACI,KAAK,EAAE,YAAY,CAAC,UAAU,CAAC,CAAkC;IAExE;;OAEG;IACI,IAAI,EAAE,YAAY,CAAC,UAAU,CAAC,CAAkC;gBAGjD,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC,EAC7B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAChB,cAAc,EAAE,cAAc;IAWnE;;OAEG;IACI,WAAW,IAAI,IAAI;IAS1B;;OAEG;IAEH,SAAS,CAAC,WAAW,IAAI,IAAI;IAQ7B;;;OAGG;IAEH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAK9C;;;OAGG;IAEH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;yCA3HpC,sBAAsB;2CAAtB,sBAAsB;CA+HlC"}
|
package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { AbstractControl, ValidationErrors, Validator } from '@angular/forms';
|
|
3
|
+
import { FormatProvider } from '../../../../interfaces';
|
|
4
|
+
import { DateApi } from '../../../../services';
|
|
5
|
+
import { DateTimeRestrictedBase } from '../dateTimeRestrictedBase';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Applies validator for date time max value
|
|
9
|
+
*/
|
|
10
|
+
export declare class DateTimeMaxValidatorDirective<TDate = unknown> extends DateTimeRestrictedBase<TDate> implements Validator, OnInit {
|
|
11
|
+
/**
|
|
12
|
+
* Function used for validations
|
|
13
|
+
*/
|
|
14
|
+
private _validator;
|
|
15
|
+
constructor(dateApi: DateApi<TDate>, formatProvider: FormatProvider);
|
|
16
|
+
/**
|
|
17
|
+
* Initialize component
|
|
18
|
+
*/
|
|
19
|
+
ngOnInit(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Validates input and returns validation result
|
|
22
|
+
* @param control - Control that is being validated
|
|
23
|
+
* @returns validation results
|
|
24
|
+
*/
|
|
25
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritdoc
|
|
28
|
+
*/
|
|
29
|
+
protected onMaxDateTimeChange(): void;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimeMaxValidatorDirective<any>, never>;
|
|
31
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DateTimeMaxValidatorDirective<any>, "[dateTime][maxDateTime][validate]", never, {}, {}, never, never, false>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=dateTimeMaxValidator.directive.d.ts.map
|
package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateTimeMaxValidator.directive.d.ts","sourceRoot":"","sources":["dateTimeMaxValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,MAAM,EAAC,MAAM,eAAe,CAAC;AACtF,OAAO,EAAC,eAAe,EAAiB,gBAAgB,EAAE,SAAS,EAAc,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAC;;AAEjE;;GAEG;AACH,qBAaa,6BAA6B,CAAC,KAAK,GAAG,OAAO,CAAE,SAAQ,sBAAsB,CAAC,KAAK,CAAG,YAAW,SAAS,EAAE,MAAM;IAI3H;;OAEG;IACH,OAAO,CAAC,UAAU,CAA2B;gBAGf,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAChB,cAAc,EAAE,cAAc;IAQnE;;OAEG;IACI,QAAQ,IAAI,IAAI;IAOvB;;;;OAIG;IACI,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,gBAAgB,GAAC,IAAI;IAOhE;;OAEG;cACgB,mBAAmB,IAAI,IAAI;yCA5CrC,6BAA6B;2CAA7B,6BAA6B;CAgDzC"}
|
package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { AbstractControl, ValidationErrors, Validator } from '@angular/forms';
|
|
3
|
+
import { FormatProvider } from '../../../../interfaces';
|
|
4
|
+
import { DateApi } from '../../../../services';
|
|
5
|
+
import { DateTimeRestrictedBase } from '../dateTimeRestrictedBase';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Applies validator for date time min value
|
|
9
|
+
*/
|
|
10
|
+
export declare class DateTimeMinValidatorDirective<TDate = unknown> extends DateTimeRestrictedBase<TDate> implements Validator, OnInit {
|
|
11
|
+
/**
|
|
12
|
+
* Function used for validations
|
|
13
|
+
*/
|
|
14
|
+
private _validator;
|
|
15
|
+
constructor(dateApi: DateApi<TDate>, formatProvider: FormatProvider);
|
|
16
|
+
/**
|
|
17
|
+
* Initialize component
|
|
18
|
+
*/
|
|
19
|
+
ngOnInit(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Validates input and returns validation result
|
|
22
|
+
* @param control - Control that is being validated
|
|
23
|
+
* @returns validation results
|
|
24
|
+
*/
|
|
25
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritdoc
|
|
28
|
+
*/
|
|
29
|
+
protected onMinDateTimeChange(): void;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimeMinValidatorDirective<any>, never>;
|
|
31
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DateTimeMinValidatorDirective<any>, "[dateTime][minDateTime][validate]", never, {}, {}, never, never, false>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=dateTimeMinValidator.directive.d.ts.map
|
package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateTimeMinValidator.directive.d.ts","sourceRoot":"","sources":["dateTimeMinValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,MAAM,EAAC,MAAM,eAAe,CAAC;AACtF,OAAO,EAAC,eAAe,EAAiB,gBAAgB,EAAE,SAAS,EAAc,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAC;;AAEjE;;GAEG;AACH,qBAaa,6BAA6B,CAAC,KAAK,GAAG,OAAO,CAAE,SAAQ,sBAAsB,CAAC,KAAK,CAAG,YAAW,SAAS,EAAE,MAAM;IAI3H;;OAEG;IACH,OAAO,CAAC,UAAU,CAA2B;gBAGf,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAChB,cAAc,EAAE,cAAc;IAOnE;;OAEG;IACI,QAAQ,IAAI,IAAI;IAOvB;;;;OAIG;IACI,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,gBAAgB,GAAC,IAAI;IAOhE;;OAEG;cACgB,mBAAmB,IAAI,IAAI;yCA3CrC,6BAA6B;2CAA7B,6BAA6B;CA+CzC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { Action1 } from '@jscrpt/common';
|
|
3
|
+
import { DateTimeBase } from './dateTimeBase';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Base class for date time directives with value restrictions
|
|
7
|
+
*/
|
|
8
|
+
export declare class DateTimeRestrictedBase<TDate = unknown> extends DateTimeBase<TDate> implements OnDestroy {
|
|
9
|
+
/**
|
|
10
|
+
* Subscription for max date instance value changes
|
|
11
|
+
*/
|
|
12
|
+
private _maxDateInstanceChange;
|
|
13
|
+
/**
|
|
14
|
+
* Subscription for min date instance value changes
|
|
15
|
+
*/
|
|
16
|
+
private _minDateInstanceChange;
|
|
17
|
+
/**
|
|
18
|
+
* Max allowed value of date time
|
|
19
|
+
*/
|
|
20
|
+
protected ɵMaxDateTime: TDate | undefined | null;
|
|
21
|
+
/**
|
|
22
|
+
* Min allowed value of date time
|
|
23
|
+
*/
|
|
24
|
+
protected ɵMinDateTime: TDate | undefined | null;
|
|
25
|
+
/**
|
|
26
|
+
* Gets or sets max allowed date for date time
|
|
27
|
+
*/
|
|
28
|
+
get maxDateTime(): TDate | undefined | null;
|
|
29
|
+
set maxDateTime(value: TDate | undefined | null);
|
|
30
|
+
/**
|
|
31
|
+
* Gets or sets min allowed date for date time
|
|
32
|
+
*/
|
|
33
|
+
get minDateTime(): TDate | undefined | null;
|
|
34
|
+
set minDateTime(value: TDate | undefined | null);
|
|
35
|
+
/**
|
|
36
|
+
* Called when component is destroyed
|
|
37
|
+
*/
|
|
38
|
+
ngOnDestroy(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Called whenever max date time restriction changes
|
|
41
|
+
*/
|
|
42
|
+
protected onMaxDateTimeChange(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Called whenever min date time restriction changes
|
|
45
|
+
*/
|
|
46
|
+
protected onMinDateTimeChange(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Sets min date time and notifies about changes
|
|
49
|
+
* @param value - Value to be set
|
|
50
|
+
*/
|
|
51
|
+
protected minDateSet(value: TDate | undefined | null): void;
|
|
52
|
+
/**
|
|
53
|
+
* Sets max date time and notifies about changes
|
|
54
|
+
* @param value - Value to be set
|
|
55
|
+
*/
|
|
56
|
+
protected maxDateSet(value: TDate | undefined | null): void;
|
|
57
|
+
/**
|
|
58
|
+
* Sets min or max date time value
|
|
59
|
+
* @param value - Value to be set
|
|
60
|
+
* @param setter - Action used for setting value
|
|
61
|
+
*/
|
|
62
|
+
protected setMinMaxValue(value: string | number | TDate | Date, setter: Action1<TDate | undefined | null>): void;
|
|
63
|
+
/**
|
|
64
|
+
* Custom input type for `maxDateTime` input
|
|
65
|
+
*/
|
|
66
|
+
static ngAcceptInputType_maxDateTime: string | number | DateTimeBase | Date;
|
|
67
|
+
/**
|
|
68
|
+
* Custom input type for `minDateTime` input
|
|
69
|
+
*/
|
|
70
|
+
static ngAcceptInputType_minDateTime: string | number | DateTimeBase | Date;
|
|
71
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimeRestrictedBase<any>, never>;
|
|
72
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DateTimeRestrictedBase<any>, never, never, { "maxDateTime": "maxDateTime"; "minDateTime": "minDateTime"; }, {}, never, never, false>;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=dateTimeRestrictedBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateTimeRestrictedBase.d.ts","sourceRoot":"","sources":["dateTimeRestrictedBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,SAAS,EAAC,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,OAAO,EAAoB,MAAM,gBAAgB,CAAC;AAK1D,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;;AAE5C;;GAEG;AACH,qBACa,sBAAsB,CAAC,KAAK,GAAG,OAAO,CAAE,SAAQ,YAAY,CAAC,KAAK,CAAE,YAAW,SAAS;IAIjG;;OAEG;IACH,OAAO,CAAC,sBAAsB,CAA8B;IAE5D;;OAEG;IACH,OAAO,CAAC,sBAAsB,CAA8B;IAI5D;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,CAAC;IAE7C;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,CAAC;IAI7C;;OAEG;IACH,IACW,WAAW,IAAI,KAAK,GAAC,SAAS,GAAC,IAAI,CAG7C;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,EA2CjD;IAED;;OAEG;IACH,IACW,WAAW,IAAI,KAAK,GAAC,SAAS,GAAC,IAAI,CAG7C;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,EA2CjD;IAID;;OAEG;IACI,WAAW,IAAI,IAAI;IAW1B;;OAEG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAIrC;;OAEG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAIrC;;;OAGG;IAEH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,GAAG,IAAI;IAMvD;;;OAGG;IAEH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,GAAG,IAAI;IAMvD;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAC,MAAM,GAAC,KAAK,GAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,GAAC,SAAS,GAAC,IAAI,CAAC,GAAG,IAAI;IAgBtG;;OAEG;IACH,OAAc,6BAA6B,EAAE,MAAM,GAAC,MAAM,GAAC,YAAY,GAAC,IAAI,CAAC;IAE7E;;OAEG;IACH,OAAc,6BAA6B,EAAE,MAAM,GAAC,MAAM,GAAC,YAAY,GAAC,IAAI,CAAC;yCAvNpE,sBAAsB;2CAAtB,sBAAsB;CAwNlC"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
1
2
|
import { AbstractControl, ValidationErrors, Validator } from '@angular/forms';
|
|
3
|
+
import { FormatProvider } from '../../../../interfaces';
|
|
2
4
|
import { DateApi } from '../../../../services';
|
|
5
|
+
import { DateTimeBase } from '../dateTimeBase';
|
|
3
6
|
import * as i0 from "@angular/core";
|
|
4
7
|
/**
|
|
5
8
|
* Applies validator for date time
|
|
6
9
|
*/
|
|
7
|
-
export declare class DateTimeValidatorDirective<TDate = unknown> implements Validator {
|
|
10
|
+
export declare class DateTimeValidatorDirective<TDate = unknown> extends DateTimeBase<TDate> implements Validator, OnInit {
|
|
8
11
|
/**
|
|
9
12
|
* Function used for validations
|
|
10
13
|
*/
|
|
11
14
|
private _validator;
|
|
12
|
-
constructor(dateApi: DateApi<TDate
|
|
15
|
+
constructor(dateApi: DateApi<TDate>, formatProvider: FormatProvider);
|
|
16
|
+
/**
|
|
17
|
+
* Initialize component
|
|
18
|
+
*/
|
|
19
|
+
ngOnInit(): void;
|
|
13
20
|
/**
|
|
14
21
|
* Validates input and returns validation result
|
|
15
22
|
* @param control - Control that is being validated
|
package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeValidator.directive.d.ts","sourceRoot":"","sources":["dateTimeValidator.directive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dateTimeValidator.directive.d.ts","sourceRoot":"","sources":["dateTimeValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,MAAM,EAAC,MAAM,eAAe,CAAC;AACtF,OAAO,EAAC,eAAe,EAAiB,gBAAgB,EAAE,SAAS,EAAc,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;AACH,qBAaa,0BAA0B,CAAC,KAAK,GAAG,OAAO,CAAE,SAAQ,YAAY,CAAC,KAAK,CAAE,YAAW,SAAS,EAAE,MAAM;IAI7G;;OAEG;IACH,OAAO,CAAC,UAAU,CAA2B;gBAGf,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAChB,cAAc,EAAE,cAAc;IAOnE;;OAEG;IACI,QAAQ,IAAI,IAAI;IAOvB;;;;OAIG;IACI,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,gBAAgB,GAAC,IAAI;yCAjCvD,0BAA0B;2CAA1B,0BAA0B;CAqCtC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export * from './dateTimeBase';
|
|
1
2
|
export * from './dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive';
|
|
2
3
|
export * from './dateTimeInput/dateTimeInput.directive';
|
|
4
|
+
export * from './dateTimeMaxValidator/dateTimeMaxValidator.directive';
|
|
5
|
+
export * from './dateTimeMinValidator/dateTimeMinValidator.directive';
|
|
6
|
+
export * from './dateTimeRestrictedBase';
|
|
3
7
|
export * from './dateTimeValidator/dateTimeValidator.directive';
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,uEAAuE,CAAC;AACtF,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uEAAuE,CAAC;AACtF,cAAc,yCAAyC,CAAC;AACxD,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC;AACtE,cAAc,0BAA0B,CAAC;AACzC,cAAc,iDAAiD,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import * as i1 from "../directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive";
|
|
3
3
|
import * as i2 from "../directives/dateTimeInput/dateTimeInput.directive";
|
|
4
|
-
import * as i3 from "../directives/
|
|
4
|
+
import * as i3 from "../directives/dateTimeMaxValidator/dateTimeMaxValidator.directive";
|
|
5
|
+
import * as i4 from "../directives/dateTimeMinValidator/dateTimeMinValidator.directive";
|
|
6
|
+
import * as i5 from "../directives/dateTimeValidator/dateTimeValidator.directive";
|
|
5
7
|
/**
|
|
6
8
|
* Module for basic date time directives, components, pipes
|
|
7
9
|
*/
|
|
8
10
|
export declare class DateTimeModule {
|
|
9
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimeModule, never>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DateTimeModule, [typeof i1.DateTimeControlValueAccessorDirective, typeof i2.DateTimeInputDirective, typeof i3.DateTimeValidatorDirective], never, [typeof i1.DateTimeControlValueAccessorDirective, typeof i2.DateTimeInputDirective, typeof i3.DateTimeValidatorDirective]>;
|
|
12
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DateTimeModule, [typeof i1.DateTimeControlValueAccessorDirective, typeof i2.DateTimeInputDirective, typeof i3.DateTimeMaxValidatorDirective, typeof i4.DateTimeMinValidatorDirective, typeof i5.DateTimeValidatorDirective], never, [typeof i1.DateTimeControlValueAccessorDirective, typeof i2.DateTimeInputDirective, typeof i3.DateTimeMaxValidatorDirective, typeof i4.DateTimeMinValidatorDirective, typeof i5.DateTimeValidatorDirective]>;
|
|
11
13
|
static ɵinj: i0.ɵɵInjectorDeclaration<DateTimeModule>;
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=dateTime.module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTime.module.d.ts","sourceRoot":"","sources":["dateTime.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dateTime.module.d.ts","sourceRoot":"","sources":["dateTime.module.ts"],"names":[],"mappings":";;;;;;AAIA;;GAEG;AACH,qBAmBa,cAAc;yCAAd,cAAc;0CAAd,cAAc;0CAAd,cAAc;CAE1B"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injector } from '@angular/core';
|
|
2
|
-
import { DateApi, DateApiObject, DateValue } from '
|
|
2
|
+
import { DateApi, DateApiObject, DateValue } from '../dateApi/dateApi.interface';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
5
5
|
* Service used for parsing relative date time strings
|
|
@@ -16,11 +16,11 @@ export declare class DateTimeRelativeParser<TDate = any> {
|
|
|
16
16
|
* @param value - Value to be parsed
|
|
17
17
|
*
|
|
18
18
|
* @summary
|
|
19
|
-
*
|
|
19
|
+
* m - for minutes
|
|
20
20
|
* h - for hours
|
|
21
21
|
* d - for days
|
|
22
22
|
* w - for weeks
|
|
23
|
-
*
|
|
23
|
+
* M - for months
|
|
24
24
|
* y - for years
|
|
25
25
|
*/
|
|
26
26
|
parse(value: TDate | DateValue): TDate | DateValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeRelativeParser.service.d.ts","sourceRoot":"","sources":["dateTimeRelativeParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAC,MAAM,eAAe,CAAC;AAInD,OAAO,EAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"dateTimeRelativeParser.service.d.ts","sourceRoot":"","sources":["dateTimeRelativeParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAC,MAAM,eAAe,CAAC;AAInD,OAAO,EAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,8BAA8B,CAAC;;AAE/E;;GAEG;AACH,qBACa,sBAAsB,CAAC,KAAK,GAAG,GAAG;IAU/B,SAAS,CAAC,SAAS,EAAE,QAAQ;IANzC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;gBAG7B,SAAS,EAAE,QAAQ;IAMzC;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,KAAK,EAAE,KAAK,GAAC,SAAS,GAAG,KAAK,GAAC,SAAS;yCA5B5C,sBAAsB;6CAAtB,sBAAsB;CAuFlC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DateTimeValue } from '
|
|
2
|
-
import { DateApi } from '
|
|
1
|
+
import { DateTimeValue } from '../../interfaces/dateTime/datetime.interface';
|
|
2
|
+
import { DateApi } from '../dateApi/dateApi.interface';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
5
5
|
* Class used for obtaining DateTimeValue for various formats
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateValueProvider.service.d.ts","sourceRoot":"","sources":["dateValueProvider.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"dateValueProvider.service.d.ts","sourceRoot":"","sources":["dateValueProvider.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,8CAA8C,CAAC;AAE3E,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAC;;AAErD;;GAEG;AACH,qBACa,iBAAiB,CAAC,KAAK,GAAG,GAAG;IAGR,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;gBAAxB,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;IAMhE;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC;yCAd1D,iBAAiB;6CAAjB,iBAAiB;CA+D7B"}
|
package/src/services/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export * from './dateApi/dateApi.interface';
|
|
2
|
-
export * from './datePositionParser.interface';
|
|
2
|
+
export * from './datePositionParser/datePositionParser.interface';
|
|
3
|
+
export * from './datePositionParser/datePositionParser.service';
|
|
4
|
+
export * from './dateTimeRelativeParser/dateTimeRelativeParser.service';
|
|
5
|
+
export * from './dateValueProvider/dateValueProvider.service';
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC;AAChE,cAAc,yDAAyD,CAAC;AACxE,cAAc,+CAA+C,CAAC"}
|
package/version.bak
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.0.0-beta.
|
|
1
|
+
5.0.0-beta.20221018102923
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datePositionParser.interface.js","sourceRoot":"","sources":["../../../src/services/datePositionParser.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Parser used for parsing date using provided format and returning positions and selected date part\n */\nexport interface DatePositionParser\n{\n /**\n * Parse date as string and returns information about positions and selected part of date\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n parse(date: string, cursorPosition: number): DatePositionParserResult;\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to next part, if it was last part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n next(date: string, cursorPosition: number): null|DatePositionParserResult;\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to previous part, if it was first part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n previous(date: string, cursorPosition: number): null|DatePositionParserResult;\n}\n\n/**\n * Result of date position parsing\n */\nexport interface DatePositionParserResult\n{\n /**\n * Index of charater where returned part of date starts\n */\n positionFrom: number;\n\n /**\n * Index of charater where returned part of date ends\n */\n positionTo: number;\n\n /**\n * Type of part that is selected\n */\n part: string;\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datePositionParser.service.js","sourceRoot":"","sources":["../../../src/services/datePositionParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAIvC;;GAEG;AAEH,MAAM,OAAO,yBAAyB;IAElC,oEAAoE;IAEpE;;;OAGG;IACI,YAAY,CAAC,MAAc;QAE9B,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;;sHAXQ,yBAAyB;0HAAzB,yBAAyB,cADb,MAAM;2FAClB,yBAAyB;kBADrC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;AAehC;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAmBlC,iEAAiE;IACjE,YAAsB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAlBrC,sEAAsE;QAEtE;;WAEG;QACO,kBAAa,GAAY,KAAK,CAAC;QAEzC;;WAEG;QACO,sBAAiB,GAAa,EAAE,CAAC;QAE3C;;WAEG;QACO,4BAAuB,GAAsD,EAAE,CAAC;QAKtF,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED,2GAA2G;IAE3G;;;;OAIG;IACI,IAAI,CAAC,IAA2B,EAAE,cAAsB;QAE3D,IAAG,OAAO,CAAC,IAAI,CAAC,EAChB;YACI,OAAO,IAAI,CAAC;SACf;QAED,mBAAmB;QACnB,IAAG,IAAI,CAAC,aAAa,EACrB;YACI,IAAI,OAAO,GAAG,KAAK,CAAC;YAEpB,OAAM,IAAI,EACV;gBACI,IAAG,cAAc,IAAI,IAAI,CAAC,MAAM,EAChC;oBACI,OAAO,IAAI,CAAC;iBACf;gBAED,IAAG,O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AC,CAAC,IAAI,QAAQ,EAC9B;oBACI,IAAG,CAAC,GAAG,CAAC,EACR;wBACI,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;qBAClE;oBAED,SAAS,GAAG,CAAC,CAAC;oBACd,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBAE3B,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;wBAC/B;4BACI,MAAM,EAAE,CAAC;4BACT,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;yBACxB,CAAC;iBACL;aACJ;YAED,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;SACpF;IACL,CAAC;CACJ","sourcesContent":["import {Injectable} from '@angular/core';\nimport {isBlank} from '@jscrpt/common';\n\nimport {DatePositionParser, DatePositionParserResult} from './datePositionParser.interface';\n\n/**\n * Service used for parsing date\n */\n@Injectable({providedIn: 'root'})\nexport class DatePositionParserService\n{\n //######################### public methods #########################\n\n /**\n * Creates parser instance for specified format\n * @param format - Format to be used for parsing date string\n */\n public createParser(format: string): DatePositionParser\n {\n return new DefaultDatePositionParser(format);\n }\n}\n\n/**\n * Default implementation of DatePositionParser\n */\nexport class DefaultDatePositionParser implements DatePositionParser\n{\n //######################### protected fields #########################\n\n /**\n * Indication whether format contains separators\n */\n protected _hasSeparator: boolean = false;\n\n /**\n * Array of date parts of parsed date format\n */\n protected _datePartsIndexes: string[] = [];\n\n /**\n * Object storing indexes for strict date parts of parsed date format\n */\n protected _strictDatePartsIndexes: {[index: number]: {part: string, length: number}} = {};\n\n //######################### constructor #########################\n constructor(protected _format: string)\n {\n this._initialize();\n }\n\n //######################### public methods - implementation of DatePositionParser #########################\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to next part, if it was last part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public next(date: string|null|undefined, cursorPosition: number): null|DatePositionParserResult\n {\n if(isBlank(date))\n {\n return null;\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n let useNext = false;\n\n while(true)\n {\n if(cursorPosition == date.length)\n {\n return null;\n }\n\n if(useNext && !isNaN(+date[cursorPosition]))\n {\n return this.parse(date, cursorPosition);\n }\n\n if(isNaN(+date[cursorPosition]))\n {\n useNext = true;\n }\n\n cursorPosition++;\n }\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition < index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to previous part, if it was first part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public previous(date: string|null|undefined, cursorPosition: number): null|DatePositionParserResult\n {\n if(isBlank(date))\n {\n return null;\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n let useNext = false;\n\n while(true)\n {\n if(cursorPosition < 0)\n {\n return null;\n }\n\n if(useNext && !isNaN(+date[cursorPosition]))\n {\n return this.parse(date, cursorPosition);\n }\n\n if(isNaN(+date[cursorPosition]))\n {\n useNext = true;\n }\n\n cursorPosition--;\n }\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).reverse().map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition > index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Parse date as string and returns information about positions and selected part of date\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public parse(date: string|null|undefined, cursorPosition: number): DatePositionParserResult\n {\n if(isBlank(date))\n {\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n //fix cursor position if is clicked on separator\n if(cursorPosition != date.length &&\n /[^0-9ɵ]/.test(date[cursorPosition]) &&\n /[^0-9ɵ]/.test(date[cursorPosition - 1]))\n {\n let breakCycle = false;\n cursorPosition++;\n\n while(/[^0-9ɵ]/.test(date[cursorPosition]))\n {\n if(cursorPosition >= date.length)\n {\n if(breakCycle)\n {\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n breakCycle = true;\n cursorPosition = 0;\n }\n\n cursorPosition++;\n }\n }\n\n const updateDate = [date.substr(0, cursorPosition), 'ɵ', date.substr(cursorPosition)].join('');\n const indexed = updateDate.replace(/[^0-9ɵ]/g, ' ').split(' ');\n let partIndex = 0;\n let startPosition = 0;\n let selectionLength = 0;\n\n for(const itm of indexed)\n {\n //this segment contains cursor\n if(itm.indexOf('ɵ') >= 0)\n {\n selectionLength = itm.length - 1;\n\n break;\n }\n\n startPosition++;\n\n //separator\n if(!itm.length)\n {\n continue;\n }\n\n partIndex++;\n startPosition += itm.length;\n }\n\n return {\n part: this._datePartsIndexes[partIndex],\n positionFrom: startPosition,\n positionTo: startPosition + selectionLength\n };\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).reverse().map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition >= index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n /**\n * Initialize parser, process format\n */\n protected _initialize(): void\n {\n this._hasSeparator = /[^yqmwdhs]/i.test(this._format);\n\n //non strict format\n if(this._hasSeparator)\n {\n this._datePartsIndexes = this._format.replace(/[^yqmwdhs]+/gi, ' ')\n .split(' ')\n .filter(itm => !!itm)\n .map(itm => itm[0]);\n }\n //strict format\n else\n {\n let lastPart: string|null = null;\n let lastIndex: number = 0;\n\n for(let x = 0; x < this._format.length; x++)\n {\n //next part\n if(this._format[x] != lastPart)\n {\n if(x > 0)\n {\n this._strictDatePartsIndexes[lastIndex].length = x - lastIndex;\n }\n\n lastIndex = x;\n lastPart = this._format[x];\n\n this._strictDatePartsIndexes[x] =\n {\n length: 0,\n part: this._format[x]\n };\n }\n }\n\n this._strictDatePartsIndexes[lastIndex].length = this._format.length - lastIndex;\n }\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeRelativeParser.service.js","sourceRoot":"","sources":["../../../src/services/dateTimeRelativeParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAGxC;;GAEG;AAEH,MAAM,OAAO,sBAAsB;IAS/B,iEAAiE;IACjE,YAAsB,SAAmB;QAAnB,cAAS,GAAT,SAAS,CAAU;IAEzC,CAAC;IAED,oEAAoE;IAEpE;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,KAAsB;;QAE/B,MAAM,KAAK,GAAG,6BAA6B,CAAC;QAE5C,wBAAwB;QACxB,IAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EACvC;YACI,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClC,MAAM,SAAS,GAAG,OAAQ,CAAC,CAAC,CAAC,CAAC;YAC9B,MAAM,MAAM,GAAG,OAAQ,CAAC,CAAC,CAAC,CAAC;YAC3B,MAAM,MAAM,GAAG,OAAQ,CAAC,CAAC,CAAC,CAAC;YAC3B,IAAI,CAAC,QAAQ,GAAG,MAAA,IAAI,CAAC,QAAQ,mCAAI,IAAI,CAAC,SAAS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C,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;wBAEhG,MAAM;qBACT;gBACD,KAAK,GAAG;oBACR;wBACI,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;wBAE9F,MAAM;qBACT;aACJ;YAED,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;SACrB;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;;mHAtFQ,sBAAsB;uHAAtB,sBAAsB,cADV,MAAM;2FAClB,sBAAsB;kBADlC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC","sourcesContent":["import {Injectable, Injector} from '@angular/core';\nimport {isString} from '@jscrpt/common';\n\nimport {DATE_API} from '../misc/tokens';\nimport {DateApi, DateApiObject, DateValue} from './dateApi/dateApi.interface';\n\n/**\n * Service used for parsing relative date time strings\n */\n@Injectable({providedIn: 'root'})\nexport class DateTimeRelativeParser<TDate = any>\n{\n //######################### protected fields #########################\n \n /**\n * Date api for handling\n */\n protected _dateApi?: DateApi<TDate, DateApiObject>;\n\n //######################### constructor #########################\n constructor(protected _injector: Injector)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Tries to parse relative value and returns parsed TDate, otherwise returns input value\n * @param value - Value to be parsed\n * \n * @summary\n * i - for minutes\n * h - for hours\n * d - for days\n * w - for weeks\n * m - for months\n * y - for years\n */\n public parse(value: TDate|DateValue): TDate|DateValue\n {\n const regex = /([+-])\\s*(\\d+)\\s*([ihdwmy])/;\n\n //relative date provided\n if(isString(value) && regex.test(value))\n {\n const matches = regex.exec(value);\n const operation = matches![1];\n const amount = matches![2];\n const period = matches![3];\n this._dateApi = this._dateApi ?? this._injector.get(DATE_API);\n const now = this._dateApi.now();\n\n switch(period)\n {\n case 'i':\n {\n operation == '+' ? now.addMinutes(+amount).endOfMinute() : now.subtractMinutes(+amount).startOfMinute();\n\n break;\n }\n case 'h':\n {\n operation == '+' ? now.addHours(+amount).endOfHour() : now.subtractHours(+amount).startOfHour();\n\n break;\n }\n case 'd':\n {\n operation == '+' ? now.addDays(+amount).endOfDay() : now.subtractDays(+amount).startOfDay();\n\n break;\n }\n case 'w':\n {\n operation == '+' ? now.addWeeks(+amount).endOfDay() : now.subtractWeeks(+amount).startOfDay();\n\n break;\n }\n case 'm':\n {\n operation == '+' ? now.addMonths(+amount).endOfDay() : now.subtractMonths(+amount).startOfDay();\n\n break;\n }\n case 'y':\n {\n operation == '+' ? now.addYears(+amount).endOfDay() : now.subtractYears(+amount).startOfDay();\n\n break;\n }\n }\n\n value = now.value;\n }\n\n return value;\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dateValueProvider.service.js","sourceRoot":"","sources":["../../../src/services/dateValueProvider.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAGxC;;GAEG;AAEH,MAAM,OAAO,iBAAiB;IAE1B,iEAAiE;IACjE,YAAwC,QAAwB;QAAxB,aAAQ,GAAR,QAAQ,CAAgB;IAEhE,CAAC;IAED,oEAAoE;IAEpE;;;;OAIG;IACI,QAAQ,CAAC,KAAY,EAAE,MAAc;QAExC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAClD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,KAAK,GAAU,KAAK,CAAC;QACzB,IAAI,GAAG,GAAU,KAAK,CAAC;QAEvB,QAAQ;QACR,IAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAC/B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AAE,EAAE,GAAG;SACV,CAAC;IACN,CAAC;;8GA9DQ,iBAAiB,kBAGN,QAAQ;kHAHnB,iBAAiB,cADL,MAAM;2FAClB,iBAAiB;kBAD7B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;0BAIf,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Injectable} from '@angular/core';\n\nimport {DateTimeValue} from '../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../misc/tokens';\nimport {DateApi} from './dateApi/dateApi.interface';\n\n/**\n * Class used for obtaining DateTimeValue for various formats\n */\n@Injectable({providedIn: 'root'})\nexport class DateValueProvider<TDate = any>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Gets DateTimeValue from single value based on format\n * @param value - Current value to be converted to ranged value\n * @param format - Format that is requested to be displayed, it tells what range should be created\n */\n public getValue(value: TDate, format: string): DateTimeValue<TDate>\n {\n const val = this._dateApi.getValue(value, format);\n const fullFormat = this._dateApi.getFormat(format);\n let start: TDate = value;\n let end: TDate = value;\n\n //minute\n if(fullFormat.indexOf('m') >= 0)\n {\n start = val.startOfMinute().value;\n end = val.endOfMinute().value;\n }\n //hour\n else if(fullFormat.indexOf('H') >= 0)\n {\n start = val.startOfHour().value;\n end = val.endOfHour().value;\n }\n //day\n else if(fullFormat.indexOf('d') >= 0)\n {\n start = val.startOfDay().value;\n end = val.endOfDay().value;\n }\n //week\n else if(fullFormat.indexOf('w') >= 0)\n {\n start = val.startOfWeek().value;\n end = val.endOfWeek().value;\n }\n //month\n else if(fullFormat.indexOf('M') >= 0)\n {\n start = val.startOfMonth().value;\n end = val.endOfMonth().value;\n }\n //year\n else if(fullFormat.indexOf('Y') >= 0 || fullFormat.indexOf('y') >= 0)\n {\n start = val.startOfYear().value;\n end = val.endOfYear().value;\n }\n\n return {\n from: start,\n to: end\n };\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datePositionParser.interface.js","sourceRoot":"","sources":["../../../src/services/datePositionParser.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Parser used for parsing date using provided format and returning positions and selected date part\n */\nexport interface DatePositionParser\n{\n /**\n * Parse date as string and returns information about positions and selected part of date\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n parse(date: string, cursorPosition: number): DatePositionParserResult;\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to next part, if it was last part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n next(date: string, cursorPosition: number): null|DatePositionParserResult;\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to previous part, if it was first part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n previous(date: string, cursorPosition: number): null|DatePositionParserResult;\n}\n\n/**\n * Result of date position parsing\n */\nexport interface DatePositionParserResult\n{\n /**\n * Index of charater where returned part of date starts\n */\n positionFrom: number;\n\n /**\n * Index of charater where returned part of date ends\n */\n positionTo: number;\n\n /**\n * Type of part that is selected\n */\n part: string;\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datePositionParser.service.js","sourceRoot":"","sources":["../../../src/services/datePositionParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAIvC;;GAEG;AAEH,MAAM,OAAO,yBAAyB;IAElC,oEAAoE;IAEpE;;;OAGG;IACI,YAAY,CAAC,MAAc;QAE9B,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;;sHAXQ,yBAAyB;0HAAzB,yBAAyB,cADb,MAAM;2FAClB,yBAAyB;kBADrC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;AAehC;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAmBlC,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C,OAAO,CAAC,CAAC;QAEtD,mBAAmB;QACnB,IAAG,IAAI,CAAC,aAAa,EACrB;YACI,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;iBAC9D,KAAK,CAAC,GAAG,CAAC;iBACV,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;iBACpB,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3B;QACD,eAAe;aAEf;YACI,IAAI,QAAQ,GAAgB,IAAI,CAAC;YACjC,IAAI,SAAS,GAAW,CAAC,CAAC;YAE1B,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAC3C;gBACI,WAAW;gBACX,IAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,EAC9B;oBACI,IAAG,CAAC,GAAG,CAAC,EACR;wBACI,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;qBAClE;oBAED,SAAS,GAAG,CAAC,CAAC;oBACd,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBAE3B,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;wBAC/B;4BACI,MAAM,EAAE,CAAC;4BACT,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;yBACxB,CAAC;iBACL;aACJ;YAED,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;SACpF;IACL,CAAC;CACJ","sourcesContent":["import {Injectable} from '@angular/core';\nimport {isBlank} from '@jscrpt/common';\n\nimport {DatePositionParser, DatePositionParserResult} from './datePositionParser.interface';\n\n/**\n * Service used for parsing date\n */\n@Injectable({providedIn: 'root'})\nexport class DatePositionParserService\n{\n //######################### public methods #########################\n\n /**\n * Creates parser instance for specified format\n * @param format - Format to be used for parsing date string\n */\n public createParser(format: string): DatePositionParser\n {\n return new DefaultDatePositionParser(format);\n }\n}\n\n/**\n * Default implementation of DatePositionParser\n */\nexport class DefaultDatePositionParser implements DatePositionParser\n{\n //######################### protected fields #########################\n\n /**\n * Indication whether format contains separators\n */\n protected _hasSeparator: boolean = false;\n\n /**\n * Array of date parts of parsed date format\n */\n protected _datePartsIndexes: string[] = [];\n\n /**\n * Object storing indexes for strict date parts of parsed date format\n */\n protected _strictDatePartsIndexes: {[index: number]: {part: string, length: number}} = {};\n\n //######################### constructor #########################\n constructor(protected _format: string)\n {\n this._initialize();\n }\n\n //######################### public methods - implementation of DatePositionParser #########################\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to next part, if it was last part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public next(date: string|null|undefined, cursorPosition: number): null|DatePositionParserResult\n {\n if(isBlank(date))\n {\n return null;\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n let useNext = false;\n\n while(true)\n {\n if(cursorPosition == date.length)\n {\n return null;\n }\n\n if(useNext && !isNaN(+date[cursorPosition]))\n {\n return this.parse(date, cursorPosition);\n }\n\n if(isNaN(+date[cursorPosition]))\n {\n useNext = true;\n }\n\n cursorPosition++;\n }\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition < index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to previous part, if it was first part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public previous(date: string|null|undefined, cursorPosition: number): null|DatePositionParserResult\n {\n if(isBlank(date))\n {\n return null;\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n let useNext = false;\n\n while(true)\n {\n if(cursorPosition < 0)\n {\n return null;\n }\n\n if(useNext && !isNaN(+date[cursorPosition]))\n {\n return this.parse(date, cursorPosition);\n }\n\n if(isNaN(+date[cursorPosition]))\n {\n useNext = true;\n }\n\n cursorPosition--;\n }\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).reverse().map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition > index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Parse date as string and returns information about positions and selected part of date\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public parse(date: string|null|undefined, cursorPosition: number): DatePositionParserResult\n {\n if(isBlank(date))\n {\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n //fix cursor position if is clicked on separator\n if(cursorPosition != date.length &&\n /[^0-9ɵ]/.test(date[cursorPosition]) &&\n /[^0-9ɵ]/.test(date[cursorPosition - 1]))\n {\n let breakCycle = false;\n cursorPosition++;\n\n while(/[^0-9ɵ]/.test(date[cursorPosition]))\n {\n if(cursorPosition >= date.length)\n {\n if(breakCycle)\n {\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n breakCycle = true;\n cursorPosition = 0;\n }\n\n cursorPosition++;\n }\n }\n\n const updateDate = [date.substr(0, cursorPosition), 'ɵ', date.substr(cursorPosition)].join('');\n const indexed = updateDate.replace(/[^0-9ɵ]/g, ' ').split(' ');\n let partIndex = 0;\n let startPosition = 0;\n let selectionLength = 0;\n\n for(const itm of indexed)\n {\n //this segment contains cursor\n if(itm.indexOf('ɵ') >= 0)\n {\n selectionLength = itm.length - 1;\n\n break;\n }\n\n startPosition++;\n\n //separator\n if(!itm.length)\n {\n continue;\n }\n\n partIndex++;\n startPosition += itm.length;\n }\n\n return {\n part: this._datePartsIndexes[partIndex],\n positionFrom: startPosition,\n positionTo: startPosition + selectionLength\n };\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).reverse().map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition >= index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n /**\n * Initialize parser, process format\n */\n protected _initialize(): void\n {\n this._hasSeparator = /[^yqmwdhs]/i.test(this._format);\n\n //non strict format\n if(this._hasSeparator)\n {\n this._datePartsIndexes = this._format.replace(/[^yqmwdhs]+/gi, ' ')\n .split(' ')\n .filter(itm => !!itm)\n .map(itm => itm[0]);\n }\n //strict format\n else\n {\n let lastPart: string|null = null;\n let lastIndex: number = 0;\n\n for(let x = 0; x < this._format.length; x++)\n {\n //next part\n if(this._format[x] != lastPart)\n {\n if(x > 0)\n {\n this._strictDatePartsIndexes[lastIndex].length = x - lastIndex;\n }\n\n lastIndex = x;\n lastPart = this._format[x];\n\n this._strictDatePartsIndexes[x] =\n {\n length: 0,\n part: this._format[x]\n };\n }\n }\n\n this._strictDatePartsIndexes[lastIndex].length = this._format.length - lastIndex;\n }\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeRelativeParser.service.js","sourceRoot":"","sources":["../../../src/services/dateTimeRelativeParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAGxC;;GAEG;AAEH,MAAM,OAAO,sBAAsB;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,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;wBAE5F,MAAM;qBACT;gBACD,KAAK,GAAG;oBACR;wBACI,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;wBAE9F,MAAM;qBACT;gBACD,KAAK,GAAG;oBACR;wBACI,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;wBAEhG,MAAM;qBACT;gBACD,KAAK,GAAG;oBACR;wBACI,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;wBAE9F,MAAM;qBACT;aACJ;YAED,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;SACrB;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;;mHAtFQ,sBAAsB;uHAAtB,sBAAsB,cADV,MAAM;2FAClB,sBAAsB;kBADlC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC","sourcesContent":["import {Injectable, Injector} from '@angular/core';\nimport {isString} from '@jscrpt/common';\n\nimport {DATE_API} from '../misc/tokens';\nimport {DateApi, DateApiObject, DateValue} from './dateApi/dateApi.interface';\n\n/**\n * Service used for parsing relative date time strings\n */\n@Injectable({providedIn: 'root'})\nexport class DateTimeRelativeParser<TDate = any>\n{\n //######################### protected fields #########################\n \n /**\n * Date api for handling\n */\n protected _dateApi?: DateApi<TDate, DateApiObject>;\n\n //######################### constructor #########################\n constructor(protected _injector: Injector)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Tries to parse relative value and returns parsed TDate, otherwise returns input value\n * @param value - Value to be parsed\n * \n * @summary\n * i - for minutes\n * h - for hours\n * d - for days\n * w - for weeks\n * m - for months\n * y - for years\n */\n public parse(value: TDate|DateValue): TDate|DateValue\n {\n const regex = /([+-])\\s*(\\d+)\\s*([ihdwmy])/;\n\n //relative date provided\n if(isString(value) && regex.test(value))\n {\n const matches = regex.exec(value);\n const operation = matches![1];\n const amount = matches![2];\n const period = matches![3];\n this._dateApi = this._dateApi ?? this._injector.get(DATE_API);\n const now = this._dateApi.now();\n\n switch(period)\n {\n case 'i':\n {\n operation == '+' ? now.addMinutes(+amount).endOfMinute() : now.subtractMinutes(+amount).startOfMinute();\n\n break;\n }\n case 'h':\n {\n operation == '+' ? now.addHours(+amount).endOfHour() : now.subtractHours(+amount).startOfHour();\n\n break;\n }\n case 'd':\n {\n operation == '+' ? now.addDays(+amount).endOfDay() : now.subtractDays(+amount).startOfDay();\n\n break;\n }\n case 'w':\n {\n operation == '+' ? now.addWeeks(+amount).endOfDay() : now.subtractWeeks(+amount).startOfDay();\n\n break;\n }\n case 'm':\n {\n operation == '+' ? now.addMonths(+amount).endOfDay() : now.subtractMonths(+amount).startOfDay();\n\n break;\n }\n case 'y':\n {\n operation == '+' ? now.addYears(+amount).endOfDay() : now.subtractYears(+amount).startOfDay();\n\n break;\n }\n }\n\n value = now.value;\n }\n\n return value;\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dateValueProvider.service.js","sourceRoot":"","sources":["../../../src/services/dateValueProvider.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,E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AW,EAAE,CAAC,KAAK,CAAC;YAChC,GAAG,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC;SAC/B;QACD,OAAO;aACF,IAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EACpC;YACI,KAAK,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC;YACjC,GAAG,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC;SAChC;QACD,MAAM;aACD,IAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EACpE;YACI,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;YAChC,GAAG,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC;SAC/B;QAED,OAAO;YACH,IAAI,EAAE,KAAK;YACX,EAAE,EAAE,GAAG;SACV,CAAC;IACN,CAAC;;8GA9DQ,iBAAiB,kBAGN,QAAQ;kHAHnB,iBAAiB,cADL,MAAM;2FAClB,iBAAiB;kBAD7B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;0BAIf,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Injectable} from '@angular/core';\n\nimport {DateTimeValue} from '../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../misc/tokens';\nimport {DateApi} from './dateApi/dateApi.interface';\n\n/**\n * Class used for obtaining DateTimeValue for various formats\n */\n@Injectable({providedIn: 'root'})\nexport class DateValueProvider<TDate = any>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Gets DateTimeValue from single value based on format\n * @param value - Current value to be converted to ranged value\n * @param format - Format that is requested to be displayed, it tells what range should be created\n */\n public getValue(value: TDate, format: string): DateTimeValue<TDate>\n {\n const val = this._dateApi.getValue(value, format);\n const fullFormat = this._dateApi.getFormat(format);\n let start: TDate = value;\n let end: TDate = value;\n\n //minute\n if(fullFormat.indexOf('m') >= 0)\n {\n start = val.startOfMinute().value;\n end = val.endOfMinute().value;\n }\n //hour\n else if(fullFormat.indexOf('H') >= 0)\n {\n start = val.startOfHour().value;\n end = val.endOfHour().value;\n }\n //day\n else if(fullFormat.indexOf('d') >= 0)\n {\n start = val.startOfDay().value;\n end = val.endOfDay().value;\n }\n //week\n else if(fullFormat.indexOf('w') >= 0)\n {\n start = val.startOfWeek().value;\n end = val.endOfWeek().value;\n }\n //month\n else if(fullFormat.indexOf('M') >= 0)\n {\n start = val.startOfMonth().value;\n end = val.endOfMonth().value;\n }\n //year\n else if(fullFormat.indexOf('Y') >= 0 || fullFormat.indexOf('y') >= 0)\n {\n start = val.startOfYear().value;\n end = val.endOfYear().value;\n }\n\n return {\n from: start,\n to: end\n };\n }\n}"]}
|