@anglr/datetime 5.0.0-beta.20221019112435 → 5.0.0-beta.20221020044622
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 +16 -13
- package/es2015/src/modules/dateTime/directives/dateTime/dateTime.directive.js +221 -0
- package/es2015/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -0
- package/es2015/src/modules/dateTime/directives/dateTimeBase.js +25 -41
- package/es2015/src/modules/dateTime/directives/dateTimeBase.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +16 -17
- package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +10 -13
- package/es2015/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +9 -11
- package/es2015/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +6 -8
- package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/index.js +1 -1
- package/es2015/src/modules/dateTime/directives/index.js.map +1 -1
- package/es2015/src/modules/dateTime/modules/dateTime.module.js +7 -3
- package/es2015/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +5 -22
- package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/dateTime/dateTime.directive.js +218 -0
- package/es2020/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -0
- package/es2020/src/modules/dateTime/directives/dateTimeBase.js +25 -41
- package/es2020/src/modules/dateTime/directives/dateTimeBase.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +16 -17
- package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +10 -13
- package/es2020/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +9 -11
- package/es2020/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +6 -8
- package/es2020/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/index.js +1 -1
- package/es2020/src/modules/dateTime/directives/index.js.map +1 -1
- package/es2020/src/modules/dateTime/modules/dateTime.module.js +7 -3
- package/es2020/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +5 -22
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts +120 -0
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -0
- package/src/modules/dateTime/directives/dateTimeBase.d.ts +19 -27
- package/src/modules/dateTime/directives/dateTimeBase.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts +3 -2
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts +4 -4
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts +4 -4
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts +2 -2
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/index.d.ts +1 -1
- package/src/modules/dateTime/directives/index.d.ts.map +1 -1
- package/src/modules/dateTime/modules/dateTime.module.d.ts +7 -6
- package/src/modules/dateTime/modules/dateTime.module.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +6 -8
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
- package/version.bak +1 -1
- package/es2015/src/modules/dateTime/directives/dateTimeRestrictedBase.js +0 -152
- package/es2015/src/modules/dateTime/directives/dateTimeRestrictedBase.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/dateTimeRestrictedBase.js +0 -149
- package/es2020/src/modules/dateTime/directives/dateTimeRestrictedBase.js.map +0 -1
- package/src/modules/dateTime/directives/dateTimeRestrictedBase.d.ts +0 -74
- package/src/modules/dateTime/directives/dateTimeRestrictedBase.d.ts.map +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { Directive, forwardRef, Inject } from '@angular/core';
|
|
2
2
|
import { NG_VALIDATORS } from '@angular/forms';
|
|
3
|
-
import { DATE_API
|
|
4
|
-
import { datetimeMaxValidator
|
|
5
|
-
import {
|
|
3
|
+
import { DATE_API } from '../../../../misc/tokens';
|
|
4
|
+
import { datetimeMaxValidator } from '../../../../misc/validators';
|
|
5
|
+
import { DateTimeBase } from '../dateTimeBase';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* Applies validator for date time max value
|
|
9
9
|
*/
|
|
10
|
-
export class DateTimeMaxValidatorDirective extends
|
|
10
|
+
export class DateTimeMaxValidatorDirective extends DateTimeBase {
|
|
11
11
|
//######################### constructor #########################
|
|
12
|
-
constructor(dateApi
|
|
13
|
-
super(
|
|
12
|
+
constructor(dateApi) {
|
|
13
|
+
super();
|
|
14
|
+
this.dateApi = dateApi;
|
|
14
15
|
//######################### private fields #########################
|
|
15
16
|
/**
|
|
16
17
|
* Function used for validations
|
|
17
18
|
*/
|
|
18
19
|
this._validator = () => null;
|
|
19
|
-
this._validator = datetimeValidator(dateApi, null, null);
|
|
20
20
|
}
|
|
21
21
|
//######################### public methods - implementation of OnInit #########################
|
|
22
22
|
/**
|
|
23
23
|
* Initialize component
|
|
24
24
|
*/
|
|
25
25
|
ngOnInit() {
|
|
26
|
-
this._validator = datetimeMaxValidator(this.dateApi, this.maxDateTime, this.valueFormat, this.customFormat);
|
|
26
|
+
this._validator = datetimeMaxValidator(this.dateApi, this.dateTimeData.maxDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);
|
|
27
27
|
}
|
|
28
28
|
//######################### public methods - implementation of Validator #########################
|
|
29
29
|
/**
|
|
@@ -39,10 +39,10 @@ export class DateTimeMaxValidatorDirective extends DateTimeRestrictedBase {
|
|
|
39
39
|
* @inheritdoc
|
|
40
40
|
*/
|
|
41
41
|
onMaxDateTimeChange() {
|
|
42
|
-
this._validator = datetimeMaxValidator(this.dateApi, this.maxDateTime, this.valueFormat, this.customFormat);
|
|
42
|
+
this._validator = datetimeMaxValidator(this.dateApi, this.dateTimeData.maxDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
DateTimeMaxValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimeMaxValidatorDirective, deps: [{ token: DATE_API }
|
|
45
|
+
DateTimeMaxValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimeMaxValidatorDirective, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive });
|
|
46
46
|
DateTimeMaxValidatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.6", type: DateTimeMaxValidatorDirective, selector: "[dateTime][maxDateTime][validate]", providers: [
|
|
47
47
|
{
|
|
48
48
|
provide: NG_VALIDATORS,
|
|
@@ -65,8 +65,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
65
65
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
66
66
|
type: Inject,
|
|
67
67
|
args: [DATE_API]
|
|
68
|
-
}] }, { type: undefined, decorators: [{
|
|
69
|
-
type: Inject,
|
|
70
|
-
args: [FORMAT_PROVIDER]
|
|
71
68
|
}] }]; } });
|
|
72
69
|
//# sourceMappingURL=dateTimeMaxValidator.directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeMaxValidator.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACtF,OAAO,EAAkB,aAAa,EAA2C,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"dateTimeMaxValidator.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACtF,OAAO,EAAkB,aAAa,EAA2C,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,6B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,GAAG,EAAE,8BAA8B,CAAC;4BAC5D,KAAK,EAAE,IAAI;yBACd;qBACJ;iBACJ;;0BAWgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, ExistingProvider, forwardRef, Inject, OnInit} from '@angular/core';\nimport {AbstractControl, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn} from '@angular/forms';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {datetimeMaxValidator} from '../../../../misc/validators';\nimport {DateApi} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n/**\n * Applies validator for date time max value\n */\n@Directive(\n{\n selector: '[dateTime][maxDateTime][validate]',\n providers:\n [\n <ExistingProvider>\n {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => DateTimeMaxValidatorDirective),\n multi: true\n },\n ],\n})\nexport class DateTimeMaxValidatorDirective<TDate = unknown> extends DateTimeBase<TDate> implements Validator, OnInit\n{\n //######################### private fields #########################\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn = () => null;\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,)\n {\n super();\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this._validator = datetimeMaxValidator(this.dateApi, this.dateTimeData.maxDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override onMaxDateTimeChange(): void\n {\n this._validator = datetimeMaxValidator(this.dateApi, this.dateTimeData.maxDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);\n }\n}"]}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Directive, forwardRef, Inject } from '@angular/core';
|
|
2
2
|
import { NG_VALIDATORS } from '@angular/forms';
|
|
3
|
-
import { DATE_API
|
|
3
|
+
import { DATE_API } from '../../../../misc/tokens';
|
|
4
4
|
import { datetimeMinValidator } from '../../../../misc/validators';
|
|
5
|
-
import {
|
|
5
|
+
import { DateTimeBase } from '../dateTimeBase';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* Applies validator for date time min value
|
|
9
9
|
*/
|
|
10
|
-
export class DateTimeMinValidatorDirective extends
|
|
10
|
+
export class DateTimeMinValidatorDirective extends DateTimeBase {
|
|
11
11
|
//######################### constructor #########################
|
|
12
|
-
constructor(dateApi
|
|
13
|
-
super(
|
|
12
|
+
constructor(dateApi) {
|
|
13
|
+
super();
|
|
14
|
+
this.dateApi = dateApi;
|
|
14
15
|
//######################### private fields #########################
|
|
15
16
|
/**
|
|
16
17
|
* Function used for validations
|
|
@@ -22,7 +23,7 @@ export class DateTimeMinValidatorDirective extends DateTimeRestrictedBase {
|
|
|
22
23
|
* Initialize component
|
|
23
24
|
*/
|
|
24
25
|
ngOnInit() {
|
|
25
|
-
this._validator = datetimeMinValidator(this.dateApi, this.minDateTime, this.valueFormat, this.customFormat);
|
|
26
|
+
this._validator = datetimeMinValidator(this.dateApi, this.dateTimeData.minDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);
|
|
26
27
|
}
|
|
27
28
|
//######################### public methods - implementation of Validator #########################
|
|
28
29
|
/**
|
|
@@ -38,10 +39,10 @@ export class DateTimeMinValidatorDirective extends DateTimeRestrictedBase {
|
|
|
38
39
|
* @inheritdoc
|
|
39
40
|
*/
|
|
40
41
|
onMinDateTimeChange() {
|
|
41
|
-
this._validator = datetimeMinValidator(this.dateApi, this.minDateTime, this.valueFormat, this.customFormat);
|
|
42
|
+
this._validator = datetimeMinValidator(this.dateApi, this.dateTimeData.minDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
DateTimeMinValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimeMinValidatorDirective, deps: [{ token: DATE_API }
|
|
45
|
+
DateTimeMinValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimeMinValidatorDirective, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive });
|
|
45
46
|
DateTimeMinValidatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.6", type: DateTimeMinValidatorDirective, selector: "[dateTime][minDateTime][validate]", providers: [
|
|
46
47
|
{
|
|
47
48
|
provide: NG_VALIDATORS,
|
|
@@ -64,8 +65,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
64
65
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
65
66
|
type: Inject,
|
|
66
67
|
args: [DATE_API]
|
|
67
|
-
}] }, { type: undefined, decorators: [{
|
|
68
|
-
type: Inject,
|
|
69
|
-
args: [FORMAT_PROVIDER]
|
|
70
68
|
}] }]; } });
|
|
71
69
|
//# sourceMappingURL=dateTimeMinValidator.directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeMinValidator.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACtF,OAAO,EAAkB,aAAa,EAA2C,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"dateTimeMinValidator.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAA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C;YAC5D,KAAK,EAAE,IAAI;SACd;KACJ;2FAEQ,6BAA6B;kBAbzC,SAAS;mBACV;oBACI,QAAQ,EAAE,mCAAmC;oBAC7C,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,aAAa;4BACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,8BAA8B,CAAC;4BAC5D,KAAK,EAAE,IAAI;yBACd;qBACJ;iBACJ;;0BAWgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, ExistingProvider, forwardRef, Inject, OnInit} from '@angular/core';\nimport {AbstractControl, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn} from '@angular/forms';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {datetimeMinValidator} from '../../../../misc/validators';\nimport {DateApi} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n/**\n * Applies validator for date time min value\n */\n@Directive(\n{\n selector: '[dateTime][minDateTime][validate]',\n providers:\n [\n <ExistingProvider>\n {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => DateTimeMinValidatorDirective),\n multi: true\n },\n ],\n})\nexport class DateTimeMinValidatorDirective<TDate = unknown> extends DateTimeBase<TDate> implements Validator, OnInit\n{\n //######################### private fields #########################\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn = () => null;\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,)\n {\n super();\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this._validator = datetimeMinValidator(this.dateApi, this.dateTimeData.minDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override onMinDateTimeChange(): void\n {\n this._validator = datetimeMinValidator(this.dateApi, this.dateTimeData.minDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);\n }\n}"]}
|
package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Directive, forwardRef, Inject } from '@angular/core';
|
|
2
2
|
import { NG_VALIDATORS } from '@angular/forms';
|
|
3
|
-
import { DATE_API
|
|
3
|
+
import { DATE_API } from '../../../../misc/tokens';
|
|
4
4
|
import { datetimeValidator } from '../../../../misc/validators';
|
|
5
5
|
import { DateTimeBase } from '../dateTimeBase';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
@@ -9,8 +9,9 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
*/
|
|
10
10
|
export class DateTimeValidatorDirective extends DateTimeBase {
|
|
11
11
|
//######################### constructor #########################
|
|
12
|
-
constructor(dateApi
|
|
13
|
-
super(
|
|
12
|
+
constructor(dateApi) {
|
|
13
|
+
super();
|
|
14
|
+
this.dateApi = dateApi;
|
|
14
15
|
//######################### private fields #########################
|
|
15
16
|
/**
|
|
16
17
|
* Function used for validations
|
|
@@ -22,7 +23,7 @@ export class DateTimeValidatorDirective extends DateTimeBase {
|
|
|
22
23
|
* Initialize component
|
|
23
24
|
*/
|
|
24
25
|
ngOnInit() {
|
|
25
|
-
this._validator = datetimeValidator(this.dateApi, this.valueFormat, this.customFormat);
|
|
26
|
+
this._validator = datetimeValidator(this.dateApi, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);
|
|
26
27
|
}
|
|
27
28
|
//######################### public methods - implementation of Validator #########################
|
|
28
29
|
/**
|
|
@@ -34,7 +35,7 @@ export class DateTimeValidatorDirective extends DateTimeBase {
|
|
|
34
35
|
return this._validator(control);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
DateTimeValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimeValidatorDirective, deps: [{ token: DATE_API }
|
|
38
|
+
DateTimeValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimeValidatorDirective, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive });
|
|
38
39
|
DateTimeValidatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.6", type: DateTimeValidatorDirective, selector: "[dateTime][validate]", providers: [
|
|
39
40
|
{
|
|
40
41
|
provide: NG_VALIDATORS,
|
|
@@ -57,8 +58,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
57
58
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
58
59
|
type: Inject,
|
|
59
60
|
args: [DATE_API]
|
|
60
|
-
}] }, { type: undefined, decorators: [{
|
|
61
|
-
type: Inject,
|
|
62
|
-
args: [FORMAT_PROVIDER]
|
|
63
61
|
}] }]; } });
|
|
64
62
|
//# sourceMappingURL=dateTimeValidator.directive.js.map
|
package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeValidator.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACtF,OAAO,EAAkB,aAAa,EAA2C,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"dateTimeValidator.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACtF,OAAO,EA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from '@angular/core';\nimport {AbstractControl, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn} from '@angular/forms';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {datetimeValidator} from '../../../../misc/validators';\nimport {DateApi} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n/**\n * Applies validator for date time\n */\n@Directive(\n{\n selector: '[dateTime][validate]',\n providers:\n [\n <ExistingProvider>\n {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => DateTimeValidatorDirective),\n multi: true\n },\n ],\n})\nexport class DateTimeValidatorDirective<TDate = unknown> extends DateTimeBase<TDate> implements Validator, OnInit\n{\n //######################### private fields #########################\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn = () => null;\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,)\n {\n super();\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this._validator = datetimeValidator(this.dateApi, this.dateTimeData.valueFormat, this.dateTimeData.customFormat);\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n}"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export * from './dateTime/dateTime.directive';
|
|
1
2
|
export * from './dateTimeBase';
|
|
2
3
|
export * from './dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive';
|
|
3
4
|
export * from './dateTimeInput/dateTimeInput.directive';
|
|
4
5
|
export * from './dateTimeMaxValidator/dateTimeMaxValidator.directive';
|
|
5
6
|
export * from './dateTimeMinValidator/dateTimeMinValidator.directive';
|
|
6
|
-
export * from './dateTimeRestrictedBase';
|
|
7
7
|
export * from './dateTimeValidator/dateTimeValidator.directive';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/dateTime/directives/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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/dateTime/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uEAAuE,CAAC;AACtF,cAAc,yCAAyC,CAAC;AACxD,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC","sourcesContent":["export * from './dateTime/dateTime.directive';\nexport * from './dateTimeBase';\nexport * from './dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive';\nexport * from './dateTimeInput/dateTimeInput.directive';\nexport * from './dateTimeMaxValidator/dateTimeMaxValidator.directive';\nexport * from './dateTimeMinValidator/dateTimeMinValidator.directive';\nexport * from './dateTimeValidator/dateTimeValidator.directive';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
|
-
import { DateTimeControlValueAccessorDirective, DateTimeInputDirective, DateTimeMaxValidatorDirective, DateTimeMinValidatorDirective, DateTimeValidatorDirective } from '../directives';
|
|
2
|
+
import { DateTimeControlValueAccessorDirective, DateTimeDirective, DateTimeInputDirective, DateTimeMaxValidatorDirective, DateTimeMinValidatorDirective, DateTimeValidatorDirective } from '../directives';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
5
5
|
* Module for basic date time directives, components, pipes
|
|
@@ -7,11 +7,13 @@ import * as i0 from "@angular/core";
|
|
|
7
7
|
export class DateTimeModule {
|
|
8
8
|
}
|
|
9
9
|
DateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
10
|
-
DateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.6", ngImport: i0, type: DateTimeModule, declarations: [
|
|
10
|
+
DateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.6", ngImport: i0, type: DateTimeModule, declarations: [DateTimeDirective,
|
|
11
|
+
DateTimeControlValueAccessorDirective,
|
|
11
12
|
DateTimeInputDirective,
|
|
12
13
|
DateTimeMaxValidatorDirective,
|
|
13
14
|
DateTimeMinValidatorDirective,
|
|
14
|
-
DateTimeValidatorDirective], exports: [
|
|
15
|
+
DateTimeValidatorDirective], exports: [DateTimeDirective,
|
|
16
|
+
DateTimeControlValueAccessorDirective,
|
|
15
17
|
DateTimeInputDirective,
|
|
16
18
|
DateTimeMaxValidatorDirective,
|
|
17
19
|
DateTimeMinValidatorDirective,
|
|
@@ -21,6 +23,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
21
23
|
type: NgModule,
|
|
22
24
|
args: [{
|
|
23
25
|
declarations: [
|
|
26
|
+
DateTimeDirective,
|
|
24
27
|
DateTimeControlValueAccessorDirective,
|
|
25
28
|
DateTimeInputDirective,
|
|
26
29
|
DateTimeMaxValidatorDirective,
|
|
@@ -28,6 +31,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
28
31
|
DateTimeValidatorDirective,
|
|
29
32
|
],
|
|
30
33
|
exports: [
|
|
34
|
+
DateTimeDirective,
|
|
31
35
|
DateTimeControlValueAccessorDirective,
|
|
32
36
|
DateTimeInputDirective,
|
|
33
37
|
DateTimeMaxValidatorDirective,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTime.module.js","sourceRoot":"","sources":["../../../../../src/modules/dateTime/modules/dateTime.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,qCAAqC,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,0BAA0B,EAAC,MAAM,eAAe,CAAC;;
|
|
1
|
+
{"version":3,"file":"dateTime.module.js","sourceRoot":"","sources":["../../../../../src/modules/dateTime/modules/dateTime.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,qCAAqC,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,0BAA0B,EAAC,MAAM,eAAe,CAAC;;AAEzM;;GAEG;AAsBH,MAAM,OAAO,cAAc;;2GAAd,cAAc;4GAAd,cAAc,iBAjBnB,iBAAiB;QACjB,qCAAqC;QACrC,sBAAsB;QACtB,6BAA6B;QAC7B,6BAA6B;QAC7B,0BAA0B,aAI1B,iBAAiB;QACjB,qCAAqC;QACrC,sBAAsB;QACtB,6BAA6B;QAC7B,6BAA6B;QAC7B,0BAA0B;4GAGrB,cAAc;2FAAd,cAAc;kBArB1B,QAAQ;mBACT;oBACI,YAAY,EACZ;wBACI,iBAAiB;wBACjB,qCAAqC;wBACrC,sBAAsB;wBACtB,6BAA6B;wBAC7B,6BAA6B;wBAC7B,0BAA0B;qBAC7B;oBACD,OAAO,EACP;wBACI,iBAAiB;wBACjB,qCAAqC;wBACrC,sBAAsB;wBACtB,6BAA6B;wBAC7B,6BAA6B;wBAC7B,0BAA0B;qBAC7B;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {DateTimeControlValueAccessorDirective, DateTimeDirective, DateTimeInputDirective, DateTimeMaxValidatorDirective, DateTimeMinValidatorDirective, DateTimeValidatorDirective} from '../directives';\n\n/**\n * Module for basic date time directives, components, pipes\n */\n@NgModule(\n{\n declarations:\n [\n DateTimeDirective,\n DateTimeControlValueAccessorDirective,\n DateTimeInputDirective,\n DateTimeMaxValidatorDirective,\n DateTimeMinValidatorDirective,\n DateTimeValidatorDirective,\n ],\n exports:\n [\n DateTimeDirective,\n DateTimeControlValueAccessorDirective,\n DateTimeInputDirective,\n DateTimeMaxValidatorDirective,\n DateTimeMinValidatorDirective,\n DateTimeValidatorDirective,\n ],\n})\nexport class DateTimeModule\n{\n}"]}
|
package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js
CHANGED
|
@@ -4,10 +4,9 @@ import { extend, isBlank, nameof } from '@jscrpt/common';
|
|
|
4
4
|
import { Subscription } from 'rxjs';
|
|
5
5
|
import { DATE_TIME_PICKER_OPTIONS } from '../../misc/tokens';
|
|
6
6
|
import { DayPickerSAComponent } from '../dayPicker/dayPicker.component';
|
|
7
|
-
import { DATE_API, FORMAT_PROVIDER } from '../../../../misc/tokens';
|
|
8
7
|
import { formatDateTime, parseDateTime } from '../../../../misc/utils';
|
|
9
8
|
import { DateTimeValueFormat } from '../../../../misc/enums';
|
|
10
|
-
import {
|
|
9
|
+
import { DateTimeDirective } from '../../../dateTime/directives';
|
|
11
10
|
import * as i0 from "@angular/core";
|
|
12
11
|
/**
|
|
13
12
|
* Text to be displayed when configuration, options are corrupted
|
|
@@ -25,10 +24,10 @@ const defaultOptions = {
|
|
|
25
24
|
/**
|
|
26
25
|
* Component used for displaying date time picker
|
|
27
26
|
*/
|
|
28
|
-
export class DateTimePickerComponent extends
|
|
27
|
+
export class DateTimePickerComponent extends DateTimeDirective {
|
|
29
28
|
//######################### constructor #########################
|
|
30
|
-
constructor(position,
|
|
31
|
-
super(
|
|
29
|
+
constructor(position, options) {
|
|
30
|
+
super();
|
|
32
31
|
this.position = position;
|
|
33
32
|
//######################### public properties - outputs #########################
|
|
34
33
|
/**
|
|
@@ -45,16 +44,6 @@ export class DateTimePickerComponent extends DateTimeRestrictedBase {
|
|
|
45
44
|
throw new Error(CORRUPTED_CONFIG_TEXT);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
//######################### public properties - inputs #########################
|
|
49
|
-
/**
|
|
50
|
-
* @inheritdoc
|
|
51
|
-
*/
|
|
52
|
-
get value() {
|
|
53
|
-
return this.ɵValue;
|
|
54
|
-
}
|
|
55
|
-
set value(value) {
|
|
56
|
-
this.ɵValue = value;
|
|
57
|
-
}
|
|
58
47
|
/**
|
|
59
48
|
* Options for date time picker
|
|
60
49
|
*/
|
|
@@ -163,7 +152,7 @@ export class DateTimePickerComponent extends DateTimeRestrictedBase {
|
|
|
163
152
|
return this.displayedPeriodType;
|
|
164
153
|
}
|
|
165
154
|
}
|
|
166
|
-
DateTimePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerComponent, deps: [{ token: POSITION }, { token:
|
|
155
|
+
DateTimePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerComponent, deps: [{ token: POSITION }, { token: DATE_TIME_PICKER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
167
156
|
DateTimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: DateTimePickerComponent, selector: "date-time-picker", inputs: { value: "value", options: "options" }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "pickerContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-container #container></ng-container>", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
168
157
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerComponent, decorators: [{
|
|
169
158
|
type: Component,
|
|
@@ -171,12 +160,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
171
160
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
172
161
|
type: Inject,
|
|
173
162
|
args: [POSITION]
|
|
174
|
-
}] }, { type: undefined, decorators: [{
|
|
175
|
-
type: Inject,
|
|
176
|
-
args: [DATE_API]
|
|
177
|
-
}] }, { type: undefined, decorators: [{
|
|
178
|
-
type: Inject,
|
|
179
|
-
args: [FORMAT_PROVIDER]
|
|
180
163
|
}] }, { type: undefined, decorators: [{
|
|
181
164
|
type: Inject,
|
|
182
165
|
args: [DATE_TIME_PICKER_OPTIONS]
|
package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,gBAAgB,EAAQ,YAAY,EAAE,MAAM,EAAE,KAAK,EAA4B,MAAM,EAAE,QAAQ,EAA0B,MAAM,eAAe,CAAC;AACtM,OAAO,EAAW,QAAQ,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kCAAkC,CAAC;AAItE,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,sBAAsB,EA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ACnC;QAED,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAErF,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;;oHA3OQ,uBAAuB,kBA+EZ,QAAQ,aACR,QAAQ,aACR,eAAe,aACf,wBAAwB;wGAlFnC,uBAAuB,0OAkCD,gBAAgB,uFC7EnD,0CAAwC;2FD2C3B,uBAAuB;kBANnC,SAAS;+BAEI,kBAAkB,mBAEX,uBAAuB,CAAC,MAAM;;0BAiFlC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,wBAAwB;;0BAAG,QAAQ;4CA/C7C,eAAe;sBADxB,SAAS;uBAAC,WAAW,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAC;gBAS1C,KAAK;sBADxB,KAAK;gBAcK,OAAO;sBADjB,KAAK;gBAqBU,WAAW;sBAD1B,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ViewChild, ViewContainerRef, Type, EventEmitter, Output, Input, OnChanges, SimpleChanges, Inject, Optional, OnDestroy, ComponentRef} from '@angular/core';\nimport {Position, POSITION} from '@anglr/common';\nimport {extend, isBlank, nameof} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInputValue, FormatProvider} from '../../../../interfaces';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {DATE_TIME_PICKER_OPTIONS} from '../../misc/tokens';\nimport {DayPickerSAComponent} from '../dayPicker/dayPicker.component';\nimport {DateTimePickerOptions} from './dateTimePicker.interface';\nimport {DateTimePicker} from '../../interfaces';\nimport {DateApi} from '../../../../services';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {formatDateTime, parseDateTime} from '../../../../misc/utils';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\nimport {DateTimeRestrictedBase} from '../../../dateTime/directives/dateTimeRestrictedBase';\n\n/**\n * Text to be displayed when configuration, options are corrupted\n */\nconst CORRUPTED_CONFIG_TEXT = 'DateTime: Corrupted configuration for DateTimePicker!';\n\n/**\n * Default options for date time picker\n */\nconst defaultOptions: DateTimePickerOptions = \n{\n defaultPeriod: 'day',\n periodsDefinition:\n {\n 'day': DayPickerSAComponent,\n },\n};\n\n/**\n * Component used for displaying date time picker\n */\n@Component(\n{\n selector: 'date-time-picker',\n templateUrl: 'dateTimePicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimePickerComponent<TDate = unknown> extends DateTimeRestrictedBase<TDate> implements DateTimeInputValue<TDate>, OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n \n /**\n * Subscription for changes in date time period picker\n */\n protected periodChangesSubscription: Subscription|undefined|null;\n\n /**\n * Options for date time picker\n */\n protected ɵOptions: DateTimePickerOptions<TDate>;\n\n /**\n * Currently displayed period type\n */\n protected displayedPeriodType: Type<DateTimePicker<TDate>>;\n\n /**\n * Name of period which is currently displayed\n */\n protected displayedPeriodName: string;\n\n /**\n * Instance of created date time period picker\n */\n protected component: ComponentRef<DateTimePicker<TDate>>|undefined|null;\n \n //######################### protected properties - children #########################\n\n /**\n * Container used for displaying pickers for specific date time part\n */\n @ViewChild('container', {read: ViewContainerRef, static: true})\n protected pickerContainer: ViewContainerRef|undefined|null;\n\n //######################### public properties - inputs #########################\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 this.ɵValue = value;\n }\n\n /**\n * Options for date time picker\n */\n @Input()\n public get options(): Partial<DateTimePickerOptions<TDate>>\n {\n return this.ɵOptions;\n }\n public set options(value: Partial<DateTimePickerOptions<TDate>>)\n {\n this.ɵOptions = extend(true, {}, defaultOptions, value);\n\n if(value?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = value.periodsDefinition;\n }\n }\n\n //######################### public properties - outputs #########################\n\n /**\n * @inheritdoc\n */\n @Output()\n public override valueChange: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(@Inject(POSITION) protected position: Position,\n @Inject(DATE_API) dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) formatProvider: FormatProvider,\n @Inject(DATE_TIME_PICKER_OPTIONS) @Optional() options?: DateTimePickerOptions<TDate>,)\n {\n super(dateApi, formatProvider);\n\n this.ɵOptions = extend(true, {}, defaultOptions, options);\n \n if(options?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = options.periodsDefinition;\n }\n\n this.displayedPeriodName = this.ɵOptions.defaultPeriod;\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n if(!this.displayedPeriodType)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<DateTimePickerComponent>('value') in changes)\n {\n //empty value show now\n if(isBlank(this.value))\n {\n const now = this.dateApi.now();\n\n this.showPicker(this.displayedPeriodType, now.value);\n\n return;\n }\n\n }\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.component?.destroy();\n this.component = null;\n\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows picker\n * @param type - Type of period that should be displayed\n * @param displayDate - Display date to be shown\n */\n protected showPicker(type: Type<DateTimePicker<TDate>>, displayDate: TDate): void\n {\n if(!this.pickerContainer)\n {\n return;\n }\n\n //create new component and destroy previous one\n if(!this.component || (this.component && type != this.displayedPeriodType))\n {\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = new Subscription();\n this.component?.destroy();\n this.component = this.pickerContainer.createComponent(type);\n\n this.periodChangesSubscription.add(this.component.instance.valueChange.subscribe(() =>\n {\n const component = this.component?.instance;\n\n if(!component)\n {\n return;\n }\n\n this.value = formatDateTime(component.value, DateTimeValueFormat.DateInstance, null);\n this.valueChange.emit();\n }));\n\n this.periodChangesSubscription.add(this.component.instance.scaleUp.subscribe(date => this.showPicker(this.getUpperType(), date)));\n this.periodChangesSubscription.add(this.component.instance.scaleDown.subscribe(date => this.showPicker(this.getLowerType(), date)));\n }\n\n const component = this.component.instance;\n\n component.canScaleDown = false,\n component.canScaleUp = false;\n component.display = displayDate;\n // component.options\n //TODO: maybe add support for format!\n component.value = parseDateTime(this.value, this.dateApi, null, null);\n }\n\n /**\n * Gets type that is above current period picker\n */\n protected getUpperType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index >= periods.length)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index + 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n\n /**\n * Gets type that is below current period picker\n */\n protected getLowerType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index <= 0)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index - 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n}","<ng-container #container></ng-container>"]}
|
|
1
|
+
{"version":3,"file":"dateTimePicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,gBAAgB,EAAQ,YAAY,EAAE,MAAM,EAAE,KAAK,EAA4B,MAAM,EAAE,QAAQ,EAA0B,MAAM,eAAe,CAAC;AACtM,OAAO,EAAW,QAAQ,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;;AAE/D;;GAEG;AACH,MAAM,qBAAqB,GAAG,uDAAuD,CAAC;AAEtF;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,aAAa,EAAE,KAAK;IACpB,iBAAiB,EACjB;QACI,KAAK,EAAE,oBAAoB;KAC9B;CACJ,CAAC;AAEF;;GAEG;AAOH,MAAM,OAAO,uBAAyC,SAAQ,iBAAwB;IAuElF,iEAAiE;IACjE,YAAwC,QAAkB,EACA,OAAsC;QAE5F,KAAK,EAAE,CAAC;QAH4B,aAAQ,GAAR,QAAQ,CAAU;QAT1D,iFAAiF;QAEjF;;WAEG;QAEI,gBAAW,GAAuB,IAAI,YAAY,EAAQ,CAAC;QAQ9D,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,EA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, Output, Input, OnChanges, SimpleChanges, Inject, Optional, OnDestroy, ComponentRef} from '@angular/core';\nimport {Position, POSITION} from '@anglr/common';\nimport {extend, isBlank, nameof} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInputValue} from '../../../../interfaces';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {DATE_TIME_PICKER_OPTIONS} from '../../misc/tokens';\nimport {DayPickerSAComponent} from '../dayPicker/dayPicker.component';\nimport {DateTimePickerOptions} from './dateTimePicker.interface';\nimport {DateTimePicker} from '../../interfaces';\nimport {formatDateTime, parseDateTime} from '../../../../misc/utils';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\nimport {DateTimeDirective} from '../../../dateTime/directives';\n\n/**\n * Text to be displayed when configuration, options are corrupted\n */\nconst CORRUPTED_CONFIG_TEXT = 'DateTime: Corrupted configuration for DateTimePicker!';\n\n/**\n * Default options for date time picker\n */\nconst defaultOptions: DateTimePickerOptions = \n{\n defaultPeriod: 'day',\n periodsDefinition:\n {\n 'day': DayPickerSAComponent,\n },\n};\n\n/**\n * Component used for displaying date time picker\n */\n@Component(\n{\n selector: 'date-time-picker',\n templateUrl: 'dateTimePicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimePickerComponent<TDate = unknown> extends DateTimeDirective<TDate> implements DateTimeInputValue<TDate>, OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n \n /**\n * Subscription for changes in date time period picker\n */\n protected periodChangesSubscription: Subscription|undefined|null;\n\n /**\n * Options for date time picker\n */\n protected ɵOptions: DateTimePickerOptions<TDate>;\n\n /**\n * Currently displayed period type\n */\n protected displayedPeriodType: Type<DateTimePicker<TDate>>;\n\n /**\n * Name of period which is currently displayed\n */\n protected displayedPeriodName: string;\n\n /**\n * Instance of created date time period picker\n */\n protected component: ComponentRef<DateTimePicker<TDate>>|undefined|null;\n \n //######################### protected properties - children #########################\n\n /**\n * Container used for displaying pickers for specific date time part\n */\n @ViewChild('container', {read: ViewContainerRef, static: true})\n protected pickerContainer: ViewContainerRef|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * @inheritdoc\n */\n @Input()\n public value: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Options for date time picker\n */\n @Input()\n public get options(): Partial<DateTimePickerOptions<TDate>>\n {\n return this.ɵOptions;\n }\n public set options(value: Partial<DateTimePickerOptions<TDate>>)\n {\n this.ɵOptions = extend(true, {}, defaultOptions, value);\n\n if(value?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = value.periodsDefinition;\n }\n }\n\n //######################### public properties - outputs #########################\n\n /**\n * @inheritdoc\n */\n @Output()\n public valueChange: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(@Inject(POSITION) protected position: Position,\n @Inject(DATE_TIME_PICKER_OPTIONS) @Optional() options?: DateTimePickerOptions<TDate>,)\n {\n super();\n\n this.ɵOptions = extend(true, {}, defaultOptions, options);\n \n if(options?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = options.periodsDefinition;\n }\n\n this.displayedPeriodName = this.ɵOptions.defaultPeriod;\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n if(!this.displayedPeriodType)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<DateTimePickerComponent>('value') in changes)\n {\n //empty value show now\n if(isBlank(this.value))\n {\n const now = this.dateApi.now();\n\n this.showPicker(this.displayedPeriodType, now.value);\n\n return;\n }\n\n }\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.component?.destroy();\n this.component = null;\n\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows picker\n * @param type - Type of period that should be displayed\n * @param displayDate - Display date to be shown\n */\n protected showPicker(type: Type<DateTimePicker<TDate>>, displayDate: TDate): void\n {\n if(!this.pickerContainer)\n {\n return;\n }\n\n //create new component and destroy previous one\n if(!this.component || (this.component && type != this.displayedPeriodType))\n {\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = new Subscription();\n this.component?.destroy();\n this.component = this.pickerContainer.createComponent(type);\n\n this.periodChangesSubscription.add(this.component.instance.valueChange.subscribe(() =>\n {\n const component = this.component?.instance;\n\n if(!component)\n {\n return;\n }\n\n this.value = formatDateTime(component.value, DateTimeValueFormat.DateInstance, null);\n this.valueChange.emit();\n }));\n\n this.periodChangesSubscription.add(this.component.instance.scaleUp.subscribe(date => this.showPicker(this.getUpperType(), date)));\n this.periodChangesSubscription.add(this.component.instance.scaleDown.subscribe(date => this.showPicker(this.getLowerType(), date)));\n }\n\n const component = this.component.instance;\n\n component.canScaleDown = false,\n component.canScaleUp = false;\n component.display = displayDate;\n // component.options\n //TODO: maybe add support for format!\n component.value = parseDateTime(this.value, this.dateApi, null, null);\n }\n\n /**\n * Gets type that is above current period picker\n */\n protected getUpperType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index >= periods.length)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index + 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n\n /**\n * Gets type that is below current period picker\n */\n protected getLowerType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index <= 0)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index - 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n}","<ng-container #container></ng-container>"]}
|