@anglr/datetime 5.0.0-beta.20221018120203 → 5.0.0-beta.20221019093146

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 (179) hide show
  1. package/changelog.md +56 -1
  2. package/es2015/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -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.map +1 -1
  5. package/es2015/src/legacy/picker/components/picker/picker.component.js +4 -4
  6. package/es2015/src/legacy/picker/components/picker/picker.component.js.map +1 -1
  7. package/es2015/src/legacy/picker/components/pickerBase.component.js.map +1 -1
  8. package/es2015/src/legacy/picker/components/pickerImplBase.component.js.map +1 -1
  9. package/es2015/src/legacy/picker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
  10. package/es2015/src/legacy/picker/components/yearPicker/yearPicker.component.js.map +1 -1
  11. package/es2015/src/legacy/picker/misc/datetimePicker.interface.js.map +1 -1
  12. package/es2015/src/legacy/picker/misc/tokens.js.map +1 -1
  13. package/es2015/src/legacy/picker/modules/picker.module.js +9 -9
  14. package/es2015/src/legacy/picker/modules/picker.module.js.map +1 -1
  15. package/es2015/src/legacy/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.js +2 -2
  16. package/es2015/src/legacy/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.js.map +1 -1
  17. package/es2015/src/legacy/selector/misc/datetimeSelector.interface.js.map +1 -1
  18. package/es2015/src/legacy/selector/modules/selector.module.js +4 -4
  19. package/es2015/src/legacy/selector/modules/selector.module.js.map +1 -1
  20. package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +18 -12
  21. package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
  22. package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +48 -0
  23. package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -0
  24. package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +180 -0
  25. package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -0
  26. package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.js +2 -0
  27. package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.js.map +1 -0
  28. package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +17 -0
  29. package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -0
  30. package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js +2 -0
  31. package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js.map +1 -0
  32. package/es2015/src/modules/dateTimePicker/components/index.js +5 -0
  33. package/es2015/src/modules/dateTimePicker/components/index.js.map +1 -0
  34. package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +189 -0
  35. package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -0
  36. package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js +2 -0
  37. package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -0
  38. package/es2015/src/modules/dateTimePicker/directives/index.js +3 -0
  39. package/es2015/src/modules/dateTimePicker/directives/index.js.map +1 -0
  40. package/es2015/src/modules/dateTimePicker/index.js +6 -0
  41. package/es2015/src/modules/dateTimePicker/index.js.map +1 -0
  42. package/es2015/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js +2 -0
  43. package/es2015/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +1 -0
  44. package/es2015/src/modules/dateTimePicker/interfaces/index.js +2 -0
  45. package/es2015/src/modules/dateTimePicker/interfaces/index.js.map +1 -0
  46. package/es2015/src/modules/dateTimePicker/misc/tokens.js +10 -0
  47. package/es2015/src/modules/dateTimePicker/misc/tokens.js.map +1 -0
  48. package/es2015/src/modules/dateTimePicker/modules/dateTimePicker.module.js +28 -0
  49. package/es2015/src/modules/dateTimePicker/modules/dateTimePicker.module.js.map +1 -0
  50. package/es2015/src/modules/dateTimePicker/modules/index.js +2 -0
  51. package/es2015/src/modules/dateTimePicker/modules/index.js.map +1 -0
  52. package/es2015/src/modules/index.js +1 -0
  53. package/es2015/src/modules/index.js.map +1 -1
  54. package/es2020/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
  55. package/es2020/src/legacy/picker/components/dayPicker/dayPicker.component.js.map +1 -1
  56. package/es2020/src/legacy/picker/components/monthPicker/monthPicker.component.js.map +1 -1
  57. package/es2020/src/legacy/picker/components/picker/picker.component.js +4 -4
  58. package/es2020/src/legacy/picker/components/picker/picker.component.js.map +1 -1
  59. package/es2020/src/legacy/picker/components/pickerBase.component.js.map +1 -1
  60. package/es2020/src/legacy/picker/components/pickerImplBase.component.js.map +1 -1
  61. package/es2020/src/legacy/picker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
  62. package/es2020/src/legacy/picker/components/yearPicker/yearPicker.component.js.map +1 -1
  63. package/es2020/src/legacy/picker/misc/datetimePicker.interface.js.map +1 -1
  64. package/es2020/src/legacy/picker/misc/tokens.js.map +1 -1
  65. package/es2020/src/legacy/picker/modules/picker.module.js +9 -9
  66. package/es2020/src/legacy/picker/modules/picker.module.js.map +1 -1
  67. package/es2020/src/legacy/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.js +2 -2
  68. package/es2020/src/legacy/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.js.map +1 -1
  69. package/es2020/src/legacy/selector/misc/datetimeSelector.interface.js.map +1 -1
  70. package/es2020/src/legacy/selector/modules/selector.module.js +4 -4
  71. package/es2020/src/legacy/selector/modules/selector.module.js.map +1 -1
  72. package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +18 -12
  73. package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
  74. package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +48 -0
  75. package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -0
  76. package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +177 -0
  77. package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -0
  78. package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.js +2 -0
  79. package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.js.map +1 -0
  80. package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +17 -0
  81. package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -0
  82. package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js +2 -0
  83. package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js.map +1 -0
  84. package/es2020/src/modules/dateTimePicker/components/index.js +5 -0
  85. package/es2020/src/modules/dateTimePicker/components/index.js.map +1 -0
  86. package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +183 -0
  87. package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -0
  88. package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js +2 -0
  89. package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -0
  90. package/es2020/src/modules/dateTimePicker/directives/index.js +3 -0
  91. package/es2020/src/modules/dateTimePicker/directives/index.js.map +1 -0
  92. package/es2020/src/modules/dateTimePicker/index.js +6 -0
  93. package/es2020/src/modules/dateTimePicker/index.js.map +1 -0
  94. package/es2020/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js +2 -0
  95. package/es2020/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +1 -0
  96. package/es2020/src/modules/dateTimePicker/interfaces/index.js +2 -0
  97. package/es2020/src/modules/dateTimePicker/interfaces/index.js.map +1 -0
  98. package/es2020/src/modules/dateTimePicker/misc/tokens.js +10 -0
  99. package/es2020/src/modules/dateTimePicker/misc/tokens.js.map +1 -0
  100. package/es2020/src/modules/dateTimePicker/modules/dateTimePicker.module.js +28 -0
  101. package/es2020/src/modules/dateTimePicker/modules/dateTimePicker.module.js.map +1 -0
  102. package/es2020/src/modules/dateTimePicker/modules/index.js +2 -0
  103. package/es2020/src/modules/dateTimePicker/modules/index.js.map +1 -0
  104. package/es2020/src/modules/index.js +1 -0
  105. package/es2020/src/modules/index.js.map +1 -1
  106. package/package.json +7 -1
  107. package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts +8 -4
  108. package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts.map +1 -1
  109. package/src/legacy/picker/components/dayPicker/dayPicker.component.d.ts +2 -2
  110. package/src/legacy/picker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
  111. package/src/legacy/picker/components/monthPicker/monthPicker.component.d.ts +2 -2
  112. package/src/legacy/picker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
  113. package/src/legacy/picker/components/picker/picker.component.d.ts +11 -11
  114. package/src/legacy/picker/components/picker/picker.component.d.ts.map +1 -1
  115. package/src/legacy/picker/components/pickerBase.component.d.ts +2 -2
  116. package/src/legacy/picker/components/pickerBase.component.d.ts.map +1 -1
  117. package/src/legacy/picker/components/pickerImplBase.component.d.ts +2 -2
  118. package/src/legacy/picker/components/pickerImplBase.component.d.ts.map +1 -1
  119. package/src/legacy/picker/components/rollerTimePicker/rollerTimePicker.component.d.ts +2 -2
  120. package/src/legacy/picker/components/rollerTimePicker/rollerTimePicker.component.d.ts.map +1 -1
  121. package/src/legacy/picker/components/yearPicker/yearPicker.component.d.ts +2 -2
  122. package/src/legacy/picker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
  123. package/src/legacy/picker/misc/datetimePicker.interface.d.ts +2 -2
  124. package/src/legacy/picker/misc/datetimePicker.interface.d.ts.map +1 -1
  125. package/src/legacy/picker/misc/tokens.d.ts +2 -2
  126. package/src/legacy/picker/misc/tokens.d.ts.map +1 -1
  127. package/src/legacy/picker/modules/picker.module.d.ts +4 -4
  128. package/src/legacy/picker/modules/picker.module.d.ts.map +1 -1
  129. package/src/legacy/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.d.ts +2 -2
  130. package/src/legacy/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.d.ts.map +1 -1
  131. package/src/legacy/selector/misc/datetimeSelector.interface.d.ts +2 -2
  132. package/src/legacy/selector/misc/datetimeSelector.interface.d.ts.map +1 -1
  133. package/src/legacy/selector/modules/selector.module.d.ts +1 -1
  134. package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts +6 -2
  135. package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
  136. package/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.d.ts +53 -0
  137. package/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.d.ts.map +1 -0
  138. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +79 -0
  139. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -0
  140. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.html +1 -0
  141. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.d.ts +17 -0
  142. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -0
  143. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.css +27 -0
  144. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts +11 -0
  145. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -0
  146. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html +23 -0
  147. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.d.ts +11 -0
  148. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.d.ts.map +1 -0
  149. package/src/modules/dateTimePicker/components/index.d.ts +5 -0
  150. package/src/modules/dateTimePicker/components/index.d.ts.map +1 -0
  151. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts +79 -0
  152. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -0
  153. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts +31 -0
  154. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -0
  155. package/src/modules/dateTimePicker/directives/index.d.ts +3 -0
  156. package/src/modules/dateTimePicker/directives/index.d.ts.map +1 -0
  157. package/src/modules/dateTimePicker/index.d.ts +6 -0
  158. package/src/modules/dateTimePicker/index.d.ts.map +1 -0
  159. package/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.d.ts +40 -0
  160. package/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -0
  161. package/src/modules/dateTimePicker/interfaces/index.d.ts +2 -0
  162. package/src/modules/dateTimePicker/interfaces/index.d.ts.map +1 -0
  163. package/src/modules/dateTimePicker/misc/tokens.d.ts +12 -0
  164. package/src/modules/dateTimePicker/misc/tokens.d.ts.map +1 -0
  165. package/src/modules/dateTimePicker/modules/dateTimePicker.module.d.ts +12 -0
  166. package/src/modules/dateTimePicker/modules/dateTimePicker.module.d.ts.map +1 -0
  167. package/src/modules/dateTimePicker/modules/index.d.ts +2 -0
  168. package/src/modules/dateTimePicker/modules/index.d.ts.map +1 -0
  169. package/src/modules/index.d.ts +1 -0
  170. package/src/modules/index.d.ts.map +1 -1
  171. package/styles/components/_date-time-picker.scss +8 -0
  172. package/styles/core/_functions.scss +11 -0
  173. package/styles/core/_misc.scss +199 -0
  174. package/styles/core/_mixins.scss +23 -0
  175. package/styles/core/_theme.scss +3 -0
  176. package/styles/index.scss +2 -0
  177. package/styles/themes/dark.scss +19 -0
  178. package/styles/themes/light.scss +19 -0
  179. package/version.bak +1 -1
@@ -13,9 +13,9 @@ import * as i1 from "../../../../services";
13
13
  */
14
14
  export class DateTimeInputDirective extends DateTimeBase {
15
15
  //######################### constructors #########################
16
- constructor(element, dateApi, formatProvider, valueProvider) {
16
+ constructor(elementRef, dateApi, formatProvider, valueProvider) {
17
17
  super(dateApi, formatProvider);
18
- this.element = element;
18
+ this.elementRef = elementRef;
19
19
  this.valueProvider = valueProvider;
20
20
  /**
21
21
  * @inheritdoc
@@ -25,19 +25,19 @@ export class DateTimeInputDirective extends DateTimeBase {
25
25
  * @inheritdoc
26
26
  */
27
27
  this.blur = new EventEmitter();
28
- this.element.nativeElement.addEventListener('input', this.handleInput);
29
- this.element.nativeElement.addEventListener('focus', this.handleFocus);
30
- this.element.nativeElement.addEventListener('blur', this.handleBlur);
28
+ this.elementRef.nativeElement.addEventListener('input', this.handleInput);
29
+ this.elementRef.nativeElement.addEventListener('focus', this.handleFocus);
30
+ this.elementRef.nativeElement.addEventListener('blur', this.handleBlur);
31
31
  }
32
32
  //######################### public properties - implementation of DateTimeInput #########################
33
33
  /**
34
34
  * @inheritdoc
35
35
  */
36
36
  get rawValue() {
37
- return this.element.nativeElement.value;
37
+ return this.elementRef.nativeElement.value;
38
38
  }
39
39
  set rawValue(value) {
40
- this.element.nativeElement.value = value ?? '';
40
+ this.elementRef.nativeElement.value = value ?? '';
41
41
  }
42
42
  /**
43
43
  * @inheritdoc
@@ -61,19 +61,25 @@ export class DateTimeInputDirective extends DateTimeBase {
61
61
  * @inheritdoc
62
62
  */
63
63
  get disabled() {
64
- return this.element.nativeElement.disabled;
64
+ return this.elementRef.nativeElement.disabled;
65
65
  }
66
66
  set disabled(value) {
67
- this.element.nativeElement.disabled = value;
67
+ this.elementRef.nativeElement.disabled = value;
68
+ }
69
+ /**
70
+ * Html element that represents input itself
71
+ */
72
+ get element() {
73
+ return this.elementRef.nativeElement;
68
74
  }
69
75
  //######################### public methods - implementation of OnDestroy #########################
70
76
  /**
71
77
  * Called when component is destroyed
72
78
  */
73
79
  ngOnDestroy() {
74
- this.element.nativeElement.removeEventListener('input', this.handleInput);
75
- this.element.nativeElement.removeEventListener('focus', this.handleFocus);
76
- this.element.nativeElement.removeEventListener('blur', this.handleBlur);
80
+ this.elementRef.nativeElement.removeEventListener('input', this.handleInput);
81
+ this.elementRef.nativeElement.removeEventListener('focus', this.handleFocus);
82
+ this.elementRef.nativeElement.removeEventListener('blur', this.handleBlur);
77
83
  }
78
84
  //######################### protected methods #########################
79
85
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dateTimeInput.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAoB,UAAU,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AACnH,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAU,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;;AAE7C,8BAA8B;AAE9B;;GAEG;AAcH,MAAM,OAAO,sBAAwC,SAAQ,YAAmB;IAqE5E,kEAAkE;IAClE,YAAsB,OAAqC,EAC7B,OAAuB,EAChB,cAA8B,EAC7C,aAAuC;QAEzD,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QALb,YAAO,GAAP,O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;IAC3B,CAAC;IAED;;;OAGG;IAEO,UAAU,CAAC,KAAiB;QAElC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;;mHAzLQ,sBAAsB,4CAuEX,QAAQ,aACR,eAAe;uGAxE1B,sBAAsB,yDAT/B;QAEI;YACI,OAAO,EAAE,eAAe;YACxB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;SACxD;KACJ;;IAuJA,QAAQ;;;;yDAiBR;;IAMA,QAAQ;;qCACoB,UAAU;;yDAGtC;;IAMA,QAAQ;;qCACmB,UAAU;;wDAGrC;2FAzLQ,sBAAsB;kBAblC,SAAS;mBACV;oBACI,QAAQ,EAAE,gCAAgC;oBAC1C,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,eAAe;4BACxB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,uBAAuB,CAAC;yBACxD;qBACJ;oBACD,QAAQ,EAAE,UAAU;iBACvB;;0BAwEgB,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe;4EA6EzB,WAAW,MAuBX,WAAW,MAUX,UAAU","sourcesContent":["import {Directive, ElementRef, EventEmitter, ExistingProvider, forwardRef, Inject, OnDestroy} from '@angular/core';\nimport {BindThis, isBlank} from '@jscrpt/common';\n\nimport {DateTimeInput, FormatProvider} from '../../../../interfaces';\nimport {DATE_API, DATE_TIME_INPUT, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from '../../../../misc/types';\nimport {formatDateTime, parseDateTime} from '../../../../misc/utils';\nimport {DateApi, DateValueProvider} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n//TODO: range is unimplemented\n\n/**\n * Directive that is used for setting up date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][dateTimeInput]',\n providers:\n [\n <ExistingProvider>\n {\n provide: DATE_TIME_INPUT,\n useExisting: forwardRef(() => DateTimeInputDirective),\n },\n ],\n exportAs: 'dateTime',\n})\nexport class DateTimeInputDirective<TDate = unknown> extends DateTimeBase<TDate> implements DateTimeInput, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\n\n //######################### public properties - implementation of DateTimeInput #########################\n\n /**\n * @inheritdoc\n */\n public get rawValue(): string|undefined|null\n {\n return this.element.nativeElement.value;\n }\n public set rawValue(value: string|undefined|null)\n {\n this.element.nativeElement.value = value ?? '';\n }\n\n /**\n * @inheritdoc\n */\n public override get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public override set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.valueFormat, this.customFormat);\n \n //not range value\n if(!Array.isArray(this.internalValue))\n {\n this.rawValue = this.internalValue?.format(this.customFormat);\n }\n else\n {\n //TODO: add support for ranges\n }\n }\n\n /**\n * @inheritdoc\n */\n public get disabled(): boolean\n {\n return this.element.nativeElement.disabled;\n }\n public set disabled(value: boolean)\n {\n this.element.nativeElement.disabled = value;\n }\n\n /**\n * @inheritdoc\n */\n public focus: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n /**\n * @inheritdoc\n */\n public blur: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n //######################### constructors #########################\n constructor(protected element: ElementRef<HTMLInputElement>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) formatProvider: FormatProvider,\n protected valueProvider: DateValueProvider<TDate>,)\n {\n super(dateApi, formatProvider);\n\n this.element.nativeElement.addEventListener('input', this.handleInput);\n this.element.nativeElement.addEventListener('focus', this.handleFocus);\n this.element.nativeElement.addEventListener('blur', this.handleBlur);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.element.nativeElement.removeEventListener('input', this.handleInput);\n this.element.nativeElement.removeEventListener('focus', this.handleFocus);\n this.element.nativeElement.removeEventListener('blur', this.handleBlur);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null): void\n {\n this.internalValue = parseDateTime(value, this.dateApi, null, this.customFormat);\n\n if(isBlank(this.internalValue))\n {\n return;\n }\n\n //ranged value\n if(Array.isArray(this.internalValue))\n {\n const [from, to] = this.internalValue;\n\n if(from)\n {\n const val = this.valueProvider.getValue(from.value, this.customFormat).from;\n\n if(val)\n {\n this.internalValue[0] = this.dateApi.getValue(val, this.customFormat);\n }\n }\n\n if(to)\n {\n const val = this.valueProvider.getValue(to.value, this.customFormat).to;\n\n if(val)\n {\n this.internalValue[1] = this.dateApi.getValue(val, this.customFormat);\n }\n }\n }\n else\n {\n const val = this.valueProvider.getValue(this.internalValue.value, this.customFormat).from;\n\n if(val)\n {\n this.internalValue = this.dateApi.getValue(val, this.customFormat);\n }\n }\n }\n\n /**\n * Handles input event on input\n */\n @BindThis\n protected handleInput(): void\n {\n if(!this.rawValue)\n {\n this.internalValue = null;\n this.ɵValue = null;\n\n this.valueChange.next();\n\n return;\n }\n\n this.setInternalValue(this.rawValue);\n this.ɵValue = formatDateTime(this.internalValue, this.valueFormat, this.customFormat);\n\n this.valueChange.next();\n }\n\n /**\n * Handles focus event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleFocus(event: FocusEvent): void\n {\n this.focus.emit(event);\n }\n\n /**\n * Handles blur event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleBlur(event: FocusEvent): void\n {\n this.blur.emit(event);\n }\n}"]}
1
+ {"version":3,"file":"dateTimeInput.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS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AE,UAAU,CAAC,GAAG,EAAE,uBAAuB,CAAC;yBACxD;qBACJ;oBACD,QAAQ,EAAE,UAAU;iBACvB;;0BAgFgB,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe;4EA6EzB,WAAW,MAuBX,WAAW,MAUX,UAAU","sourcesContent":["import {Directive, ElementRef, EventEmitter, ExistingProvider, forwardRef, Inject, OnDestroy} from '@angular/core';\nimport {BindThis, isBlank} from '@jscrpt/common';\n\nimport {DateTimeInput, FormatProvider} from '../../../../interfaces';\nimport {DATE_API, DATE_TIME_INPUT, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from '../../../../misc/types';\nimport {formatDateTime, parseDateTime} from '../../../../misc/utils';\nimport {DateApi, DateValueProvider} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n//TODO: range is unimplemented\n\n/**\n * Directive that is used for setting up date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][dateTimeInput]',\n providers:\n [\n <ExistingProvider>\n {\n provide: DATE_TIME_INPUT,\n useExisting: forwardRef(() => DateTimeInputDirective),\n },\n ],\n exportAs: 'dateTime',\n})\nexport class DateTimeInputDirective<TDate = unknown> extends DateTimeBase<TDate> implements DateTimeInput, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\n\n //######################### public properties - implementation of DateTimeInput #########################\n\n /**\n * @inheritdoc\n */\n public get rawValue(): string|undefined|null\n {\n return this.elementRef.nativeElement.value;\n }\n public set rawValue(value: string|undefined|null)\n {\n this.elementRef.nativeElement.value = value ?? '';\n }\n\n /**\n * @inheritdoc\n */\n public override get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public override set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.valueFormat, this.customFormat);\n \n //not range value\n if(!Array.isArray(this.internalValue))\n {\n this.rawValue = this.internalValue?.format(this.customFormat);\n }\n else\n {\n //TODO: add support for ranges\n }\n }\n\n /**\n * @inheritdoc\n */\n public get disabled(): boolean\n {\n return this.elementRef.nativeElement.disabled;\n }\n public set disabled(value: boolean)\n {\n this.elementRef.nativeElement.disabled = value;\n }\n\n /**\n * Html element that represents input itself\n */\n public get element(): HTMLElement\n {\n return this.elementRef.nativeElement;\n }\n\n /**\n * @inheritdoc\n */\n public focus: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n /**\n * @inheritdoc\n */\n public blur: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n //######################### constructors #########################\n constructor(protected elementRef: ElementRef<HTMLInputElement>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) formatProvider: FormatProvider,\n protected valueProvider: DateValueProvider<TDate>,)\n {\n super(dateApi, formatProvider);\n\n this.elementRef.nativeElement.addEventListener('input', this.handleInput);\n this.elementRef.nativeElement.addEventListener('focus', this.handleFocus);\n this.elementRef.nativeElement.addEventListener('blur', this.handleBlur);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.elementRef.nativeElement.removeEventListener('input', this.handleInput);\n this.elementRef.nativeElement.removeEventListener('focus', this.handleFocus);\n this.elementRef.nativeElement.removeEventListener('blur', this.handleBlur);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null): void\n {\n this.internalValue = parseDateTime(value, this.dateApi, null, this.customFormat);\n\n if(isBlank(this.internalValue))\n {\n return;\n }\n\n //ranged value\n if(Array.isArray(this.internalValue))\n {\n const [from, to] = this.internalValue;\n\n if(from)\n {\n const val = this.valueProvider.getValue(from.value, this.customFormat).from;\n\n if(val)\n {\n this.internalValue[0] = this.dateApi.getValue(val, this.customFormat);\n }\n }\n\n if(to)\n {\n const val = this.valueProvider.getValue(to.value, this.customFormat).to;\n\n if(val)\n {\n this.internalValue[1] = this.dateApi.getValue(val, this.customFormat);\n }\n }\n }\n else\n {\n const val = this.valueProvider.getValue(this.internalValue.value, this.customFormat).from;\n\n if(val)\n {\n this.internalValue = this.dateApi.getValue(val, this.customFormat);\n }\n }\n }\n\n /**\n * Handles input event on input\n */\n @BindThis\n protected handleInput(): void\n {\n if(!this.rawValue)\n {\n this.internalValue = null;\n this.ɵValue = null;\n\n this.valueChange.next();\n\n return;\n }\n\n this.setInternalValue(this.rawValue);\n this.ɵValue = formatDateTime(this.internalValue, this.valueFormat, this.customFormat);\n\n this.valueChange.next();\n }\n\n /**\n * Handles focus event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleFocus(event: FocusEvent): void\n {\n this.focus.emit(event);\n }\n\n /**\n * Handles blur event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleBlur(event: FocusEvent): void\n {\n this.blur.emit(event);\n }\n}"]}
@@ -0,0 +1,48 @@
1
+ import { Subject } from 'rxjs';
2
+ /**
3
+ * Base abstract class for each date time period picker
4
+ */
5
+ export class DateTimePeriodPickerBase {
6
+ constructor() {
7
+ //######################### protected properties #########################
8
+ /**
9
+ * Subject used for emitting of value changes
10
+ */
11
+ this.valueChangeSubject = new Subject();
12
+ /**
13
+ * Subject used for emitting of go up
14
+ */
15
+ this.goUpSubject = new Subject();
16
+ /**
17
+ * Subject used for emitting of go down
18
+ */
19
+ this.goDownSubject = new Subject();
20
+ /**
21
+ * @inheritdoc
22
+ */
23
+ this.canGoUp = false;
24
+ /**
25
+ * @inheritdoc
26
+ */
27
+ this.canGoDown = false;
28
+ }
29
+ /**
30
+ * @inheritdoc
31
+ */
32
+ get valueChange() {
33
+ return this.valueChangeSubject.asObservable();
34
+ }
35
+ /**
36
+ * @inheritdoc
37
+ */
38
+ get goUp() {
39
+ return this.goUpSubject.asObservable();
40
+ }
41
+ /**
42
+ * @inheritdoc
43
+ */
44
+ get goDown() {
45
+ return this.goDownSubject.asObservable();
46
+ }
47
+ }
48
+ //# sourceMappingURL=dateTimePeriodPickerBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateTimePeriodPickerBase.js","sourceRoot":"","sources":["../../../../../src/modules/dateTimePicker/components/dateTimePeriodPickerBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAKzC;;GAEG;AACH,MAAM,OAAgB,wBAAwB;IAA9C;QAEI,0EAA0E;QAE1E;;WAEG;QACO,uBAAkB,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAElE;;WAEG;QACO,gBAAW,GAAmB,IAAI,OAAO,EAAS,CAAC;QAE7D;;WAEG;QACO,kBAAa,GAAmB,IAAI,OAAO,EAAS,CAAC;QAmB/D;;WAEG;QACI,YAAO,GAAY,KAAK,CAAC;QAEhC;;WAEG;QACI,cAAS,GAAY,KAAK,CAAC;IAyBtC,CAAC;IAvBG;;OAEG;IACH,IAAW,WAAW;QAElB,OAAO,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QAEX,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QAEb,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;IAC7C,CAAC;CACJ","sourcesContent":["import {Observable, Subject} from 'rxjs';\n\nimport {DateTimeObjectValue} from '../../../misc/types';\nimport {DateTimePicker} from '../interfaces';\n\n/**\n * Base abstract class for each date time period picker\n */\nexport abstract class DateTimePeriodPickerBase<TDate = unknown, TOptions = unknown> implements DateTimePicker<TDate, TOptions>\n{\n //######################### protected properties #########################\n\n /**\n * Subject used for emitting of value changes\n */\n protected valueChangeSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for emitting of go up\n */\n protected goUpSubject: Subject<TDate> = new Subject<TDate>();\n\n /**\n * Subject used for emitting of go down\n */\n protected goDownSubject: Subject<TDate> = new Subject<TDate>();\n\n //######################### public properties - implementation of DateTimePicker #########################\n\n /**\n * @inheritdoc\n */\n public value: DateTimeObjectValue<TDate>|undefined|null;\n\n /**\n * @inheritdoc\n */\n public options: TOptions|undefined|null;\n\n /**\n * @inheritdoc\n */\n public display: TDate|undefined|null;\n\n /**\n * @inheritdoc\n */\n public canGoUp: boolean = false;\n\n /**\n * @inheritdoc\n */\n public canGoDown: boolean = false;\n\n /**\n * @inheritdoc\n */\n public get valueChange(): Observable<void>\n {\n return this.valueChangeSubject.asObservable();\n }\n\n /**\n * @inheritdoc\n */\n public get goUp(): Observable<TDate>\n {\n return this.goUpSubject.asObservable();\n }\n\n /**\n * @inheritdoc\n */\n public get goDown(): Observable<TDate>\n {\n return this.goDownSubject.asObservable();\n }\n}"]}
@@ -0,0 +1,177 @@
1
+ import { Component, ChangeDetectionStrategy, ViewChild, ViewContainerRef, EventEmitter, Output, Input, Inject, Optional } from '@angular/core';
2
+ import { POSITION } from '@anglr/common';
3
+ import { extend, isBlank, nameof } from '@jscrpt/common';
4
+ import { Subscription } from 'rxjs';
5
+ import { DATE_TIME_PICKER_OPTIONS } from '../../misc/tokens';
6
+ import { DayPickerSAComponent } from '../dayPicker/dayPicker.component';
7
+ import { DATE_API } from '../../../../misc/tokens';
8
+ import { formatDateTime, parseDateTime } from '../../../../misc/utils';
9
+ import { DateTimeValueFormat } from '../../../../misc/enums';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * Text to be displayed when configuration, options are corrupted
13
+ */
14
+ const CORRUPTED_CONFIG_TEXT = 'DateTime: Corrupted configuration for DateTimePicker!';
15
+ /**
16
+ * Default options for date time picker
17
+ */
18
+ const defaultOptions = {
19
+ defaultPeriod: 'day',
20
+ periodsDefinition: {
21
+ 'day': DayPickerSAComponent,
22
+ },
23
+ };
24
+ /**
25
+ * Component used for displaying date time picker
26
+ */
27
+ export class DateTimePickerComponent {
28
+ //######################### constructor #########################
29
+ constructor(position, dateApi, options) {
30
+ this.position = position;
31
+ this.dateApi = dateApi;
32
+ //######################### public properties - outputs #########################
33
+ /**
34
+ * @inheritdoc
35
+ */
36
+ this.valueChange = new EventEmitter();
37
+ this.ɵOptions = extend(true, {}, defaultOptions, options);
38
+ if (options?.periodsDefinition) {
39
+ this.ɵOptions.periodsDefinition = options.periodsDefinition;
40
+ }
41
+ this.displayedPeriodName = this.ɵOptions.defaultPeriod;
42
+ this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];
43
+ if (!this.displayedPeriodType) {
44
+ throw new Error(CORRUPTED_CONFIG_TEXT);
45
+ }
46
+ }
47
+ /**
48
+ * Options for date time picker
49
+ */
50
+ get options() {
51
+ return this.ɵOptions;
52
+ }
53
+ set options(value) {
54
+ this.ɵOptions = extend(true, {}, defaultOptions, value);
55
+ if (value?.periodsDefinition) {
56
+ this.ɵOptions.periodsDefinition = value.periodsDefinition;
57
+ }
58
+ }
59
+ //######################### public methods - implementation of OnChanges #########################
60
+ /**
61
+ * Called when input value changes
62
+ */
63
+ ngOnChanges(changes) {
64
+ if (nameof('value') in changes) {
65
+ //empty value show now
66
+ if (isBlank(this.value)) {
67
+ const now = this.dateApi.now();
68
+ this.showPicker(this.displayedPeriodType, now.value);
69
+ return;
70
+ }
71
+ }
72
+ }
73
+ //######################### public methods - implementation of OnDestroy #########################
74
+ /**
75
+ * Called when component is destroyed
76
+ */
77
+ ngOnDestroy() {
78
+ this.component?.destroy();
79
+ this.component = null;
80
+ this.periodChangesSubscription?.unsubscribe();
81
+ this.periodChangesSubscription = null;
82
+ }
83
+ //######################### protected methods #########################
84
+ /**
85
+ * Shows picker
86
+ * @param type - Type of period that should be displayed
87
+ * @param displayDate - Display date to be shown
88
+ */
89
+ showPicker(type, displayDate) {
90
+ if (!this.pickerContainer) {
91
+ return;
92
+ }
93
+ //create new component and destroy previous one
94
+ if (!this.component || (this.component && type != this.displayedPeriodType)) {
95
+ this.periodChangesSubscription?.unsubscribe();
96
+ this.periodChangesSubscription = new Subscription();
97
+ this.component?.destroy();
98
+ this.component = this.pickerContainer.createComponent(type);
99
+ this.periodChangesSubscription.add(this.component.instance.valueChange.subscribe(() => {
100
+ const component = this.component?.instance;
101
+ if (!component) {
102
+ return;
103
+ }
104
+ this.value = formatDateTime(component.value, DateTimeValueFormat.DateInstance, null);
105
+ this.valueChange.emit();
106
+ }));
107
+ this.periodChangesSubscription.add(this.component.instance.goUp.subscribe(date => this.showPicker(this.getUpperType(), date)));
108
+ this.periodChangesSubscription.add(this.component.instance.goDown.subscribe(date => this.showPicker(this.getLowerType(), date)));
109
+ }
110
+ const component = this.component.instance;
111
+ component.canGoDown = false,
112
+ component.canGoUp = false;
113
+ component.display = displayDate;
114
+ // component.options
115
+ //TODO: maybe add support for format!
116
+ component.value = parseDateTime(this.value, this.dateApi, null, null);
117
+ }
118
+ /**
119
+ * Gets type that is above current period picker
120
+ */
121
+ getUpperType() {
122
+ const periods = Object.keys(this.ɵOptions.periodsDefinition);
123
+ const index = periods.indexOf(this.displayedPeriodName);
124
+ if (index < 0) {
125
+ throw new Error(CORRUPTED_CONFIG_TEXT);
126
+ }
127
+ if (index >= periods.length) {
128
+ return this.displayedPeriodType;
129
+ }
130
+ this.displayedPeriodName = periods[index + 1];
131
+ this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];
132
+ return this.displayedPeriodType;
133
+ }
134
+ /**
135
+ * Gets type that is below current period picker
136
+ */
137
+ getLowerType() {
138
+ const periods = Object.keys(this.ɵOptions.periodsDefinition);
139
+ const index = periods.indexOf(this.displayedPeriodName);
140
+ if (index < 0) {
141
+ throw new Error(CORRUPTED_CONFIG_TEXT);
142
+ }
143
+ if (index <= 0) {
144
+ return this.displayedPeriodType;
145
+ }
146
+ this.displayedPeriodName = periods[index - 1];
147
+ this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];
148
+ return this.displayedPeriodType;
149
+ }
150
+ }
151
+ DateTimePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerComponent, deps: [{ token: POSITION }, { token: DATE_API }, { token: DATE_TIME_PICKER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
152
+ DateTimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: DateTimePickerComponent, selector: "date-time-picker", inputs: { value: "value", options: "options" }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "pickerContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container #container></ng-container>", changeDetection: i0.ChangeDetectionStrategy.OnPush });
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerComponent, decorators: [{
154
+ type: Component,
155
+ args: [{ selector: 'date-time-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container #container></ng-container>" }]
156
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
157
+ type: Inject,
158
+ args: [POSITION]
159
+ }] }, { type: undefined, decorators: [{
160
+ type: Inject,
161
+ args: [DATE_API]
162
+ }] }, { type: undefined, decorators: [{
163
+ type: Inject,
164
+ args: [DATE_TIME_PICKER_OPTIONS]
165
+ }, {
166
+ type: Optional
167
+ }] }]; }, propDecorators: { pickerContainer: [{
168
+ type: ViewChild,
169
+ args: ['container', { read: ViewContainerRef, static: true }]
170
+ }], value: [{
171
+ type: Input
172
+ }], options: [{
173
+ type: Input
174
+ }], valueChange: [{
175
+ type: Output
176
+ }] } });
177
+ //# sourceMappingURL=dateTimePicker.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateTimePicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dateTimePicker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,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAExD,IAAG,KAAK,GAAG,CAAC,EACZ;YACI,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SAC1C;QAED,IAAG,KAAK,IAAI,CAAC,EACb;YACI,OAAO,IAAI,CAAC,mBAAmB,CAAC;SACnC;QAED,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAErF,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;;oHA/NQ,uBAAuB,kBAwEZ,QAAQ,aACR,QAAQ,aACR,wBAAwB;wGA1EnC,uBAAuB,0OAkCD,gBAAgB,gEC5EnD,0CAAwC;2FD0C3B,uBAAuB;kBANnC,SAAS;+BAEI,kBAAkB,mBAEX,uBAAuB,CAAC,MAAM;;0BA0ElC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,wBAAwB;;0BAAG,QAAQ;4CAvC7C,eAAe;sBADxB,SAAS;uBAAC,WAAW,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAC;gBASvD,KAAK;sBADX,KAAK;gBAOK,OAAO;sBADjB,KAAK;gBAqBC,WAAW;sBADjB,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ViewChild, ViewContainerRef, Type, EventEmitter, Output, Input, OnChanges, SimpleChanges, Inject, Optional, OnDestroy, ComponentRef} from '@angular/core';\nimport {Position, POSITION} from '@anglr/common';\nimport {extend, isBlank, nameof} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInputValue} from '../../../../interfaces';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {DATE_TIME_PICKER_OPTIONS} from '../../misc/tokens';\nimport {DayPickerSAComponent} from '../dayPicker/dayPicker.component';\nimport {DateTimePickerOptions} from './dateTimePicker.interface';\nimport {DateTimePicker} from '../../interfaces';\nimport {DateApi} from '../../../../services';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {formatDateTime, parseDateTime} from '../../../../misc/utils';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\n\n/**\n * Text to be displayed when configuration, options are corrupted\n */\nconst CORRUPTED_CONFIG_TEXT = 'DateTime: Corrupted configuration for DateTimePicker!';\n\n/**\n * Default options for date time picker\n */\nconst defaultOptions: DateTimePickerOptions = \n{\n defaultPeriod: 'day',\n periodsDefinition:\n {\n 'day': DayPickerSAComponent,\n },\n};\n\n/**\n * Component used for displaying date time picker\n */\n@Component(\n{\n selector: 'date-time-picker',\n templateUrl: 'dateTimePicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimePickerComponent<TDate = unknown> implements DateTimeInputValue<TDate>, OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n \n /**\n * Subscription for changes in date time period picker\n */\n protected periodChangesSubscription: Subscription|undefined|null;\n\n /**\n * Options for date time picker\n */\n protected ɵOptions: DateTimePickerOptions<TDate>;\n\n /**\n * Currently displayed period type\n */\n protected displayedPeriodType: Type<DateTimePicker<TDate>>;\n\n /**\n * Name of period which is currently displayed\n */\n protected displayedPeriodName: string;\n\n /**\n * Instance of created date time period picker\n */\n protected component: ComponentRef<DateTimePicker<TDate>>|undefined|null;\n \n //######################### protected properties - children #########################\n\n /**\n * Container used for displaying pickers for specific date time part\n */\n @ViewChild('container', {read: ViewContainerRef, static: true})\n protected pickerContainer: ViewContainerRef|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * @inheritdoc\n */\n @Input()\n public value: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Options for date time picker\n */\n @Input()\n public get options(): Partial<DateTimePickerOptions<TDate>>\n {\n return this.ɵOptions;\n }\n public set options(value: Partial<DateTimePickerOptions<TDate>>)\n {\n this.ɵOptions = extend(true, {}, defaultOptions, value);\n\n if(value?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = value.periodsDefinition;\n }\n }\n\n //######################### public properties - outputs #########################\n\n /**\n * @inheritdoc\n */\n @Output()\n public valueChange: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(@Inject(POSITION) protected position: Position,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n @Inject(DATE_TIME_PICKER_OPTIONS) @Optional() options?: DateTimePickerOptions<TDate>,)\n {\n this.ɵOptions = extend(true, {}, defaultOptions, options);\n \n if(options?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = options.periodsDefinition;\n }\n\n this.displayedPeriodName = this.ɵOptions.defaultPeriod;\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n if(!this.displayedPeriodType)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<DateTimePickerComponent>('value') in changes)\n {\n //empty value show now\n if(isBlank(this.value))\n {\n const now = this.dateApi.now();\n\n this.showPicker(this.displayedPeriodType, now.value);\n\n return;\n }\n\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.component?.destroy();\n this.component = null;\n\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows picker\n * @param type - Type of period that should be displayed\n * @param displayDate - Display date to be shown\n */\n protected showPicker(type: Type<DateTimePicker<TDate>>, displayDate: TDate): void\n {\n if(!this.pickerContainer)\n {\n return;\n }\n\n //create new component and destroy previous one\n if(!this.component || (this.component && type != this.displayedPeriodType))\n {\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = new Subscription();\n this.component?.destroy();\n this.component = this.pickerContainer.createComponent(type);\n\n this.periodChangesSubscription.add(this.component.instance.valueChange.subscribe(() =>\n {\n const component = this.component?.instance;\n\n if(!component)\n {\n return;\n }\n\n this.value = formatDateTime(component.value, DateTimeValueFormat.DateInstance, null);\n this.valueChange.emit();\n }));\n\n this.periodChangesSubscription.add(this.component.instance.goUp.subscribe(date => this.showPicker(this.getUpperType(), date)));\n this.periodChangesSubscription.add(this.component.instance.goDown.subscribe(date => this.showPicker(this.getLowerType(), date)));\n }\n\n const component = this.component.instance;\n\n component.canGoDown = false,\n component.canGoUp = false;\n component.display = displayDate;\n // component.options\n //TODO: maybe add support for format!\n component.value = parseDateTime(this.value, this.dateApi, null, null);\n }\n\n /**\n * Gets type that is above current period picker\n */\n protected getUpperType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index >= periods.length)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index + 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n\n /**\n * Gets type that is below current period picker\n */\n protected getLowerType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index <= 0)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index - 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n}","<ng-container #container></ng-container>"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dateTimePicker.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from '@angular/core';\nimport {Dictionary} from '@jscrpt/common';\n\nimport {DateTimePicker} from '../../interfaces';\n\n/**\n * Defintion of date time picker component options\n */\nexport interface DateTimePickerOptions<TDate = unknown>\n{\n /**\n * Definition of types for each period type for picker\n */\n periodsDefinition: Dictionary<Type<DateTimePicker<TDate>>>;\n\n /**\n * Name of default period for picker that is displayed after opening\n */\n defaultPeriod: string;\n}"]}
@@ -0,0 +1,17 @@
1
+ import { Component, ChangeDetectionStrategy } from '@angular/core';
2
+ import { DateTimePeriodPickerBase } from '../dateTimePeriodPickerBase';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Component used for displaying day picker
6
+ */
7
+ export class DayPickerSAComponent extends DateTimePeriodPickerBase {
8
+ }
9
+ DayPickerSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DayPickerSAComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
10
+ DayPickerSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: DayPickerSAComponent, isStandalone: true, selector: "day-picker", host: { properties: { "class.date-time-period": "true" } }, usesInheritance: true, ngImport: i0, template: "<!-- <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> -->\r\n\r\nDAY", changeDetection: i0.ChangeDetectionStrategy.OnPush });
11
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DayPickerSAComponent, decorators: [{
12
+ type: Component,
13
+ args: [{ selector: 'day-picker', host: {
14
+ '[class.date-time-period]': 'true',
15
+ }, standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- <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> -->\r\n\r\nDAY" }]
16
+ }] });
17
+ //# sourceMappingURL=dayPicker.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAGjE,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;;AAErE;;GAEG;AAYH,MAAM,OAAO,oBAAsC,SAAQ,wBAA+B;;iHAA7E,oBAAoB;qGAApB,oBAAoB,yJCnBjC,+xCAsBG;2FDHU,oBAAoB;kBAXhC,SAAS;+BAEI,YAAY,QAGtB;wBACI,0BAA0B,EAAE,MAAM;qBACrC,cACW,IAAI,mBACC,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy} from '@angular/core';\n\nimport {DateTimePicker} from '../../interfaces';\nimport {DateTimePeriodPickerBase} from '../dateTimePeriodPickerBase';\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'day-picker',\n templateUrl: 'dayPicker.component.html',\n host:\n {\n '[class.date-time-period]': 'true',\n },\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DayPickerSAComponent<TDate = unknown> extends DateTimePeriodPickerBase<TDate> implements DateTimePicker<TDate>\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> -->\r\n\r\nDAY"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dayPicker.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dayPicker.interfaces.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import {CommonPickerCssClasses} from '../../../../legacy/picker/interfaces';\n\n/**\n * Specific css classes for day picker\n */\nexport interface DayPickerCssClasses extends CommonPickerCssClasses\n{\n /**\n * Element displaying weekday name\n */\n weekdayName?: string;\n}"]}
@@ -0,0 +1,5 @@
1
+ export * from './dateTimePeriodPickerBase';
2
+ export * from './dateTimePicker/dateTimePicker.component';
3
+ export * from './dateTimePicker/dateTimePicker.interface';
4
+ export * from './dayPicker/dayPicker.component';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/dateTimePicker/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './dateTimePeriodPickerBase';\nexport * from './dateTimePicker/dateTimePicker.component';\nexport * from './dateTimePicker/dateTimePicker.interface';\nexport * from './dayPicker/dayPicker.component';\n"]}
@@ -0,0 +1,183 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Directive, ElementRef, Inject, Input, Optional, ViewContainerRef } from '@angular/core';
3
+ import { DOCUMENT } from '@angular/common';
4
+ import { POSITION, applyPositionResult, PositionPlacement } from '@anglr/common';
5
+ import { extend, nameof, isDescendant, BindThis } from '@jscrpt/common';
6
+ import { lastValueFrom, Subscription } from 'rxjs';
7
+ import { DATE_TIME_INPUT } from '../../../../misc/tokens';
8
+ import { DateTimePickerComponent } from '../../components';
9
+ import { DATE_TIME_PICKER_DIRECTIVE_OPTIONS } from '../../misc/tokens';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * Default options for date time picker directive
13
+ */
14
+ const defaultOptions = {
15
+ absolute: true,
16
+ alwaysVisible: false,
17
+ closeOnValueSelect: true,
18
+ disabled: false,
19
+ positionOptions: PositionPlacement.BottomStart,
20
+ showOnFocus: true,
21
+ };
22
+ /**
23
+ * Directive that is used for displaying and attaching date time picker
24
+ */
25
+ export class DateTimePickerDirective {
26
+ //######################### constructor #########################
27
+ constructor(viewContainer, element, input, document, position, options) {
28
+ this.viewContainer = viewContainer;
29
+ this.element = element;
30
+ this.input = input;
31
+ this.document = document;
32
+ this.position = position;
33
+ //######################### protected properties #########################
34
+ /**
35
+ * Indication whether is value changes disabled
36
+ */
37
+ this.valueChangeDisabled = false;
38
+ /**
39
+ * Subscriptions created during initialization
40
+ */
41
+ this.initSubscriptions = new Subscription();
42
+ this.ɵWithPickerOptions = extend(true, {}, defaultOptions, options);
43
+ }
44
+ //######################### public properties - inputs #########################
45
+ /**
46
+ * Gets or sets options for date time picker directive
47
+ */
48
+ get withPickerOptions() {
49
+ return this.ɵWithPickerOptions;
50
+ }
51
+ set withPickerOptions(value) {
52
+ this.ɵWithPickerOptions = extend(true, {}, this.ɵWithPickerOptions, value);
53
+ }
54
+ //######################### public methods - implementation of OnInit #########################
55
+ /**
56
+ * Initialize component
57
+ */
58
+ async ngOnInit() {
59
+ if (this.withPickerOptions.alwaysVisible) {
60
+ this.showPicker();
61
+ }
62
+ this.initSubscriptions.add(this.input.valueChange.subscribe(() => this.setPickerValue()));
63
+ this.initSubscriptions.add(this.input.focus.subscribe(() => {
64
+ if (this.withPickerOptions.showOnFocus) {
65
+ this.showPicker();
66
+ }
67
+ }));
68
+ }
69
+ //######################### public methods - implementation of OnDestroy #########################
70
+ /**
71
+ * Called when component is destroyed
72
+ */
73
+ ngOnDestroy() {
74
+ this.hidePicker();
75
+ this.initSubscriptions.unsubscribe();
76
+ }
77
+ //######################### public methods #########################
78
+ /**
79
+ * Hides date time picker
80
+ */
81
+ async showPicker() {
82
+ if (this.withPickerOptions.disabled || this.componentRef) {
83
+ return;
84
+ }
85
+ this.componentRef = this.viewContainer.createComponent((DateTimePickerComponent));
86
+ this.componentElement = this.componentRef?.hostView.rootNodes[0];
87
+ this.component = this.componentRef.instance;
88
+ if (this.withPickerOptions.absolute) {
89
+ this.document.body.append(this.componentElement);
90
+ }
91
+ this.valueChangeSubscription = this.component.valueChange.subscribe(() => {
92
+ if (this.component) {
93
+ this.valueChangeDisabled = true;
94
+ this.input.value = this.component.value;
95
+ this.input.valueChange.emit();
96
+ this.valueChangeDisabled = false;
97
+ }
98
+ });
99
+ this.document.addEventListener('click', this.handleClickOutside);
100
+ const result = await lastValueFrom(this.position.placeElement(this.componentElement, this.element.nativeElement, {
101
+ placement: this.withPickerOptions.positionOptions,
102
+ }));
103
+ applyPositionResult(result);
104
+ this.setPickerValue();
105
+ }
106
+ /**
107
+ * Shows date time picker
108
+ */
109
+ hidePicker() {
110
+ if (this.withPickerOptions.alwaysVisible) {
111
+ return;
112
+ }
113
+ this.valueChangeSubscription?.unsubscribe();
114
+ this.valueChangeSubscription = null;
115
+ this.component = null;
116
+ this.componentRef?.destroy();
117
+ this.componentRef = null;
118
+ this.componentElement?.remove();
119
+ this.componentElement = null;
120
+ this.document.removeEventListener('click', this.handleClickOutside);
121
+ }
122
+ //######################### protected methods #########################
123
+ /**
124
+ * Sets all picker value
125
+ */
126
+ setPickerValue() {
127
+ if (this.valueChangeDisabled) {
128
+ return;
129
+ }
130
+ if (this.componentRef) {
131
+ this.componentRef.setInput(nameof('value'), this.input.value);
132
+ // this.componentRef.changeDetectorRef.markForCheck();
133
+ this.componentRef.changeDetectorRef.detectChanges();
134
+ }
135
+ }
136
+ /**
137
+ * Handles clicking outside of picker
138
+ * @param event - Event that occured
139
+ */
140
+ handleClickOutside(event) {
141
+ if (!this.componentElement) {
142
+ return;
143
+ }
144
+ if (this.componentElement != event.target &&
145
+ !isDescendant(this.componentElement, event.target) &&
146
+ (!this.input.element || (this.input.element != event.target &&
147
+ !isDescendant(this.input.element, event.target)))) {
148
+ this.hidePicker();
149
+ }
150
+ }
151
+ }
152
+ 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 });
153
+ DateTimePickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.6", type: DateTimePickerDirective, selector: "[dateTime][withPicker]", inputs: { withPickerOptions: "withPickerOptions" }, exportAs: ["dateTimePicker"], ngImport: i0 });
154
+ __decorate([
155
+ BindThis,
156
+ __metadata("design:type", Function),
157
+ __metadata("design:paramtypes", [MouseEvent]),
158
+ __metadata("design:returntype", void 0)
159
+ ], DateTimePickerDirective.prototype, "handleClickOutside", null);
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerDirective, decorators: [{
161
+ type: Directive,
162
+ args: [{
163
+ selector: '[dateTime][withPicker]',
164
+ exportAs: 'dateTimePicker'
165
+ }]
166
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ElementRef }, { type: undefined, decorators: [{
167
+ type: Inject,
168
+ args: [DATE_TIME_INPUT]
169
+ }] }, { type: Document, decorators: [{
170
+ type: Inject,
171
+ args: [DOCUMENT]
172
+ }] }, { type: undefined, decorators: [{
173
+ type: Inject,
174
+ args: [POSITION]
175
+ }] }, { type: undefined, decorators: [{
176
+ type: Inject,
177
+ args: [DATE_TIME_PICKER_DIRECTIVE_OPTIONS]
178
+ }, {
179
+ type: Optional
180
+ }] }]; }, propDecorators: { withPickerOptions: [{
181
+ type: Input
182
+ }], handleClickOutside: [] } });
183
+ //# sourceMappingURL=dateTimePicker.directive.js.map