@anglr/datetime 8.1.0 → 9.0.0-beta.20241004120552

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/changelog.md +61 -1
  2. package/date-fns/src/services/dateFnsDateApi.service.d.ts +58 -130
  3. package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
  4. package/es2022/date-fns/src/services/dateFnsDateApi.service.js +60 -143
  5. package/es2022/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
  6. package/es2022/moment/src/services/momentDateApi.service.js +58 -140
  7. package/es2022/moment/src/services/momentDateApi.service.js.map +1 -1
  8. package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js +17 -30
  9. package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js.map +1 -1
  10. package/es2022/src/directives/datePickerInput/datePickerInput.directive.js +9 -9
  11. package/es2022/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -1
  12. package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +16 -26
  13. package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -1
  14. package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +8 -8
  15. package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -1
  16. package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js +9 -9
  17. package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +1 -1
  18. package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js +7 -11
  19. package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +1 -1
  20. package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js +8 -8
  21. package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +1 -1
  22. package/es2022/src/directives/withNow/withNow.directive.js +11 -11
  23. package/es2022/src/directives/withNow/withNow.directive.js.map +1 -1
  24. package/es2022/src/directives/withTime/withTime.directive.js +10 -10
  25. package/es2022/src/directives/withTime/withTime.directive.js.map +1 -1
  26. package/es2022/src/directives/withToday/withToday.directive.js +11 -11
  27. package/es2022/src/directives/withToday/withToday.directive.js.map +1 -1
  28. package/es2022/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
  29. package/es2022/src/misc/enums.js +8 -4
  30. package/es2022/src/misc/enums.js.map +1 -1
  31. package/es2022/src/misc/utils.js +7 -6
  32. package/es2022/src/misc/utils.js.map +1 -1
  33. package/es2022/src/misc/validators.js.map +1 -1
  34. package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js +36 -59
  35. package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +1 -1
  36. package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js +5 -5
  37. package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +1 -1
  38. package/es2022/src/modules/calendar/modules/monthCalendar.module.js +7 -11
  39. package/es2022/src/modules/calendar/modules/monthCalendar.module.js.map +1 -1
  40. package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js +3 -4
  41. package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js.map +1 -1
  42. package/es2022/src/modules/datePipes.module.js +6 -6
  43. package/es2022/src/modules/datePipes.module.js.map +1 -1
  44. package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js +41 -72
  45. package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
  46. package/es2022/src/modules/dateTime/directives/dateTimeBase.js +21 -25
  47. package/es2022/src/modules/dateTime/directives/dateTimeBase.js.map +1 -1
  48. package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js +36 -16
  49. package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +1 -1
  50. package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +18 -26
  51. package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
  52. package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +12 -13
  53. package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -1
  54. package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +12 -13
  55. package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -1
  56. package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +12 -13
  57. package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
  58. package/es2022/src/modules/dateTime/modules/dateTime.module.js +27 -27
  59. package/es2022/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
  60. package/es2022/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +39 -58
  61. package/es2022/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
  62. package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +21 -57
  63. package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
  64. package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +14 -14
  65. package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
  66. package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +4 -5
  67. package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -1
  68. package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +27 -24
  69. package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
  70. package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +12 -9
  71. package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +1 -1
  72. package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +11 -40
  73. package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
  74. package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js +40 -55
  75. package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +1 -1
  76. package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +8 -14
  77. package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +1 -1
  78. package/es2022/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.js.map +1 -1
  79. package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js +9 -10
  80. package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js.map +1 -1
  81. package/es2022/src/pipes/dateConvert.pipe.js +4 -5
  82. package/es2022/src/pipes/dateConvert.pipe.js.map +1 -1
  83. package/es2022/src/pipes/dateFormat.pipe.js +4 -6
  84. package/es2022/src/pipes/dateFormat.pipe.js.map +1 -1
  85. package/es2022/src/services/dateApi/dateApi.interface.js.map +1 -1
  86. package/es2022/src/services/datePositionParser/datePositionParser.service.js +16 -17
  87. package/es2022/src/services/datePositionParser/datePositionParser.service.js.map +1 -1
  88. package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js +3 -9
  89. package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +1 -1
  90. package/es2022/src/services/dateValueProvider/dateValueProvider.service.js +3 -5
  91. package/es2022/src/services/dateValueProvider/dateValueProvider.service.js.map +1 -1
  92. package/lerna.json +4 -0
  93. package/moment/src/services/momentDateApi.service.d.ts +59 -132
  94. package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
  95. package/package.json +41 -43
  96. package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts +3 -3
  97. package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts.map +1 -1
  98. package/src/directives/datePickerInput/datePickerInput.directive.d.ts +3 -3
  99. package/src/directives/datePickerInput/datePickerInput.directive.d.ts.map +1 -1
  100. package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts +7 -7
  101. package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts.map +1 -1
  102. package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts +3 -3
  103. package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts.map +1 -1
  104. package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts +3 -3
  105. package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts.map +1 -1
  106. package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts +7 -7
  107. package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts.map +1 -1
  108. package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts +3 -3
  109. package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts.map +1 -1
  110. package/src/directives/withNow/withNow.directive.d.ts +5 -5
  111. package/src/directives/withNow/withNow.directive.d.ts.map +1 -1
  112. package/src/directives/withTime/withTime.directive.d.ts +5 -5
  113. package/src/directives/withTime/withTime.directive.d.ts.map +1 -1
  114. package/src/directives/withToday/withToday.directive.d.ts +5 -5
  115. package/src/directives/withToday/withToday.directive.d.ts.map +1 -1
  116. package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts +1 -1
  117. package/src/misc/enums.d.ts +8 -4
  118. package/src/misc/enums.d.ts.map +1 -1
  119. package/src/misc/utils.d.ts +3 -3
  120. package/src/misc/utils.d.ts.map +1 -1
  121. package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts +1 -1
  122. package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts.map +1 -1
  123. package/src/modules/calendar/components/monthCalendar/monthCalendar.component.html +17 -9
  124. package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts +1 -1
  125. package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts.map +1 -1
  126. package/src/modules/calendar/modules/monthCalendar.module.d.ts +3 -4
  127. package/src/modules/calendar/modules/monthCalendar.module.d.ts.map +1 -1
  128. package/src/modules/datePipes.module.d.ts +1 -1
  129. package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts +3 -3
  130. package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
  131. package/src/modules/dateTime/directives/dateTimeBase.d.ts +3 -3
  132. package/src/modules/dateTime/directives/dateTimeBase.d.ts.map +1 -1
  133. package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts +6 -4
  134. package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts.map +1 -1
  135. package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts +3 -3
  136. package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
  137. package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts +3 -3
  138. package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -1
  139. package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts +3 -3
  140. package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -1
  141. package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts +3 -3
  142. package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
  143. package/src/modules/dateTime/modules/dateTime.module.d.ts +1 -1
  144. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +4 -4
  145. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
  146. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.html +1 -1
  147. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts +3 -3
  148. package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
  149. package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts +3 -3
  150. package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
  151. package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts +3 -3
  152. package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts.map +1 -1
  153. package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts +3 -3
  154. package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
  155. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts +5 -5
  156. package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
  157. package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts +7 -7
  158. package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts.map +1 -1
  159. package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts +3 -3
  160. package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts.map +1 -1
  161. package/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.d.ts.map +1 -1
  162. package/src/modules/dateTimePicker/modules/dateTimePicker.module.d.ts +3 -3
  163. package/src/modules/dateTimePicker/modules/dateTimePicker.module.d.ts.map +1 -1
  164. package/src/pipes/dateConvert.pipe.d.ts +1 -1
  165. package/src/pipes/dateFormat.pipe.d.ts +1 -1
  166. package/src/services/dateApi/dateApi.interface.d.ts +5 -1
  167. package/src/services/dateApi/dateApi.interface.d.ts.map +1 -1
  168. package/src/services/dateValueProvider/dateValueProvider.service.d.ts.map +1 -1
  169. package/version.bak +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dateTimePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/dateTimePickerInput/dateTimePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,0BAA0B,EAAC,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;;;;AAEnE;;GAEG;AAeH,MAAM,OAAO,8BAA8B;uGAA9B,8BAA8B;2FAA9B,8BAA8B;;2FAA9B,8BAA8B;kBAd1C,SAAS;mBACV;oBACI,QAAQ,EAAE,sCAAsC;oBAChD,UAAU,EAAE,IAAI;oBAChB,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,0BAA0B;yBACxC;wBACD;4BACI,SAAS,EAAE,mBAAmB;yBACjC;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {DatePickerInputSADirective} from '../datePickerInput/datePickerInput.directive';\nimport {WithTimeSADirective} from '../withTime/withTime.directive';\n\n/**\n * Directive that combines date time picker with date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][dateTimePickerInput]',\n standalone: true,\n hostDirectives:\n [\n {\n directive: DatePickerInputSADirective,\n },\n {\n directive: WithTimeSADirective,\n },\n ],\n})\nexport class DateTimePickerInputSADirective\n{\n}"]}
1
+ {"version":3,"file":"dateTimePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/dateTimePickerInput/dateTimePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,wBAAwB,EAAC,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;;;;AAEjE;;GAEG;AAeH,MAAM,OAAO,4BAA4B;8GAA5B,4BAA4B;kGAA5B,4BAA4B;;2FAA5B,4BAA4B;kBAdxC,SAAS;mBACV;oBACI,QAAQ,EAAE,sCAAsC;oBAChD,UAAU,EAAE,IAAI;oBAChB,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,wBAAwB;yBACtC;wBACD;4BACI,SAAS,EAAE,iBAAiB;yBAC/B;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {DatePickerInputDirective} from '../datePickerInput/datePickerInput.directive';\nimport {WithTimeDirective} from '../withTime/withTime.directive';\n\n/**\n * Directive that combines date time picker with date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][dateTimePickerInput]',\n standalone: true,\n hostDirectives:\n [\n {\n directive: DatePickerInputDirective,\n },\n {\n directive: WithTimeDirective,\n },\n ],\n})\nexport class DateTimePickerInputDirective\n{\n}"]}
@@ -1,6 +1,6 @@
1
1
  import { Directive } from '@angular/core';
2
- import { DateTimeInputSADirective, DateTimePickerSADirective } from '../../modules';
3
- import { SimpleDateTimeInputHandlerSADirective } from '../simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive';
2
+ import { DateTimeInputDirective, DateTimePickerDirective } from '../../modules';
3
+ import { SimpleDateTimeInputHandlerDirective } from '../simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive';
4
4
  import * as i0 from "@angular/core";
5
5
  import * as i1 from "../../modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive";
6
6
  import * as i2 from "../../modules/dateTime/directives/dateTimeInput/dateTimeInput.directive";
@@ -8,28 +8,28 @@ import * as i3 from "../simpleDateTimeInputHandler/simpleDateTimeInputHandler.di
8
8
  /**
9
9
  * Directive that combines date picker with simple date input
10
10
  */
11
- export class SimpleDatePickerInputSADirective {
12
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: SimpleDatePickerInputSADirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
13
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: SimpleDatePickerInputSADirective, isStandalone: true, selector: "input[dateTime][simpleDatePickerInput]", hostDirectives: [{ directive: i1.DateTimePickerSADirective, inputs: ["withPickerOptions", "withPickerOptions", "pickerOptions", "pickerOptions"] }, { directive: i2.DateTimeInputSADirective }, { directive: i3.SimpleDateTimeInputHandlerSADirective }], ngImport: i0 });
11
+ export class SimpleDatePickerInputDirective {
12
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SimpleDatePickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
13
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: SimpleDatePickerInputDirective, isStandalone: true, selector: "input[dateTime][simpleDatePickerInput]", hostDirectives: [{ directive: i1.DateTimePickerDirective, inputs: ["withPickerOptions", "withPickerOptions", "pickerOptions", "pickerOptions"] }, { directive: i2.DateTimeInputDirective }, { directive: i3.SimpleDateTimeInputHandlerDirective }], ngImport: i0 }); }
14
14
  }
15
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: SimpleDatePickerInputSADirective, decorators: [{
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SimpleDatePickerInputDirective, decorators: [{
16
16
  type: Directive,
17
17
  args: [{
18
18
  selector: 'input[dateTime][simpleDatePickerInput]',
19
19
  standalone: true,
20
20
  hostDirectives: [
21
21
  {
22
- directive: DateTimePickerSADirective,
22
+ directive: DateTimePickerDirective,
23
23
  inputs: [
24
24
  'withPickerOptions',
25
25
  'pickerOptions',
26
26
  ]
27
27
  },
28
28
  {
29
- directive: DateTimeInputSADirective,
29
+ directive: DateTimeInputDirective,
30
30
  },
31
31
  {
32
- directive: SimpleDateTimeInputHandlerSADirective,
32
+ directive: SimpleDateTimeInputHandlerDirective,
33
33
  },
34
34
  ],
35
35
  }]
@@ -1 +1 @@
1
- {"version":3,"file":"simpleDatePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,wBAAwB,EAAE,yBAAyB,EAAC,MAAM,eAAe,CAAC;AAClF,OAAO,EAAC,qCAAqC,EAAC,MAAM,oEAAoE,CAAC;;;;;AAEzH;;GAEG;AAuBH,MAAM,OAAO,gCAAgC;uGAAhC,gCAAgC;2FAAhC,gCAAgC;;2FAAhC,gCAAgC;kBAtB5C,SAAS;mBACV;oBACI,QAAQ,EAAE,wCAAwC;oBAClD,UAAU,EAAE,IAAI;oBAChB,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,yBAAyB;4BACpC,MAAM,EACN;gCACI,mBAAmB;gCACnB,eAAe;6BAClB;yBACJ;wBACD;4BACI,SAAS,EAAE,wBAAwB;yBACtC;wBACD;4BACI,SAAS,EAAE,qCAAqC;yBACnD;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {DateTimeInputSADirective, DateTimePickerSADirective} from '../../modules';\nimport {SimpleDateTimeInputHandlerSADirective} from '../simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive';\n\n/**\n * Directive that combines date picker with simple date input\n */\n@Directive(\n{\n selector: 'input[dateTime][simpleDatePickerInput]',\n standalone: true,\n hostDirectives:\n [\n {\n directive: DateTimePickerSADirective,\n inputs:\n [\n 'withPickerOptions',\n 'pickerOptions',\n ]\n },\n {\n directive: DateTimeInputSADirective,\n },\n {\n directive: SimpleDateTimeInputHandlerSADirective,\n },\n ],\n})\nexport class SimpleDatePickerInputSADirective\n{\n}"]}
1
+ {"version":3,"file":"simpleDatePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,mCAAmC,EAAC,MAAM,oEAAoE,CAAC;;;;;AAEvH;;GAEG;AAuBH,MAAM,OAAO,8BAA8B;8GAA9B,8BAA8B;kGAA9B,8BAA8B;;2FAA9B,8BAA8B;kBAtB1C,SAAS;mBACV;oBACI,QAAQ,EAAE,wCAAwC;oBAClD,UAAU,EAAE,IAAI;oBAChB,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,uBAAuB;4BAClC,MAAM,EACN;gCACI,mBAAmB;gCACnB,eAAe;6BAClB;yBACJ;wBACD;4BACI,SAAS,EAAE,sBAAsB;yBACpC;wBACD;4BACI,SAAS,EAAE,mCAAmC;yBACjD;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {DateTimeInputDirective, DateTimePickerDirective} from '../../modules';\nimport {SimpleDateTimeInputHandlerDirective} from '../simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive';\n\n/**\n * Directive that combines date picker with simple date input\n */\n@Directive(\n{\n selector: 'input[dateTime][simpleDatePickerInput]',\n standalone: true,\n hostDirectives:\n [\n {\n directive: DateTimePickerDirective,\n inputs:\n [\n 'withPickerOptions',\n 'pickerOptions',\n ]\n },\n {\n directive: DateTimeInputDirective,\n },\n {\n directive: SimpleDateTimeInputHandlerDirective,\n },\n ],\n})\nexport class SimpleDatePickerInputDirective\n{\n}"]}
@@ -3,17 +3,13 @@ import { Directive, Inject, Optional } from '@angular/core';
3
3
  import { BindThis } from '@jscrpt/common';
4
4
  import { DATE_TIME_INPUT, DATE_API } from '../../misc/tokens';
5
5
  import { parseDateTime } from '../../misc/utils';
6
- import { DateTimePickerSADirective, DateTimeSADirective } from '../../modules';
6
+ import { DateTimePickerDirective, DateTimeDirective } from '../../modules';
7
7
  import * as i0 from "@angular/core";
8
8
  import * as i1 from "../../modules";
9
9
  /**
10
10
  * Directive that adds simple handler for date time input, which allows simple navigation using keyboard
11
11
  */
12
- export class SimpleDateTimeInputHandlerSADirective {
13
- input;
14
- dateApi;
15
- dateTimeData;
16
- picker;
12
+ export class SimpleDateTimeInputHandlerDirective {
17
13
  //######################### constructor #########################
18
14
  constructor(input, dateApi, dateTimeData, picker) {
19
15
  this.input = input;
@@ -113,16 +109,16 @@ export class SimpleDateTimeInputHandlerSADirective {
113
109
  this.input.valueChange.next();
114
110
  }
115
111
  }
116
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: SimpleDateTimeInputHandlerSADirective, deps: [{ token: DATE_TIME_INPUT }, { token: DATE_API }, { token: i1.DateTimeSADirective }, { token: i1.DateTimePickerSADirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
117
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: SimpleDateTimeInputHandlerSADirective, isStandalone: true, selector: "[dateTime][withSimpleHandler]", ngImport: i0 });
112
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SimpleDateTimeInputHandlerDirective, deps: [{ token: DATE_TIME_INPUT }, { token: DATE_API }, { token: i1.DateTimeDirective }, { token: i1.DateTimePickerDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
113
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: SimpleDateTimeInputHandlerDirective, isStandalone: true, selector: "[dateTime][withSimpleHandler]", ngImport: i0 }); }
118
114
  }
119
115
  __decorate([
120
116
  BindThis,
121
117
  __metadata("design:type", Function),
122
118
  __metadata("design:paramtypes", [KeyboardEvent]),
123
119
  __metadata("design:returntype", void 0)
124
- ], SimpleDateTimeInputHandlerSADirective.prototype, "handleKeyboard", null);
125
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: SimpleDateTimeInputHandlerSADirective, decorators: [{
120
+ ], SimpleDateTimeInputHandlerDirective.prototype, "handleKeyboard", null);
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SimpleDateTimeInputHandlerDirective, decorators: [{
126
122
  type: Directive,
127
123
  args: [{
128
124
  selector: '[dateTime][withSimpleHandler]',
@@ -134,7 +130,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImpor
134
130
  }] }, { type: undefined, decorators: [{
135
131
  type: Inject,
136
132
  args: [DATE_API]
137
- }] }, { type: i1.DateTimeSADirective }, { type: i1.DateTimePickerSADirective, decorators: [{
133
+ }] }, { type: i1.DateTimeDirective }, { type: i1.DateTimePickerDirective, decorators: [{
138
134
  type: Optional
139
135
  }] }], propDecorators: { handleKeyboard: [] } });
140
136
  //# sourceMappingURL=simpleDateTimeInputHandler.directive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"simpleDateTimeInputHandler.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAqB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,yBAAyB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;;;AAG7E;;GAEG;AAMH,MAAM,OAAO,qCAAqC;IAGC;IACP;IAClB;IACY;IAJlC,iEAAiE;IACjE,YAA+C,KAA2B,EAClC,OAAuB,EACzC,YAAwC,EAC5B,MAAyC;QAH5B,UAAK,GAAL,KAAK,CAAsB;QAClC,YAAO,GAAP,OAAO,CAAg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,CAAC,aAAa,CAAC,EACrC;YACI,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;SACjC;IACL,CAAC;uGAtIQ,qCAAqC,kBAG1B,eAAe,aACf,QAAQ;2FAJnB,qCAAqC;;AAqCvC;IADN,QAAQ;;qCACoB,aAAa;;2EA8DzC;2FAnGQ,qCAAqC;kBALjD,SAAS;mBACV;oBACI,QAAQ,EAAE,+BAA+B;oBACzC,UAAU,EAAE,IAAI;iBACnB;;0BAIgB,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ;;0BAEf,QAAQ;yCA+Bd,cAAc","sourcesContent":["import {Directive, Inject, OnDestroy, OnInit, Optional} from '@angular/core';\nimport {BindThis} from '@jscrpt/common';\n\nimport {DateTimeInput} from '../../interfaces';\nimport {DATE_TIME_INPUT, DATE_API} from '../../misc/tokens';\nimport {parseDateTime} from '../../misc/utils';\nimport {DateTimePickerSADirective, DateTimeSADirective} from '../../modules';\nimport {DateApi, DateApiObject} from '../../services';\n\n/**\n * Directive that adds simple handler for date time input, which allows simple navigation using keyboard\n */\n@Directive(\n{\n selector: '[dateTime][withSimpleHandler]',\n standalone: true,\n})\nexport class SimpleDateTimeInputHandlerSADirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected dateTimeData: DateTimeSADirective<TDate>,\n @Optional() protected picker?: DateTimePickerSADirective<TDate>,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.input.element.addEventListener('keydown', this.handleKeyboard);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.input.element.removeEventListener('keydown', this.handleKeyboard);\n }\n\n //######################### protected methods #########################\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n public handleKeyboard(event: KeyboardEvent): void\n {\n const parsedValue = parseDateTime(this.input.value, this.dateApi, null, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n \n //no value do nothing\n if(!parsedValue)\n {\n return;\n }\n\n //range value\n if(Array.isArray(parsedValue))\n {\n //TODO: finish range support\n }\n else\n {\n //do nothing for invalid date time\n if(!parsedValue.isValid())\n {\n return;\n }\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.withMinMaxConstraint(parsedValue, () => event.key == 'ArrowLeft' ? parsedValue.subtractDays(1) : parsedValue.addDays(1));\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.withMinMaxConstraint(parsedValue, () => event.key == 'ArrowUp' ? parsedValue.subtractWeeks(1) : parsedValue.addWeeks(1));\n\n break;\n }\n case 'Escape':\n {\n this.picker?.hidePicker();\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this.picker?.showPicker();\n }\n\n break;\n }\n }\n }\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n * @param value - Value to be tested\n */\n protected minMaxConstraintTest(value: DateApiObject<TDate>): boolean\n {\n return (!!this.dateTimeData.minDateTime && value.isBefore(this.dateTimeData.minDateTime)) ||\n (!!this.dateTimeData.maxDateTime && value.isAfter(this.dateTimeData.maxDateTime));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param value - Value to be used checked for constrains\n * @param code - Code that should be executed which can change current value\n */\n protected withMinMaxConstraint(value: DateApiObject<TDate>, code: () => void): void\n {\n value.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this.minMaxConstraintTest(value))\n {\n value.resetOriginal();\n }\n\n //value has changed, change input value\n if(!value.isSame(value.originalValue))\n {\n this.input.value = value.value;\n this.input.valueChange.next();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"simpleDateTimeInputHandler.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAqB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,uBAAuB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;;;AAGzE;;GAEG;AAMH,MAAM,OAAO,mCAAmC;IAE5C,iEAAiE;IACjE,YAA+C,KAA2B,EAClC,OAAuB,EACzC,YAAsC,EAC1B,MAAuC;QAH1B,UAAK,GAAL,KAAK,CAAsB;QAClC,YAAO,GAAP,OAAO,CAAgB;QACzC,iBAAY,GAAZ,YAAY,CAA0B;QAC1B,WAAM,GAAN,MAAM,CAAiC;IAEzE,CAAC;IAED,+FAA+F;IAE/F;;OAEG;IACI,QAAQ;QAEX,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACxE,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3E,CAAC;IAED,uEAAuE;IAEvE;;;OAGG;IAEI,cAAc,CAAC,KAAoB;QAEtC,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC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QAAQ;;0BAEf,QAAQ;yCA+Bd,cAAc","sourcesContent":["import {Directive, Inject, OnDestroy, OnInit, Optional} from '@angular/core';\nimport {BindThis} from '@jscrpt/common';\n\nimport {DateTimeInput} from '../../interfaces';\nimport {DATE_TIME_INPUT, DATE_API} from '../../misc/tokens';\nimport {parseDateTime} from '../../misc/utils';\nimport {DateTimePickerDirective, DateTimeDirective} from '../../modules';\nimport {DateApi, DateApiObject} from '../../services';\n\n/**\n * Directive that adds simple handler for date time input, which allows simple navigation using keyboard\n */\n@Directive(\n{\n selector: '[dateTime][withSimpleHandler]',\n standalone: true,\n})\nexport class SimpleDateTimeInputHandlerDirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected dateTimeData: DateTimeDirective<TDate>,\n @Optional() protected picker?: DateTimePickerDirective<TDate>,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.input.element.addEventListener('keydown', this.handleKeyboard);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.input.element.removeEventListener('keydown', this.handleKeyboard);\n }\n\n //######################### protected methods #########################\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n public handleKeyboard(event: KeyboardEvent): void\n {\n const parsedValue = parseDateTime(this.input.value, this.dateApi, null, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n \n //no value do nothing\n if(!parsedValue)\n {\n return;\n }\n\n //range value\n if(Array.isArray(parsedValue))\n {\n //TODO: finish range support\n }\n else\n {\n //do nothing for invalid date time\n if(!parsedValue.isValid())\n {\n return;\n }\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.withMinMaxConstraint(parsedValue, () => event.key == 'ArrowLeft' ? parsedValue.subtractDays(1) : parsedValue.addDays(1));\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.withMinMaxConstraint(parsedValue, () => event.key == 'ArrowUp' ? parsedValue.subtractWeeks(1) : parsedValue.addWeeks(1));\n\n break;\n }\n case 'Escape':\n {\n this.picker?.hidePicker();\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this.picker?.showPicker();\n }\n\n break;\n }\n }\n }\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n * @param value - Value to be tested\n */\n protected minMaxConstraintTest(value: DateApiObject<TDate>): boolean\n {\n return (!!this.dateTimeData.minDateTime && value.isBefore(this.dateTimeData.minDateTime)) ||\n (!!this.dateTimeData.maxDateTime && value.isAfter(this.dateTimeData.maxDateTime));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param value - Value to be used checked for constrains\n * @param code - Code that should be executed which can change current value\n */\n protected withMinMaxConstraint(value: DateApiObject<TDate>, code: () => void): void\n {\n value.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this.minMaxConstraintTest(value))\n {\n value.resetOriginal();\n }\n\n //value has changed, change input value\n if(!value.isSame(value.originalValue))\n {\n this.input.value = value.value;\n this.input.valueChange.next();\n }\n }\n}\n"]}
@@ -1,27 +1,27 @@
1
1
  import { Directive } from '@angular/core';
2
- import { SimpleDatePickerInputSADirective } from '../simpleDatePickerInput/simpleDatePickerInput.directive';
3
- import { WithTimeSADirective } from '../withTime/withTime.directive';
2
+ import { SimpleDatePickerInputDirective } from '../simpleDatePickerInput/simpleDatePickerInput.directive';
3
+ import { WithTimeDirective } from '../withTime/withTime.directive';
4
4
  import * as i0 from "@angular/core";
5
5
  import * as i1 from "../simpleDatePickerInput/simpleDatePickerInput.directive";
6
6
  import * as i2 from "../withTime/withTime.directive";
7
7
  /**
8
8
  * Directive that combines date time picker with simple date time input
9
9
  */
10
- export class SimpleDateTimePickerInputSADirective {
11
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: SimpleDateTimePickerInputSADirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
12
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: SimpleDateTimePickerInputSADirective, isStandalone: true, selector: "input[dateTime][simpleDateTimePickerInput]", hostDirectives: [{ directive: i1.SimpleDatePickerInputSADirective }, { directive: i2.WithTimeSADirective }], ngImport: i0 });
10
+ export class SimpleDateTimePickerInputDirective {
11
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SimpleDateTimePickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
12
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: SimpleDateTimePickerInputDirective, isStandalone: true, selector: "input[dateTime][simpleDateTimePickerInput]", hostDirectives: [{ directive: i1.SimpleDatePickerInputDirective }, { directive: i2.WithTimeDirective }], ngImport: i0 }); }
13
13
  }
14
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: SimpleDateTimePickerInputSADirective, decorators: [{
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SimpleDateTimePickerInputDirective, decorators: [{
15
15
  type: Directive,
16
16
  args: [{
17
17
  selector: 'input[dateTime][simpleDateTimePickerInput]',
18
18
  standalone: true,
19
19
  hostDirectives: [
20
20
  {
21
- directive: SimpleDatePickerInputSADirective,
21
+ directive: SimpleDatePickerInputDirective,
22
22
  },
23
23
  {
24
- directive: WithTimeSADirective,
24
+ directive: WithTimeDirective,
25
25
  },
26
26
  ],
27
27
  }]
@@ -1 +1 @@
1
- {"version":3,"file":"simpleDateTimePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,gCAAgC,EAAC,MAAM,0DAA0D,CAAC;AAC1G,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;;;;AAEnE;;GAEG;AAeH,MAAM,OAAO,oCAAoC;uGAApC,oCAAoC;2FAApC,oCAAoC;;2FAApC,oCAAoC;kBAdhD,SAAS;mBACV;oBACI,QAAQ,EAAE,4CAA4C;oBACtD,UAAU,EAAE,IAAI;oBAChB,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,gCAAgC;yBAC9C;wBACD;4BACI,SAAS,EAAE,mBAAmB;yBACjC;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {SimpleDatePickerInputSADirective} from '../simpleDatePickerInput/simpleDatePickerInput.directive';\nimport {WithTimeSADirective} from '../withTime/withTime.directive';\n\n/**\n * Directive that combines date time picker with simple date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][simpleDateTimePickerInput]',\n standalone: true,\n hostDirectives:\n [\n {\n directive: SimpleDatePickerInputSADirective,\n },\n {\n directive: WithTimeSADirective,\n },\n ],\n})\nexport class SimpleDateTimePickerInputSADirective\n{\n}"]}
1
+ {"version":3,"file":"simpleDateTimePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,8BAA8B,EAAC,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;;;;AAEjE;;GAEG;AAeH,MAAM,OAAO,kCAAkC;8GAAlC,kCAAkC;kGAAlC,kCAAkC;;2FAAlC,kCAAkC;kBAd9C,SAAS;mBACV;oBACI,QAAQ,EAAE,4CAA4C;oBACtD,UAAU,EAAE,IAAI;oBAChB,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,8BAA8B;yBAC5C;wBACD;4BACI,SAAS,EAAE,iBAAiB;yBAC/B;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {SimpleDatePickerInputDirective} from '../simpleDatePickerInput/simpleDatePickerInput.directive';\nimport {WithTimeDirective} from '../withTime/withTime.directive';\n\n/**\n * Directive that combines date time picker with simple date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][simpleDateTimePickerInput]',\n standalone: true,\n hostDirectives:\n [\n {\n directive: SimpleDatePickerInputDirective,\n },\n {\n directive: WithTimeDirective,\n },\n ],\n})\nexport class SimpleDateTimePickerInputDirective\n{\n}"]}
@@ -1,20 +1,20 @@
1
1
  import { Directive, Inject } from '@angular/core';
2
2
  import { Subscription } from 'rxjs';
3
3
  import { DATE_API } from '../../misc/tokens';
4
- import { DateTimeInputSADirective } from '../../modules';
4
+ import { DateTimeInputDirective } from '../../modules';
5
5
  import * as i0 from "@angular/core";
6
6
  import * as i1 from "../../modules";
7
7
  /**
8
8
  * Directive that sets current date and time as day and time for empty date time on focus
9
9
  */
10
- export class WithNowSADirective {
11
- //######################### protected fields #########################
12
- /**
13
- * Subscriptions created during initialization
14
- */
15
- initSubscriptions = new Subscription();
10
+ export class WithNowDirective {
16
11
  //######################### constructor #########################
17
12
  constructor(input, dateApi) {
13
+ //######################### protected fields #########################
14
+ /**
15
+ * Subscriptions created during initialization
16
+ */
17
+ this.initSubscriptions = new Subscription();
18
18
  this.initSubscriptions.add(input.focus.subscribe(() => {
19
19
  if (!input.value) {
20
20
  input.value = dateApi.now().value;
@@ -28,16 +28,16 @@ export class WithNowSADirective {
28
28
  ngOnDestroy() {
29
29
  this.initSubscriptions.unsubscribe();
30
30
  }
31
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: WithNowSADirective, deps: [{ token: i1.DateTimeInputSADirective }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive });
32
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: WithNowSADirective, isStandalone: true, selector: "[dateTime][withNow]", ngImport: i0 });
31
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: WithNowDirective, deps: [{ token: i1.DateTimeInputDirective }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive }); }
32
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: WithNowDirective, isStandalone: true, selector: "[dateTime][withNow]", ngImport: i0 }); }
33
33
  }
34
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: WithNowSADirective, decorators: [{
34
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: WithNowDirective, decorators: [{
35
35
  type: Directive,
36
36
  args: [{
37
37
  selector: '[dateTime][withNow]',
38
38
  standalone: true,
39
39
  }]
40
- }], ctorParameters: () => [{ type: i1.DateTimeInputSADirective }, { type: undefined, decorators: [{
40
+ }], ctorParameters: () => [{ type: i1.DateTimeInputDirective }, { type: undefined, decorators: [{
41
41
  type: Inject,
42
42
  args: [DATE_API]
43
43
  }] }] });
@@ -1 +1 @@
1
- {"version":3,"file":"withNow.directive.js","sourceRoot":"","sources":["../../../../src/directives/withNow/withNow.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;;;AAGvD;;GAEG;AAMH,MAAM,OAAO,kBAAkB;IAE3B,sEAAsE;IAEtE;;OAEG;IACO,iBAAiB,GAAiB,IAAI,YAAY,EAAE,CAAC;IAE/D,iEAAiE;IACjE,YAAY,KAAsC,EACpB,OAAuB;QAEjD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAElD,IAAG,CAAC,KAAK,CAAC,KAAK,EACf;gBACI,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;aACrC;QACL,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;uGA9BQ,kBAAkB,0DAWP,QAAQ;2FAXnB,kBAAkB;;2FAAlB,kBAAkB;kBAL9B,SAAS;mBACV;oBACI,QAAQ,EAAE,qBAAqB;oBAC/B,UAAU,EAAE,IAAI;iBACnB;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, Inject, OnDestroy} from '@angular/core';\nimport {Subscription} from 'rxjs';\n\nimport {DATE_API} from '../../misc/tokens';\nimport {DateTimeInputSADirective} from '../../modules';\nimport {DateApi} from '../../services';\n\n/**\n * Directive that sets current date and time as day and time for empty date time on focus\n */\n@Directive(\n{\n selector: '[dateTime][withNow]',\n standalone: true,\n})\nexport class WithNowSADirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n //######################### constructor #########################\n constructor(input: DateTimeInputSADirective<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,)\n {\n this.initSubscriptions.add(input.focus.subscribe(() =>\n {\n if(!input.value)\n {\n input.value = dateApi.now().value;\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.initSubscriptions.unsubscribe();\n }\n}"]}
1
+ {"version":3,"file":"withNow.directive.js","sourceRoot":"","sources":["../../../../src/directives/withNow/withNow.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;;;AAGrD;;GAEG;AAMH,MAAM,OAAO,gBAAgB;IASzB,iEAAiE;IACjE,YAAY,KAAoC,EAClB,OAAuB;QATrD,sEAAsE;QAEtE;;WAEG;QACO,sBAAiB,GAAiB,IAAI,YAAY,EAAE,CAAC;QAM3D,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAElD,IAAG,CAAC,KAAK,CAAC,KAAK,EACf,CAAC;gBACG,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;YACtC,CAAC;QACL,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;8GA9BQ,gBAAgB,wDAWL,QAAQ;kGAXnB,gBAAgB;;2FAAhB,gBAAgB;kBAL5B,SAAS;mBACV;oBACI,QAAQ,EAAE,qBAAqB;oBAC/B,UAAU,EAAE,IAAI;iBACnB;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, Inject, OnDestroy} from '@angular/core';\nimport {Subscription} from 'rxjs';\n\nimport {DATE_API} from '../../misc/tokens';\nimport {DateTimeInputDirective} from '../../modules';\nimport {DateApi} from '../../services';\n\n/**\n * Directive that sets current date and time as day and time for empty date time on focus\n */\n@Directive(\n{\n selector: '[dateTime][withNow]',\n standalone: true,\n})\nexport class WithNowDirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n //######################### constructor #########################\n constructor(input: DateTimeInputDirective<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,)\n {\n this.initSubscriptions.add(input.focus.subscribe(() =>\n {\n if(!input.value)\n {\n input.value = dateApi.now().value;\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.initSubscriptions.unsubscribe();\n }\n}"]}
@@ -1,32 +1,32 @@
1
1
  import { Directive } from '@angular/core';
2
- import { RollerTimePickerSAComponent, DateTimePickerSADirective, DayPickerSAComponent, MonthPickerSAComponent, YearPickerSAComponent, DateTimeSADirective } from '../../modules';
2
+ import { RollerTimePickerComponent, DateTimePickerDirective, DayPickerComponent, MonthPickerComponent, YearPickerComponent, DateTimeDirective } from '../../modules';
3
3
  import * as i0 from "@angular/core";
4
4
  import * as i1 from "../../modules";
5
5
  /**
6
6
  * Directive that sets up usage of date time picker to use time format and time picker
7
7
  */
8
- export class WithTimeSADirective {
8
+ export class WithTimeDirective {
9
9
  //######################### constructor #########################
10
10
  constructor(picker, dateTime) {
11
11
  picker.pickerOptions =
12
12
  {
13
13
  periodsDefinition: {
14
- 'time': RollerTimePickerSAComponent,
15
- 'day': DayPickerSAComponent,
16
- 'month': MonthPickerSAComponent,
17
- 'year': YearPickerSAComponent,
14
+ 'time': RollerTimePickerComponent,
15
+ 'day': DayPickerComponent,
16
+ 'month': MonthPickerComponent,
17
+ 'year': YearPickerComponent,
18
18
  },
19
19
  };
20
20
  dateTime.format = 'dateTime';
21
21
  }
22
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: WithTimeSADirective, deps: [{ token: i1.DateTimePickerSADirective }, { token: i1.DateTimeSADirective }], target: i0.ɵɵFactoryTarget.Directive });
23
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: WithTimeSADirective, isStandalone: true, selector: "[dateTime][withPicker][withTime]", ngImport: i0 });
22
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: WithTimeDirective, deps: [{ token: i1.DateTimePickerDirective }, { token: i1.DateTimeDirective }], target: i0.ɵɵFactoryTarget.Directive }); }
23
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: WithTimeDirective, isStandalone: true, selector: "[dateTime][withPicker][withTime]", ngImport: i0 }); }
24
24
  }
25
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: WithTimeSADirective, decorators: [{
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: WithTimeDirective, decorators: [{
26
26
  type: Directive,
27
27
  args: [{
28
28
  selector: '[dateTime][withPicker][withTime]',
29
29
  standalone: true,
30
30
  }]
31
- }], ctorParameters: () => [{ type: i1.DateTimePickerSADirective }, { type: i1.DateTimeSADirective }] });
31
+ }], ctorParameters: () => [{ type: i1.DateTimePickerDirective }, { type: i1.DateTimeDirective }] });
32
32
  //# sourceMappingURL=withTime.directive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"withTime.directive.js","sourceRoot":"","sources":["../../../../src/directives/withTime/withTime.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,2BAA2B,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;;;AAE/K;;GAEG;AAMH,MAAM,OAAO,mBAAmB;IAE5B,iEAAiE;IACjE,YAAY,MAAwC,EACxC,QAAoC;QAE5C,MAAM,CAAC,aAAa;YACpB;gBACI,iBAAiB,EACjB;oBACI,MAAM,EAAE,2BAA2B;oBACnC,KAAK,EAAE,oBAAoB;oBAC3B,OAAO,EAAE,sBAAsB;oBAC/B,MAAM,EAAE,qBAAqB;iBAChC;aACJ,CAAC;QAEF,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC;IACjC,CAAC;uGAlBQ,mBAAmB;2FAAnB,mBAAmB;;2FAAnB,mBAAmB;kBAL/B,SAAS;mBACV;oBACI,QAAQ,EAAE,kCAAkC;oBAC5C,UAAU,EAAE,IAAI;iBACnB","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {RollerTimePickerSAComponent, DateTimePickerSADirective, DayPickerSAComponent, MonthPickerSAComponent, YearPickerSAComponent, DateTimeSADirective} from '../../modules';\n\n/**\n * Directive that sets up usage of date time picker to use time format and time picker\n */\n@Directive(\n{\n selector: '[dateTime][withPicker][withTime]',\n standalone: true,\n})\nexport class WithTimeSADirective<TDate = unknown>\n{\n //######################### constructor #########################\n constructor(picker: DateTimePickerSADirective<TDate>,\n dateTime: DateTimeSADirective<TDate>,)\n {\n picker.pickerOptions = \n {\n periodsDefinition:\n {\n 'time': RollerTimePickerSAComponent,\n 'day': DayPickerSAComponent,\n 'month': MonthPickerSAComponent,\n 'year': YearPickerSAComponent,\n },\n };\n\n dateTime.format = 'dateTime';\n }\n}"]}
1
+ {"version":3,"file":"withTime.directive.js","sourceRoot":"","sources":["../../../../src/directives/withTime/withTime.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,yBAAyB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;;;AAEnK;;GAEG;AAMH,MAAM,OAAO,iBAAiB;IAE1B,iEAAiE;IACjE,YAAY,MAAsC,EACtC,QAAkC;QAE1C,MAAM,CAAC,aAAa;YACpB;gBACI,iBAAiB,EACjB;oBACI,MAAM,EAAE,yBAAyB;oBACjC,KAAK,EAAE,kBAAkB;oBACzB,OAAO,EAAE,oBAAoB;oBAC7B,MAAM,EAAE,mBAAmB;iBAC9B;aACJ,CAAC;QAEF,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC;IACjC,CAAC;8GAlBQ,iBAAiB;kGAAjB,iBAAiB;;2FAAjB,iBAAiB;kBAL7B,SAAS;mBACV;oBACI,QAAQ,EAAE,kCAAkC;oBAC5C,UAAU,EAAE,IAAI;iBACnB","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {RollerTimePickerComponent, DateTimePickerDirective, DayPickerComponent, MonthPickerComponent, YearPickerComponent, DateTimeDirective} from '../../modules';\n\n/**\n * Directive that sets up usage of date time picker to use time format and time picker\n */\n@Directive(\n{\n selector: '[dateTime][withPicker][withTime]',\n standalone: true,\n})\nexport class WithTimeDirective<TDate = unknown>\n{\n //######################### constructor #########################\n constructor(picker: DateTimePickerDirective<TDate>,\n dateTime: DateTimeDirective<TDate>,)\n {\n picker.pickerOptions = \n {\n periodsDefinition:\n {\n 'time': RollerTimePickerComponent,\n 'day': DayPickerComponent,\n 'month': MonthPickerComponent,\n 'year': YearPickerComponent,\n },\n };\n\n dateTime.format = 'dateTime';\n }\n}"]}
@@ -1,20 +1,20 @@
1
1
  import { Directive, Inject } from '@angular/core';
2
2
  import { Subscription } from 'rxjs';
3
3
  import { DATE_API } from '../../misc/tokens';
4
- import { DateTimeInputSADirective } from '../../modules';
4
+ import { DateTimeInputDirective } from '../../modules';
5
5
  import * as i0 from "@angular/core";
6
6
  import * as i1 from "../../modules";
7
7
  /**
8
8
  * Directive that sets today (start of a day) as day for empty date time on focus
9
9
  */
10
- export class WithTodaySADirective {
11
- //######################### protected fields #########################
12
- /**
13
- * Subscriptions created during initialization
14
- */
15
- initSubscriptions = new Subscription();
10
+ export class WithTodayDirective {
16
11
  //######################### constructor #########################
17
12
  constructor(input, dateApi) {
13
+ //######################### protected fields #########################
14
+ /**
15
+ * Subscriptions created during initialization
16
+ */
17
+ this.initSubscriptions = new Subscription();
18
18
  this.initSubscriptions.add(input.focus.subscribe(() => {
19
19
  if (!input.value) {
20
20
  input.value = dateApi.now().startOfDay().value;
@@ -28,16 +28,16 @@ export class WithTodaySADirective {
28
28
  ngOnDestroy() {
29
29
  this.initSubscriptions.unsubscribe();
30
30
  }
31
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: WithTodaySADirective, deps: [{ token: i1.DateTimeInputSADirective }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive });
32
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: WithTodaySADirective, isStandalone: true, selector: "[dateTime][withToday]", ngImport: i0 });
31
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: WithTodayDirective, deps: [{ token: i1.DateTimeInputDirective }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive }); }
32
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: WithTodayDirective, isStandalone: true, selector: "[dateTime][withToday]", ngImport: i0 }); }
33
33
  }
34
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: WithTodaySADirective, decorators: [{
34
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: WithTodayDirective, decorators: [{
35
35
  type: Directive,
36
36
  args: [{
37
37
  selector: '[dateTime][withToday]',
38
38
  standalone: true,
39
39
  }]
40
- }], ctorParameters: () => [{ type: i1.DateTimeInputSADirective }, { type: undefined, decorators: [{
40
+ }], ctorParameters: () => [{ type: i1.DateTimeInputDirective }, { type: undefined, decorators: [{
41
41
  type: Inject,
42
42
  args: [DATE_API]
43
43
  }] }] });
@@ -1 +1 @@
1
- {"version":3,"file":"withToday.directive.js","sourceRoot":"","sources":["../../../../src/directives/withToday/withToday.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;;;AAGvD;;GAEG;AAMH,MAAM,OAAO,oBAAoB;IAE7B,sEAAsE;IAEtE;;OAEG;IACO,iBAAiB,GAAiB,IAAI,YAAY,EAAE,CAAC;IAE/D,iEAAiE;IACjE,YAAY,KAAsC,EACpB,OAAuB;QAEjD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAElD,IAAG,CAAC,KAAK,CAAC,KAAK,EACf;gBACI,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC;aAClD;QACL,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;uGA9BQ,oBAAoB,0DAWT,QAAQ;2FAXnB,oBAAoB;;2FAApB,oBAAoB;kBALhC,SAAS;mBACV;oBACI,QAAQ,EAAE,uBAAuB;oBACjC,UAAU,EAAE,IAAI;iBACnB;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, Inject, OnDestroy} from '@angular/core';\nimport {Subscription} from 'rxjs';\n\nimport {DATE_API} from '../../misc/tokens';\nimport {DateTimeInputSADirective} from '../../modules';\nimport {DateApi} from '../../services';\n\n/**\n * Directive that sets today (start of a day) as day for empty date time on focus\n */\n@Directive(\n{\n selector: '[dateTime][withToday]',\n standalone: true,\n})\nexport class WithTodaySADirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n //######################### constructor #########################\n constructor(input: DateTimeInputSADirective<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,)\n {\n this.initSubscriptions.add(input.focus.subscribe(() =>\n {\n if(!input.value)\n {\n input.value = dateApi.now().startOfDay().value;\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.initSubscriptions.unsubscribe();\n }\n}"]}
1
+ {"version":3,"file":"withToday.directive.js","sourceRoot":"","sources":["../../../../src/directives/withToday/withToday.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;;;AAGrD;;GAEG;AAMH,MAAM,OAAO,kBAAkB;IAS3B,iEAAiE;IACjE,YAAY,KAAoC,EAClB,OAAuB;QATrD,sEAAsE;QAEtE;;WAEG;QACO,sBAAiB,GAAiB,IAAI,YAAY,EAAE,CAAC;QAM3D,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAElD,IAAG,CAAC,KAAK,CAAC,KAAK,EACf,CAAC;gBACG,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC;YACnD,CAAC;QACL,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;8GA9BQ,kBAAkB,wDAWP,QAAQ;kGAXnB,kBAAkB;;2FAAlB,kBAAkB;kBAL9B,SAAS;mBACV;oBACI,QAAQ,EAAE,uBAAuB;oBACjC,UAAU,EAAE,IAAI;iBACnB;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, Inject, OnDestroy} from '@angular/core';\nimport {Subscription} from 'rxjs';\n\nimport {DATE_API} from '../../misc/tokens';\nimport {DateTimeInputDirective} from '../../modules';\nimport {DateApi} from '../../services';\n\n/**\n * Directive that sets today (start of a day) as day for empty date time on focus\n */\n@Directive(\n{\n selector: '[dateTime][withToday]',\n standalone: true,\n})\nexport class WithTodayDirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n //######################### constructor #########################\n constructor(input: DateTimeInputDirective<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,)\n {\n this.initSubscriptions.add(input.focus.subscribe(() =>\n {\n if(!input.value)\n {\n input.value = dateApi.now().startOfDay().value;\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.initSubscriptions.unsubscribe();\n }\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dateTimeInput.interface.js","sourceRoot":"","sources":["../../../../src/interfaces/dateTimeInput/dateTimeInput.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {EventEmitter} from '@angular/core';\n\nimport {DateTimeInputOutputValue} from '../../misc/types';\n\n/**\n * Defines date time input value API\n */\nexport interface DateTimeInputValue<TDate = unknown>\n{\n /**\n * Current value of date time, could be string, unix timestamp, Date, TDate object, or ranged DateTimeValue\n */\n value: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Occurs when value changes\n */\n readonly valueChange: EventEmitter<void>;\n\n /**\n * Occurs when value is set, occurs everytime when value was set, even from code\n */\n readonly valueSet: EventEmitter<void>;\n}\n/**\n * Defines date time input and communication API for it\n */\nexport interface DateTimeInput<TDate = unknown> extends DateTimeInputValue<TDate>\n{\n /**\n * Value of date time, raw string value which is visible to user\n */\n readonly rawValue: string|undefined|null;\n\n /**\n * Indication whether is date time disabled\n */\n disabled: boolean;\n\n /**\n * Occurs when input gains focus\n */\n readonly focus: EventEmitter<FocusEvent>;\n\n /**\n * Occurs when input loses focus\n */\n readonly blur: EventEmitter<FocusEvent>;\n\n /**\n * Html element that represents input itself\n */\n readonly element: HTMLElement;\n}"]}
1
+ {"version":3,"file":"dateTimeInput.interface.js","sourceRoot":"","sources":["../../../../src/interfaces/dateTimeInput/dateTimeInput.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {EventEmitter} from '@angular/core';\n\nimport {DateTimeInputOutputValue} from '../../misc/types';\n\n/**\n * Defines date time input value API\n */\nexport interface DateTimeInputValue<TDate = unknown>\n{\n /**\n * Current value of date time, could be string, timestamp, Date, TDate object, or ranged DateTimeValue\n */\n value: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Occurs when value changes\n */\n readonly valueChange: EventEmitter<void>;\n\n /**\n * Occurs when value is set, occurs everytime when value was set, even from code\n */\n readonly valueSet: EventEmitter<void>;\n}\n/**\n * Defines date time input and communication API for it\n */\nexport interface DateTimeInput<TDate = unknown> extends DateTimeInputValue<TDate>\n{\n /**\n * Value of date time, raw string value which is visible to user\n */\n readonly rawValue: string|undefined|null;\n\n /**\n * Indication whether is date time disabled\n */\n disabled: boolean;\n\n /**\n * Occurs when input gains focus\n */\n readonly focus: EventEmitter<FocusEvent>;\n\n /**\n * Occurs when input loses focus\n */\n readonly blur: EventEmitter<FocusEvent>;\n\n /**\n * Html element that represents input itself\n */\n readonly element: HTMLElement;\n}"]}
@@ -8,20 +8,24 @@ export var DateTimeValueFormat;
8
8
  */
9
9
  DateTimeValueFormat[DateTimeValueFormat["DateInstance"] = 0] = "DateInstance";
10
10
  /**
11
- * Numeric unix timestamp in miliseconds
11
+ * Numeric unix timestamp in seconds (only works for ControlValueAccessor, internally its Timestamp)
12
12
  */
13
13
  DateTimeValueFormat[DateTimeValueFormat["UnixTimestamp"] = 1] = "UnixTimestamp";
14
+ /**
15
+ * Numeric timestamp in miliseconds
16
+ */
17
+ DateTimeValueFormat[DateTimeValueFormat["Timestamp"] = 2] = "Timestamp";
14
18
  /**
15
19
  * Formatted date as string value, same string as displayed string
16
20
  */
17
- DateTimeValueFormat[DateTimeValueFormat["FormattedString"] = 2] = "FormattedString";
21
+ DateTimeValueFormat[DateTimeValueFormat["FormattedString"] = 3] = "FormattedString";
18
22
  /**
19
23
  * Formatted date as string value, custom string format for date time value, different from displayed string format
20
24
  */
21
- DateTimeValueFormat[DateTimeValueFormat["DataString"] = 3] = "DataString";
25
+ DateTimeValueFormat[DateTimeValueFormat["DataString"] = 4] = "DataString";
22
26
  /**
23
27
  * Range of date instances from, to
24
28
  */
25
- DateTimeValueFormat[DateTimeValueFormat["RangeOfDateInstances"] = 4] = "RangeOfDateInstances";
29
+ DateTimeValueFormat[DateTimeValueFormat["RangeOfDateInstances"] = 5] = "RangeOfDateInstances";
26
30
  })(DateTimeValueFormat || (DateTimeValueFormat = {}));
27
31
  //# sourceMappingURL=enums.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/misc/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,mBA0BX;AA1BD,WAAY,mBAAmB;IAE3B;;OAEG;IACH,6EAAY,CAAA;IAEZ;;OAEG;IACH,+EAAa,CAAA;IAEb;;OAEG;IACH,mFAAe,CAAA;IAEf;;OAEG;IACH,yEAAU,CAAA;IAEV;;OAEG;IACH,6FAAoB,CAAA;AACxB,CAAC,EA1BW,mBAAmB,KAAnB,mBAAmB,QA0B9B","sourcesContent":["/**\n * Available formats for date time value\n */\nexport enum DateTimeValueFormat\n{\n /**\n * Instance of date\n */\n DateInstance,\n\n /**\n * Numeric unix timestamp in miliseconds\n */\n UnixTimestamp,\n\n /**\n * Formatted date as string value, same string as displayed string\n */\n FormattedString,\n\n /**\n * Formatted date as string value, custom string format for date time value, different from displayed string format\n */\n DataString,\n\n /**\n * Range of date instances from, to\n */\n RangeOfDateInstances,\n}"]}
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/misc/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,mBA+BX;AA/BD,WAAY,mBAAmB;IAE3B;;OAEG;IACH,6EAAY,CAAA;IAEZ;;OAEG;IACH,+EAAa,CAAA;IAEb;;OAEG;IACH,uEAAS,CAAA;IAET;;OAEG;IACH,mFAAe,CAAA;IAEf;;OAEG;IACH,yEAAU,CAAA;IAEV;;OAEG;IACH,6FAAoB,CAAA;AACxB,CAAC,EA/BW,mBAAmB,KAAnB,mBAAmB,QA+B9B","sourcesContent":["/**\n * Available formats for date time value\n */\nexport enum DateTimeValueFormat\n{\n /**\n * Instance of date\n */\n DateInstance,\n\n /**\n * Numeric unix timestamp in seconds (only works for ControlValueAccessor, internally its Timestamp)\n */\n UnixTimestamp,\n\n /**\n * Numeric timestamp in miliseconds\n */\n Timestamp,\n\n /**\n * Formatted date as string value, same string as displayed string\n */\n FormattedString,\n\n /**\n * Formatted date as string value, custom string format for date time value, different from displayed string format\n */\n DataString,\n\n /**\n * Range of date instances from, to\n */\n RangeOfDateInstances,\n}"]}
@@ -33,14 +33,15 @@ export function parseDateTime(value, dateApi, dateTimeFormat, stringFormat, data
33
33
  if (dateTimeFormat != DateTimeValueFormat.DateInstance &&
34
34
  dateTimeFormat != DateTimeValueFormat.FormattedString &&
35
35
  dateTimeFormat != DateTimeValueFormat.UnixTimestamp &&
36
+ dateTimeFormat != DateTimeValueFormat.Timestamp &&
36
37
  dateTimeFormat != DateTimeValueFormat.DataString) {
37
38
  throw new Error('DateTime: unable to get date time value, should be date instance, or string, or number!');
38
39
  }
39
40
  if (dateTimeFormat == DateTimeValueFormat.DataString) {
40
- //value is string, instance of date or unix timestamp
41
+ //value is string, instance of date or timestamp
41
42
  return dateApi.getValue(value, dataFormat ?? undefined);
42
43
  }
43
- //value is string, instance of date or unix timestamp
44
+ //value is string, instance of date or timestamp
44
45
  return dateApi.getValue(value, stringFormat ?? undefined);
45
46
  }
46
47
  //value is range
@@ -54,7 +55,7 @@ export function parseDateTime(value, dateApi, dateTimeFormat, stringFormat, data
54
55
  if (isString(value) && isBlank(stringFormat) && isBlank(dataFormat)) {
55
56
  throw new Error('DateTime: unable to parse string date, because format is missing!');
56
57
  }
57
- //value is string, instance of date or unix timestamp
58
+ //value is string, instance of date or timestamp
58
59
  return dateApi.getValue(value, dataFormat ?? stringFormat ?? undefined);
59
60
  }
60
61
  /**
@@ -102,9 +103,9 @@ export function formatDateTime(value, dateTimeFormat, stringFormat, dataFormat)
102
103
  }
103
104
  return value.format(stringFormat);
104
105
  }
105
- if (dateTimeFormat == DateTimeValueFormat.UnixTimestamp) {
106
- //TODO: fix this in "future"
107
- return value.unixTimestamp() * 1000;
106
+ if (dateTimeFormat == DateTimeValueFormat.UnixTimestamp ||
107
+ dateTimeFormat == DateTimeValueFormat.Timestamp) {
108
+ return value.timestamp();
108
109
  }
109
110
  return value.value;
110
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/misc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAKhF,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAG5C;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAkB,KAAqD,EACrD,OAAuB,EACvB,cAAkD,EAClD,YAAmC,EACnC,UAAiC;IAE5E,IAAG,OAAO,CAAC,KAAK,CAAC,EACjB;QACI,OAAO,KAAK,CAAC;KAChB;IAED,qBAAqB;IACrB,IAAG,SAAS,CAAC,cAAc,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EAAE,EACL;YACI,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;YAEtG,IAAG,GAAG,EACN;gBACI,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;aAClG;SACJ;KACJ;SAED;QACI,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;QAEnH,IAAG,GAAG,EACN;YACI,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;SAC/F;KACJ;IAED,OAAO,aAAa,CAAC;AACzB,CAAC","sourcesContent":["import {isBlank, isJsObject, isPresent, isString, nameof} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../interfaces';\nimport type {DateTimeSADirective} from '../modules/dateTime/directives/dateTime/dateTime.directive';\nimport {DateApi, DateApiObject, DateValue, DateValueProvider} from '../services';\nimport {DateTimeValueFormat} from './enums';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from './types';\n\n/**\n * Parses date time input output value\n * @param value - Value to be parsed\n * @param dateApi - Date api used for obtaining result\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used\n * @param stringFormat - String format for parsing string dates, required only for string dates\n * @param dataFormat - String format for parsing string dates, required only for string dates, has higher priority than `stringFormat`\n */\nexport function parseDateTime<TDate = unknown>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): DateTimeObjectValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //format is specified\n if(isPresent(dateTimeFormat))\n {\n //string format required, but format string was not provided\n if(dateTimeFormat == DateTimeValueFormat.FormattedString && isBlank(stringFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n //requirested format is different\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: requested datetime format is not range, but value is range!');\n }\n\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance, null, null) as DateApiObject<TDate>,\n ];\n }\n\n //value should be date instance, or number, or string, but it is not\n if(dateTimeFormat != DateTimeValueFormat.DateInstance &&\n dateTimeFormat != DateTimeValueFormat.FormattedString &&\n dateTimeFormat != DateTimeValueFormat.UnixTimestamp &&\n dateTimeFormat != DateTimeValueFormat.DataString)\n {\n throw new Error('DateTime: unable to get date time value, should be date instance, or string, or number!');\n }\n\n if(dateTimeFormat == DateTimeValueFormat.DataString)\n {\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, dataFormat ?? undefined);\n }\n\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, stringFormat ?? undefined);\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance , null, null) as DateApiObject<TDate>,\n ];\n }\n\n //string format, but format string was not provided\n if(isString(value) && isBlank(stringFormat) && isBlank(dataFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, dataFormat ?? stringFormat ?? undefined);\n}\n\n/**\n * Formats value into specified format of date time\n * @param value - Value that should be converted to input output date time value\n * @param dateTimeFormat - Date time format type\n * @param stringFormat - String format for formatting string dates, required only for string dates\n * @param dataFormat - String format for formatting string dates, required only for string dates, has higher priority than `stringFormat`\n */\nexport function formatDateTime<TDate = unknown>(value: DateTimeObjectValue<TDate>|undefined|null,\n dateTimeFormat: DateTimeValueFormat,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): DateTimeInputOutputValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //value is range\n if(Array.isArray(value))\n {\n //range is expected\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is array of values, but format is not range!');\n }\n\n return {\n from: value[0]?.value ?? null,\n to: value[1]?.value ?? null,\n };\n }\n\n //range is not expected\n if(dateTimeFormat == DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is not array of values, but format is range!');\n }\n\n if(!value.isValid())\n {\n return;\n }\n\n //data string date time\n if(dateTimeFormat == DateTimeValueFormat.DataString)\n {\n //string format is missing for string date time\n if(isBlank(dataFormat))\n {\n throw new Error('DateTime: missing data string format for string date time!');\n }\n\n return value.format(dataFormat);\n }\n\n //string date time\n if(dateTimeFormat == DateTimeValueFormat.FormattedString)\n {\n //string format is missing for string date time\n if(isBlank(stringFormat))\n {\n throw new Error('DateTime: missing string format for string date time!');\n }\n\n return value.format(stringFormat);\n }\n\n if(dateTimeFormat == DateTimeValueFormat.UnixTimestamp)\n {\n //TODO: fix this in \"future\"\n return value.unixTimestamp() * 1000;\n }\n\n return value.value;\n}\n\n/**\n * Tests whether value is `DateTimeValue`\n * @param value - Value that is tested\n */\nexport function isDateTimeValue<TDate = unknown>(value: unknown): value is DateTimeValue<TDate>\n{\n return isJsObject(value) &&\n nameof<DateTimeValue>('from') in value &&\n nameof<DateTimeValue>('to') in value;\n}\n\n/**\n * Gets single date time value, use in places where ranged date time can not be used\n * @param value - Value to be examined\n */\nexport function getSingleDateTimeValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null): DateValue|TDate|null|undefined\n{\n if(isDateTimeValue(value))\n {\n throw new Error('DateTime: Unable to apply ranged date time input as value restriction!');\n }\n\n return value;\n}\n\n/**\n * Parses raw value into internal value and value\n * @param rawValue - Raw value to be parsed\n * @param dateApi - Date api for manipulation with date\n * @param dateTimeData - Object storing information about format\n * @param valueProvider - Provider used for obtaining rounded value according format\n */\nexport function parseRawInput<TDate>(rawValue: string, \n dateApi: DateApi<TDate>,\n dateTimeData: DateTimeSADirective<TDate>,\n valueProvider: DateValueProvider<TDate>,): [DateTimeObjectValue<TDate>|undefined|null, DateTimeInputOutputValue<TDate>|undefined|null]\n{\n if(!rawValue)\n {\n return [null, null];\n }\n\n const internalValue = getInternalValue(rawValue, dateApi, dateTimeData, valueProvider);\n const value = formatDateTime(internalValue, dateTimeData.valueFormat, dateTimeData.customFormat, dateTimeData.dataFormat);\n\n return [internalValue, value];\n}\n\n/**\n * Gets internal value and fix lowest time difference\n * @param value - Value to be get as internal value\n * @param dateApi - Date api for manipulation with date\n * @param dateTimeData - Object storing information about format\n * @param valueProvider - Provider used for obtaining rounded value according format\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used, used when obtaining value from users input\n */\nexport function getInternalValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeData: DateTimeSADirective<TDate>,\n valueProvider: DateValueProvider<TDate>,\n dateTimeFormat: DateTimeValueFormat|undefined|null = null,): DateTimeObjectValue<TDate>|undefined|null\n{\n let internalValue = parseDateTime(value, dateApi, dateTimeFormat, dateTimeData.customFormat, dateTimeData.dataFormat);\n\n if(isBlank(internalValue))\n {\n return;\n }\n\n //update for specified format, round value\n\n //ranged value\n if(Array.isArray(internalValue))\n {\n const [from, to] = internalValue;\n\n if(from)\n {\n const val = valueProvider.getValue(from.value, dateTimeData.dataFormat ?? dateTimeData.customFormat).from;\n\n if(val)\n {\n internalValue[0] = dateApi.getValue(val, dateTimeData.dataFormat ?? dateTimeData.customFormat);\n }\n }\n\n if(to)\n {\n const val = valueProvider.getValue(to.value, dateTimeData.dataFormat ?? dateTimeData.customFormat).to;\n\n if(val)\n {\n internalValue[1] = dateApi.getValue(val, dateTimeData.dataFormat ?? dateTimeData.customFormat);\n }\n }\n }\n else\n {\n const val = valueProvider.getValue(internalValue.value, dateTimeData.dataFormat ?? dateTimeData.customFormat).from;\n\n if(val)\n {\n internalValue = dateApi.getValue(val, dateTimeData.dataFormat ?? dateTimeData.customFormat);\n }\n }\n\n return internalValue;\n}"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/misc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAKhF,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAG5C;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAkB,KAAqD,EACrD,OAAuB,EACvB,cAAkD,EAClD,YAAmC,EACnC,UAAiC;IAE5E,IAAG,OAAO,CAAC,KAAK,CAAC,EACjB,CAAC;QACG,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,qBAAqB;IACrB,IAAG,SAAS,CAAC,cAAc,CAAC,EAC5B,CAAC;QACG,4DAA4D;QAC5D,IAAG,cAAc,IAAI,mBAAmB,CAAC,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,EACjF,CAAC;YACG,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;QACzF,CAAC;QAED,gBAAgB;QAChB,IAAG,eAAe,CAAC,KAAK,CAAC,EACzB,CAAC;YACG,iCAAiC;YACjC,IAAG,cAAc,IAAI,mBAAmB,CAAC,oBAAoB,EAC7D,CAAC;gBACG,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;YAC7F,CAAC;YAED,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QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;YAEtG,IAAG,GAAG,EACN,CAAC;gBACG,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;YACnG,CAAC;QACL,CAAC;IACL,CAAC;SAED,CAAC;QACG,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;QAEnH,IAAG,GAAG,EACN,CAAC;YACG,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;QAChG,CAAC;IACL,CAAC;IAED,OAAO,aAAa,CAAC;AACzB,CAAC","sourcesContent":["import {isBlank, isJsObject, isPresent, isString, nameof} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../interfaces';\nimport type {DateTimeDirective} from '../modules/dateTime/directives/dateTime/dateTime.directive';\nimport {DateApi, DateApiObject, DateValue, DateValueProvider} from '../services';\nimport {DateTimeValueFormat} from './enums';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from './types';\n\n/**\n * Parses date time input output value\n * @param value - Value to be parsed\n * @param dateApi - Date api used for obtaining result\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used\n * @param stringFormat - String format for parsing string dates, required only for string dates\n * @param dataFormat - String format for parsing string dates, required only for string dates, has higher priority than `stringFormat`\n */\nexport function parseDateTime<TDate = unknown>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): DateTimeObjectValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //format is specified\n if(isPresent(dateTimeFormat))\n {\n //string format required, but format string was not provided\n if(dateTimeFormat == DateTimeValueFormat.FormattedString && isBlank(stringFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n //requirested format is different\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: requested datetime format is not range, but value is range!');\n }\n\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance, null, null) as DateApiObject<TDate>,\n ];\n }\n\n //value should be date instance, or number, or string, but it is not\n if(dateTimeFormat != DateTimeValueFormat.DateInstance &&\n dateTimeFormat != DateTimeValueFormat.FormattedString &&\n dateTimeFormat != DateTimeValueFormat.UnixTimestamp &&\n dateTimeFormat != DateTimeValueFormat.Timestamp &&\n dateTimeFormat != DateTimeValueFormat.DataString)\n {\n throw new Error('DateTime: unable to get date time value, should be date instance, or string, or number!');\n }\n\n if(dateTimeFormat == DateTimeValueFormat.DataString)\n {\n //value is string, instance of date or timestamp\n return dateApi.getValue(value, dataFormat ?? undefined);\n }\n\n //value is string, instance of date or timestamp\n return dateApi.getValue(value, stringFormat ?? undefined);\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance , null, null) as DateApiObject<TDate>,\n ];\n }\n\n //string format, but format string was not provided\n if(isString(value) && isBlank(stringFormat) && isBlank(dataFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is string, instance of date or timestamp\n return dateApi.getValue(value, dataFormat ?? stringFormat ?? undefined);\n}\n\n/**\n * Formats value into specified format of date time\n * @param value - Value that should be converted to input output date time value\n * @param dateTimeFormat - Date time format type\n * @param stringFormat - String format for formatting string dates, required only for string dates\n * @param dataFormat - String format for formatting string dates, required only for string dates, has higher priority than `stringFormat`\n */\nexport function formatDateTime<TDate = unknown>(value: DateTimeObjectValue<TDate>|undefined|null,\n dateTimeFormat: DateTimeValueFormat,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): DateTimeInputOutputValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //value is range\n if(Array.isArray(value))\n {\n //range is expected\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is array of values, but format is not range!');\n }\n\n return {\n from: value[0]?.value ?? null,\n to: value[1]?.value ?? null,\n };\n }\n\n //range is not expected\n if(dateTimeFormat == DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is not array of values, but format is range!');\n }\n\n if(!value.isValid())\n {\n return;\n }\n\n //data string date time\n if(dateTimeFormat == DateTimeValueFormat.DataString)\n {\n //string format is missing for string date time\n if(isBlank(dataFormat))\n {\n throw new Error('DateTime: missing data string format for string date time!');\n }\n\n return value.format(dataFormat);\n }\n\n //string date time\n if(dateTimeFormat == DateTimeValueFormat.FormattedString)\n {\n //string format is missing for string date time\n if(isBlank(stringFormat))\n {\n throw new Error('DateTime: missing string format for string date time!');\n }\n\n return value.format(stringFormat);\n }\n\n if(dateTimeFormat == DateTimeValueFormat.UnixTimestamp ||\n dateTimeFormat == DateTimeValueFormat.Timestamp)\n {\n return value.timestamp();\n }\n\n return value.value;\n}\n\n/**\n * Tests whether value is `DateTimeValue`\n * @param value - Value that is tested\n */\nexport function isDateTimeValue<TDate = unknown>(value: unknown): value is DateTimeValue<TDate>\n{\n return isJsObject(value) &&\n nameof<DateTimeValue>('from') in value &&\n nameof<DateTimeValue>('to') in value;\n}\n\n/**\n * Gets single date time value, use in places where ranged date time can not be used\n * @param value - Value to be examined\n */\nexport function getSingleDateTimeValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null): DateValue|TDate|null|undefined\n{\n if(isDateTimeValue(value))\n {\n throw new Error('DateTime: Unable to apply ranged date time input as value restriction!');\n }\n\n return value;\n}\n\n/**\n * Parses raw value into internal value and value\n * @param rawValue - Raw value to be parsed\n * @param dateApi - Date api for manipulation with date\n * @param dateTimeData - Object storing information about format\n * @param valueProvider - Provider used for obtaining rounded value according format\n */\nexport function parseRawInput<TDate>(rawValue: string, \n dateApi: DateApi<TDate>,\n dateTimeData: DateTimeDirective<TDate>,\n valueProvider: DateValueProvider<TDate>,): [DateTimeObjectValue<TDate>|undefined|null, DateTimeInputOutputValue<TDate>|undefined|null]\n{\n if(!rawValue)\n {\n return [null, null];\n }\n\n const internalValue = getInternalValue(rawValue, dateApi, dateTimeData, valueProvider);\n const value = formatDateTime(internalValue, dateTimeData.valueFormat, dateTimeData.customFormat, dateTimeData.dataFormat);\n\n return [internalValue, value];\n}\n\n/**\n * Gets internal value and fix lowest time difference\n * @param value - Value to be get as internal value\n * @param dateApi - Date api for manipulation with date\n * @param dateTimeData - Object storing information about format\n * @param valueProvider - Provider used for obtaining rounded value according format\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used, used when obtaining value from users input\n */\nexport function getInternalValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeData: DateTimeDirective<TDate>,\n valueProvider: DateValueProvider<TDate>,\n dateTimeFormat: DateTimeValueFormat|undefined|null = null,): DateTimeObjectValue<TDate>|undefined|null\n{\n let internalValue = parseDateTime(value, dateApi, dateTimeFormat, dateTimeData.customFormat, dateTimeData.dataFormat);\n\n if(isBlank(internalValue))\n {\n return;\n }\n\n //update for specified format, round value\n\n //ranged value\n if(Array.isArray(internalValue))\n {\n const [from, to] = internalValue;\n\n if(from)\n {\n const val = valueProvider.getValue(from.value, dateTimeData.dataFormat ?? dateTimeData.customFormat).from;\n\n if(val)\n {\n internalValue[0] = dateApi.getValue(val, dateTimeData.dataFormat ?? dateTimeData.customFormat);\n }\n }\n\n if(to)\n {\n const val = valueProvider.getValue(to.value, dateTimeData.dataFormat ?? dateTimeData.customFormat).to;\n\n if(val)\n {\n internalValue[1] = dateApi.getValue(val, dateTimeData.dataFormat ?? dateTimeData.customFormat);\n }\n }\n }\n else\n {\n const val = valueProvider.getValue(internalValue.value, dateTimeData.dataFormat ?? dateTimeData.customFormat).from;\n\n if(val)\n {\n internalValue = dateApi.getValue(val, dateTimeData.dataFormat ?? dateTimeData.customFormat);\n }\n }\n\n return internalValue;\n}"]}