@anglr/datetime 8.1.0-beta.20240827080139 → 9.0.0-beta.20241004120552
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 +61 -1
- package/date-fns/src/services/dateFnsDateApi.service.d.ts +58 -130
- package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js +60 -143
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2022/moment/src/services/momentDateApi.service.js +58 -140
- package/es2022/moment/src/services/momentDateApi.service.js.map +1 -1
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js +17 -30
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js.map +1 -1
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js +9 -9
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +16 -26
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +8 -8
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js +9 -9
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js +7 -11
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js +8 -8
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/withNow/withNow.directive.js +11 -11
- package/es2022/src/directives/withNow/withNow.directive.js.map +1 -1
- package/es2022/src/directives/withTime/withTime.directive.js +10 -10
- package/es2022/src/directives/withTime/withTime.directive.js.map +1 -1
- package/es2022/src/directives/withToday/withToday.directive.js +11 -11
- package/es2022/src/directives/withToday/withToday.directive.js.map +1 -1
- package/es2022/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
- package/es2022/src/misc/enums.js +8 -4
- package/es2022/src/misc/enums.js.map +1 -1
- package/es2022/src/misc/utils.js +7 -6
- package/es2022/src/misc/utils.js.map +1 -1
- package/es2022/src/misc/validators.js.map +1 -1
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js +36 -59
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +1 -1
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js +5 -5
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +1 -1
- package/es2022/src/modules/calendar/modules/monthCalendar.module.js +7 -11
- package/es2022/src/modules/calendar/modules/monthCalendar.module.js.map +1 -1
- package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js +3 -4
- package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js.map +1 -1
- package/es2022/src/modules/datePipes.module.js +6 -6
- package/es2022/src/modules/datePipes.module.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js +41 -72
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeBase.js +21 -25
- package/es2022/src/modules/dateTime/directives/dateTimeBase.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js +36 -16
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +18 -26
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +12 -13
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +12 -13
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +12 -13
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/modules/dateTime.module.js +27 -27
- package/es2022/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +39 -58
- package/es2022/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +21 -57
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +14 -14
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +4 -5
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +27 -24
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +12 -9
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +11 -40
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js +40 -55
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +8 -14
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js +9 -10
- package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js.map +1 -1
- package/es2022/src/pipes/dateConvert.pipe.js +4 -5
- package/es2022/src/pipes/dateConvert.pipe.js.map +1 -1
- package/es2022/src/pipes/dateFormat.pipe.js +4 -6
- package/es2022/src/pipes/dateFormat.pipe.js.map +1 -1
- package/es2022/src/services/dateApi/dateApi.interface.js.map +1 -1
- package/es2022/src/services/datePositionParser/datePositionParser.service.js +16 -17
- package/es2022/src/services/datePositionParser/datePositionParser.service.js.map +1 -1
- package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js +3 -9
- package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +1 -1
- package/es2022/src/services/dateValueProvider/dateValueProvider.service.js +3 -5
- package/es2022/src/services/dateValueProvider/dateValueProvider.service.js.map +1 -1
- package/lerna.json +4 -0
- package/moment/src/services/momentDateApi.service.d.ts +59 -132
- package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
- package/package.json +41 -43
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts +3 -3
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts.map +1 -1
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts +3 -3
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts.map +1 -1
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts +7 -7
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts +3 -3
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts +3 -3
- package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts +7 -7
- package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts +3 -3
- package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/withNow/withNow.directive.d.ts +5 -5
- package/src/directives/withNow/withNow.directive.d.ts.map +1 -1
- package/src/directives/withTime/withTime.directive.d.ts +5 -5
- package/src/directives/withTime/withTime.directive.d.ts.map +1 -1
- package/src/directives/withToday/withToday.directive.d.ts +5 -5
- package/src/directives/withToday/withToday.directive.d.ts.map +1 -1
- package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts +1 -1
- package/src/misc/enums.d.ts +8 -4
- package/src/misc/enums.d.ts.map +1 -1
- package/src/misc/utils.d.ts +3 -3
- package/src/misc/utils.d.ts.map +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts.map +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.html +17 -9
- package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts +1 -1
- package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts.map +1 -1
- package/src/modules/calendar/modules/monthCalendar.module.d.ts +3 -4
- package/src/modules/calendar/modules/monthCalendar.module.d.ts.map +1 -1
- package/src/modules/datePipes.module.d.ts +1 -1
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeBase.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeBase.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts +6 -4
- package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/modules/dateTime.module.d.ts +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +4 -4
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.html +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts +5 -5
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts +7 -7
- package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts +3 -3
- package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.d.ts.map +1 -1
- package/src/modules/dateTimePicker/modules/dateTimePicker.module.d.ts +3 -3
- package/src/modules/dateTimePicker/modules/dateTimePicker.module.d.ts.map +1 -1
- package/src/pipes/dateConvert.pipe.d.ts +1 -1
- package/src/pipes/dateFormat.pipe.d.ts +1 -1
- package/src/services/dateApi/dateApi.interface.d.ts +5 -1
- package/src/services/dateApi/dateApi.interface.d.ts.map +1 -1
- package/src/services/dateValueProvider/dateValueProvider.service.d.ts.map +1 -1
- package/version.bak +1 -1
package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js
CHANGED
|
@@ -7,17 +7,16 @@ import * as i0 from "@angular/core";
|
|
|
7
7
|
/**
|
|
8
8
|
* Applies validator for date time
|
|
9
9
|
*/
|
|
10
|
-
export class
|
|
11
|
-
dateApi;
|
|
12
|
-
//######################### private fields #########################
|
|
13
|
-
/**
|
|
14
|
-
* Function used for validations
|
|
15
|
-
*/
|
|
16
|
-
_validator = () => null;
|
|
10
|
+
export class DateTimeValidatorDirective extends DateTimeBase {
|
|
17
11
|
//######################### constructor #########################
|
|
18
12
|
constructor(dateApi) {
|
|
19
13
|
super();
|
|
20
14
|
this.dateApi = dateApi;
|
|
15
|
+
//######################### private fields #########################
|
|
16
|
+
/**
|
|
17
|
+
* Function used for validations
|
|
18
|
+
*/
|
|
19
|
+
this._validator = () => null;
|
|
21
20
|
}
|
|
22
21
|
//######################### public methods - implementation of OnInit #########################
|
|
23
22
|
/**
|
|
@@ -35,23 +34,23 @@ export class DateTimeValidatorSADirective extends DateTimeBase {
|
|
|
35
34
|
validate(control) {
|
|
36
35
|
return this._validator(control);
|
|
37
36
|
}
|
|
38
|
-
static
|
|
39
|
-
static
|
|
37
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeValidatorDirective, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
38
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimeValidatorDirective, isStandalone: true, selector: "[dateTime][validate]", providers: [
|
|
40
39
|
{
|
|
41
40
|
provide: NG_VALIDATORS,
|
|
42
|
-
useExisting: forwardRef(() =>
|
|
41
|
+
useExisting: forwardRef(() => DateTimeValidatorDirective),
|
|
43
42
|
multi: true
|
|
44
43
|
},
|
|
45
|
-
], usesInheritance: true, ngImport: i0 });
|
|
44
|
+
], usesInheritance: true, ngImport: i0 }); }
|
|
46
45
|
}
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeValidatorDirective, decorators: [{
|
|
48
47
|
type: Directive,
|
|
49
48
|
args: [{
|
|
50
49
|
selector: '[dateTime][validate]',
|
|
51
50
|
providers: [
|
|
52
51
|
{
|
|
53
52
|
provide: NG_VALIDATORS,
|
|
54
|
-
useExisting: forwardRef(() =>
|
|
53
|
+
useExisting: forwardRef(() => DateTimeValidatorDirective),
|
|
55
54
|
multi: true
|
|
56
55
|
},
|
|
57
56
|
],
|
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;AAeH,MAAM,OAAO,
|
|
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;AAeH,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,mEAVnC;YAEI;gBACI,OAAO,EAAE,aAAa;gBACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC;gBACzD,KAAK,EAAE,IAAI;aACd;SACJ;;2FAGQ,0BAA0B;kBAdtC,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;oBACD,UAAU,EAAE,IAAI;iBACnB;;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 standalone: true,\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}"]}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
|
-
import {
|
|
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
|
|
6
6
|
*/
|
|
7
7
|
export class DateTimeModule {
|
|
8
|
-
static
|
|
9
|
-
static
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
static
|
|
8
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
9
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: DateTimeModule, imports: [DateTimeDirective,
|
|
10
|
+
DateTimeControlValueAccessorDirective,
|
|
11
|
+
DateTimeInputDirective,
|
|
12
|
+
DateTimeMaxValidatorDirective,
|
|
13
|
+
DateTimeMinValidatorDirective,
|
|
14
|
+
DateTimeValidatorDirective], exports: [DateTimeDirective,
|
|
15
|
+
DateTimeControlValueAccessorDirective,
|
|
16
|
+
DateTimeInputDirective,
|
|
17
|
+
DateTimeMaxValidatorDirective,
|
|
18
|
+
DateTimeMinValidatorDirective,
|
|
19
|
+
DateTimeValidatorDirective] }); }
|
|
20
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeModule }); }
|
|
21
21
|
}
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeModule, decorators: [{
|
|
23
23
|
type: NgModule,
|
|
24
24
|
args: [{
|
|
25
25
|
imports: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
DateTimeDirective,
|
|
27
|
+
DateTimeControlValueAccessorDirective,
|
|
28
|
+
DateTimeInputDirective,
|
|
29
|
+
DateTimeMaxValidatorDirective,
|
|
30
|
+
DateTimeMinValidatorDirective,
|
|
31
|
+
DateTimeValidatorDirective,
|
|
32
32
|
],
|
|
33
33
|
exports: [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
DateTimeDirective,
|
|
35
|
+
DateTimeControlValueAccessorDirective,
|
|
36
|
+
DateTimeInputDirective,
|
|
37
|
+
DateTimeMaxValidatorDirective,
|
|
38
|
+
DateTimeMinValidatorDirective,
|
|
39
|
+
DateTimeValidatorDirective,
|
|
40
40
|
],
|
|
41
41
|
}]
|
|
42
42
|
}] });
|
|
@@ -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,
|
|
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;8GAAd,cAAc;+GAAd,cAAc,YAjBnB,iBAAiB;YACjB,qCAAqC;YACrC,sBAAsB;YACtB,6BAA6B;YAC7B,6BAA6B;YAC7B,0BAA0B,aAI1B,iBAAiB;YACjB,qCAAqC;YACrC,sBAAsB;YACtB,6BAA6B;YAC7B,6BAA6B;YAC7B,0BAA0B;+GAGrB,cAAc;;2FAAd,cAAc;kBArB1B,QAAQ;mBACT;oBACI,OAAO,EACP;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 imports:\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}"]}
|
|
@@ -5,39 +5,45 @@ import { DATE_API } from '../../../misc/tokens';
|
|
|
5
5
|
* Base abstract class for each date time period picker
|
|
6
6
|
*/
|
|
7
7
|
export class DateTimePeriodPickerBase {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
8
|
+
constructor() {
|
|
9
|
+
//######################### protected properties #########################
|
|
10
|
+
/**
|
|
11
|
+
* Array of period data to be displayed
|
|
12
|
+
*/
|
|
13
|
+
this.periodData = [];
|
|
14
|
+
/**
|
|
15
|
+
* Subject used for emitting of value changes
|
|
16
|
+
*/
|
|
17
|
+
this.valueChangeSubject = new Subject();
|
|
18
|
+
/**
|
|
19
|
+
* Subject used for scaling up
|
|
20
|
+
*/
|
|
21
|
+
this.scaleUpSubject = new Subject();
|
|
22
|
+
/**
|
|
23
|
+
* Subject used for scaling down
|
|
24
|
+
*/
|
|
25
|
+
this.scaleDownSubject = new Subject();
|
|
26
|
+
/**
|
|
27
|
+
* Change detector instance
|
|
28
|
+
*/
|
|
29
|
+
this.changeDetector = inject(ChangeDetectorRef);
|
|
30
|
+
/**
|
|
31
|
+
* Instance of date api for manipulation with date time
|
|
32
|
+
*/
|
|
33
|
+
this.dateApi = inject(DATE_API);
|
|
34
|
+
/**
|
|
35
|
+
* @inheritdoc
|
|
36
|
+
*/
|
|
37
|
+
this.canScaleUp = false;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritdoc
|
|
40
|
+
*/
|
|
41
|
+
this.canScaleDown = false;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritdoc
|
|
44
|
+
*/
|
|
45
|
+
this.ranged = false;
|
|
46
|
+
}
|
|
41
47
|
/**
|
|
42
48
|
* Gets or sets value as single value
|
|
43
49
|
*/
|
|
@@ -62,19 +68,6 @@ export class DateTimePeriodPickerBase {
|
|
|
62
68
|
set rangeValue(value) {
|
|
63
69
|
this.value = value;
|
|
64
70
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Change detector instance
|
|
67
|
-
*/
|
|
68
|
-
changeDetector = inject(ChangeDetectorRef);
|
|
69
|
-
/**
|
|
70
|
-
* Instance of date api for manipulation with date time
|
|
71
|
-
*/
|
|
72
|
-
dateApi = inject(DATE_API);
|
|
73
|
-
//######################### public properties - implementation of DateTimePicker #########################
|
|
74
|
-
/**
|
|
75
|
-
* @inheritdoc
|
|
76
|
-
*/
|
|
77
|
-
value;
|
|
78
71
|
/**
|
|
79
72
|
* @inheritdoc
|
|
80
73
|
*/
|
|
@@ -114,18 +107,6 @@ export class DateTimePeriodPickerBase {
|
|
|
114
107
|
}
|
|
115
108
|
this.minDateObj = this.dateApi.getValue(value);
|
|
116
109
|
}
|
|
117
|
-
/**
|
|
118
|
-
* @inheritdoc
|
|
119
|
-
*/
|
|
120
|
-
canScaleUp = false;
|
|
121
|
-
/**
|
|
122
|
-
* @inheritdoc
|
|
123
|
-
*/
|
|
124
|
-
canScaleDown = false;
|
|
125
|
-
/**
|
|
126
|
-
* @inheritdoc
|
|
127
|
-
*/
|
|
128
|
-
ranged = false;
|
|
129
110
|
/**
|
|
130
111
|
* @inheritdoc
|
|
131
112
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePeriodPickerBase.js","sourceRoot":"","sources":["../../../../../src/modules/dateTimePicker/components/dateTimePeriodPickerBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACxD,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAK9C;;GAEG;AACH,MAAM,OAAgB,wBAAwB;IAE1C,0EAA0E;IAE1E;;OAEG;IACO,UAAU,GAAc,EAAE,CAAC;IAErC;;OAEG;IACO,kBAAkB,GAAkB,IAAI,OAAO,EAAQ,CAAC;IAElE;;OAEG;IACO,cAAc,GAAmB,IAAI,OAAO,EAAS,CAAC;IAEhE;;OAEG;IACO,gBAAgB,GAAmB,IAAI,OAAO,EAAS,CAAC;IAElE;;OAEG;IACO,WAAW,CAAsC;IAE3D;;OAEG;IACO,aAAa,CAAuB;IAE9C;;OAEG;IACO,UAAU,CAAsC;IAE1D;;OAEG;IACO,UAAU,CAAsC;IAE1D;;OAEG;IACH,IAAc,WAAW;QAErB,IAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAC5B;YACI,OAAO,IAAI,CAAC;SACf;QAED,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IACD,IAAc,WAAW,CAAC,KAA0C;QAEhE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAc,UAAU;QAEpB,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAC7B;YACI,OAAO,IAAI,CAAC;SACf;QAED,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IACD,IAAc,UAAU,CAAC,KAA4E;QAEjG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;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CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAC3J;gBACI,SAAS,GAAG,IAAI,CAAC;gBACjB,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;aAC1B;SACJ;IACL,CAAC;IAED;;OAEG;IACO,SAAS;QAEf,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;QAEnD,IAAG,CAAC,IAAI,CAAC,KAAK,EACd;YACI,OAAO;SACV;QAED,IAAG,CAAC,IAAI,CAAC,MAAM,EACf;YACI,IAAG,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,EAC9B;gBACI,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC;gBAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;gBAEtF,IAAG,IAAI,EACP;oBACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;iBACtB;aACJ;SACJ;aAED;YACI,qBAAqB;SACxB;IACL,CAAC;CACJ","sourcesContent":["import {ChangeDetectorRef, inject} from '@angular/core';\nimport {Observable, Subject} from 'rxjs';\n\nimport {DATE_API} from '../../../misc/tokens';\nimport {DateTimeObjectValue} from '../../../misc/types';\nimport {DateApi, DateApiObject} from '../../../services';\nimport {DateTimePicker, PeriodData} from '../interfaces';\n\n/**\n * Base abstract class for each date time period picker\n */\nexport abstract class DateTimePeriodPickerBase<TPeriod extends PeriodData<TDate>, TDate = unknown> implements DateTimePicker<TDate>\n{\n //######################### protected properties #########################\n\n /**\n * Array of period data to be displayed\n */\n protected periodData: TPeriod[] = [];\n\n /**\n * Subject used for emitting of value changes\n */\n protected valueChangeSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for scaling up\n */\n protected scaleUpSubject: Subject<TDate> = new Subject<TDate>();\n\n /**\n * Subject used for scaling down\n */\n protected scaleDownSubject: Subject<TDate> = new Subject<TDate>();\n\n /**\n * Date api instance for displayed date\n */\n protected displayDate: DateApiObject<TDate>|undefined|null;\n\n /**\n * Currently displayed date\n */\n protected displayedDate: TDate|undefined|null;\n\n /**\n * Date api instance for max date\n */\n protected maxDateObj: DateApiObject<TDate>|undefined|null;\n\n /**\n * Date api instance for min date\n */\n protected minDateObj: DateApiObject<TDate>|undefined|null;\n\n /**\n * Gets or sets value as single value\n */\n protected get singleValue(): DateApiObject<TDate>|undefined|null\n {\n if(Array.isArray(this.value))\n {\n return null;\n }\n\n return this.value;\n }\n protected set singleValue(value: DateApiObject<TDate>|undefined|null)\n {\n this.value = value;\n }\n\n /**\n * Gets or sets value as single value\n */\n protected get rangeValue(): [DateApiObject<TDate>|null, DateApiObject<TDate>|null]|undefined|null\n {\n if(!Array.isArray(this.value))\n {\n return null;\n }\n\n return this.value;\n }\n protected set rangeValue(value: [DateApiObject<TDate>|null, DateApiObject<TDate>|null]|undefined|null)\n {\n this.value = value;\n }\n\n /**\n * Change detector instance\n */\n protected changeDetector: ChangeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Instance of date api for manipulation with date time\n */\n protected dateApi: DateApi<TDate> = inject(DATE_API) as DateApi<TDate>;\n\n //######################### public properties - implementation of DateTimePicker #########################\n\n /**\n * @inheritdoc\n */\n public value: DateTimeObjectValue<TDate>|undefined|null;\n\n /**\n * @inheritdoc\n */\n public get display(): TDate|undefined|null\n {\n return this.displayDate?.value;\n }\n public set display(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.displayDate = null;\n\n return;\n }\n\n this.displayDate = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public get maxDate(): TDate|undefined|null\n {\n return this.maxDateObj?.value;\n }\n public set maxDate(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.maxDateObj = null;\n\n return;\n }\n\n this.maxDateObj = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public get minDate(): TDate|undefined|null\n {\n return this.minDateObj?.value;\n }\n public set minDate(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.minDateObj = null;\n\n return;\n }\n\n this.minDateObj = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public canScaleUp: boolean = false;\n\n /**\n * @inheritdoc\n */\n public canScaleDown: boolean = false;\n\n /**\n * @inheritdoc\n */\n public ranged: boolean = false;\n\n /**\n * @inheritdoc\n */\n public get valueChange(): Observable<void>\n {\n return this.valueChangeSubject.asObservable();\n }\n\n /**\n * @inheritdoc\n */\n public get scaleUp(): Observable<TDate>\n {\n return this.scaleUpSubject.asObservable();\n }\n\n /**\n * @inheritdoc\n */\n public get scaleDown(): Observable<TDate>\n {\n return this.scaleDownSubject.asObservable();\n }\n\n //######################### public methods - implementation of invalidatable #########################\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n this.onRender();\n\n this.changeDetector.detectChanges();\n }\n\n //######################### protected methods #########################\n\n /**\n * Method that is being called to render changes\n */\n protected abstract onRender(): void;\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 abstract isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean;\n\n /**\n * Updates minimal and maximal value for picker\n */\n protected updateMinMax(): void\n {\n if(!this.periodData.length)\n {\n return;\n }\n\n //no min, no max\n if(!this.minDateObj && !this.maxDateObj)\n {\n this.periodData.forEach(itm => itm.disabled = false);\n\n return;\n }\n\n let restAfter = false;\n\n for(const period of this.periodData)\n {\n if(this.minDateObj?.isValid() && this.minDateObj.isAfter(period.dateObj.value) && !this.isSamePeriod(this.minDateObj, period.dateObj.value))\n {\n period.disabled = true;\n }\n\n if(restAfter || (this.maxDateObj?.isValid() && this.maxDateObj.isBefore(period.dateObj.value) && !this.isSamePeriod(this.maxDateObj, period.dateObj.value)))\n {\n restAfter = true;\n period.disabled = true;\n }\n }\n }\n\n /**\n * Sets active date\n */\n protected setActive(): void\n {\n this.periodData.forEach(itm => itm.active = false);\n\n if(!this.value)\n {\n return;\n }\n \n if(!this.ranged)\n {\n if(this.singleValue?.isValid())\n {\n const value = this.singleValue;\n const data = this.periodData.find(itm => this.isSamePeriod(itm.dateObj, value.value));\n\n if(data)\n {\n data.active = true;\n }\n }\n }\n else\n {\n //TODO: support range\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"dateTimePeriodPickerBase.js","sourceRoot":"","sources":["../../../../../src/modules/dateTimePicker/components/dateTimePeriodPickerBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACxD,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAK9C;;GAEG;AACH,MAAM,OAAgB,wBAAwB;IAA9C;QAEI,0EAA0E;QAE1E;;WAEG;QACO,eAAU,GAAc,EAAE,CAAC;QAErC;;WAEG;QACO,uBAAkB,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAElE;;WAEG;QACO,mBAAc,GAAmB,IAAI,OAAO,EAAS,CAAC;QAEhE;;WAEG;QACO,qBAAgB,GAAmB,IAAI,OAAO,EAAS,CAAC;QAwDlE;;WAEG;QACO,mBAAc,GAAsB,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAExE;;WAEG;QACO,YAAO,GAAmB,MAAM,CAAC,QAAQ,CAAmB,CAAC;QAkEvE;;WAEG;QACI,eAAU,GAAY,KAAK,CAAC;QAEnC;;WAEG;QACI,iBAAY,GAAY,KAAK,CAAC;QAErC;;WAEG;QACI,WAAM,GAAY,KAAK,CAAC;IAqHnC,CAAC;IA9OG;;OAEG;IACH,IAAc,WAAW;QAErB,IAAG,KAAK,CAAC,OAA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observable, Subject} from 'rxjs';\n\nimport {DATE_API} from '../../../misc/tokens';\nimport {DateTimeObjectValue} from '../../../misc/types';\nimport {DateApi, DateApiObject} from '../../../services';\nimport {DateTimePicker, PeriodData} from '../interfaces';\n\n/**\n * Base abstract class for each date time period picker\n */\nexport abstract class DateTimePeriodPickerBase<TPeriod extends PeriodData<TDate>, TDate = unknown> implements DateTimePicker<TDate>\n{\n //######################### protected properties #########################\n\n /**\n * Array of period data to be displayed\n */\n protected periodData: TPeriod[] = [];\n\n /**\n * Subject used for emitting of value changes\n */\n protected valueChangeSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for scaling up\n */\n protected scaleUpSubject: Subject<TDate> = new Subject<TDate>();\n\n /**\n * Subject used for scaling down\n */\n protected scaleDownSubject: Subject<TDate> = new Subject<TDate>();\n\n /**\n * Date api instance for displayed date\n */\n protected displayDate: DateApiObject<TDate>|undefined|null;\n\n /**\n * Currently displayed date\n */\n protected displayedDate: TDate|undefined|null;\n\n /**\n * Date api instance for max date\n */\n protected maxDateObj: DateApiObject<TDate>|undefined|null;\n\n /**\n * Date api instance for min date\n */\n protected minDateObj: DateApiObject<TDate>|undefined|null;\n\n /**\n * Gets or sets value as single value\n */\n protected get singleValue(): DateApiObject<TDate>|undefined|null\n {\n if(Array.isArray(this.value))\n {\n return null;\n }\n\n return this.value;\n }\n protected set singleValue(value: DateApiObject<TDate>|undefined|null)\n {\n this.value = value;\n }\n\n /**\n * Gets or sets value as single value\n */\n protected get rangeValue(): [DateApiObject<TDate>|null, DateApiObject<TDate>|null]|undefined|null\n {\n if(!Array.isArray(this.value))\n {\n return null;\n }\n\n return this.value;\n }\n protected set rangeValue(value: [DateApiObject<TDate>|null, DateApiObject<TDate>|null]|undefined|null)\n {\n this.value = value;\n }\n\n /**\n * Change detector instance\n */\n protected changeDetector: ChangeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Instance of date api for manipulation with date time\n */\n protected dateApi: DateApi<TDate> = inject(DATE_API) as DateApi<TDate>;\n\n //######################### public properties - implementation of DateTimePicker #########################\n\n /**\n * @inheritdoc\n */\n public value: DateTimeObjectValue<TDate>|undefined|null;\n\n /**\n * @inheritdoc\n */\n public get display(): TDate|undefined|null\n {\n return this.displayDate?.value;\n }\n public set display(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.displayDate = null;\n\n return;\n }\n\n this.displayDate = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public get maxDate(): TDate|undefined|null\n {\n return this.maxDateObj?.value;\n }\n public set maxDate(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.maxDateObj = null;\n\n return;\n }\n\n this.maxDateObj = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public get minDate(): TDate|undefined|null\n {\n return this.minDateObj?.value;\n }\n public set minDate(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.minDateObj = null;\n\n return;\n }\n\n this.minDateObj = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public canScaleUp: boolean = false;\n\n /**\n * @inheritdoc\n */\n public canScaleDown: boolean = false;\n\n /**\n * @inheritdoc\n */\n public ranged: boolean = false;\n\n /**\n * @inheritdoc\n */\n public get valueChange(): Observable<void>\n {\n return this.valueChangeSubject.asObservable();\n }\n\n /**\n * @inheritdoc\n */\n public get scaleUp(): Observable<TDate>\n {\n return this.scaleUpSubject.asObservable();\n }\n\n /**\n * @inheritdoc\n */\n public get scaleDown(): Observable<TDate>\n {\n return this.scaleDownSubject.asObservable();\n }\n\n //######################### public methods - implementation of invalidatable #########################\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n this.onRender();\n\n this.changeDetector.detectChanges();\n }\n\n //######################### protected methods #########################\n\n /**\n * Method that is being called to render changes\n */\n protected abstract onRender(): void;\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 abstract isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean;\n\n /**\n * Updates minimal and maximal value for picker\n */\n protected updateMinMax(): void\n {\n if(!this.periodData.length)\n {\n return;\n }\n\n //no min, no max\n if(!this.minDateObj && !this.maxDateObj)\n {\n this.periodData.forEach(itm => itm.disabled = false);\n\n return;\n }\n\n let restAfter = false;\n\n for(const period of this.periodData)\n {\n if(this.minDateObj?.isValid() && this.minDateObj.isAfter(period.dateObj.value) && !this.isSamePeriod(this.minDateObj, period.dateObj.value))\n {\n period.disabled = true;\n }\n\n if(restAfter || (this.maxDateObj?.isValid() && this.maxDateObj.isBefore(period.dateObj.value) && !this.isSamePeriod(this.maxDateObj, period.dateObj.value)))\n {\n restAfter = true;\n period.disabled = true;\n }\n }\n }\n\n /**\n * Sets active date\n */\n protected setActive(): void\n {\n this.periodData.forEach(itm => itm.active = false);\n\n if(!this.value)\n {\n return;\n }\n \n if(!this.ranged)\n {\n if(this.singleValue?.isValid())\n {\n const value = this.singleValue;\n const data = this.periodData.find(itm => this.isSamePeriod(itm.dateObj, value.value));\n\n if(data)\n {\n data.active = true;\n }\n }\n }\n else\n {\n //TODO: support range\n }\n }\n}"]}
|
package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js
CHANGED
|
@@ -3,11 +3,11 @@ import { POSITION } from '@anglr/common';
|
|
|
3
3
|
import { extend, isBlank, nameof } from '@jscrpt/common';
|
|
4
4
|
import { Subscription } from 'rxjs';
|
|
5
5
|
import { DATE_TIME_PICKER_OPTIONS } from '../../misc/tokens';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { DayPickerComponent } from '../dayPicker/dayPicker.component';
|
|
7
|
+
import { MonthPickerComponent } from '../monthPicker/monthPicker.component';
|
|
8
|
+
import { YearPickerComponent } from '../yearPicker/yearPicker.component';
|
|
9
9
|
import { formatDateTime, getInternalValue } from '../../../../misc/utils';
|
|
10
|
-
import {
|
|
10
|
+
import { DateTimeDirective } from '../../../dateTime/directives';
|
|
11
11
|
import { DateValueProvider } from '../../../../services';
|
|
12
12
|
import { DateTimeValueFormat } from '../../../../misc/enums';
|
|
13
13
|
import * as i0 from "@angular/core";
|
|
@@ -23,51 +23,15 @@ const CORRUPTED_CONFIG_TEXT = 'DateTime: Corrupted configuration for DateTimePic
|
|
|
23
23
|
const defaultOptions = {
|
|
24
24
|
defaultPeriod: 'day',
|
|
25
25
|
periodsDefinition: {
|
|
26
|
-
'day':
|
|
27
|
-
'month':
|
|
28
|
-
'year':
|
|
26
|
+
'day': DayPickerComponent,
|
|
27
|
+
'month': MonthPickerComponent,
|
|
28
|
+
'year': YearPickerComponent,
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* Component used for displaying date time picker
|
|
33
33
|
*/
|
|
34
|
-
export class DateTimePickerComponent extends
|
|
35
|
-
position;
|
|
36
|
-
valueProvider;
|
|
37
|
-
//######################### protected properties #########################
|
|
38
|
-
/**
|
|
39
|
-
* Current value of date time, could be string, unix timestamp, Date, TDate object, or ranged DateTimeValue
|
|
40
|
-
*/
|
|
41
|
-
ɵValue;
|
|
42
|
-
/**
|
|
43
|
-
* Internal representation of current date time value
|
|
44
|
-
*/
|
|
45
|
-
internalValue;
|
|
46
|
-
/**
|
|
47
|
-
* Subscription for changes in date time period picker
|
|
48
|
-
*/
|
|
49
|
-
periodChangesSubscription;
|
|
50
|
-
/**
|
|
51
|
-
* Options for date time picker
|
|
52
|
-
*/
|
|
53
|
-
ɵOptions;
|
|
54
|
-
/**
|
|
55
|
-
* Currently displayed period type
|
|
56
|
-
*/
|
|
57
|
-
displayedPeriodType;
|
|
58
|
-
/**
|
|
59
|
-
* Name of period which is currently displayed
|
|
60
|
-
*/
|
|
61
|
-
displayedPeriodName;
|
|
62
|
-
/**
|
|
63
|
-
* Instance of created date time period picker
|
|
64
|
-
*/
|
|
65
|
-
component;
|
|
66
|
-
//######################### protected properties - children #########################
|
|
67
|
-
/**
|
|
68
|
-
* Container used for displaying pickers for specific date time part
|
|
69
|
-
*/
|
|
70
|
-
pickerContainer;
|
|
34
|
+
export class DateTimePickerComponent extends DateTimeDirective {
|
|
71
35
|
//######################### public properties - inputs #########################
|
|
72
36
|
/**
|
|
73
37
|
* @inheritdoc
|
|
@@ -91,20 +55,20 @@ export class DateTimePickerComponent extends DateTimeSADirective {
|
|
|
91
55
|
this.ɵOptions = extend(true, {}, defaultOptions, value);
|
|
92
56
|
this.setOptions(value);
|
|
93
57
|
}
|
|
94
|
-
//######################### public properties - outputs #########################
|
|
95
|
-
/**
|
|
96
|
-
* @inheritdoc
|
|
97
|
-
*/
|
|
98
|
-
valueChange = new EventEmitter();
|
|
99
|
-
/**
|
|
100
|
-
* @inheritdoc
|
|
101
|
-
*/
|
|
102
|
-
valueSet = new EventEmitter();
|
|
103
58
|
//######################### constructor #########################
|
|
104
59
|
constructor(position, valueProvider, options) {
|
|
105
60
|
super();
|
|
106
61
|
this.position = position;
|
|
107
62
|
this.valueProvider = valueProvider;
|
|
63
|
+
//######################### public properties - outputs #########################
|
|
64
|
+
/**
|
|
65
|
+
* @inheritdoc
|
|
66
|
+
*/
|
|
67
|
+
this.valueChange = new EventEmitter();
|
|
68
|
+
/**
|
|
69
|
+
* @inheritdoc
|
|
70
|
+
*/
|
|
71
|
+
this.valueSet = new EventEmitter();
|
|
108
72
|
this.ɵOptions = extend(true, {}, defaultOptions, options);
|
|
109
73
|
this.setOptions(options);
|
|
110
74
|
if (!this.displayedPeriodType) {
|
|
@@ -283,12 +247,12 @@ export class DateTimePickerComponent extends DateTimeSADirective {
|
|
|
283
247
|
this.displayedPeriodName = this.ɵOptions.defaultPeriod;
|
|
284
248
|
this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];
|
|
285
249
|
}
|
|
286
|
-
static
|
|
287
|
-
static
|
|
250
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimePickerComponent, deps: [{ token: POSITION }, { token: i1.DateValueProvider }, { token: DATE_TIME_PICKER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
251
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.7", 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 }); }
|
|
288
252
|
}
|
|
289
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimePickerComponent, decorators: [{
|
|
290
254
|
type: Component,
|
|
291
|
-
args: [{ selector: 'date-time-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container #container
|
|
255
|
+
args: [{ selector: 'date-time-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container #container/>" }]
|
|
292
256
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
293
257
|
type: Inject,
|
|
294
258
|
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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iB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACO,UAAU,CAAC,OAA0D;QAE3E,IAAG,OAAO,EAAE,iBAAiB,EAC7B;YACI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;SAC/D;QAED,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;QACvD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACzF,CAAC;uGApWQ,uBAAuB,kBA+FZ,QAAQ,8CAER,wBAAwB;2FAjGnC,uBAAuB,gQA4CD,gBAAgB,uFC5FnD,0CAAwC;;2FDgD3B,uBAAuB;kBANnC,SAAS;+BAEI,kBAAkB,mBAEX,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 {DayPickerSAComponent} from '../dayPicker/dayPicker.component';\nimport {MonthPickerSAComponent} from '../monthPicker/monthPicker.component';\nimport {DateTimePickerOptions} from './dateTimePicker.interface';\nimport {YearPickerSAComponent} from '../yearPicker/yearPicker.component';\nimport {DateTimePicker} from '../../interfaces';\nimport {formatDateTime, getInternalValue} from '../../../../misc/utils';\nimport {DateTimeSADirective} 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': DayPickerSAComponent,\n 'month': MonthPickerSAComponent,\n 'year': YearPickerSAComponent,\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 DateTimeSADirective<TDate> implements DateTimeInputValue<TDate>, OnInit, OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Current value of date time, could be string, unix 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></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,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,mBAA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AuB,kBA+FZ,QAAQ,8CAER,wBAAwB;kGAjGnC,uBAAuB,oRA4CD,gBAAgB,uFC7FnD,4BAA0B;;2FDiDb,uBAAuB;kBAPnC,SAAS;+BAEI,kBAAkB,cAEhB,IAAI,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/>"]}
|
|
@@ -8,20 +8,20 @@ import * as i2 from "../../../../pipes/dateFormat.pipe";
|
|
|
8
8
|
/**
|
|
9
9
|
* Component used for displaying day picker
|
|
10
10
|
*/
|
|
11
|
-
export class
|
|
12
|
-
//######################### protected properties #########################
|
|
13
|
-
/**
|
|
14
|
-
* Stored this picker month data
|
|
15
|
-
*/
|
|
16
|
-
thisMonthData = [];
|
|
17
|
-
//######################### protected properties - template bindings #########################
|
|
18
|
-
/**
|
|
19
|
-
* Names of days
|
|
20
|
-
*/
|
|
21
|
-
weekdays = [];
|
|
11
|
+
export class DayPickerComponent extends DateTimePeriodPickerBase {
|
|
22
12
|
//######################### constructor #########################
|
|
23
13
|
constructor() {
|
|
24
14
|
super();
|
|
15
|
+
//######################### protected properties #########################
|
|
16
|
+
/**
|
|
17
|
+
* Stored this picker month data
|
|
18
|
+
*/
|
|
19
|
+
this.thisMonthData = [];
|
|
20
|
+
//######################### protected properties - template bindings #########################
|
|
21
|
+
/**
|
|
22
|
+
* Names of days
|
|
23
|
+
*/
|
|
24
|
+
this.weekdays = [];
|
|
25
25
|
this.weekdays = this.dateApi.weekdaysShort();
|
|
26
26
|
}
|
|
27
27
|
//######################### protected methods - template bindings #########################
|
|
@@ -132,10 +132,10 @@ export class DayPickerSAComponent extends DateTimePeriodPickerBase {
|
|
|
132
132
|
isSamePeriod(val, target) {
|
|
133
133
|
return val.isSameDay(target);
|
|
134
134
|
}
|
|
135
|
-
static
|
|
136
|
-
static
|
|
135
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DayPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
136
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.7", 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 <div class=\"weekday\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n 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</div>\r\n\r\n<div class=\"go-down-button\" *ngIf=\"canScaleDown\">\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>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: DatePipesModule }, { kind: "pipe", type: i2.DateFormatPipe, name: "dateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
137
137
|
}
|
|
138
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DayPickerComponent, decorators: [{
|
|
139
139
|
type: Component,
|
|
140
140
|
args: [{ selector: 'day-picker', host: {
|
|
141
141
|
'[class.date-time-period]': 'true',
|