@anglr/datetime 5.0.0-beta.20221020045240 → 5.0.0-beta.20221020124055

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.
Files changed (76) hide show
  1. package/changelog.md +15 -2
  2. package/es2015/src/legacy/picker/components/dayPicker/dayPicker.component.js +2 -1
  3. package/es2015/src/legacy/picker/components/dayPicker/dayPicker.component.js.map +1 -1
  4. package/es2015/src/legacy/picker/components/monthPicker/monthPicker.component.js +2 -1
  5. package/es2015/src/legacy/picker/components/monthPicker/monthPicker.component.js.map +1 -1
  6. package/es2015/src/legacy/picker/components/yearPicker/yearPicker.component.js +2 -1
  7. package/es2015/src/legacy/picker/components/yearPicker/yearPicker.component.js.map +1 -1
  8. package/es2015/src/legacy/picker/misc/datetimePicker.interface.js.map +1 -1
  9. package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +110 -0
  10. package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
  11. package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +141 -28
  12. package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
  13. package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +103 -29
  14. package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
  15. package/es2015/src/modules/dateTimePicker/components/index.js +1 -0
  16. package/es2015/src/modules/dateTimePicker/components/index.js.map +1 -1
  17. package/es2015/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +120 -0
  18. package/es2015/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -0
  19. package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +69 -15
  20. package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
  21. package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -1
  22. package/es2015/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +1 -1
  23. package/es2020/src/legacy/picker/components/dayPicker/dayPicker.component.js +2 -1
  24. package/es2020/src/legacy/picker/components/dayPicker/dayPicker.component.js.map +1 -1
  25. package/es2020/src/legacy/picker/components/monthPicker/monthPicker.component.js +2 -1
  26. package/es2020/src/legacy/picker/components/monthPicker/monthPicker.component.js.map +1 -1
  27. package/es2020/src/legacy/picker/components/yearPicker/yearPicker.component.js +2 -1
  28. package/es2020/src/legacy/picker/components/yearPicker/yearPicker.component.js.map +1 -1
  29. package/es2020/src/legacy/picker/misc/datetimePicker.interface.js.map +1 -1
  30. package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +105 -0
  31. package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
  32. package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +138 -27
  33. package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
  34. package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +101 -28
  35. package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
  36. package/es2020/src/modules/dateTimePicker/components/index.js +1 -0
  37. package/es2020/src/modules/dateTimePicker/components/index.js.map +1 -1
  38. package/es2020/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +116 -0
  39. package/es2020/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -0
  40. package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +65 -11
  41. package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
  42. package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -1
  43. package/es2020/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/legacy/picker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
  46. package/src/legacy/picker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
  47. package/src/legacy/picker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
  48. package/src/legacy/picker/misc/datetimePicker.interface.d.ts +4 -0
  49. package/src/legacy/picker/misc/datetimePicker.interface.d.ts.map +1 -1
  50. package/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.d.ts +55 -8
  51. package/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.d.ts.map +1 -1
  52. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +38 -6
  53. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
  54. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts +26 -12
  55. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
  56. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html +5 -5
  57. package/src/modules/dateTimePicker/components/index.d.ts +1 -0
  58. package/src/modules/dateTimePicker/components/index.d.ts.map +1 -1
  59. package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts +43 -0
  60. package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts.map +1 -0
  61. package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.html +13 -0
  62. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts +21 -6
  63. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
  64. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts +8 -0
  65. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -1
  66. package/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.d.ts +2 -5
  67. package/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -1
  68. package/styles/components/_date-time-picker.scss +137 -0
  69. package/version.bak +1 -1
  70. package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js +0 -2
  71. package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js.map +0 -1
  72. package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js +0 -2
  73. package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js.map +0 -1
  74. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.css +0 -27
  75. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.d.ts +0 -11
  76. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.d.ts.map +0 -1
@@ -0,0 +1,120 @@
1
+ import { Component, ChangeDetectionStrategy, Inject } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { DateTimePeriodPickerBase } from '../dateTimePeriodPickerBase';
4
+ import { DatePipesModule } from '../../../datePipes.module';
5
+ import { FORMAT_PROVIDER } from '../../../../misc/tokens';
6
+ import * as i0 from "@angular/core";
7
+ import * as i1 from "@angular/common";
8
+ import * as i2 from "../../../../pipes/dateFormat.pipe";
9
+ /**
10
+ * Component used for displaying month picker
11
+ */
12
+ export class MonthPickerSAComponent extends DateTimePeriodPickerBase {
13
+ constructor(formatProvider) {
14
+ super();
15
+ this.formatProvider = formatProvider;
16
+ }
17
+ //######################### protected methods - template bindings #########################
18
+ /**
19
+ * Selects month as value of day time picker
20
+ * @param monthData - Month data that were selected
21
+ */
22
+ selectMonth(monthData) {
23
+ var _a, _b, _c;
24
+ if (monthData.disabled) {
25
+ return;
26
+ }
27
+ if (!this.value) {
28
+ this.value = (_b = (_a = this.displayDate) === null || _a === void 0 ? void 0 : _a.clone()) !== null && _b !== void 0 ? _b : this.dateApi.getValue((_c = this.display) !== null && _c !== void 0 ? _c : new Date());
29
+ }
30
+ //single value
31
+ if (!Array.isArray(this.value)) {
32
+ this.value.month(monthData.dateObj.month());
33
+ this.value.updateOriginal();
34
+ this.valueChangeSubject.next();
35
+ }
36
+ else {
37
+ //TODO: range
38
+ }
39
+ this.render();
40
+ this.changeDetector.detectChanges();
41
+ }
42
+ /**
43
+ * Changes displayed year to next year
44
+ */
45
+ nextYear() {
46
+ var _a;
47
+ (_a = this.displayDate) === null || _a === void 0 ? void 0 : _a.addYears(1).updateOriginal();
48
+ this.render();
49
+ }
50
+ /**
51
+ * Changes displayed year to previous year
52
+ */
53
+ previousYear() {
54
+ var _a;
55
+ (_a = this.displayDate) === null || _a === void 0 ? void 0 : _a.subtractYears(1).updateOriginal();
56
+ this.render();
57
+ }
58
+ //######################### protected methods #########################
59
+ /**
60
+ * Renders current day picker data
61
+ */
62
+ render() {
63
+ var _a, _b;
64
+ //same year only data change
65
+ if (this.displayedDate && ((_a = this.displayDate) === null || _a === void 0 ? void 0 : _a.isSameYear(this.displayedDate))) {
66
+ this.setActive();
67
+ this.updateMinMax();
68
+ return;
69
+ }
70
+ this.displayedDate = (_b = this.displayDate) === null || _b === void 0 ? void 0 : _b.value;
71
+ this.periodData = [];
72
+ if (!this.displayDate) {
73
+ return;
74
+ }
75
+ const monthOfYear = this.displayDate.startOfYear().updateOriginal();
76
+ for (let x = 0; x < 12; x++) {
77
+ this.periodData.push({
78
+ active: false,
79
+ disabled: false,
80
+ date: monthOfYear.value,
81
+ name: monthOfYear.format(this.dateApi.getFormat(this.formatProvider.monthNameShort)),
82
+ dateObj: monthOfYear.clone(),
83
+ });
84
+ monthOfYear.addMonths(1);
85
+ }
86
+ this.displayDate.resetOriginal();
87
+ this.setActive();
88
+ this.updateMinMax();
89
+ }
90
+ //######################### protected methods - overrides #########################
91
+ /**
92
+ * @inheritdoc
93
+ */
94
+ onRender() {
95
+ this.render();
96
+ }
97
+ /**
98
+ * Tests whether provided value is in same period target value
99
+ * @param val - Tested value
100
+ * @param target - Target value to be tested against
101
+ */
102
+ isSamePeriod(val, target) {
103
+ return val.isSameMonth(target);
104
+ }
105
+ }
106
+ MonthPickerSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: MonthPickerSAComponent, deps: [{ token: FORMAT_PROVIDER }], target: i0.ɵɵFactoryTarget.Component });
107
+ MonthPickerSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: MonthPickerSAComponent, 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 <div *ngFor=\"let month of periodData\"\r\n 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</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: DatePipesModule }, { kind: "pipe", type: i2.DateFormatPipe, name: "dateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: MonthPickerSAComponent, decorators: [{
109
+ type: Component,
110
+ args: [{ selector: 'month-picker', host: {
111
+ '[class.date-time-period]': 'true',
112
+ }, standalone: true, imports: [
113
+ CommonModule,
114
+ DatePipesModule,
115
+ ], 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 <div *ngFor=\"let month of periodData\"\r\n 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</div>" }]
116
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
117
+ type: Inject,
118
+ args: [FORMAT_PROVIDER]
119
+ }] }]; } });
120
+ //# sourceMappingURL=monthPicker.component.js.map
@@ -0,0 +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;AACzE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;;;;AAGxD;;GAEG;AAiBH,MAAM,OAAO,sBAAwC,SAAQ,wBAAiD;IAE1G,YAA+C,cAA8B;QAEzE,KAAK,EAAE,CAAC;QAFmC,mBAAc,GAAd,cAAc,CAAgB;IAG7E,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACO,WAAW,CA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0B,EAAE,MAAM;qBACrC,cACW,IAAI,WAEhB;wBACI,YAAY;wBACZ,eAAe;qBAClB,mBACgB,uBAAuB,CAAC,MAAM;;0BAIlC,MAAM;2BAAC,eAAe","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject} from '@angular/core';\nimport {CommonModule} from '@angular/common';\n\nimport {DateTimePicker} from '../../interfaces';\nimport {DateTimePeriodPickerBase} from '../dateTimePeriodPickerBase';\nimport {DatePipesModule} from '../../../datePipes.module';\nimport {MonthData} from '../../../../legacy/picker/interfaces';\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 standalone: true,\n imports:\n [\n CommonModule,\n DatePipesModule,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MonthPickerSAComponent<TDate = unknown> extends DateTimePeriodPickerBase<MonthData<TDate>, TDate> implements DateTimePicker<TDate>\n{\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 if(!this.value)\n {\n this.value = this.displayDate?.clone() ?? this.dateApi.getValue(this.display ?? new Date());\n }\n\n //single value\n if(!Array.isArray(this.value))\n {\n this.value.month(monthData.dateObj.month());\n this.value.updateOriginal();\n\n this.valueChangeSubject.next();\n }\n else\n {\n //TODO: range\n }\n\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}","<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 <div *ngFor=\"let month of periodData\"\r\n 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</div>"]}
@@ -3,10 +3,11 @@ import { Directive, ElementRef, Inject, Input, Optional, ViewContainerRef } from
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import { POSITION, applyPositionResult, PositionPlacement } from '@anglr/common';
5
5
  import { extend, nameof, isDescendant, BindThis } from '@jscrpt/common';
6
- import { lastValueFrom, Subscription } from 'rxjs';
6
+ import { lastValueFrom } from 'rxjs';
7
7
  import { DATE_TIME_INPUT } from '../../../../misc/tokens';
8
8
  import { DateTimePickerComponent } from '../../components';
9
9
  import { DATE_TIME_PICKER_DIRECTIVE_OPTIONS } from '../../misc/tokens';
10
+ import { DateTimeBase } from '../../../dateTime/directives';
10
11
  import * as i0 from "@angular/core";
11
12
  /**
12
13
  * Default options for date time picker directive
@@ -15,16 +16,19 @@ const defaultOptions = {
15
16
  absolute: true,
16
17
  alwaysVisible: false,
17
18
  closeOnValueSelect: true,
19
+ closeOnBlur: true,
18
20
  disabled: false,
19
21
  positionOptions: PositionPlacement.BottomStart,
20
22
  showOnFocus: true,
23
+ pickerCssClass: null,
21
24
  };
22
25
  /**
23
26
  * Directive that is used for displaying and attaching date time picker
24
27
  */
25
- export class DateTimePickerDirective {
28
+ export class DateTimePickerDirective extends DateTimeBase {
26
29
  //######################### constructor #########################
27
30
  constructor(viewContainer, element, input, document, position, options) {
31
+ super();
28
32
  this.viewContainer = viewContainer;
29
33
  this.element = element;
30
34
  this.input = input;
@@ -35,10 +39,6 @@ export class DateTimePickerDirective {
35
39
  * Indication whether is value changes disabled
36
40
  */
37
41
  this.valueChangeDisabled = false;
38
- /**
39
- * Subscriptions created during initialization
40
- */
41
- this.initSubscriptions = new Subscription();
42
42
  this.ɵWithPickerOptions = extend(true, {}, defaultOptions, options);
43
43
  }
44
44
  //######################### public properties - inputs #########################
@@ -70,6 +70,11 @@ export class DateTimePickerDirective {
70
70
  this.showPicker();
71
71
  }
72
72
  }));
73
+ this.initSubscriptions.add(this.input.blur.subscribe(() => {
74
+ if (this.withPickerOptions.closeOnBlur) {
75
+ this.hidePicker();
76
+ }
77
+ }));
73
78
  });
74
79
  }
75
80
  //######################### public methods - implementation of OnDestroy #########################
@@ -77,6 +82,7 @@ export class DateTimePickerDirective {
77
82
  * Called when component is destroyed
78
83
  */
79
84
  ngOnDestroy() {
85
+ super.ngOnDestroy();
80
86
  this.hidePicker();
81
87
  this.initSubscriptions.unsubscribe();
82
88
  }
@@ -102,17 +108,27 @@ export class DateTimePickerDirective {
102
108
  this.input.value = this.component.value;
103
109
  this.input.valueChange.emit();
104
110
  this.valueChangeDisabled = false;
111
+ if (this.ɵWithPickerOptions.closeOnValueSelect) {
112
+ this.hidePicker();
113
+ }
105
114
  }
106
115
  });
107
116
  this.document.addEventListener('click', this.handleClickOutside);
117
+ this.componentElement.addEventListener('mousedown', this.handleClickInside);
118
+ if (this.ɵWithPickerOptions.pickerCssClass) {
119
+ this.componentElement.classList.add(this.ɵWithPickerOptions.pickerCssClass);
120
+ }
108
121
  const result = yield lastValueFrom(this.position.placeElement(this.componentElement, this.element.nativeElement, {
109
122
  placement: this.withPickerOptions.positionOptions,
110
123
  }));
111
124
  applyPositionResult(result);
112
125
  this.setPickerValue();
113
- // this.componentRef.setInput(nameof<DateTimePickerComponent>('valueFormat'), this.input.);
114
- // this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);
115
- // this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);
126
+ this.componentRef.setInput(nameof('options'), this.pickerOptions);
127
+ this.componentRef.setInput(nameof('valueFormat'), this.dateTimeData.valueFormat);
128
+ this.componentRef.setInput(nameof('format'), this.dateTimeData.format);
129
+ this.componentRef.setInput(nameof('customFormat'), this.dateTimeData.customFormat);
130
+ this.componentRef.setInput(nameof('minDateTime'), this.dateTimeData.minDateTime);
131
+ this.componentRef.setInput(nameof('maxDateTime'), this.dateTimeData.maxDateTime);
116
132
  this.componentRef.changeDetectorRef.detectChanges();
117
133
  });
118
134
  }
@@ -120,16 +136,17 @@ export class DateTimePickerDirective {
120
136
  * Shows date time picker
121
137
  */
122
138
  hidePicker() {
123
- var _a, _b, _c;
139
+ var _a, _b, _c, _d;
124
140
  if (this.withPickerOptions.alwaysVisible) {
125
141
  return;
126
142
  }
127
- (_a = this.valueChangeSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
143
+ (_a = this.componentElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('mousedown', this.handleClickInside);
144
+ (_b = this.valueChangeSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
128
145
  this.valueChangeSubscription = null;
129
146
  this.component = null;
130
- (_b = this.componentRef) === null || _b === void 0 ? void 0 : _b.destroy();
147
+ (_c = this.componentRef) === null || _c === void 0 ? void 0 : _c.destroy();
131
148
  this.componentRef = null;
132
- (_c = this.componentElement) === null || _c === void 0 ? void 0 : _c.remove();
149
+ (_d = this.componentElement) === null || _d === void 0 ? void 0 : _d.remove();
133
150
  this.componentElement = null;
134
151
  this.document.removeEventListener('click', this.handleClickOutside);
135
152
  }
@@ -160,15 +177,50 @@ export class DateTimePickerDirective {
160
177
  this.hidePicker();
161
178
  }
162
179
  }
180
+ /**
181
+ * Handles clicking inside of picker element
182
+ * @param event - Event that occured
183
+ */
184
+ handleClickInside(event) {
185
+ event.preventDefault();
186
+ event.stopPropagation();
187
+ }
188
+ //######################### protected methods - overrides #########################
189
+ /**
190
+ * @inheritdoc
191
+ */
192
+ onMaxDateTimeChange() {
193
+ if (!this.componentRef) {
194
+ return;
195
+ }
196
+ this.componentRef.setInput(nameof('maxDateTime'), this.dateTimeData.maxDateTime);
197
+ this.componentRef.changeDetectorRef.detectChanges();
198
+ }
199
+ /**
200
+ * @inheritdoc
201
+ */
202
+ onMinDateTimeChange() {
203
+ if (!this.componentRef) {
204
+ return;
205
+ }
206
+ this.componentRef.setInput(nameof('minDateTime'), this.dateTimeData.minDateTime);
207
+ this.componentRef.changeDetectorRef.detectChanges();
208
+ }
163
209
  }
164
210
  DateTimePickerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.ElementRef }, { token: DATE_TIME_INPUT }, { token: DOCUMENT }, { token: POSITION }, { token: DATE_TIME_PICKER_DIRECTIVE_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
165
- DateTimePickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.6", type: DateTimePickerDirective, selector: "[dateTime][withPicker]", inputs: { withPickerOptions: "withPickerOptions" }, exportAs: ["dateTimePicker"], ngImport: i0 });
211
+ DateTimePickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.6", type: DateTimePickerDirective, selector: "[dateTime][withPicker]", inputs: { withPickerOptions: "withPickerOptions", pickerOptions: "pickerOptions" }, exportAs: ["dateTimePicker"], usesInheritance: true, ngImport: i0 });
166
212
  __decorate([
167
213
  BindThis,
168
214
  __metadata("design:type", Function),
169
215
  __metadata("design:paramtypes", [MouseEvent]),
170
216
  __metadata("design:returntype", void 0)
171
217
  ], DateTimePickerDirective.prototype, "handleClickOutside", null);
218
+ __decorate([
219
+ BindThis,
220
+ __metadata("design:type", Function),
221
+ __metadata("design:paramtypes", [MouseEvent]),
222
+ __metadata("design:returntype", void 0)
223
+ ], DateTimePickerDirective.prototype, "handleClickInside", null);
172
224
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerDirective, decorators: [{
173
225
  type: Directive,
174
226
  args: [{
@@ -191,5 +243,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
191
243
  type: Optional
192
244
  }] }]; }, propDecorators: { withPickerOptions: [{
193
245
  type: Input
194
- }], handleClickOutside: [] } });
246
+ }], pickerOptions: [{
247
+ type: Input
248
+ }], handleClickOutside: [], handleClickInside: [] } });
195
249
  //# sourceMappingURL=dateTimePicker.directive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateTimePicker.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAe,SAAS,EAAE,UAAU,EAAmB,MAAM,EAAE,KAAK,EAAqB,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACjJ,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAW,QAAQ,EAAE,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACzF,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAGjD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAC,kCAAkC,EAAC,MAAM,mBAAmB,CAAC;;AAErE;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,KAAK;IACpB,kBAAkB,EAAE,IAAI;IACxB,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,iBAAiB,CAAC,WAAW;IAC9C,WAAW,EAAE,IAAI;CACpB,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,uBAAuB;IAsDhC,iEAAiE;IACjE,YAAsB,aAA+B,EAC/B,OAAgC,EACP,KAA2B,EAClC,QAAkB,EAClB,QAAkB,EACU,OAAwC;QALtF,kBAAa,GAAb,aAAa,CAAkB;QAC/B,YAAO,GAAP,OAAO,CAAyB;QACP,UAAK,GAAL,KAAK,CAAsB;QAClC,aAAQ,GAAR,QAAQ,CAAU;QAClB,aAAQ,GAAR,QAAQ,CAAU;QAzD1D,0EAA0E;QAE1E;;WAEG;QACO,wBAAmB,GAAY,KAAK,CAAC;QAO/C;;WAEG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AC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM;gBAClC,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAqB,CAAC,CAAC,CAAC,EAC5F;YACI,IAAI,CAAC,UAAU,EAAE,CAAC;SACrB;IACL,CAAC;;oHAnNQ,uBAAuB,4EAyDZ,eAAe,aACf,QAAQ,aACR,QAAQ,aACR,kCAAkC;wGA5D7C,uBAAuB;;IAoM/B,QAAQ;;qCAC2B,UAAU;;iEAc7C;2FAnNQ,uBAAuB;kBALnC,SAAS;mBACV;oBACI,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE,gBAAgB;iBAC7B;;0BA0DgB,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,kCAAkC;;0BAAG,QAAQ;4CAftD,iBAAiB;sBAD3B,KAAK;gBAyJI,kBAAkB","sourcesContent":["import {ComponentRef, Directive, ElementRef, EmbeddedViewRef, Inject, Input, OnDestroy, OnInit, Optional, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {Position, POSITION, applyPositionResult, PositionPlacement} from '@anglr/common';\nimport {extend, nameof, isDescendant, BindThis} from '@jscrpt/common';\nimport {lastValueFrom, Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../../../interfaces';\nimport {DATE_TIME_INPUT} from '../../../../misc/tokens';\nimport {DateTimePickerComponent} from '../../components';\nimport {DateTimePickerDirectiveOptions} from './dateTimePicker.interface';\nimport {DATE_TIME_PICKER_DIRECTIVE_OPTIONS} from '../../misc/tokens';\n\n/**\n * Default options for date time picker directive\n */\nconst defaultOptions: DateTimePickerDirectiveOptions =\n{\n absolute: true,\n alwaysVisible: false,\n closeOnValueSelect: true,\n disabled: false,\n positionOptions: PositionPlacement.BottomStart,\n showOnFocus: true,\n};\n\n/**\n * Directive that is used for displaying and attaching date time picker\n */\n@Directive(\n{\n selector: '[dateTime][withPicker]',\n exportAs: 'dateTimePicker'\n})\nexport class DateTimePickerDirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Indication whether is value changes disabled\n */\n protected valueChangeDisabled: boolean = false;\n\n /**\n * Options for date time picker directive\n */\n protected ɵWithPickerOptions: DateTimePickerDirectiveOptions;\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n /**\n * Date time picker component reference\n */\n protected componentRef: ComponentRef<DateTimePickerComponent<TDate>>|undefined|null;\n\n /**\n * Instance of date time picker component\n */\n protected component: DateTimePickerComponent<TDate>|undefined|null;\n\n /**\n * Instance of date time picker element\n */\n protected componentElement: HTMLElement|undefined|null;\n\n /**\n * Subscription for value changes in picker\n */\n protected valueChangeSubscription: Subscription|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets options for date time picker directive\n */\n @Input()\n public get withPickerOptions(): Partial<DateTimePickerDirectiveOptions>\n {\n return this.ɵWithPickerOptions;\n }\n public set withPickerOptions(value: Partial<DateTimePickerDirectiveOptions>)\n {\n this.ɵWithPickerOptions = extend(true, {}, this.ɵWithPickerOptions, value);\n }\n\n //######################### constructor #########################\n constructor(protected viewContainer: ViewContainerRef,\n protected element: ElementRef<HTMLElement>,\n @Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DOCUMENT) protected document: Document,\n @Inject(POSITION) protected position: Position,\n @Inject(DATE_TIME_PICKER_DIRECTIVE_OPTIONS) @Optional() options?: DateTimePickerDirectiveOptions,)\n {\n this.ɵWithPickerOptions = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public async ngOnInit(): Promise<void>\n {\n if(this.withPickerOptions.alwaysVisible)\n {\n this.showPicker();\n }\n\n this.initSubscriptions.add(this.input.valueChange.subscribe(() =>\n {\n this.setPickerValue();\n this.componentRef?.changeDetectorRef.detectChanges();\n }));\n\n this.initSubscriptions.add(this.input.focus.subscribe(() =>\n {\n if(this.withPickerOptions.showOnFocus)\n {\n this.showPicker();\n }\n }));\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.hidePicker();\n this.initSubscriptions.unsubscribe();\n }\n\n //######################### public methods #########################\n\n /**\n * Hides date time picker\n */\n public async showPicker(): Promise<void>\n {\n if(this.withPickerOptions.disabled || this.componentRef)\n {\n return;\n }\n\n this.componentRef = this.viewContainer.createComponent(DateTimePickerComponent<TDate>);\n this.componentElement = (this.componentRef?.hostView as EmbeddedViewRef<DateTimePickerComponent<TDate>>).rootNodes[0] as HTMLElement;\n this.component = this.componentRef.instance;\n\n if(this.withPickerOptions.absolute)\n {\n this.document.body.append(this.componentElement);\n }\n\n this.valueChangeSubscription = this.component.valueChange.subscribe(() =>\n {\n if(this.component)\n {\n this.valueChangeDisabled = true;\n this.input.value = this.component.value;\n this.input.valueChange.emit();\n this.valueChangeDisabled = false;\n }\n });\n\n this.document.addEventListener('click', this.handleClickOutside);\n\n const result = await lastValueFrom(this.position.placeElement(this.componentElement, this.element.nativeElement,\n {\n placement: this.withPickerOptions.positionOptions,\n }));\n\n applyPositionResult(result);\n this.setPickerValue();\n // this.componentRef.setInput(nameof<DateTimePickerComponent>('valueFormat'), this.input.);\n // this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);\n // this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);\n this.componentRef.changeDetectorRef.detectChanges();\n }\n\n /**\n * Shows date time picker\n */\n public hidePicker(): void\n {\n if(this.withPickerOptions.alwaysVisible)\n {\n return;\n }\n\n this.valueChangeSubscription?.unsubscribe();\n this.valueChangeSubscription = null;\n\n this.component = null;\n\n this.componentRef?.destroy();\n this.componentRef = null;\n\n this.componentElement?.remove();\n this.componentElement = null;\n\n this.document.removeEventListener('click', this.handleClickOutside);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets all picker value\n */\n protected setPickerValue(): void\n {\n if(this.valueChangeDisabled)\n {\n return;\n }\n\n if(this.componentRef)\n {\n this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);\n }\n }\n\n /**\n * Handles clicking outside of picker\n * @param event - Event that occured\n */\n @BindThis\n protected handleClickOutside(event: MouseEvent): void\n {\n if(!this.componentElement)\n {\n return;\n }\n\n if(this.componentElement != event.target &&\n !isDescendant(this.componentElement, event.target as HTMLElement) &&\n (!this.input.element || (this.input.element != event.target &&\n !isDescendant(this.input.element, event.target as HTMLElement))))\n {\n this.hidePicker();\n }\n }\n}"]}
1
+ {"version":3,"file":"dateTimePicker.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAe,SAAS,EAAE,UAAU,EAAmB,MAAM,EAAE,KAAK,EAAqB,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACjJ,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAW,QAAQ,EAAE,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACzF,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAC,aAAa,EAAe,MAAM,MAAM,CAAC;AAGjD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAC,kCAAkC,EAAC,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC;;AAE1D;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,QAAQ,EAAE,I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0B,aAAa,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAC1G,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;IACxD,CAAC;IAED;;OAEG;IACgB,mBAAmB;QAElC,IAAG,CAAC,IAAI,CAAC,YAAY,EACrB;YACI,OAAO;SACV;QAED,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAA0B,aAAa,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAC1G,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;IACxD,CAAC;;oHA1RQ,uBAAuB,4EA0DZ,eAAe,aACf,QAAQ,aACR,QAAQ,aAER,kCAAkC;wGA9D7C,uBAAuB;;IAkO/B,QAAQ;;qCAC2B,UAAU;;iEAc7C;;IAMA,QAAQ;;qCAC0B,UAAU;;gEAI5C;2FA5PQ,uBAAuB;kBALnC,SAAS;mBACV;oBACI,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE,gBAAgB;iBAC7B;;0BA2DgB,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BAEf,MAAM;2BAAC,kCAAkC;;0BAAG,QAAQ;4CAtBtD,iBAAiB;sBAD3B,KAAK;gBAcC,aAAa;sBADnB,KAAK;gBA+KI,kBAAkB,MAqBlB,iBAAiB","sourcesContent":["import {ComponentRef, Directive, ElementRef, EmbeddedViewRef, Inject, Input, OnDestroy, OnInit, Optional, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {Position, POSITION, applyPositionResult, PositionPlacement} from '@anglr/common';\nimport {extend, nameof, isDescendant, BindThis} from '@jscrpt/common';\nimport {lastValueFrom, Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../../../interfaces';\nimport {DATE_TIME_INPUT} from '../../../../misc/tokens';\nimport {DateTimePickerComponent} from '../../components';\nimport {DateTimePickerOptions} from '../../components/dateTimePicker/dateTimePicker.interface';\nimport {DateTimePickerDirectiveOptions} from './dateTimePicker.interface';\nimport {DATE_TIME_PICKER_DIRECTIVE_OPTIONS} from '../../misc/tokens';\nimport {DateTimeBase} from '../../../dateTime/directives';\n\n/**\n * Default options for date time picker directive\n */\nconst defaultOptions: DateTimePickerDirectiveOptions =\n{\n absolute: true,\n alwaysVisible: false,\n closeOnValueSelect: true,\n closeOnBlur: true,\n disabled: false,\n positionOptions: PositionPlacement.BottomStart,\n showOnFocus: true,\n pickerCssClass: null,\n};\n\n/**\n * Directive that is used for displaying and attaching date time picker\n */\n@Directive(\n{\n selector: '[dateTime][withPicker]',\n exportAs: 'dateTimePicker'\n})\nexport class DateTimePickerDirective<TDate = unknown> extends DateTimeBase<TDate> implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Indication whether is value changes disabled\n */\n protected valueChangeDisabled: boolean = false;\n\n /**\n * Options for date time picker directive\n */\n protected ɵWithPickerOptions: DateTimePickerDirectiveOptions;\n\n /**\n * Date time picker component reference\n */\n protected componentRef: ComponentRef<DateTimePickerComponent<TDate>>|undefined|null;\n\n /**\n * Instance of date time picker component\n */\n protected component: DateTimePickerComponent<TDate>|undefined|null;\n\n /**\n * Instance of date time picker element\n */\n protected componentElement: HTMLElement|undefined|null;\n\n /**\n * Subscription for value changes in picker\n */\n protected valueChangeSubscription: Subscription|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets options for date time picker directive\n */\n @Input()\n public get withPickerOptions(): Partial<DateTimePickerDirectiveOptions>\n {\n return this.ɵWithPickerOptions;\n }\n public set withPickerOptions(value: Partial<DateTimePickerDirectiveOptions>)\n {\n this.ɵWithPickerOptions = extend(true, {}, this.ɵWithPickerOptions, value);\n }\n\n /**\n * Options for date time picker component\n */\n @Input()\n public pickerOptions: Partial<DateTimePickerOptions<TDate>>|undefined|null;\n\n //######################### constructor #########################\n constructor(protected viewContainer: ViewContainerRef,\n protected element: ElementRef<HTMLElement>,\n @Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DOCUMENT) protected document: Document,\n @Inject(POSITION) protected position: Position,\n\n @Inject(DATE_TIME_PICKER_DIRECTIVE_OPTIONS) @Optional() options?: DateTimePickerDirectiveOptions,)\n {\n super();\n\n this.ɵWithPickerOptions = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public async ngOnInit(): Promise<void>\n {\n if(this.withPickerOptions.alwaysVisible)\n {\n this.showPicker();\n }\n\n this.initSubscriptions.add(this.input.valueChange.subscribe(() =>\n {\n this.setPickerValue();\n this.componentRef?.changeDetectorRef.detectChanges();\n }));\n\n this.initSubscriptions.add(this.input.focus.subscribe(() =>\n {\n if(this.withPickerOptions.showOnFocus)\n {\n this.showPicker();\n }\n }));\n\n this.initSubscriptions.add(this.input.blur.subscribe(() =>\n {\n if(this.withPickerOptions.closeOnBlur)\n {\n this.hidePicker();\n }\n }));\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public override ngOnDestroy(): void\n {\n super.ngOnDestroy();\n\n this.hidePicker();\n this.initSubscriptions.unsubscribe();\n }\n\n //######################### public methods #########################\n\n /**\n * Hides date time picker\n */\n public async showPicker(): Promise<void>\n {\n if(this.withPickerOptions.disabled || this.componentRef)\n {\n return;\n }\n\n this.componentRef = this.viewContainer.createComponent(DateTimePickerComponent<TDate>);\n this.componentElement = (this.componentRef?.hostView as EmbeddedViewRef<DateTimePickerComponent<TDate>>).rootNodes[0] as HTMLElement;\n this.component = this.componentRef.instance;\n\n if(this.withPickerOptions.absolute)\n {\n this.document.body.append(this.componentElement);\n }\n\n this.valueChangeSubscription = this.component.valueChange.subscribe(() =>\n {\n if(this.component)\n {\n this.valueChangeDisabled = true;\n this.input.value = this.component.value;\n this.input.valueChange.emit();\n this.valueChangeDisabled = false;\n\n if(this.ɵWithPickerOptions.closeOnValueSelect)\n {\n this.hidePicker();\n }\n }\n });\n\n this.document.addEventListener('click', this.handleClickOutside);\n this.componentElement.addEventListener('mousedown', this.handleClickInside);\n\n if(this.ɵWithPickerOptions.pickerCssClass)\n {\n this.componentElement.classList.add(this.ɵWithPickerOptions.pickerCssClass);\n }\n\n const result = await lastValueFrom(this.position.placeElement(this.componentElement, this.element.nativeElement,\n {\n placement: this.withPickerOptions.positionOptions,\n }));\n\n applyPositionResult(result);\n this.setPickerValue();\n this.componentRef.setInput(nameof<DateTimePickerComponent>('options'), this.pickerOptions);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('valueFormat'), this.dateTimeData.valueFormat);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('format'), this.dateTimeData.format);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('customFormat'), this.dateTimeData.customFormat);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('minDateTime'), this.dateTimeData.minDateTime);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('maxDateTime'), this.dateTimeData.maxDateTime);\n this.componentRef.changeDetectorRef.detectChanges();\n }\n\n /**\n * Shows date time picker\n */\n public hidePicker(): void\n {\n if(this.withPickerOptions.alwaysVisible)\n {\n return;\n }\n \n this.componentElement?.removeEventListener('mousedown', this.handleClickInside);\n \n this.valueChangeSubscription?.unsubscribe();\n this.valueChangeSubscription = null;\n \n this.component = null;\n\n this.componentRef?.destroy();\n this.componentRef = null;\n\n this.componentElement?.remove();\n this.componentElement = null;\n\n this.document.removeEventListener('click', this.handleClickOutside);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets all picker value\n */\n protected setPickerValue(): void\n {\n if(this.valueChangeDisabled)\n {\n return;\n }\n\n if(this.componentRef)\n {\n this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);\n }\n }\n\n /**\n * Handles clicking outside of picker\n * @param event - Event that occured\n */\n @BindThis\n protected handleClickOutside(event: MouseEvent): void\n {\n if(!this.componentElement)\n {\n return;\n }\n\n if(this.componentElement != event.target &&\n !isDescendant(this.componentElement, event.target as HTMLElement) &&\n (!this.input.element || (this.input.element != event.target &&\n !isDescendant(this.input.element, event.target as HTMLElement))))\n {\n this.hidePicker();\n }\n }\n\n /**\n * Handles clicking inside of picker element\n * @param event - Event that occured\n */\n @BindThis\n protected handleClickInside(event: MouseEvent): void\n {\n event.preventDefault();\n event.stopPropagation();\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override onMaxDateTimeChange(): void\n {\n if(!this.componentRef)\n {\n return;\n }\n\n this.componentRef.setInput(nameof<DateTimePickerComponent>('maxDateTime'), this.dateTimeData.maxDateTime);\n this.componentRef.changeDetectorRef.detectChanges();\n }\n\n /**\n * @inheritdoc\n */\n protected override onMinDateTimeChange(): void\n {\n if(!this.componentRef)\n {\n return;\n }\n\n this.componentRef.setInput(nameof<DateTimePickerComponent>('minDateTime'), this.dateTimeData.minDateTime);\n this.componentRef.changeDetectorRef.detectChanges();\n }\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {PositionPlacement} from '@anglr/common';\n\n/**\n * Defintion of date time picker directive options\n */\nexport interface DateTimePickerDirectiveOptions\n{\n /**\n * Indication whether close picker on value selection\n */\n closeOnValueSelect: boolean;\n\n /**\n * Indication whether display picker when date time input gets focus\n */\n showOnFocus: boolean;\n\n /**\n * Indication whether is picker always visible, mostly used for debugging\n */\n alwaysVisible: boolean;\n\n /**\n * Indication whether picker is disabled, if true, you cant display picker\n */\n disabled: boolean;\n\n /**\n * Indication whether use absolute global positioning of picker\n */\n absolute: boolean;\n\n /**\n * Position options that are used to position picker\n */\n positionOptions: Partial<PositionPlacement>;\n}"]}
1
+ {"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {PositionPlacement} from '@anglr/common';\n\n/**\n * Defintion of date time picker directive options\n */\nexport interface DateTimePickerDirectiveOptions\n{\n /**\n * Indication whether close picker on value selection\n */\n closeOnValueSelect: boolean;\n\n /**\n * Indication whether close picker when date time input loses focus\n */\n closeOnBlur: boolean;\n\n /**\n * Indication whether display picker when date time input gets focus\n */\n showOnFocus: boolean;\n\n /**\n * Indication whether is picker always visible, mostly used for debugging\n */\n alwaysVisible: boolean;\n\n /**\n * Indication whether picker is disabled, if true, you cant display picker\n */\n disabled: boolean;\n\n /**\n * Indication whether use absolute global positioning of picker\n */\n absolute: boolean;\n\n /**\n * Position options that are used to position picker\n */\n positionOptions: Partial<PositionPlacement>;\n\n /**\n * Custom css class that is being added to picker component\n */\n pickerCssClass: string|undefined|null;\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Observable} from 'rxjs';\n\nimport {DateTimeObjectValue} from '../../../../misc/types';\n\n/**\n * Describes date time picker API for each date time period\n */\nexport interface DateTimePicker<TDate = unknown, TOptions = unknown>\n{\n /**\n * Value of date time picker\n */\n value: DateTimeObjectValue<TDate>|undefined|null;\n\n /**\n * Options for date time picker period\n */\n options: TOptions|undefined|null;\n\n /**\n * Date that describes which date should be displayed\n */\n display: TDate|undefined|null;\n\n /**\n * Max allowed date\n */\n maxDate: TDate|undefined|null;\n\n /**\n * Min allowed date to be selected\n */\n minDate: TDate|undefined|null;\n\n /**\n * Indication whether picker can display scale date time period up\n */\n canScaleUp: boolean;\n\n /**\n * Indication whether picker can display scale date time period down\n */\n canScaleDown: boolean;\n\n /**\n * Occurs when date time picker value changes\n */\n readonly valueChange: Observable<void>; \n\n /**\n * Occurs when period should be scaled up\n */\n readonly scaleUp: Observable<TDate>;\n\n /**\n * Occurs when period should be scaled down\n */\n readonly scaleDown: Observable<TDate>;\n}"]}
1
+ {"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Invalidatable} from '@jscrpt/common';\nimport {Observable} from 'rxjs';\n\nimport {DateTimeObjectValue} from '../../../../misc/types';\n\n/**\n * Describes date time picker API for each date time period\n */\nexport interface DateTimePicker<TDate = unknown> extends Invalidatable\n{\n /**\n * Value of date time picker\n */\n value: DateTimeObjectValue<TDate>|undefined|null;\n\n /**\n * Date that describes which date should be displayed\n */\n display: TDate|undefined|null;\n\n /**\n * Max allowed date\n */\n maxDate: TDate|undefined|null;\n\n /**\n * Min allowed date to be selected\n */\n minDate: TDate|undefined|null;\n\n /**\n * Indication whether picker can display scale date time period up\n */\n canScaleUp: boolean;\n\n /**\n * Indication whether picker can display scale date time period down\n */\n canScaleDown: boolean;\n\n /**\n * Occurs when date time picker value changes\n */\n readonly valueChange: Observable<void>; \n\n /**\n * Occurs when period should be scaled up\n */\n readonly scaleUp: Observable<TDate>;\n\n /**\n * Occurs when period should be scaled down\n */\n readonly scaleDown: Observable<TDate>;\n}"]}
@@ -148,7 +148,8 @@ export class DateTimeDayPickerComponent extends PickerBaseComponent {
148
148
  otherMonth: otherMonth,
149
149
  today: this.displayDate.isSameDay(today),
150
150
  weekend: this.displayDate.isWeekend(),
151
- day: day
151
+ day: day,
152
+ dateObj: this.displayDate.clone(),
152
153
  };
153
154
  this.periodData.push(data);
154
155
  if (!otherMonth) {
@@ -1 +1 @@
1
- {"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/dayPicker/dayPicker.component.ts","../../../../../../src/legacy/picker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iB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AAC,GAAyB,EAAE,MAAa;QAE5D,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;;uHAjPQ,0BAA0B,kBA0Bf,QAAQ;2GA1BnB,0BAA0B,mFCnCvC,2wCAoBM;2FDeO,0BAA0B;kBAPtC,SAAS;+BAEI,sBAAsB,mBAGf,uBAAuB,CAAC,MAAM;;0BA4BlC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, DayData, PeriodData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {DayPickerCssClasses} from './dayPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: DayPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n weekdayName: 'weekday',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'date-time-day-picker',\n templateUrl: 'dayPicker.component.html',\n styleUrls: ['dayPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeDayPickerComponent<TDate = any> extends PickerBaseComponent<TDate, DayData<TDate>, DayPickerCssClasses> implements DateTimeLegacyPicker<TDate, DayPickerCssClasses>\n{\n //######################### protected fields #########################\n\n /**\n * Stored this picker month data\n */\n protected _thisMonthData: DayData<TDate>[] = [];\n\n //######################### public properties - template bindings #########################\n\n /**\n * Names of days\n * @internal\n */\n public weekdays: string[] = [];\n\n /**\n * Value used for displaying time\n */\n public get timeValue(): DateTimeValue<TDate> | null\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n this.weekdays = this._dateApi.weekdaysShort();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed period to \"lower\" period\n * @param event - Event that occured\n * @internal\n */\n public goDown(event: Event): void\n {\n event.preventDefault();\n\n if(!this.canGoDown)\n {\n return;\n }\n\n if(this.displayDate)\n {\n this._scaleDown.next(this.displayDate.value);\n }\n }\n\n /**\n * Changes displayed month to next month\n * @param event - Event that occured\n * @internal\n */\n public nextMonth(event: Event): void\n {\n event.preventDefault();\n this.displayDate!.addMonths(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed month to previous month\n * @param event - Event that occured\n * @internal\n */\n public previousMonth(event: Event): void\n {\n event.preventDefault();\n this.displayDate!.subtractMonths(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Selects day\n * @param event - Event that occured\n * @param day - Selects day \n * @internal\n */\n public override select(event: Event, day: DayData<TDate>): void\n {\n event.preventDefault();\n\n if(day.disabled)\n {\n return;\n }\n\n this._setPeriod(day);\n\n //when time picker is enabled\n if(this.canGoDown)\n {\n const from = this._dateApi\n .getValue(day.date)\n .hour(this._originalHour)\n .minute(this._originalMinute);\n\n const to = this._dateApi\n .getValue(this._endOfPeriod(day))\n .hour(this._originalHour)\n .minute(this._originalMinute);\n\n this._value =\n {\n from: from.value,\n to: to.value\n };\n }\n //no time picker\n else\n {\n this._value =\n {\n from: day.date,\n to: this._endOfPeriod(day)\n };\n }\n \n this._valueChange.next();\n\n if(day.otherMonth)\n {\n this.display(this._dateApi.getValue(day.date));\n }\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n this.periodData = [];\n this._thisMonthData = [];\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 const data = \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 };\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 //can go down set minutes and hours\n if(this.canGoDown)\n {\n this.displayDate\n .minute(this._originalMinute)\n .hour(this._originalHour);\n }\n\n this._updateMinMax();\n\n //set value if exists\n if(this._value && (this.displayDate.isSameMonth(this._value.from!) || this.displayDate.isSameMonth(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfDay().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameMonth(this.displayDate!.value);\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 /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this._thisMonthData[val.dayOfMonth() - 1];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousMonth($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired | mergeCssClasses: [{'clickable': canGoUp}]\" (mousedown)=\"goUp($event)\">{{displayDate?.format('MMMM yyyy')}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextMonth($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div [ngClass]=\"cssClasses.weekdayName | asRequired\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\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)=\"select($event, day)\">{{day.day}}</div>\r\n</div>\r\n\r\n<div class=\"flex-row\" style=\"justify-content: center; border-top: 1px solid #FFF;\" *ngIf=\"canGoDown\">\r\n <div [class.clickable]=\"canGoDown\" (mousedown)=\"goDown($event)\">{{timeValue?.from | dateFormat: 'time'}}</div>\r\n</div>"]}
1
+ {"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/dayPicker/dayPicker.component.ts","../../../../../../src/legacy/picker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAC,QAAQ,EAAC,MA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MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;;uHAlPQ,0BAA0B,kBA0Bf,QAAQ;2GA1BnB,0BAA0B,mFCnCvC,2wCAoBM;2FDeO,0BAA0B;kBAPtC,SAAS;+BAEI,sBAAsB,mBAGf,uBAAuB,CAAC,MAAM;;0BA4BlC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, DayData, PeriodData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {DayPickerCssClasses} from './dayPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: DayPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n weekdayName: 'weekday',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'date-time-day-picker',\n templateUrl: 'dayPicker.component.html',\n styleUrls: ['dayPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeDayPickerComponent<TDate = any> extends PickerBaseComponent<TDate, DayData<TDate>, DayPickerCssClasses> implements DateTimeLegacyPicker<TDate, DayPickerCssClasses>\n{\n //######################### protected fields #########################\n\n /**\n * Stored this picker month data\n */\n protected _thisMonthData: DayData<TDate>[] = [];\n\n //######################### public properties - template bindings #########################\n\n /**\n * Names of days\n * @internal\n */\n public weekdays: string[] = [];\n\n /**\n * Value used for displaying time\n */\n public get timeValue(): DateTimeValue<TDate> | null\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n this.weekdays = this._dateApi.weekdaysShort();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed period to \"lower\" period\n * @param event - Event that occured\n * @internal\n */\n public goDown(event: Event): void\n {\n event.preventDefault();\n\n if(!this.canGoDown)\n {\n return;\n }\n\n if(this.displayDate)\n {\n this._scaleDown.next(this.displayDate.value);\n }\n }\n\n /**\n * Changes displayed month to next month\n * @param event - Event that occured\n * @internal\n */\n public nextMonth(event: Event): void\n {\n event.preventDefault();\n this.displayDate!.addMonths(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed month to previous month\n * @param event - Event that occured\n * @internal\n */\n public previousMonth(event: Event): void\n {\n event.preventDefault();\n this.displayDate!.subtractMonths(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Selects day\n * @param event - Event that occured\n * @param day - Selects day \n * @internal\n */\n public override select(event: Event, day: DayData<TDate>): void\n {\n event.preventDefault();\n\n if(day.disabled)\n {\n return;\n }\n\n this._setPeriod(day);\n\n //when time picker is enabled\n if(this.canGoDown)\n {\n const from = this._dateApi\n .getValue(day.date)\n .hour(this._originalHour)\n .minute(this._originalMinute);\n\n const to = this._dateApi\n .getValue(this._endOfPeriod(day))\n .hour(this._originalHour)\n .minute(this._originalMinute);\n\n this._value =\n {\n from: from.value,\n to: to.value\n };\n }\n //no time picker\n else\n {\n this._value =\n {\n from: day.date,\n to: this._endOfPeriod(day)\n };\n }\n \n this._valueChange.next();\n\n if(day.otherMonth)\n {\n this.display(this._dateApi.getValue(day.date));\n }\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n this.periodData = [];\n this._thisMonthData = [];\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 const data = \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 //can go down set minutes and hours\n if(this.canGoDown)\n {\n this.displayDate\n .minute(this._originalMinute)\n .hour(this._originalHour);\n }\n\n this._updateMinMax();\n\n //set value if exists\n if(this._value && (this.displayDate.isSameMonth(this._value.from!) || this.displayDate.isSameMonth(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfDay().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameMonth(this.displayDate!.value);\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 /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this._thisMonthData[val.dayOfMonth() - 1];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousMonth($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired | mergeCssClasses: [{'clickable': canGoUp}]\" (mousedown)=\"goUp($event)\">{{displayDate?.format('MMMM yyyy')}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextMonth($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div [ngClass]=\"cssClasses.weekdayName | asRequired\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\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)=\"select($event, day)\">{{day.day}}</div>\r\n</div>\r\n\r\n<div class=\"flex-row\" style=\"justify-content: center; border-top: 1px solid #FFF;\" *ngIf=\"canGoDown\">\r\n <div [class.clickable]=\"canGoDown\" (mousedown)=\"goDown($event)\">{{timeValue?.from | dateFormat: 'time'}}</div>\r\n</div>"]}
@@ -61,7 +61,8 @@ export class DateTimeMonthPickerComponent extends PickerBaseComponent {
61
61
  active: false,
62
62
  disabled: false,
63
63
  date: monthOfYear.value,
64
- name: monthOfYear.format('MMM')
64
+ name: monthOfYear.format('MMM'),
65
+ dateObj: monthOfYear.clone(),
65
66
  });
66
67
  monthOfYear.addMonths(1);
67
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"monthPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/monthPicker/monthPicker.component.ts","../../../../../../src/legacy/picker/components/monthPicker/monthPicker.component.html"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yB,EAAE,MAAa;QAE5D,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IACxC,CAAC;;yHAhHQ,4BAA4B,kBAGjB,QAAQ;6GAHnB,4BAA4B,qFCjCzC,gxBAYM;2FDqBO,4BAA4B;kBAPxC,SAAS;+BAEI,wBAAwB,mBAGjB,uBAAuB,CAAC,MAAM;;0BAKlC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, MonthData, PeriodData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {MonthPickerCssClasses} from './monthPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: MonthPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying month picker\n */\n@Component(\n{\n selector: 'date-time-month-picker',\n templateUrl: 'monthPicker.component.html',\n styleUrls: ['monthPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeMonthPickerComponent<TDate = any> extends PickerBaseComponent<TDate, MonthData<TDate>, MonthPickerCssClasses> implements DateTimeLegacyPicker<TDate, MonthPickerCssClasses>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed year to next year\n * @param event - Event that occured\n * @internal\n */\n public nextYear(event: Event)\n {\n event.preventDefault();\n this.displayDate!.addYears(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed year to previous year\n * @param event - Event that occured\n * @internal\n */\n public previousYear(event: Event)\n {\n event.preventDefault();\n this.displayDate!.subtractYears(1);\n\n this.display(this.displayDate!);\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n\n const monthOfYear = this.displayDate.startOfYear().updateOriginal();\n this.periodData = [];\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('MMM')\n });\n\n monthOfYear.addMonths(1);\n }\n\n this.displayDate.resetOriginal();\n this._updateMinMax();\n\n //set value if exists\n if(this._value && (this.displayDate.isSameYear(this._value.from!) || this.displayDate.isSameYear(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfMonth().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameYear(this.displayDate!.value);\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 /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this.periodData[val.month()];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousYear($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired\" [class.clickable]=\"canGoUp\" (mousedown)=\"goUp($event)\">{{displayDate?.format('yyyy')}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextYear($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div *ngFor=\"let month of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\r\n [class.active]=\"month.active\"\r\n [class.disabled]=\"month.disabled\"\r\n (mousedown)=\"select($event, month)\">{{month.name}}</div>\r\n</div>"]}
1
+ {"version":3,"file":"monthPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/monthPicker/monthPicker.component.ts","../../../../../../src/legacy/picker/components/monthPicker/monthPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;;;;AAG5D;;GAEG;AACH,MAAM,aAAa,GACnB;IACI,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,6BAA6B;IAC7C,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,WAAW;CACzB,CAAC;AAEF;;GAEG;AAQH,MAAM,OAAO,4BAA0C,SAAQ,mBAAmE;IAE9H,iEAAiE;IACjE,YAA8B,OAAuB,EACzC,cAAiC;QAEzC,KAAK,CA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CAAC,aAAa,EAAE,CAAC;QAErB,qBAAqB;QACrB,IAAG,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAK,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAG,CAAC,CAAC,EAClH;YACI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC9B;IACL,CAAC;IAED,uEAAuE;IAEvE;;;OAGG;IACO,YAAY,CAAC,MAAyB;QAE5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC;IAClE,CAAC;IAED;;;OAGG;IACO,wBAAwB,CAAC,GAAyB;QAExD,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,WAAY,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAED;;;;OAIG;IACO,aAAa,CAAC,GAAyB,EAAE,MAAa;QAE5D,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IACxC,CAAC;;yHAjHQ,4BAA4B,kBAGjB,QAAQ;6GAHnB,4BAA4B,qFCjCzC,gxBAYM;2FDqBO,4BAA4B;kBAPxC,SAAS;+BAEI,wBAAwB,mBAGjB,uBAAuB,CAAC,MAAM;;0BAKlC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, MonthData, PeriodData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {MonthPickerCssClasses} from './monthPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: MonthPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying month picker\n */\n@Component(\n{\n selector: 'date-time-month-picker',\n templateUrl: 'monthPicker.component.html',\n styleUrls: ['monthPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeMonthPickerComponent<TDate = any> extends PickerBaseComponent<TDate, MonthData<TDate>, MonthPickerCssClasses> implements DateTimeLegacyPicker<TDate, MonthPickerCssClasses>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed year to next year\n * @param event - Event that occured\n * @internal\n */\n public nextYear(event: Event)\n {\n event.preventDefault();\n this.displayDate!.addYears(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed year to previous year\n * @param event - Event that occured\n * @internal\n */\n public previousYear(event: Event)\n {\n event.preventDefault();\n this.displayDate!.subtractYears(1);\n\n this.display(this.displayDate!);\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n\n const monthOfYear = this.displayDate.startOfYear().updateOriginal();\n this.periodData = [];\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('MMM'),\n dateObj: monthOfYear.clone(),\n });\n\n monthOfYear.addMonths(1);\n }\n\n this.displayDate.resetOriginal();\n this._updateMinMax();\n\n //set value if exists\n if(this._value && (this.displayDate.isSameYear(this._value.from!) || this.displayDate.isSameYear(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfMonth().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameYear(this.displayDate!.value);\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 /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this.periodData[val.month()];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousYear($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired\" [class.clickable]=\"canGoUp\" (mousedown)=\"goUp($event)\">{{displayDate?.format('yyyy')}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextYear($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div *ngFor=\"let month of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\r\n [class.active]=\"month.active\"\r\n [class.disabled]=\"month.disabled\"\r\n (mousedown)=\"select($event, month)\">{{month.name}}</div>\r\n</div>"]}
@@ -71,7 +71,8 @@ export class DateTimeYearPickerComponent extends PickerBaseComponent {
71
71
  active: false,
72
72
  disabled: false,
73
73
  date: this.displayDate.value,
74
- value: year
74
+ value: year,
75
+ dateObj: this.displayDate.clone(),
75
76
  });
76
77
  year++;
77
78
  this.displayDate.addYears(1);
@@ -1 +1 @@
1
- {"version":3,"file":"yearPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/yearPicker/yearPicker.component.ts","../../../../../../src/legacy/picker/components/yearPicker/yearPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;;;;AAG5D;;GAEG;AACH,MAAM,aAAa,GACnB;IACI,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,6BAA6B;IAC7C,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,WAAW;CACzB,CAAC;AAEF;;GAEG;AAQH,MAAM,OAAO,2BAAyC,SAAQ,mBAAiE;IAU3H,iEAAiE;IACjE,YAA8B,OAAuB,EACzC,cAAiC;QAEzC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAZnC,2FAA2F;QAE3F;;;WAGG;QACI,WAAM,GAAW,EAAE,CAAC;QAQvB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;IAED,wFAAwF;IAExF;;;;OAIG;IACI,UAAU,CAAC,KAAY;QAE1B,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAE/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C;QAE7E,qBAAqB;QACrB,IAAG,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAK,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAG,CAAC,CAAC,EACtH;YACI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC9B;IACL,CAAC;IAED,uEAAuE;IAEvE;;;OAGG;IACO,YAAY,CAAC,MAAyB;QAE5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC;IACjE,CAAC;IAED;;;OAGG;IACO,wBAAwB,CAAC,GAAyB;QAExD,OAAO,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,WAAY,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACO,aAAa,CAAC,GAAyB,EAAE,MAAa;QAE5D,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,CAAC;;wHAlIQ,2BAA2B,kBAWhB,QAAQ;4GAXnB,2BAA2B,oFCjCxC,2vBAYM;2FDqBO,2BAA2B;kBAPvC,SAAS;+BAEI,uBAAuB,mBAGhB,uBAAuB,CAAC,MAAM;;0BAalC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, PeriodData, YearData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {YearPickerCssClasses} from './yearPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: YearPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying year picker\n */\n@Component(\n{\n selector: 'date-time-year-picker',\n templateUrl: 'yearPicker.component.html',\n styleUrls: ['yearPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeYearPickerComponent<TDate = any> extends PickerBaseComponent<TDate, YearData<TDate>, YearPickerCssClasses> implements DateTimeLegacyPicker<TDate, YearPickerCssClasses>\n{\n //######################### public properties - template bindings #########################\n\n /**\n * Displayed decade period\n * @internal\n */\n public period: string = '';\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed decade to next decade\n * @param event - Event that occured\n * @internal\n */\n public nextDecade(event: Event)\n {\n event.preventDefault();\n this.displayDate!.addYears(10);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed decade to previous decade\n * @param event - Event that occured\n * @internal\n */\n public previousDecade(event: Event)\n {\n event.preventDefault();\n this.displayDate!.subtractYears(10);\n\n this.display(this.displayDate!);\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n\n let year = this.displayDate.startOfYear().year();\n\n while(year % 10 !== 0)\n {\n year--;\n }\n\n this.displayDate.year(year).updateOriginal();\n\n this.periodData = [];\n\n for(let x = 0; x < 10; x++)\n {\n this.periodData.push(\n {\n active: false,\n disabled: false,\n date: this.displayDate.value,\n value: year\n });\n\n year++;\n this.displayDate.addYears(1);\n }\n\n this.displayDate.resetOriginal();\n this._updateMinMax();\n this.period = `${this.displayDate.year()} - ${this.displayDate.year() + 10}`;\n\n //set value if exists\n if(this._value && (this.displayDate.isSameDecade(this._value.from!) || this.displayDate.isSameDecade(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfYear().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameDecade(this.displayDate!.value);\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.isSameYear(target);\n }\n\n /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this.periodData[val.year() % 10];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousDecade($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired\" [class.clickable]=\"canGoUp\" (mousedown)=\"goUp($event)\">{{period}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextDecade($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div *ngFor=\"let year of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\r\n [class.active]=\"year.active\"\r\n [class.disabled]=\"year.disabled\"\r\n (mousedown)=\"select($event, year)\">{{year.value}}</div>\r\n</div>"]}
1
+ {"version":3,"file":"yearPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/yearPicker/yearPicker.component.ts","../../../../../../src/legacy/picker/components/yearPicker/yearPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;;;;AAG5D;;GAEG;AACH,MAAM,aAAa,GACnB;IACI,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,6BAA6B;IAC7C,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,WAAW;CACzB,CAAC;AAEF;;GAEG;AAQH,MAAM,OAAO,2BAAyC,SAAQ,mBAAiE;IAU3H,iEAAiE;IACjE,YAA8B,OAAuB,EACzC,cAAiC;QAEzC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAZnC,2FAA2F;QAE3F;;;WAGG;QACI,WAAM,GAAW,EAAE,CAAC;QAQvB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;IAED,wFAAwF;IAExF;;;;OAIG;IACI,UAAU,CAAC,KAAY;QAE1B,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAE/B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACI,cAAc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AAC,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAK,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAG,CAAC,CAAC,EACtH;YACI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC9B;IACL,CAAC;IAED,uEAAuE;IAEvE;;;OAGG;IACO,YAAY,CAAC,MAAyB;QAE5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC;IACjE,CAAC;IAED;;;OAGG;IACO,wBAAwB,CAAC,GAAyB;QAExD,OAAO,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,WAAY,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACO,aAAa,CAAC,GAAyB,EAAE,MAAa;QAE5D,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,CAAC;;wHAnIQ,2BAA2B,kBAWhB,QAAQ;4GAXnB,2BAA2B,oFCjCxC,2vBAYM;2FDqBO,2BAA2B;kBAPvC,SAAS;+BAEI,uBAAuB,mBAGhB,uBAAuB,CAAC,MAAM;;0BAalC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, PeriodData, YearData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {YearPickerCssClasses} from './yearPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: YearPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying year picker\n */\n@Component(\n{\n selector: 'date-time-year-picker',\n templateUrl: 'yearPicker.component.html',\n styleUrls: ['yearPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeYearPickerComponent<TDate = any> extends PickerBaseComponent<TDate, YearData<TDate>, YearPickerCssClasses> implements DateTimeLegacyPicker<TDate, YearPickerCssClasses>\n{\n //######################### public properties - template bindings #########################\n\n /**\n * Displayed decade period\n * @internal\n */\n public period: string = '';\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed decade to next decade\n * @param event - Event that occured\n * @internal\n */\n public nextDecade(event: Event)\n {\n event.preventDefault();\n this.displayDate!.addYears(10);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed decade to previous decade\n * @param event - Event that occured\n * @internal\n */\n public previousDecade(event: Event)\n {\n event.preventDefault();\n this.displayDate!.subtractYears(10);\n\n this.display(this.displayDate!);\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n\n let year = this.displayDate.startOfYear().year();\n\n while(year % 10 !== 0)\n {\n year--;\n }\n\n this.displayDate.year(year).updateOriginal();\n\n this.periodData = [];\n\n for(let x = 0; x < 10; x++)\n {\n this.periodData.push(\n {\n active: false,\n disabled: false,\n date: this.displayDate.value,\n value: year,\n dateObj: this.displayDate.clone(),\n });\n\n year++;\n this.displayDate.addYears(1);\n }\n\n this.displayDate.resetOriginal();\n this._updateMinMax();\n this.period = `${this.displayDate.year()} - ${this.displayDate.year() + 10}`;\n\n //set value if exists\n if(this._value && (this.displayDate.isSameDecade(this._value.from!) || this.displayDate.isSameDecade(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfYear().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameDecade(this.displayDate!.value);\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.isSameYear(target);\n }\n\n /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this.periodData[val.year() % 10];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousDecade($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired\" [class.clickable]=\"canGoUp\" (mousedown)=\"goUp($event)\">{{period}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextDecade($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div *ngFor=\"let year of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\r\n [class.active]=\"year.active\"\r\n [class.disabled]=\"year.disabled\"\r\n (mousedown)=\"select($event, year)\">{{year.value}}</div>\r\n</div>"]}