@anglr/datetime 9.0.0-beta.20241203113633 → 9.0.0-beta.20250123141536
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 +7 -5
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js +3 -3
- package/es2022/moment/src/services/momentDateApi.service.js +3 -3
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js +3 -4
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js.map +1 -1
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js +3 -4
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +3 -4
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +3 -4
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js +3 -4
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js +3 -4
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js +3 -4
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/withNow/withNow.directive.js +3 -4
- package/es2022/src/directives/withNow/withNow.directive.js.map +1 -1
- package/es2022/src/directives/withTime/withTime.directive.js +7 -8
- package/es2022/src/directives/withTime/withTime.directive.js.map +1 -1
- package/es2022/src/directives/withToday/withToday.directive.js +3 -4
- package/es2022/src/directives/withToday/withToday.directive.js.map +1 -1
- package/es2022/src/index.js +1 -2
- package/es2022/src/index.js.map +1 -1
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js +4 -4
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +1 -1
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js +3 -4
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +1 -1
- package/es2022/src/modules/calendar/modules/monthCalendar.module.js +4 -4
- package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js +3 -3
- package/es2022/src/modules/{datePipes.module.js → datePipes/datePipes.module.js} +15 -8
- package/es2022/src/modules/datePipes/datePipes.module.js.map +1 -0
- package/es2022/src/modules/datePipes/index.js +2 -0
- package/es2022/src/modules/datePipes/index.js.map +1 -0
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js +3 -4
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeBase.js +3 -3
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js +3 -4
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +3 -4
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +5 -6
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +5 -6
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +5 -6
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/modules/dateTime.module.js +4 -4
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +11 -10
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +6 -6
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +6 -6
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +8 -9
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +5 -5
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +5 -5
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js +3 -4
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +3 -4
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js +4 -4
- package/es2022/src/modules/index.js +1 -1
- package/es2022/src/modules/index.js.map +1 -1
- package/es2022/src/pipes/{dateConvert.pipe.js → dateConvert/dateConvert.pipe.js} +5 -5
- package/es2022/src/pipes/dateConvert/dateConvert.pipe.js.map +1 -0
- package/es2022/src/pipes/{dateFormat.pipe.js → dateFormat/dateFormat.pipe.js} +5 -5
- package/es2022/src/pipes/dateFormat/dateFormat.pipe.js.map +1 -0
- package/es2022/src/pipes/index.js +5 -0
- package/es2022/src/pipes/index.js.map +1 -0
- package/es2022/src/pipes/isAfter/isAfter.pipe.js +38 -0
- package/es2022/src/pipes/isAfter/isAfter.pipe.js.map +1 -0
- package/es2022/src/pipes/isBefore/isBefore.pipe.js +38 -0
- package/es2022/src/pipes/isBefore/isBefore.pipe.js.map +1 -0
- package/es2022/src/services/datePositionParser/datePositionParser.service.js +3 -3
- package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js +3 -3
- package/es2022/src/services/dateValueProvider/dateValueProvider.service.js +3 -3
- package/package.json +35 -29
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts.map +1 -1
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts.map +1 -1
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/withNow/withNow.directive.d.ts.map +1 -1
- package/src/directives/withTime/withTime.directive.d.ts.map +1 -1
- package/src/directives/withToday/withToday.directive.d.ts.map +1 -1
- package/src/index.d.ts +1 -2
- package/src/index.d.ts.map +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts.map +1 -1
- package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts.map +1 -1
- package/src/modules/datePipes/datePipes.module.d.ts +14 -0
- package/src/modules/datePipes/datePipes.module.d.ts.map +1 -0
- package/src/modules/datePipes/index.d.ts +2 -0
- package/src/modules/datePipes/index.d.ts.map +1 -0
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeBase.d.ts +1 -1
- package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts +0 -1
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts.map +1 -1
- package/src/modules/index.d.ts +1 -1
- package/src/modules/index.d.ts.map +1 -1
- package/src/pipes/{dateConvert.pipe.d.ts → dateConvert/dateConvert.pipe.d.ts} +1 -1
- package/src/pipes/dateConvert/dateConvert.pipe.d.ts.map +1 -0
- package/src/pipes/{dateFormat.pipe.d.ts → dateFormat/dateFormat.pipe.d.ts} +2 -2
- package/src/pipes/dateFormat/dateFormat.pipe.d.ts.map +1 -0
- package/src/pipes/index.d.ts +5 -0
- package/src/pipes/index.d.ts.map +1 -0
- package/src/pipes/isAfter/isAfter.pipe.d.ts +19 -0
- package/src/pipes/isAfter/isAfter.pipe.d.ts.map +1 -0
- package/src/pipes/isBefore/isBefore.pipe.d.ts +19 -0
- package/src/pipes/isBefore/isBefore.pipe.d.ts.map +1 -0
- package/version.bak +1 -1
- package/es2022/src/modules/datePipes.module.js.map +0 -1
- package/es2022/src/pipes/dateConvert.pipe.js.map +0 -1
- package/es2022/src/pipes/dateFormat.pipe.js.map +0 -1
- package/lerna.json +0 -4
- package/src/modules/datePipes.module.d.ts +0 -12
- package/src/modules/datePipes.module.d.ts.map +0 -1
- package/src/pipes/dateConvert.pipe.d.ts.map +0 -1
- package/src/pipes/dateFormat.pipe.d.ts.map +0 -1
|
@@ -41,16 +41,16 @@ export class DateTimeMinValidatorDirective extends DateTimeBase {
|
|
|
41
41
|
onMinDateTimeChange() {
|
|
42
42
|
this._validator = datetimeMinValidator(this.dateApi, this.dateTimeData.minDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);
|
|
43
43
|
}
|
|
44
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
45
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeMinValidatorDirective, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
45
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: DateTimeMinValidatorDirective, isStandalone: true, selector: "[dateTime][minDateTime][validate]", providers: [
|
|
46
46
|
{
|
|
47
47
|
provide: NG_VALIDATORS,
|
|
48
48
|
useExisting: forwardRef(() => DateTimeMinValidatorDirective),
|
|
49
|
-
multi: true
|
|
49
|
+
multi: true,
|
|
50
50
|
},
|
|
51
51
|
], usesInheritance: true, ngImport: i0 }); }
|
|
52
52
|
}
|
|
53
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeMinValidatorDirective, decorators: [{
|
|
54
54
|
type: Directive,
|
|
55
55
|
args: [{
|
|
56
56
|
selector: '[dateTime][minDateTime][validate]',
|
|
@@ -58,10 +58,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
58
58
|
{
|
|
59
59
|
provide: NG_VALIDATORS,
|
|
60
60
|
useExisting: forwardRef(() => DateTimeMinValidatorDirective),
|
|
61
|
-
multi: true
|
|
61
|
+
multi: true,
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
|
-
standalone: true,
|
|
65
64
|
}]
|
|
66
65
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
67
66
|
type: Inject,
|
|
@@ -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;AAExG,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;
|
|
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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AC,GAAG,EAAE,CAAC,6BAA6B,CAAC;gBAC5D,KAAK,EAAE,IAAI;aACd;SACJ;;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, this.dateTimeData.dataFormat);\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, this.dateTimeData.dataFormat);\n }\n}\n"]}
|
package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js
CHANGED
|
@@ -34,16 +34,16 @@ export class DateTimeValidatorDirective extends DateTimeBase {
|
|
|
34
34
|
validate(control) {
|
|
35
35
|
return this._validator(control);
|
|
36
36
|
}
|
|
37
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
38
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
37
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeValidatorDirective, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
38
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: DateTimeValidatorDirective, isStandalone: true, selector: "[dateTime][validate]", providers: [
|
|
39
39
|
{
|
|
40
40
|
provide: NG_VALIDATORS,
|
|
41
41
|
useExisting: forwardRef(() => DateTimeValidatorDirective),
|
|
42
|
-
multi: true
|
|
42
|
+
multi: true,
|
|
43
43
|
},
|
|
44
44
|
], usesInheritance: true, ngImport: i0 }); }
|
|
45
45
|
}
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeValidatorDirective, decorators: [{
|
|
47
47
|
type: Directive,
|
|
48
48
|
args: [{
|
|
49
49
|
selector: '[dateTime][validate]',
|
|
@@ -51,10 +51,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
51
51
|
{
|
|
52
52
|
provide: NG_VALIDATORS,
|
|
53
53
|
useExisting: forwardRef(() => DateTimeValidatorDirective),
|
|
54
|
-
multi: true
|
|
54
|
+
multi: true,
|
|
55
55
|
},
|
|
56
56
|
],
|
|
57
|
-
standalone: true,
|
|
58
57
|
}]
|
|
59
58
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
60
59
|
type: Inject,
|
package/es2022/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;AAExG,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;
|
|
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;AAExG,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;AAcH,MAAM,OAAO,0BAA4C,SAAQ,YAAmB;IAShF,iEAAiE;IACjE,YAAwC,OAAuB;QAE3D,KAAK,EAAE,CAAC;QAF4B,YAAO,GAAP,OAAO,CAAgB;QAR/D,oEAAoE;QAEpE;;WAEG;QACK,eAAU,GAAgB,GAAG,EAAE,CAAC,IAAI,CAAC;IAM7C,CAAC;IAED,+FAA+F;IAE/F;;OAEG;IACI,QAAQ;QAEX,IAAI,CAAC,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACnJ,CAAC;IAED,kGAAkG;IAElG;;;;OAIG;IACI,QAAQ,CAAC,OAAwB;QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;8GAnCQ,0BAA0B,kBAUf,QAAQ;kGAVnB,0BAA0B,mEATnC;YAEI;gBACI,OAAO,EAAE,aAAa;gBACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC;gBACzD,KAAK,EAAE,IAAI;aACd;SACJ;;2FAEQ,0BAA0B;kBAbtC,SAAS;mBACV;oBACI,QAAQ,EAAE,sBAAsB;oBAChC,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,aAAa;4BACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,2BAA2B,CAAC;4BACzD,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 {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, this.dateTimeData.dataFormat);\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"]}
|
|
@@ -5,8 +5,8 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
* Module for basic date time directives, components, pipes
|
|
6
6
|
*/
|
|
7
7
|
export class DateTimeModule {
|
|
8
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
9
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
8
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
9
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0", ngImport: i0, type: DateTimeModule, imports: [DateTimeDirective,
|
|
10
10
|
DateTimeControlValueAccessorDirective,
|
|
11
11
|
DateTimeInputDirective,
|
|
12
12
|
DateTimeMaxValidatorDirective,
|
|
@@ -17,9 +17,9 @@ export class DateTimeModule {
|
|
|
17
17
|
DateTimeMaxValidatorDirective,
|
|
18
18
|
DateTimeMinValidatorDirective,
|
|
19
19
|
DateTimeValidatorDirective] }); }
|
|
20
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
20
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeModule }); }
|
|
21
21
|
}
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimeModule, decorators: [{
|
|
23
23
|
type: NgModule,
|
|
24
24
|
args: [{
|
|
25
25
|
imports: [
|
package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, ChangeDetectionStrategy, ViewChild, ViewContainerRef, EventEmitter, Output, Input, Inject, Optional } from '@angular/core';
|
|
2
2
|
import { POSITION } from '@anglr/common';
|
|
3
|
-
import {
|
|
3
|
+
import { isBlank, nameof } from '@jscrpt/common';
|
|
4
|
+
import { extend } from '@jscrpt/common/extend';
|
|
4
5
|
import { Subscription } from 'rxjs';
|
|
5
6
|
import { DATE_TIME_PICKER_OPTIONS } from '../../misc/tokens';
|
|
6
7
|
import { DayPickerComponent } from '../dayPicker/dayPicker.component';
|
|
@@ -23,9 +24,9 @@ const CORRUPTED_CONFIG_TEXT = 'DateTime: Corrupted configuration for DateTimePic
|
|
|
23
24
|
const defaultOptions = {
|
|
24
25
|
defaultPeriod: 'day',
|
|
25
26
|
periodsDefinition: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
day: DayPickerComponent,
|
|
28
|
+
month: MonthPickerComponent,
|
|
29
|
+
year: YearPickerComponent,
|
|
29
30
|
},
|
|
30
31
|
};
|
|
31
32
|
/**
|
|
@@ -172,8 +173,8 @@ export class DateTimePickerComponent extends DateTimeDirective {
|
|
|
172
173
|
}
|
|
173
174
|
const component = this.component.instance;
|
|
174
175
|
component.ranged = this.valueFormat === DateTimeValueFormat.RangeOfDateInstances;
|
|
175
|
-
component.canScaleDown = this.canScaleDown()
|
|
176
|
-
|
|
176
|
+
component.canScaleDown = this.canScaleDown();
|
|
177
|
+
component.canScaleUp = this.canScaleUp();
|
|
177
178
|
component.display = displayDate;
|
|
178
179
|
component.maxDate = this.maxDateTime;
|
|
179
180
|
component.minDate = this.minDateTime;
|
|
@@ -247,12 +248,12 @@ export class DateTimePickerComponent extends DateTimeDirective {
|
|
|
247
248
|
this.displayedPeriodName = this.ɵOptions.defaultPeriod;
|
|
248
249
|
this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];
|
|
249
250
|
}
|
|
250
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
251
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
251
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimePickerComponent, deps: [{ token: POSITION }, { token: i1.DateValueProvider }, { token: DATE_TIME_PICKER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
252
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: DateTimePickerComponent, isStandalone: true, selector: "date-time-picker", inputs: { value: "value", options: "options" }, outputs: { valueChange: "valueChange", valueSet: "valueSet" }, viewQueries: [{ propertyName: "pickerContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-container #container/>", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
252
253
|
}
|
|
253
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DateTimePickerComponent, decorators: [{
|
|
254
255
|
type: Component,
|
|
255
|
-
args: [{ selector: 'date-time-picker',
|
|
256
|
+
args: [{ selector: 'date-time-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container #container/>" }]
|
|
256
257
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
257
258
|
type: Inject,
|
|
258
259
|
args: [POSITION]
|
package/es2022/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,EAAkC,MAAM,eAAe,CAAC;AAC9M,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,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAE1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAA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AI,mBACC,uBAAuB,CAAC,MAAM;;0BAiGlC,MAAM;2BAAC,QAAQ;;0BAEf,MAAM;2BAAC,wBAAwB;;0BAAG,QAAQ;yCApD7C,eAAe;sBADxB,SAAS;uBAAC,WAAW,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAC;gBASnD,KAAK;sBADf,KAAK;gBAiBK,OAAO;sBADjB,KAAK;gBAkBC,WAAW;sBADjB,MAAM;gBAOA,QAAQ;sBADd,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ViewChild, ViewContainerRef, Type, EventEmitter, Output, Input, OnChanges, SimpleChanges, Inject, Optional, OnDestroy, ComponentRef, OnInit} 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, DateTimeObjectValue} from '../../../../misc/types';\nimport {DATE_TIME_PICKER_OPTIONS} from '../../misc/tokens';\nimport {DayPickerComponent} from '../dayPicker/dayPicker.component';\nimport {MonthPickerComponent} from '../monthPicker/monthPicker.component';\nimport {DateTimePickerOptions} from './dateTimePicker.interface';\nimport {YearPickerComponent} from '../yearPicker/yearPicker.component';\nimport {DateTimePicker} from '../../interfaces';\nimport {formatDateTime, getInternalValue} from '../../../../misc/utils';\nimport {DateTimeDirective} from '../../../dateTime/directives';\nimport {DateValueProvider} from '../../../../services';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\n\n//TODO: use mixin for set internal\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': DayPickerComponent,\n 'month': MonthPickerComponent,\n 'year': YearPickerComponent,\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 standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimePickerComponent<TDate = unknown> extends DateTimeDirective<TDate> implements DateTimeInputValue<TDate>, OnInit, OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Current value of date time, could be string, timestamp, Date, TDate object, or ranged DateTimeValue\n */\n protected ɵValue: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\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 get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.valueFormat, this.customFormat, this.dataFormat);\n this.valueSet.next();\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 this.setOptions(value);\n }\n\n //######################### public properties - outputs #########################\n\n /**\n * @inheritdoc\n */\n @Output()\n public valueChange: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * @inheritdoc\n */\n @Output()\n public valueSet: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(@Inject(POSITION) protected position: Position,\n protected valueProvider: DateValueProvider<TDate>,\n @Inject(DATE_TIME_PICKER_OPTIONS) @Optional() options?: Partial<DateTimePickerOptions<TDate>>,)\n {\n super();\n\n this.ɵOptions = extend(true, {}, defaultOptions, options);\n \n this.setOptions(options);\n\n if(!this.displayedPeriodType)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\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 else\n {\n const val = (Array.isArray(this.internalValue) ? this.internalValue[0] : this.internalValue) ?? this.dateApi.now();\n\n this.showPicker(this.displayedPeriodType, val.isValid() ? val.value : this.dateApi.now().value);\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(!this.component)\n {\n return;\n }\n\n const component = this.component.instance;\n let invalidate: boolean = false;\n\n if(nameof<DateTimePickerComponent>('maxDateTime') in changes)\n {\n component.maxDate = this.maxDateTime;\n invalidate = true;\n }\n\n if(nameof<DateTimePickerComponent>('minDateTime') in changes)\n {\n component.minDate = this.minDateTime;\n invalidate = true;\n }\n\n if(nameof<DateTimePickerComponent>('value') in changes)\n {\n const val = (Array.isArray(this.internalValue) ? this.internalValue[0] : this.internalValue) ?? this.dateApi.now();\n\n component.display = val.isValid() ? val.value : this.dateApi.now().value;\n component.value = this.internalValue;\n invalidate = true;\n }\n\n if(this.component && invalidate)\n {\n this.component.instance.invalidateVisuals();\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 * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null): void\n {\n this.internalValue = getInternalValue(value, this.dateApi, this, this.valueProvider);\n }\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.displayedPeriodType = type;\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 if(!Array.isArray(component.value))\n {\n this.setInternalValue(component.value?.value);\n }\n else\n {\n //TODO: handle ranges\n }\n\n this.value = formatDateTime(this.internalValue, this.valueFormat, this.customFormat, this.dataFormat);\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.ranged = this.valueFormat === DateTimeValueFormat.RangeOfDateInstances;\n component.canScaleDown = this.canScaleDown(),\n component.canScaleUp = this.canScaleUp();\n component.display = displayDate;\n component.maxDate = this.maxDateTime;\n component.minDate = this.minDateTime;\n component.value = this.internalValue;\n component.invalidateVisuals();\n }\n\n /**\n * Gets indication whether current period can be scaled down\n * @param periods - Array of defined period names\n * @param index - Index of displayed period\n */\n protected canScaleDown(periods?: string[], index?: number): boolean\n {\n periods ??= Object.keys(this.ɵOptions.periodsDefinition);\n 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 false;\n }\n\n return true;\n }\n\n /**\n * Gets indication whether current period can be scaled up\n * @param periods - Array of defined period names\n * @param index - Index of displayed period\n */\n protected canScaleUp(periods?: string[], index?: number): boolean\n {\n periods ??= Object.keys(this.ɵOptions.periodsDefinition);\n index ??= periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index + 1 >= periods.length)\n {\n return false;\n }\n\n return true;\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(!this.canScaleUp(periods, index))\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index + 1];\n\n return this.ɵOptions.periodsDefinition[this.displayedPeriodName];\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(!this.canScaleDown(periods, index))\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index - 1];\n\n return this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n }\n\n /**\n * Sets options and use them to set parameters of component\n * @param options - Options to be set\n */\n protected setOptions(options: Partial<DateTimePickerOptions<TDate>> | undefined): void\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}","<ng-container #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,EAAkC,MAAM,eAAe,CAAC;AAC9M,OAAO,EAAW,QAAQ,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAE1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;;;AAE3D,kCAAkC;AAElC;;GAEG;AACH,MAAM,qBAAqB,GAAG,uDAAuD,CAAC;AAEtF;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,aAAa,EAAE,KAAK;IACpB,iBAAiB,EACjB;QACI,GAAG,EAAE,kBAAkB;QACvB,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,mBAAmB;KAC5B;CACJ,CAAC;AAEF;;GA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ter, Output, Input, OnChanges, SimpleChanges, Inject, Optional, OnDestroy, ComponentRef, OnInit} from '@angular/core';\nimport {Position, POSITION} from '@anglr/common';\nimport {isBlank, nameof} from '@jscrpt/common';\nimport {extend} from '@jscrpt/common/extend';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInputValue} from '../../../../interfaces';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from '../../../../misc/types';\nimport {DATE_TIME_PICKER_OPTIONS} from '../../misc/tokens';\nimport {DayPickerComponent} from '../dayPicker/dayPicker.component';\nimport {MonthPickerComponent} from '../monthPicker/monthPicker.component';\nimport {DateTimePickerOptions} from './dateTimePicker.interface';\nimport {YearPickerComponent} from '../yearPicker/yearPicker.component';\nimport {DateTimePicker} from '../../interfaces';\nimport {formatDateTime, getInternalValue} from '../../../../misc/utils';\nimport {DateTimeDirective} from '../../../dateTime/directives';\nimport {DateValueProvider} from '../../../../services';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\n\n//TODO: use mixin for set internal\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: DayPickerComponent,\n month: MonthPickerComponent,\n year: YearPickerComponent,\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>, OnInit, OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Current value of date time, could be string, timestamp, Date, TDate object, or ranged DateTimeValue\n */\n protected ɵValue: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\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 get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.valueFormat, this.customFormat, this.dataFormat);\n this.valueSet.next();\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 this.setOptions(value);\n }\n\n //######################### public properties - outputs #########################\n\n /**\n * @inheritdoc\n */\n @Output()\n public valueChange: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * @inheritdoc\n */\n @Output()\n public valueSet: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(@Inject(POSITION) protected position: Position,\n protected valueProvider: DateValueProvider<TDate>,\n @Inject(DATE_TIME_PICKER_OPTIONS) @Optional() options?: Partial<DateTimePickerOptions<TDate>>,)\n {\n super();\n\n this.ɵOptions = extend(true, {}, defaultOptions, options);\n\n this.setOptions(options);\n\n if(!this.displayedPeriodType)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public ngOnInit(): void\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 else\n {\n const val = (Array.isArray(this.internalValue) ? this.internalValue[0] : this.internalValue) ?? this.dateApi.now();\n\n this.showPicker(this.displayedPeriodType, val.isValid() ? val.value : this.dateApi.now().value);\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(!this.component)\n {\n return;\n }\n\n const component = this.component.instance;\n let invalidate: boolean = false;\n\n if(nameof<DateTimePickerComponent>('maxDateTime') in changes)\n {\n component.maxDate = this.maxDateTime;\n invalidate = true;\n }\n\n if(nameof<DateTimePickerComponent>('minDateTime') in changes)\n {\n component.minDate = this.minDateTime;\n invalidate = true;\n }\n\n if(nameof<DateTimePickerComponent>('value') in changes)\n {\n const val = (Array.isArray(this.internalValue) ? this.internalValue[0] : this.internalValue) ?? this.dateApi.now();\n\n component.display = val.isValid() ? val.value : this.dateApi.now().value;\n component.value = this.internalValue;\n invalidate = true;\n }\n\n if(this.component && invalidate)\n {\n this.component.instance.invalidateVisuals();\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 * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null): void\n {\n this.internalValue = getInternalValue(value, this.dateApi, this, this.valueProvider);\n }\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.displayedPeriodType = type;\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 if(!Array.isArray(component.value))\n {\n this.setInternalValue(component.value?.value);\n }\n else\n {\n //TODO: handle ranges\n }\n\n this.value = formatDateTime(this.internalValue, this.valueFormat, this.customFormat, this.dataFormat);\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.ranged = this.valueFormat === DateTimeValueFormat.RangeOfDateInstances;\n component.canScaleDown = this.canScaleDown();\n component.canScaleUp = this.canScaleUp();\n component.display = displayDate;\n component.maxDate = this.maxDateTime;\n component.minDate = this.minDateTime;\n component.value = this.internalValue;\n component.invalidateVisuals();\n }\n\n /**\n * Gets indication whether current period can be scaled down\n * @param periods - Array of defined period names\n * @param index - Index of displayed period\n */\n protected canScaleDown(periods?: string[], index?: number): boolean\n {\n periods ??= Object.keys(this.ɵOptions.periodsDefinition);\n 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 false;\n }\n\n return true;\n }\n\n /**\n * Gets indication whether current period can be scaled up\n * @param periods - Array of defined period names\n * @param index - Index of displayed period\n */\n protected canScaleUp(periods?: string[], index?: number): boolean\n {\n periods ??= Object.keys(this.ɵOptions.periodsDefinition);\n index ??= periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index + 1 >= periods.length)\n {\n return false;\n }\n\n return true;\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(!this.canScaleUp(periods, index))\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index + 1];\n\n return this.ɵOptions.periodsDefinition[this.displayedPeriodName];\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(!this.canScaleDown(periods, index))\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index - 1];\n\n return this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n }\n\n /**\n * Sets options and use them to set parameters of component\n * @param options - Options to be set\n */\n protected setOptions(options: Partial<DateTimePickerOptions<TDate>> | undefined): void\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}\n","<ng-container #container/>"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
2
|
import { DateTimePeriodPickerBase } from '../dateTimePeriodPickerBase';
|
|
3
|
-
import { DatePipesModule } from '../../../datePipes
|
|
3
|
+
import { DatePipesModule } from '../../../datePipes';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
-
import * as i1 from "../../../../pipes/dateFormat.pipe";
|
|
5
|
+
import * as i1 from "../../../../pipes/dateFormat/dateFormat.pipe";
|
|
6
6
|
/**
|
|
7
7
|
* Component used for displaying day picker
|
|
8
8
|
*/
|
|
@@ -130,14 +130,14 @@ export class DayPickerComponent extends DateTimePeriodPickerBase {
|
|
|
130
130
|
isSamePeriod(val, target) {
|
|
131
131
|
return val.isSameDay(target);
|
|
132
132
|
}
|
|
133
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
134
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
133
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DayPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
134
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0", type: DayPickerComponent, isStandalone: true, selector: "day-picker", host: { properties: { "class.date-time-period": "true" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'monthName'}} {{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextMonth()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n @for(weekday of weekdays; track weekday)\r\n {\r\n <div class=\"weekday\">{{weekday}}</div>\r\n }\r\n\r\n @for(day of periodData; track day)\r\n {\r\n <div class=\"period-datum clickable\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"selectDay(day)\">{{day.day}}</div>\r\n }\r\n</div>\r\n\r\n@if(canScaleDown)\r\n{\r\n <div class=\"go-down-button\">\r\n <div [class.clickable]=\"canScaleDown\" (mousedown)=\"displayDate ? scaleDownSubject.next(displayDate.value) : undefined\">{{singleValue?.isValid() ? (singleValue?.value | dateFormat: 'time') : '0:00'}}</div>\r\n </div>\r\n}", dependencies: [{ kind: "ngmodule", type: DatePipesModule }, { kind: "pipe", type: i1.DateFormatPipe, name: "dateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
135
135
|
}
|
|
136
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DayPickerComponent, decorators: [{
|
|
137
137
|
type: Component,
|
|
138
138
|
args: [{ selector: 'day-picker', host: {
|
|
139
139
|
'[class.date-time-period]': 'true',
|
|
140
|
-
},
|
|
140
|
+
}, imports: [
|
|
141
141
|
DatePipesModule,
|
|
142
142
|
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'monthName'}} {{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextMonth()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n @for(weekday of weekdays; track weekday)\r\n {\r\n <div class=\"weekday\">{{weekday}}</div>\r\n }\r\n\r\n @for(day of periodData; track day)\r\n {\r\n <div class=\"period-datum clickable\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"selectDay(day)\">{{day.day}}</div>\r\n }\r\n</div>\r\n\r\n@if(canScaleDown)\r\n{\r\n <div class=\"go-down-button\">\r\n <div [class.clickable]=\"canScaleDown\" (mousedown)=\"displayDate ? scaleDownSubject.next(displayDate.value) : undefined\">{{singleValue?.isValid() ? (singleValue?.value | dateFormat: 'time') : '0:00'}}</div>\r\n </div>\r\n}" }]
|
|
143
143
|
}], ctorParameters: () => [] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAGjE,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;;;AAG1D;;GAEG;AAgBH,MAAM,OAAO,kBAAoC,SAAQ,wBAA+C;IAgBpG,iEAAiE;IACjE;QAEI,KAAK,EAAE,CAAC;QAjBZ,0EAA0E;QAE1E;;WAEG;QACO,kBAAa,GAAqB,EAAE,CAAC;QAE/C,8FAA8F;QAE9F;;WAEG;QACO,aAAQ,GAAa,EAAE,CAAC;QAO9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACO,SAAS,CAAC,OAAuB;QAEvC,IAAG,OAAO,CAAC,QAAQ,EACnB,CAAC;YACG,OAAO;QACX,CAAC;QAED,cAAc;QACd,IAAG,CAAC,IAAI,CAAC,MAAM,EACf,CAAC;YACG,uBAAuB;YACvB,IAAG,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,EAC/B,CAAC;gBACG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;Y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;gBAED,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC;QACL,CAAC,QACK,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE;QAEtD,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QAEjC,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED,mFAAmF;IAEnF;;OAEG;IACO,QAAQ;QAEd,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACO,YAAY,CAAC,GAAyB,EAAE,MAAa;QAE3D,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;8GAhLQ,kBAAkB;kGAAlB,kBAAkB,yJCzB/B,k1CA6BC,2CDRO,eAAe;;2FAIV,kBAAkB;kBAf9B,SAAS;+BAEI,YAAY,QAGtB;wBACI,0BAA0B,EAAE,MAAM;qBACrC,cACW,IAAI,WAEhB;wBACI,eAAe;qBAClB,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy} from '@angular/core';\n\nimport {DateTimePicker, DayData} from '../../interfaces';\nimport {DateTimePeriodPickerBase} from '../dateTimePeriodPickerBase';\nimport {DatePipesModule} from '../../../datePipes.module';\nimport {DateApiObject} from '../../../../services';\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'day-picker',\n templateUrl: 'dayPicker.component.html',\n host:\n {\n '[class.date-time-period]': 'true',\n },\n standalone: true,\n imports:\n [\n DatePipesModule,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DayPickerComponent<TDate = unknown> extends DateTimePeriodPickerBase<DayData<TDate>, TDate> implements DateTimePicker<TDate>\n{\n //######################### protected properties #########################\n\n /**\n * Stored this picker month data\n */\n protected thisMonthData: DayData<TDate>[] = [];\n\n //######################### protected properties - template bindings #########################\n\n /**\n * Names of days\n */\n protected weekdays: string[] = [];\n\n //######################### constructor #########################\n constructor()\n {\n super();\n\n this.weekdays = this.dateApi.weekdays(true);\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Selects day as value of date time picker\n * @param dayData - Day data that were selected\n */\n protected selectDay(dayData: DayData<TDate>): void\n {\n if(dayData.disabled)\n {\n return;\n }\n\n //single value\n if(!this.ranged)\n {\n //no value selected yet\n if(!this.singleValue?.isValid())\n {\n this.singleValue = this.displayDate?.clone() ?? this.dateApi.getValue(new Date());\n }\n\n this.singleValue.year(dayData.dateObj.year());\n this.singleValue.month(dayData.dateObj.month());\n this.singleValue.dayOfMonth(dayData.day);\n\n //other month was selected\n if(dayData.otherMonth)\n {\n this.displayDate?.month(dayData.dateObj.month());\n }\n\n this.singleValue.updateOriginal();\n }\n else\n {\n //TODO: range\n }\n\n this.valueChangeSubject.next();\n this.render();\n this.changeDetector.detectChanges();\n }\n\n /**\n * Changes displayed month to next month\n */\n protected nextMonth(): void\n {\n this.displayDate?.addMonths(1).updateOriginal();\n\n this.render();\n }\n\n /**\n * Changes displayed month to previous month\n */\n protected previousMonth(): void\n {\n this.displayDate?.subtractMonths(1).updateOriginal();\n\n this.render();\n }\n\n //######################### protected methods #########################\n\n /**\n * Renders current day picker data\n */\n protected render(): void\n {\n //same month only data change\n if(this.displayedDate && this.displayDate?.isSameMonth(this.displayedDate))\n {\n this.setActive();\n this.updateMinMax();\n\n return;\n }\n\n this.displayedDate = this.displayDate?.value;\n this.periodData = [];\n this.thisMonthData = [];\n\n if(!this.displayDate)\n {\n return;\n }\n\n const currentMonthDate = this.displayDate.value;\n const today = this.dateApi.now().value;\n\n this.displayDate\n .startOfMonth()\n .updateOriginal()\n .startOfWeek();\n\n do\n {\n for(let x = 0; x < 7; x++)\n {\n const day = this.displayDate.dayOfMonth();\n const otherMonth = !this.displayDate.isSameMonth(currentMonthDate);\n\n const data: DayData<TDate> =\n {\n active: false,\n disabled: false,\n date: this.displayDate.value,\n otherMonth: otherMonth,\n today: this.displayDate.isSameDay(today),\n weekend: this.displayDate.isWeekend(),\n day: day,\n dateObj: this.displayDate.clone(),\n };\n\n this.periodData.push(data);\n\n if(!otherMonth)\n {\n this.thisMonthData.push(data);\n }\n\n this.displayDate.addDays(1);\n }\n }\n while(this.displayDate.isSameMonth(currentMonthDate));\n\n this.displayDate.resetOriginal();\n\n this.setActive();\n this.updateMinMax();\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected onRender(): void\n {\n this.render();\n }\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean\n {\n return val.isSameDay(target);\n }\n}","<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'monthName'}} {{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextMonth()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n @for(weekday of weekdays; track weekday)\r\n {\r\n <div class=\"weekday\">{{weekday}}</div>\r\n }\r\n\r\n @for(day of periodData; track day)\r\n {\r\n <div class=\"period-datum clickable\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"selectDay(day)\">{{day.day}}</div>\r\n }\r\n</div>\r\n\r\n@if(canScaleDown)\r\n{\r\n <div class=\"go-down-button\">\r\n <div [class.clickable]=\"canScaleDown\" (mousedown)=\"displayDate ? scaleDownSubject.next(displayDate.value) : undefined\">{{singleValue?.isValid() ? (singleValue?.value | dateFormat: 'time') : '0:00'}}</div>\r\n </div>\r\n}"]}
|
|
1
|
+
{"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAGjE,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;;;AAEnD;;GAEG;AAeH,MAAM,OAAO,kBAAoC,SAAQ,wBAA+C;IAgBpG,iEAAiE;IACjE;QAEI,KAAK,EAAE,CAAC;QAjBZ,0EAA0E;QAE1E;;WAEG;QACO,kBAAa,GAAqB,EAAE,CAAC;QAE/C,8FAA8F;QAE9F;;WAEG;QACO,aAAQ,GAAa,EAAE,CAAC;QAO9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACO,SAAS,CAAC,OAAuB;QAEvC,IAAG,OAAO,CAAC,QAAQ,EACnB,CAAC;YACG,OAAO;QACX,CAAC;QAED,cAAc;QACd,IAAG,CAAC,IAAI,CAAC,MAAM,EACf,CAAC;YACG,uBAAuB;YACvB,IAAG,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,EAC/B,CAAC;gBACG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YACtF,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAC9C,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,O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I,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QAEjC,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED,mFAAmF;IAEnF;;OAEG;IACO,QAAQ;QAEd,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACO,YAAY,CAAC,GAAyB,EAAE,MAAa;QAE3D,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;8GAhLQ,kBAAkB;kGAAlB,kBAAkB,yJCxB/B,k1CA6BC,2CDTO,eAAe;;2FAIV,kBAAkB;kBAd9B,SAAS;+BAEI,YAAY,QAGtB;wBACI,0BAA0B,EAAE,MAAM;qBACrC,WAED;wBACI,eAAe;qBAClB,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy} from '@angular/core';\n\nimport {DateTimePicker, DayData} from '../../interfaces';\nimport {DateTimePeriodPickerBase} from '../dateTimePeriodPickerBase';\nimport {DateApiObject} from '../../../../services';\nimport {DatePipesModule} from '../../../datePipes';\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'day-picker',\n templateUrl: 'dayPicker.component.html',\n host:\n {\n '[class.date-time-period]': 'true',\n },\n imports:\n [\n DatePipesModule,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DayPickerComponent<TDate = unknown> extends DateTimePeriodPickerBase<DayData<TDate>, TDate> implements DateTimePicker<TDate>\n{\n //######################### protected properties #########################\n\n /**\n * Stored this picker month data\n */\n protected thisMonthData: DayData<TDate>[] = [];\n\n //######################### protected properties - template bindings #########################\n\n /**\n * Names of days\n */\n protected weekdays: string[] = [];\n\n //######################### constructor #########################\n constructor()\n {\n super();\n\n this.weekdays = this.dateApi.weekdays(true);\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Selects day as value of date time picker\n * @param dayData - Day data that were selected\n */\n protected selectDay(dayData: DayData<TDate>): void\n {\n if(dayData.disabled)\n {\n return;\n }\n\n //single value\n if(!this.ranged)\n {\n //no value selected yet\n if(!this.singleValue?.isValid())\n {\n this.singleValue = this.displayDate?.clone() ?? this.dateApi.getValue(new Date());\n }\n\n this.singleValue.year(dayData.dateObj.year());\n this.singleValue.month(dayData.dateObj.month());\n this.singleValue.dayOfMonth(dayData.day);\n\n //other month was selected\n if(dayData.otherMonth)\n {\n this.displayDate?.month(dayData.dateObj.month());\n }\n\n this.singleValue.updateOriginal();\n }\n else\n {\n //TODO: range\n }\n\n this.valueChangeSubject.next();\n this.render();\n this.changeDetector.detectChanges();\n }\n\n /**\n * Changes displayed month to next month\n */\n protected nextMonth(): void\n {\n this.displayDate?.addMonths(1).updateOriginal();\n\n this.render();\n }\n\n /**\n * Changes displayed month to previous month\n */\n protected previousMonth(): void\n {\n this.displayDate?.subtractMonths(1).updateOriginal();\n\n this.render();\n }\n\n //######################### protected methods #########################\n\n /**\n * Renders current day picker data\n */\n protected render(): void\n {\n //same month only data change\n if(this.displayedDate && this.displayDate?.isSameMonth(this.displayedDate))\n {\n this.setActive();\n this.updateMinMax();\n\n return;\n }\n\n this.displayedDate = this.displayDate?.value;\n this.periodData = [];\n this.thisMonthData = [];\n\n if(!this.displayDate)\n {\n return;\n }\n\n const currentMonthDate = this.displayDate.value;\n const today = this.dateApi.now().value;\n\n this.displayDate\n .startOfMonth()\n .updateOriginal()\n .startOfWeek();\n\n do\n {\n for(let x = 0; x < 7; x++)\n {\n const day = this.displayDate.dayOfMonth();\n const otherMonth = !this.displayDate.isSameMonth(currentMonthDate);\n\n const data: DayData<TDate> =\n {\n active: false,\n disabled: false,\n date: this.displayDate.value,\n otherMonth: otherMonth,\n today: this.displayDate.isSameDay(today),\n weekend: this.displayDate.isWeekend(),\n day: day,\n dateObj: this.displayDate.clone(),\n };\n\n this.periodData.push(data);\n\n if(!otherMonth)\n {\n this.thisMonthData.push(data);\n }\n\n this.displayDate.addDays(1);\n }\n }\n while(this.displayDate.isSameMonth(currentMonthDate));\n\n this.displayDate.resetOriginal();\n\n this.setActive();\n this.updateMinMax();\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected onRender(): void\n {\n this.render();\n }\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean\n {\n return val.isSameDay(target);\n }\n}\n","<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'monthName'}} {{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextMonth()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n @for(weekday of weekdays; track weekday)\r\n {\r\n <div class=\"weekday\">{{weekday}}</div>\r\n }\r\n\r\n @for(day of periodData; track day)\r\n {\r\n <div class=\"period-datum clickable\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"selectDay(day)\">{{day.day}}</div>\r\n }\r\n</div>\r\n\r\n@if(canScaleDown)\r\n{\r\n <div class=\"go-down-button\">\r\n <div [class.clickable]=\"canScaleDown\" (mousedown)=\"displayDate ? scaleDownSubject.next(displayDate.value) : undefined\">{{singleValue?.isValid() ? (singleValue?.value | dateFormat: 'time') : '0:00'}}</div>\r\n </div>\r\n}"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Component, ChangeDetectionStrategy, Inject } from '@angular/core';
|
|
2
2
|
import { DateTimePeriodPickerBase } from '../dateTimePeriodPickerBase';
|
|
3
|
-
import { DatePipesModule } from '../../../datePipes
|
|
3
|
+
import { DatePipesModule } from '../../../datePipes';
|
|
4
4
|
import { FORMAT_PROVIDER } from '../../../../misc/tokens';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
-
import * as i1 from "../../../../pipes/dateFormat.pipe";
|
|
6
|
+
import * as i1 from "../../../../pipes/dateFormat/dateFormat.pipe";
|
|
7
7
|
/**
|
|
8
8
|
* Component used for displaying month picker
|
|
9
9
|
*/
|
|
@@ -99,14 +99,14 @@ export class MonthPickerComponent extends DateTimePeriodPickerBase {
|
|
|
99
99
|
isSamePeriod(val, target) {
|
|
100
100
|
return val.isSameMonth(target);
|
|
101
101
|
}
|
|
102
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
103
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
102
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MonthPickerComponent, deps: [{ token: FORMAT_PROVIDER }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
103
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0", type: MonthPickerComponent, isStandalone: true, selector: "month-picker", host: { properties: { "class.date-time-period": "true" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousYear()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextYear()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n @for(month of periodData; track month)\r\n {\r\n <div class=\"period-datum clickable\"\r\n [class.active]=\"month.active\"\r\n [class.disabled]=\"month.disabled\"\r\n (mousedown)=\"canScaleDown && displayDate ? scaleDownSubject.next(month.dateObj.value) : selectMonth(month)\">{{month.name}}</div>\r\n }\r\n</div>", dependencies: [{ kind: "ngmodule", type: DatePipesModule }, { kind: "pipe", type: i1.DateFormatPipe, name: "dateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
104
104
|
}
|
|
105
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MonthPickerComponent, decorators: [{
|
|
106
106
|
type: Component,
|
|
107
107
|
args: [{ selector: 'month-picker', host: {
|
|
108
108
|
'[class.date-time-period]': 'true',
|
|
109
|
-
},
|
|
109
|
+
}, imports: [
|
|
110
110
|
DatePipesModule,
|
|
111
111
|
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousYear()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextYear()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n @for(month of periodData; track month)\r\n {\r\n <div class=\"period-datum clickable\"\r\n [class.active]=\"month.active\"\r\n [class.disabled]=\"month.disabled\"\r\n (mousedown)=\"canScaleDown && displayDate ? scaleDownSubject.next(month.dateObj.value) : selectMonth(month)\">{{month.name}}</div>\r\n }\r\n</div>" }]
|
|
112
112
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthPicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/monthPicker/monthPicker.component.ts","../../../../../../src/modules/dateTimePicker/components/monthPicker/monthPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAGzE,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"monthPicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/monthPicker/monthPicker.component.ts","../../../../../../src/modules/dateTimePicker/components/monthPicker/monthPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAGzE,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;;;AAGxD;;GAEG;AAeH,MAAM,OAAO,oBAAsC,SAAQ,wBAAiD;IAExG,iEAAiE;IACjE,YAA+C,cAA8B;QAEzE,KAAK,EAAE,CAAC;QAFmC,mBAAc,GAAd,cAAc,CAAgB;IAG7E,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACO,WAAW,CAAC,SAA2B;QAE7C,IAAG,SAAS,CAAC,QAAQ,EACrB,CAAC;YACG,OAAO;QACX,CAAC;QAED,cAAc;QACd,IAAG,CAAC,IAAI,CAAC,MAAM,EACf,CAAC;YACG,uBAAuB;YACvB,IAAG,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,EAC/B,CAAC;gBACG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YACtF,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CA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AE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAC1B,CAAC;YACG,IAAI,CAAC,UAAU,CAAC,IAAI,CACpB;gBACI,MAAM,EAAE,KAAK;gBACb,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,WAAW,CAAC,KAAK;gBACvB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;gBACpF,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE;aAC/B,CAAC,CAAC;YAEH,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QAEjC,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED,mFAAmF;IAEnF;;OAEG;IACO,QAAQ;QAEd,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACO,YAAY,CAAC,GAAyB,EAAE,MAAa;QAE3D,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;8GAhIQ,oBAAoB,kBAGT,eAAe;kGAH1B,oBAAoB,2JC1BjC,yzBAcM,2CDQE,eAAe;;2FAIV,oBAAoB;kBAdhC,SAAS;+BAEI,cAAc,QAGxB;wBACI,0BAA0B,EAAE,MAAM;qBACrC,WAED;wBACI,eAAe;qBAClB,mBACgB,uBAAuB,CAAC,MAAM;;0BAKlC,MAAM;2BAAC,eAAe","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject} from '@angular/core';\n\nimport {DateTimePicker, MonthData} from '../../interfaces';\nimport {DateTimePeriodPickerBase} from '../dateTimePeriodPickerBase';\nimport {DatePipesModule} from '../../../datePipes';\nimport {DateApiObject} from '../../../../services';\nimport {FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {FormatProvider} from '../../../../interfaces';\n\n/**\n * Component used for displaying month picker\n */\n@Component(\n{\n selector: 'month-picker',\n templateUrl: 'monthPicker.component.html',\n host:\n {\n '[class.date-time-period]': 'true',\n },\n imports:\n [\n DatePipesModule,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MonthPickerComponent<TDate = unknown> extends DateTimePeriodPickerBase<MonthData<TDate>, TDate> implements DateTimePicker<TDate>\n{\n //######################### constructor #########################\n constructor(@Inject(FORMAT_PROVIDER) protected formatProvider: FormatProvider,)\n {\n super();\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Selects month as value of day time picker\n * @param monthData - Month data that were selected\n */\n protected selectMonth(monthData: MonthData<TDate>): void\n {\n if(monthData.disabled)\n {\n return;\n }\n\n //single value\n if(!this.ranged)\n {\n //no value selected yet\n if(!this.singleValue?.isValid())\n {\n this.singleValue = this.displayDate?.clone() ?? this.dateApi.getValue(new Date());\n }\n\n this.singleValue.year(monthData.dateObj.year());\n this.singleValue.month(monthData.dateObj.month());\n this.singleValue.updateOriginal();\n }\n else\n {\n //TODO: range\n }\n\n this.valueChangeSubject.next();\n this.render();\n this.changeDetector.detectChanges();\n }\n\n /**\n * Changes displayed year to next year\n */\n protected nextYear(): void\n {\n this.displayDate?.addYears(1).updateOriginal();\n\n this.render();\n }\n\n /**\n * Changes displayed year to previous year\n */\n protected previousYear(): void\n {\n this.displayDate?.subtractYears(1).updateOriginal();\n\n this.render();\n }\n\n //######################### protected methods #########################\n\n /**\n * Renders current day picker data\n */\n protected render(): void\n {\n //same year only data change\n if(this.displayedDate && this.displayDate?.isSameYear(this.displayedDate))\n {\n this.setActive();\n this.updateMinMax();\n\n return;\n }\n\n this.displayedDate = this.displayDate?.value;\n this.periodData = [];\n\n if(!this.displayDate)\n {\n return;\n }\n\n const monthOfYear = this.displayDate.startOfYear().updateOriginal();\n\n for(let x = 0; x < 12; x++)\n {\n this.periodData.push(\n {\n active: false,\n disabled: false,\n date: monthOfYear.value,\n name: monthOfYear.format(this.dateApi.getFormat(this.formatProvider.monthNameShort)),\n dateObj: monthOfYear.clone(),\n });\n\n monthOfYear.addMonths(1);\n }\n\n this.displayDate.resetOriginal();\n\n this.setActive();\n this.updateMinMax();\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected onRender(): void\n {\n this.render();\n }\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean\n {\n return val.isSameMonth(target);\n }\n}\n","<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousYear()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextYear()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n @for(month of periodData; track month)\r\n {\r\n <div class=\"period-datum clickable\"\r\n [class.active]=\"month.active\"\r\n [class.disabled]=\"month.disabled\"\r\n (mousedown)=\"canScaleDown && displayDate ? scaleDownSubject.next(month.dateObj.value) : selectMonth(month)\">{{month.name}}</div>\r\n }\r\n</div>"]}
|
package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
2
|
import { SlicePipe } from '@angular/common';
|
|
3
|
-
import {
|
|
4
|
-
import { DatePipesModule } from '../../../datePipes
|
|
3
|
+
import { ClickOutsideDirective } from '@anglr/common';
|
|
4
|
+
import { DatePipesModule } from '../../../datePipes';
|
|
5
5
|
import { hours, minutes } from './rollerTimePicker.data';
|
|
6
6
|
import { DateTimePeriodPickerBase } from '../dateTimePeriodPickerBase';
|
|
7
7
|
import { LoopScrollDataDirective, LoopScrollDirective } from '../../directives';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
|
-
import * as i1 from "../../../../pipes/dateFormat.pipe";
|
|
9
|
+
import * as i1 from "../../../../pipes/dateFormat/dateFormat.pipe";
|
|
10
10
|
/**
|
|
11
11
|
* Component used for rendering roller time picker
|
|
12
12
|
*/
|
|
@@ -62,7 +62,6 @@ export class RollerTimePickerComponent extends DateTimePeriodPickerBase {
|
|
|
62
62
|
* Sets hour
|
|
63
63
|
* @param event - Mouse event that was triggered
|
|
64
64
|
* @param value - Value to be set as hour
|
|
65
|
-
* @returns
|
|
66
65
|
*/
|
|
67
66
|
setHour(event, value) {
|
|
68
67
|
if (!this.hoursOpen && event) {
|
|
@@ -111,17 +110,17 @@ export class RollerTimePickerComponent extends DateTimePeriodPickerBase {
|
|
|
111
110
|
isSamePeriod() {
|
|
112
111
|
return false;
|
|
113
112
|
}
|
|
114
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
115
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
113
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: RollerTimePickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
114
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0", type: RollerTimePickerComponent, isStandalone: true, selector: "roller-time-picker", host: { properties: { "class.date-time-period": "true" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"date-time-flex-row\" style=\"justify-content: center;\">\n <div [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'date'}}</div>\n</div>\n\n<div class=\"time-area\">\n <div class=\"value-container\"\n [clickOutside]=\"true\"\n (clickOutsideChange)=\"hoursOpen = false\"\n [clickOutsideElement]=\"hoursScroll\">\n <div #hoursScroll\n class=\"roller-scroll\"\n [class.open]=\"hoursOpen\"\n [loopScroll]=\"hour\"\n [open]=\"hoursOpen\"\n (loopScrollChange)=\"setHour(null, $event)\"\n (mousedown)=\"hoursOpen = !hoursOpen\">\n @for(hour of hours | slice: -14; track hour)\n {\n <div [loopScrollData]=\"hour?.data\"\n [clone]=\"true\"\n class=\"roller-item\"\n (mousedown)=\"setHour($event, hour?.data)\">{{hour?.displayText}}</div>\n }\n\n @for(hour of hours; track hour)\n {\n <div [loopScrollData]=\"hour?.data\"\n class=\"roller-item\"\n (mousedown)=\"setHour($event, hour?.data)\">{{hour?.displayText}}</div>\n }\n\n @for(hour of hours | slice: 0: 14; track hour)\n {\n <div [loopScrollData]=\"hour?.data\"\n [clone]=\"true\"\n class=\"roller-item\"\n (mousedown)=\"setHour($event, hour?.data)\">{{hour?.displayText}}</div>\n }\n </div>\n </div>\n\n <div class=\"minute-second-separator\">:</div>\n\n <div class=\"value-container\"\n [clickOutside]=\"true\"\n (clickOutsideChange)=\"minutesOpen = false\"\n [clickOutsideElement]=\"minutesScroll\">\n <div #minutesScroll\n class=\"roller-scroll\"\n [class.open]=\"minutesOpen\"\n [loopScroll]=\"minute\"\n [open]=\"minutesOpen\"\n (loopScrollChange)=\"setMinute(null, $event)\"\n (mousedown)=\"minutesOpen = !minutesOpen\">\n @for(minute of minutes | slice: -14; track minute)\n {\n <div [loopScrollData]=\"minute?.data\"\n [clone]=\"true\"\n class=\"roller-item\"\n (mousedown)=\"setMinute($event, minute?.data)\">{{minute?.displayText}}</div>\n }\n\n @for(minute of minutes; track minute)\n {\n <div [loopScrollData]=\"minute?.data\"\n class=\"roller-item\"\n (mousedown)=\"setMinute($event, minute?.data)\">{{minute?.displayText}}</div>\n }\n\n @for(minute of minutes | slice: 0: 14; track minute)\n {\n <div [loopScrollData]=\"minute?.data\"\n [clone]=\"true\"\n class=\"roller-item\"\n (mousedown)=\"setMinute($event, minute?.data)\">{{minute?.displayText}}</div>\n }\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "pipe", type: SlicePipe, name: "slice" }, { kind: "ngmodule", type: DatePipesModule }, { kind: "pipe", type: i1.DateFormatPipe, name: "dateFormat" }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", inputs: ["clickOutside", "clickOutsideElement"], outputs: ["clickOutsideChange"] }, { kind: "directive", type: LoopScrollDataDirective, selector: "[loopScrollData]", inputs: ["loopScrollData", "clone"] }, { kind: "directive", type: LoopScrollDirective, selector: "[loopScroll]", inputs: ["loopScroll", "open"], outputs: ["loopScrollChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
116
115
|
}
|
|
117
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: RollerTimePickerComponent, decorators: [{
|
|
118
117
|
type: Component,
|
|
119
118
|
args: [{ selector: 'roller-time-picker', host: {
|
|
120
119
|
'[class.date-time-period]': 'true',
|
|
121
|
-
},
|
|
120
|
+
}, imports: [
|
|
122
121
|
SlicePipe,
|
|
123
122
|
DatePipesModule,
|
|
124
|
-
|
|
123
|
+
ClickOutsideDirective,
|
|
125
124
|
LoopScrollDataDirective,
|
|
126
125
|
LoopScrollDirective,
|
|
127
126
|
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"date-time-flex-row\" style=\"justify-content: center;\">\n <div [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'date'}}</div>\n</div>\n\n<div class=\"time-area\">\n <div class=\"value-container\"\n [clickOutside]=\"true\"\n (clickOutsideChange)=\"hoursOpen = false\"\n [clickOutsideElement]=\"hoursScroll\">\n <div #hoursScroll\n class=\"roller-scroll\"\n [class.open]=\"hoursOpen\"\n [loopScroll]=\"hour\"\n [open]=\"hoursOpen\"\n (loopScrollChange)=\"setHour(null, $event)\"\n (mousedown)=\"hoursOpen = !hoursOpen\">\n @for(hour of hours | slice: -14; track hour)\n {\n <div [loopScrollData]=\"hour?.data\"\n [clone]=\"true\"\n class=\"roller-item\"\n (mousedown)=\"setHour($event, hour?.data)\">{{hour?.displayText}}</div>\n }\n\n @for(hour of hours; track hour)\n {\n <div [loopScrollData]=\"hour?.data\"\n class=\"roller-item\"\n (mousedown)=\"setHour($event, hour?.data)\">{{hour?.displayText}}</div>\n }\n\n @for(hour of hours | slice: 0: 14; track hour)\n {\n <div [loopScrollData]=\"hour?.data\"\n [clone]=\"true\"\n class=\"roller-item\"\n (mousedown)=\"setHour($event, hour?.data)\">{{hour?.displayText}}</div>\n }\n </div>\n </div>\n\n <div class=\"minute-second-separator\">:</div>\n\n <div class=\"value-container\"\n [clickOutside]=\"true\"\n (clickOutsideChange)=\"minutesOpen = false\"\n [clickOutsideElement]=\"minutesScroll\">\n <div #minutesScroll\n class=\"roller-scroll\"\n [class.open]=\"minutesOpen\"\n [loopScroll]=\"minute\"\n [open]=\"minutesOpen\"\n (loopScrollChange)=\"setMinute(null, $event)\"\n (mousedown)=\"minutesOpen = !minutesOpen\">\n @for(minute of minutes | slice: -14; track minute)\n {\n <div [loopScrollData]=\"minute?.data\"\n [clone]=\"true\"\n class=\"roller-item\"\n (mousedown)=\"setMinute($event, minute?.data)\">{{minute?.displayText}}</div>\n }\n\n @for(minute of minutes; track minute)\n {\n <div [loopScrollData]=\"minute?.data\"\n class=\"roller-item\"\n (mousedown)=\"setMinute($event, minute?.data)\">{{minute?.displayText}}</div>\n }\n\n @for(minute of minutes | slice: 0: 14; track minute)\n {\n <div [loopScrollData]=\"minute?.data\"\n [clone]=\"true\"\n class=\"roller-item\"\n (mousedown)=\"setMinute($event, minute?.data)\">{{minute?.displayText}}</div>\n }\n </div>\n </div>\n</div>\n" }]
|