@anglr/datetime 8.1.0-beta.20240827080139 → 9.0.0-beta.20241004120552

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,46 +1,12 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { ContentChildren, Directive, ElementRef, EventEmitter, HostListener, Input, Output } from '@angular/core';
3
3
  import { DebounceCall, isBlank, nameof } from '@jscrpt/common';
4
- import { LoopScrollDataSADirective } from '../loopScrollData/loopScrollData.directive';
4
+ import { LoopScrollDataDirective } from '../loopScrollData/loopScrollData.directive';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Renders loop scroll for array of elements
8
8
  */
9
- export class LoopScrollSADirective {
10
- scrollElement;
11
- //######################### protected fields #########################
12
- /**
13
- * Item height that obtained
14
- */
15
- itemHeight;
16
- /**
17
- * Array of elements for scrolled stuff
18
- */
19
- ɵitems = [];
20
- /**
21
- * Array of elements and data for scrolled stuff
22
- */
23
- dataItems = [];
24
- /**
25
- * Indication whether is loop scroll initialized
26
- */
27
- initialized = false;
28
- /**
29
- * Count of cloned elements before or after
30
- */
31
- clonedCount = 0;
32
- /**
33
- * Indication whether ignore scroll handle
34
- */
35
- ignoreScrollHandle = false;
36
- /**
37
- * Indication whether skip value change
38
- */
39
- skipValueChange = false;
40
- /**
41
- * Value that is being set in loop scroll
42
- */
43
- ɵvalue;
9
+ export class LoopScrollDirective {
44
10
  //######################### public properties - inputs #########################
45
11
  /**
46
12
  * Gets or sets value that is being set in loop scroll
@@ -52,23 +18,42 @@ export class LoopScrollSADirective {
52
18
  this.skipValueChange = this.ɵvalue == value;
53
19
  this.ɵvalue = value;
54
20
  }
55
- /**
56
- * Indication whether is currently selection scroll open
57
- */
58
- open = false;
59
- //######################### public properties - outputs #########################
60
- /**
61
- * Occurs when current value of loop scroll changes
62
- */
63
- valueChange = new EventEmitter();
64
- //######################### protected properties - children #########################
65
- /**
66
- * Array of items that are loop scrolled
67
- */
68
- items;
69
21
  //######################### constructor #########################
70
22
  constructor(scrollElement) {
71
23
  this.scrollElement = scrollElement;
24
+ /**
25
+ * Array of elements for scrolled stuff
26
+ */
27
+ this.ɵitems = [];
28
+ /**
29
+ * Array of elements and data for scrolled stuff
30
+ */
31
+ this.dataItems = [];
32
+ /**
33
+ * Indication whether is loop scroll initialized
34
+ */
35
+ this.initialized = false;
36
+ /**
37
+ * Count of cloned elements before or after
38
+ */
39
+ this.clonedCount = 0;
40
+ /**
41
+ * Indication whether ignore scroll handle
42
+ */
43
+ this.ignoreScrollHandle = false;
44
+ /**
45
+ * Indication whether skip value change
46
+ */
47
+ this.skipValueChange = false;
48
+ /**
49
+ * Indication whether is currently selection scroll open
50
+ */
51
+ this.open = false;
52
+ //######################### public properties - outputs #########################
53
+ /**
54
+ * Occurs when current value of loop scroll changes
55
+ */
56
+ this.valueChange = new EventEmitter();
72
57
  }
73
58
  //######################### public methods - implementation of OnChanges #########################
74
59
  /**
@@ -198,16 +183,16 @@ export class LoopScrollSADirective {
198
183
  this.valueChange.next(this.value);
199
184
  }
200
185
  }
201
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: LoopScrollSADirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
202
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: LoopScrollSADirective, isStandalone: true, selector: "[loopScroll]", inputs: { value: ["loopScroll", "value"], open: "open" }, outputs: { valueChange: "loopScrollChange" }, host: { listeners: { "scroll": "_handleScroll()" } }, queries: [{ propertyName: "items", predicate: LoopScrollDataSADirective }], usesOnChanges: true, ngImport: i0 });
186
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoopScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
187
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: LoopScrollDirective, isStandalone: true, selector: "[loopScroll]", inputs: { value: ["loopScroll", "value"], open: "open" }, outputs: { valueChange: "loopScrollChange" }, host: { listeners: { "scroll": "_handleScroll()" } }, queries: [{ propertyName: "items", predicate: LoopScrollDataDirective }], usesOnChanges: true, ngImport: i0 }); }
203
188
  }
204
189
  __decorate([
205
190
  DebounceCall(18),
206
191
  __metadata("design:type", Function),
207
192
  __metadata("design:paramtypes", [Number, Boolean, Number, Number]),
208
193
  __metadata("design:returntype", void 0)
209
- ], LoopScrollSADirective.prototype, "_updateScroll", null);
210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: LoopScrollSADirective, decorators: [{
194
+ ], LoopScrollDirective.prototype, "_updateScroll", null);
195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoopScrollDirective, decorators: [{
211
196
  type: Directive,
212
197
  args: [{
213
198
  selector: '[loopScroll]',
@@ -223,7 +208,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImpor
223
208
  args: ['loopScrollChange']
224
209
  }], items: [{
225
210
  type: ContentChildren,
226
- args: [LoopScrollDataSADirective]
211
+ args: [LoopScrollDataDirective]
227
212
  }], _handleScroll: [{
228
213
  type: HostListener,
229
214
  args: ['scroll']
@@ -1 +1 @@
1
- {"version":3,"file":"loopScroll.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAa,MAAM,EAA2B,MAAM,eAAe,CAAC;AACvK,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,4CAA4C,CAAC;;AAErF;;GAEG;AAMH,MAAM,OAAO,q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C,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;QAE1J,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACO,UAAU,CAAC,KAAa;QAE9B,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAElD,IAAG,KAAK,GAAG,CAAC,EACZ;YACI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC;SACzC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAEnC,IAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,EAC1B;YACI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;IACL,CAAC;uGAtRQ,qBAAqB;2FAArB,qBAAqB,4PA+Eb,yBAAyB;;AA4KhC;IADT,YAAY,CAAC,EAAE,CAAC;;;;0DAMhB;2FAhQQ,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;oBACxB,UAAU,EAAE,IAAI;iBACnB;+EAmDc,KAAK;sBADf,KAAK;uBAAC,YAAY;gBAeZ,IAAI;sBADV,KAAK;gBASC,WAAW;sBADjB,MAAM;uBAAC,kBAAkB;gBAShB,KAAK;sBADd,eAAe;uBAAC,yBAAyB;gBA8HhC,aAAa;sBADtB,YAAY;uBAAC,QAAQ;gBA+CZ,aAAa","sourcesContent":["import {AfterContentInit, ContentChildren, Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, QueryList, SimpleChanges} from '@angular/core';\nimport {DebounceCall, isBlank, nameof} from '@jscrpt/common';\n\nimport {LoopScrollDataSADirective} from '../loopScrollData/loopScrollData.directive';\n\n/**\n * Renders loop scroll for array of elements\n */\n@Directive(\n{\n selector: '[loopScroll]',\n standalone: true,\n})\nexport class LoopScrollSADirective<TData = unknown> implements OnChanges, AfterContentInit\n{\n //######################### protected fields #########################\n\n /**\n * Item height that obtained\n */\n protected itemHeight: number|undefined|null;\n\n /**\n * Array of elements for scrolled stuff\n */\n protected ɵitems: LoopScrollDataSADirective<TData>[] = [];\n\n /**\n * Array of elements and data for scrolled stuff\n */ \n protected dataItems: LoopScrollDataSADirective<TData>[] = [];\n\n /**\n * Indication whether is loop scroll initialized\n */\n protected initialized: boolean = false;\n\n /**\n * Count of cloned elements before or after\n */\n protected clonedCount: number = 0;\n\n /**\n * Indication whether ignore scroll handle\n */\n protected ignoreScrollHandle: boolean = false;\n\n /**\n * Indication whether skip value change\n */\n protected skipValueChange: boolean = false;\n\n /**\n * Value that is being set in loop scroll\n */\n protected ɵvalue: TData|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets value that is being set in loop scroll\n */\n @Input('loopScroll')\n public get value(): TData|undefined|null\n {\n return this.ɵvalue;\n }\n public set value(value: TData|undefined|null)\n {\n this.skipValueChange = this.ɵvalue == value;\n this.ɵvalue = value;\n }\n\n /**\n * Indication whether is currently selection scroll open\n */\n @Input()\n public open: boolean = false;\n\n //######################### public properties - outputs #########################\n\n /**\n * Occurs when current value of loop scroll changes\n */\n @Output('loopScrollChange')\n public valueChange: EventEmitter<TData|undefined|null> = new EventEmitter<TData|undefined|null>();\n\n //######################### protected properties - children #########################\n\n /**\n * Array of items that are loop scrolled\n */\n @ContentChildren(LoopScrollDataSADirective)\n protected items: QueryList<LoopScrollDataSADirective<TData>>|undefined|null;\n\n //######################### constructor #########################\n constructor(protected scrollElement: ElementRef<HTMLElement>)\n {\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(!this.initialized)\n {\n return;\n }\n\n const itemHeight = this.itemHeight ?? 1;\n\n if(nameof<LoopScrollSADirective>('open') in changes)\n {\n if(this.open)\n {\n this.scrollElement.nativeElement.scrollTo({top: this.scrollElement.nativeElement.scrollTop - (2 * itemHeight), behavior: 'auto'});\n\n return;\n }\n\n if(nameof<LoopScrollSADirective>('value') in changes)\n {\n const selectedItem = this.dataItems?.find(itm => itm.data == this.value);\n\n if(!selectedItem)\n {\n throw new Error('No item selected in loop scroll');\n }\n\n const selectedIndex = this.dataItems.indexOf(selectedItem);\n\n this.scrollElement.nativeElement.scrollTo({top: (selectedIndex + this.clonedCount) * itemHeight, behavior: 'auto'});\n }\n else\n {\n this.scrollElement.nativeElement.scrollTo({top: this.scrollElement.nativeElement.scrollTop + (2 * itemHeight), behavior: 'auto'});\n }\n }\n else if(nameof<LoopScrollSADirective>('value') in changes)\n {\n if(!this.skipValueChange)\n {\n this.ignoreScrollHandle = true;\n this.scrollElement.nativeElement.scrollTo({top: (this.itemHeight ?? 0) * (this.clonedCount + this.dataItems.findIndex(itm => itm.data == this.value) + (this.open ? -2 : 0)), behavior: 'auto'});\n this.ignoreScrollHandle = false;\n }\n }\n\n this.skipValueChange = false;\n }\n\n //######################### public methods - implementation of AfterContentInit #########################\n \n /**\n * Called when content was initialized\n */\n public ngAfterContentInit(): void\n {\n this.ɵitems = this.items?.toArray() ?? [];\n this.dataItems = this.ɵitems?.filter(itm => !itm.clone);\n\n if(!this.dataItems?.length)\n {\n this.items?.changes.subscribe(() =>\n {\n this.ɵitems = this.items?.toArray() ?? [];\n this.dataItems = this.ɵitems?.filter(itm => !itm.clone);\n\n this._initialize();\n });\n\n return;\n }\n\n this._initialize();\n }\n\n //######################### protected methods #########################\n\n /**\n * Intialize default value\n */\n protected _initialize(): void\n {\n const cloned = this.ɵitems?.filter(itm => itm.clone) ?? [];\n this.clonedCount = cloned.length / 2;\n\n if(!this.dataItems?.length)\n {\n return;\n }\n\n this.dataItems.forEach(itm =>\n {\n if(isBlank(this.itemHeight))\n {\n this.itemHeight = itm.element.nativeElement.offsetHeight;\n\n return;\n }\n\n if(this.itemHeight != itm.element.nativeElement.offsetHeight)\n {\n throw new Error('All items inside of loop scroll should have same height');\n }\n });\n\n this.scrollElement.nativeElement.scrollTo({top: (this.itemHeight ?? 0) * (this.clonedCount + this.dataItems.findIndex(itm => itm.data == this.value)), behavior: 'auto'});\n this.initialized = true;\n }\n\n /**\n * Handles scroll event\n */\n @HostListener('scroll')\n protected _handleScroll(): void\n {\n if(this.ignoreScrollHandle)\n {\n return;\n }\n\n requestAnimationFrame(() =>\n {\n if(!this.dataItems)\n {\n return;\n }\n\n const index = this.scrollElement.nativeElement.scrollTop / (this.itemHeight ?? 1);\n const dataIndex = index + (this.open ? 2 : 0) - this.clonedCount;\n const dataLength = (this.itemHeight ?? 1) * this.dataItems.length;\n\n if(index % 1 <= .2 || index % 1 >= .8)\n {\n this.scrollElement.nativeElement.querySelector('.selected')?.classList?.remove('selected');\n\n const roundIndex = Math.round(index);\n this.ɵitems[roundIndex + (this.open ? 2 : 0)].element.nativeElement.classList.add('selected');\n this._emitValue(dataIndex);\n }\n\n if(dataIndex <= -1)\n {\n this._updateScroll(dataLength, true, index, dataIndex);\n }\n else if(dataIndex >= (this.dataItems.length ?? 0))\n {\n this._updateScroll(dataLength, false, index, dataIndex);\n }\n });\n }\n\n /**\n * Updates scroll to be at full value of item\n * @param dataLength - Length of all data\n * @param add - Indication whether add or subtract length\n * @param index - Current index\n * @param dataIndex - Current index of data \n */\n @DebounceCall(18)\n protected _updateScroll(dataLength: number, add: boolean, index: number, dataIndex: number): void\n {\n this.scrollElement.nativeElement.scrollTo({top: (Math.round(index) * (this.itemHeight ?? 1)) + (add ? dataLength : (dataLength * -1)), behavior: 'auto'});\n\n this._emitValue(dataIndex);\n }\n\n /**\n * Emits value after scroll\n * @param index - Index of currently selected data item\n */\n protected _emitValue(index: number): void\n {\n index = Math.round(index) % this.dataItems.length;\n \n if(index < 0)\n {\n index = this.dataItems.length + index;\n }\n\n const item = this.dataItems[index];\n\n if(this.value != item.data)\n {\n this.value = item.data;\n this.valueChange.next(this.value);\n }\n }\n}"]}
1
+ {"version":3,"file":"loopScroll.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAa,MAAM,EAA2B,MAAM,eAAe,CAAC;AACvK,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;;AAEnF;;GAEG;AAMH,MAAM,OAAO,mBAAmB;IA4C5B,gFAAgF;IAEhF;;OAEG;IACH,IACW,KAAK;QAEZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAW,KAAK,CAAC,KAA2B;QAExC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAwBD,iEAAiE;IACjE,YAAsB,aAAsC;QAAtC,kBAAa,GAAb,aAAa,CAAyB;QA1E5D;;WAEG;QACO,WAAM,GAAqC,EAAE,CAAC;QAExD;;WAEG;QACO,cAAS,GAAqC,EAAE,CAAC;QAE3D;;WAEG;QACO,gBAAW,GAAY,KAAK,CAAC;QAEvC;;WAEG;QACO,gBAAW,GAAW,CAAC,CAAC;QAElC;;WAEG;QACO,uBAAkB,GAAY,KAAK,CAAC;QAE9C;;WAEG;QACO,oBAAe,GAAY,KAAK,CAAC;QAuB3C;;WAEG;QAEI,SAAI,GAAY,KAAK,CAAC;QAE7B,iFAAiF;QAEjF;;WAEG;QAEI,gBAAW,GAAuC,IAAI,YAAY,EAAwB,CAAC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;YACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;8GAtRQ,mBAAmB;kGAAnB,mBAAmB,4PA+EX,uBAAuB;;AA4K9B;IADT,YAAY,CAAC,EAAE,CAAC;;;;wDAMhB;2FAhQQ,mBAAmB;kBAL/B,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;oBACxB,UAAU,EAAE,IAAI;iBACnB;+EAmDc,KAAK;sBADf,KAAK;uBAAC,YAAY;gBAeZ,IAAI;sBADV,KAAK;gBASC,WAAW;sBADjB,MAAM;uBAAC,kBAAkB;gBAShB,KAAK;sBADd,eAAe;uBAAC,uBAAuB;gBA8H9B,aAAa;sBADtB,YAAY;uBAAC,QAAQ;gBA+CZ,aAAa","sourcesContent":["import {AfterContentInit, ContentChildren, Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, QueryList, SimpleChanges} from '@angular/core';\nimport {DebounceCall, isBlank, nameof} from '@jscrpt/common';\n\nimport {LoopScrollDataDirective} from '../loopScrollData/loopScrollData.directive';\n\n/**\n * Renders loop scroll for array of elements\n */\n@Directive(\n{\n selector: '[loopScroll]',\n standalone: true,\n})\nexport class LoopScrollDirective<TData = unknown> implements OnChanges, AfterContentInit\n{\n //######################### protected fields #########################\n\n /**\n * Item height that obtained\n */\n protected itemHeight: number|undefined|null;\n\n /**\n * Array of elements for scrolled stuff\n */\n protected ɵitems: LoopScrollDataDirective<TData>[] = [];\n\n /**\n * Array of elements and data for scrolled stuff\n */ \n protected dataItems: LoopScrollDataDirective<TData>[] = [];\n\n /**\n * Indication whether is loop scroll initialized\n */\n protected initialized: boolean = false;\n\n /**\n * Count of cloned elements before or after\n */\n protected clonedCount: number = 0;\n\n /**\n * Indication whether ignore scroll handle\n */\n protected ignoreScrollHandle: boolean = false;\n\n /**\n * Indication whether skip value change\n */\n protected skipValueChange: boolean = false;\n\n /**\n * Value that is being set in loop scroll\n */\n protected ɵvalue: TData|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets value that is being set in loop scroll\n */\n @Input('loopScroll')\n public get value(): TData|undefined|null\n {\n return this.ɵvalue;\n }\n public set value(value: TData|undefined|null)\n {\n this.skipValueChange = this.ɵvalue == value;\n this.ɵvalue = value;\n }\n\n /**\n * Indication whether is currently selection scroll open\n */\n @Input()\n public open: boolean = false;\n\n //######################### public properties - outputs #########################\n\n /**\n * Occurs when current value of loop scroll changes\n */\n @Output('loopScrollChange')\n public valueChange: EventEmitter<TData|undefined|null> = new EventEmitter<TData|undefined|null>();\n\n //######################### protected properties - children #########################\n\n /**\n * Array of items that are loop scrolled\n */\n @ContentChildren(LoopScrollDataDirective)\n protected items: QueryList<LoopScrollDataDirective<TData>>|undefined|null;\n\n //######################### constructor #########################\n constructor(protected scrollElement: ElementRef<HTMLElement>)\n {\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(!this.initialized)\n {\n return;\n }\n\n const itemHeight = this.itemHeight ?? 1;\n\n if(nameof<LoopScrollDirective>('open') in changes)\n {\n if(this.open)\n {\n this.scrollElement.nativeElement.scrollTo({top: this.scrollElement.nativeElement.scrollTop - (2 * itemHeight), behavior: 'auto'});\n\n return;\n }\n\n if(nameof<LoopScrollDirective>('value') in changes)\n {\n const selectedItem = this.dataItems?.find(itm => itm.data == this.value);\n\n if(!selectedItem)\n {\n throw new Error('No item selected in loop scroll');\n }\n\n const selectedIndex = this.dataItems.indexOf(selectedItem);\n\n this.scrollElement.nativeElement.scrollTo({top: (selectedIndex + this.clonedCount) * itemHeight, behavior: 'auto'});\n }\n else\n {\n this.scrollElement.nativeElement.scrollTo({top: this.scrollElement.nativeElement.scrollTop + (2 * itemHeight), behavior: 'auto'});\n }\n }\n else if(nameof<LoopScrollDirective>('value') in changes)\n {\n if(!this.skipValueChange)\n {\n this.ignoreScrollHandle = true;\n this.scrollElement.nativeElement.scrollTo({top: (this.itemHeight ?? 0) * (this.clonedCount + this.dataItems.findIndex(itm => itm.data == this.value) + (this.open ? -2 : 0)), behavior: 'auto'});\n this.ignoreScrollHandle = false;\n }\n }\n\n this.skipValueChange = false;\n }\n\n //######################### public methods - implementation of AfterContentInit #########################\n \n /**\n * Called when content was initialized\n */\n public ngAfterContentInit(): void\n {\n this.ɵitems = this.items?.toArray() ?? [];\n this.dataItems = this.ɵitems?.filter(itm => !itm.clone);\n\n if(!this.dataItems?.length)\n {\n this.items?.changes.subscribe(() =>\n {\n this.ɵitems = this.items?.toArray() ?? [];\n this.dataItems = this.ɵitems?.filter(itm => !itm.clone);\n\n this._initialize();\n });\n\n return;\n }\n\n this._initialize();\n }\n\n //######################### protected methods #########################\n\n /**\n * Intialize default value\n */\n protected _initialize(): void\n {\n const cloned = this.ɵitems?.filter(itm => itm.clone) ?? [];\n this.clonedCount = cloned.length / 2;\n\n if(!this.dataItems?.length)\n {\n return;\n }\n\n this.dataItems.forEach(itm =>\n {\n if(isBlank(this.itemHeight))\n {\n this.itemHeight = itm.element.nativeElement.offsetHeight;\n\n return;\n }\n\n if(this.itemHeight != itm.element.nativeElement.offsetHeight)\n {\n throw new Error('All items inside of loop scroll should have same height');\n }\n });\n\n this.scrollElement.nativeElement.scrollTo({top: (this.itemHeight ?? 0) * (this.clonedCount + this.dataItems.findIndex(itm => itm.data == this.value)), behavior: 'auto'});\n this.initialized = true;\n }\n\n /**\n * Handles scroll event\n */\n @HostListener('scroll')\n protected _handleScroll(): void\n {\n if(this.ignoreScrollHandle)\n {\n return;\n }\n\n requestAnimationFrame(() =>\n {\n if(!this.dataItems)\n {\n return;\n }\n\n const index = this.scrollElement.nativeElement.scrollTop / (this.itemHeight ?? 1);\n const dataIndex = index + (this.open ? 2 : 0) - this.clonedCount;\n const dataLength = (this.itemHeight ?? 1) * this.dataItems.length;\n\n if(index % 1 <= .2 || index % 1 >= .8)\n {\n this.scrollElement.nativeElement.querySelector('.selected')?.classList?.remove('selected');\n\n const roundIndex = Math.round(index);\n this.ɵitems[roundIndex + (this.open ? 2 : 0)].element.nativeElement.classList.add('selected');\n this._emitValue(dataIndex);\n }\n\n if(dataIndex <= -1)\n {\n this._updateScroll(dataLength, true, index, dataIndex);\n }\n else if(dataIndex >= (this.dataItems.length ?? 0))\n {\n this._updateScroll(dataLength, false, index, dataIndex);\n }\n });\n }\n\n /**\n * Updates scroll to be at full value of item\n * @param dataLength - Length of all data\n * @param add - Indication whether add or subtract length\n * @param index - Current index\n * @param dataIndex - Current index of data \n */\n @DebounceCall(18)\n protected _updateScroll(dataLength: number, add: boolean, index: number, dataIndex: number): void\n {\n this.scrollElement.nativeElement.scrollTo({top: (Math.round(index) * (this.itemHeight ?? 1)) + (add ? dataLength : (dataLength * -1)), behavior: 'auto'});\n\n this._emitValue(dataIndex);\n }\n\n /**\n * Emits value after scroll\n * @param index - Index of currently selected data item\n */\n protected _emitValue(index: number): void\n {\n index = Math.round(index) % this.dataItems.length;\n \n if(index < 0)\n {\n index = this.dataItems.length + index;\n }\n\n const item = this.dataItems[index];\n\n if(this.value != item.data)\n {\n this.value = item.data;\n this.valueChange.next(this.value);\n }\n }\n}"]}
@@ -3,25 +3,19 @@ import * as i0 from "@angular/core";
3
3
  /**
4
4
  * Loop scroll data that are used inside LoopScrollDirective
5
5
  */
6
- export class LoopScrollDataSADirective {
7
- element;
8
- //######################### public properties - inputs #########################
9
- /**
10
- * Data for loop
11
- */
12
- data;
13
- /**
14
- * Indication that this node is clone
15
- */
16
- clone = false;
6
+ export class LoopScrollDataDirective {
17
7
  //######################### constructor #########################
18
8
  constructor(element) {
19
9
  this.element = element;
10
+ /**
11
+ * Indication that this node is clone
12
+ */
13
+ this.clone = false;
20
14
  }
21
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: LoopScrollDataSADirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
22
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: LoopScrollDataSADirective, isStandalone: true, selector: "[loopScrollData]", inputs: { data: ["loopScrollData", "data"], clone: "clone" }, ngImport: i0 });
15
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoopScrollDataDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
16
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: LoopScrollDataDirective, isStandalone: true, selector: "[loopScrollData]", inputs: { data: ["loopScrollData", "data"], clone: "clone" }, ngImport: i0 }); }
23
17
  }
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: LoopScrollDataSADirective, decorators: [{
18
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoopScrollDataDirective, decorators: [{
25
19
  type: Directive,
26
20
  args: [{
27
21
  selector: '[loopScrollData]',
@@ -1 +1 @@
1
- {"version":3,"file":"loopScrollData.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;;AAE3D;;GAEG;AAMH,MAAM,OAAO,yBAAyB;IAiBf;IAfnB,gFAAgF;IAEhF;;OAEG;IAEI,IAAI,CAAuB;IAElC;;OAEG;IAEI,KAAK,GAAY,KAAK,CAAC;IAE9B,iEAAiE;IACjE,YAAmB,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAEnD,CAAC;uGAnBQ,yBAAyB;2FAAzB,yBAAyB;;2FAAzB,yBAAyB;kBALrC,SAAS;mBACV;oBACI,QAAQ,EAAE,kBAAkB;oBAC5B,UAAU,EAAE,IAAI;iBACnB;+EASU,IAAI;sBADV,KAAK;uBAAC,gBAAgB;gBAOhB,KAAK;sBADX,KAAK","sourcesContent":["import {Directive, ElementRef, Input} from '@angular/core';\n\n/**\n * Loop scroll data that are used inside LoopScrollDirective\n */\n@Directive(\n{\n selector: '[loopScrollData]',\n standalone: true,\n})\nexport class LoopScrollDataSADirective<TData = unknown>\n{\n //######################### public properties - inputs #########################\n\n /**\n * Data for loop\n */\n @Input('loopScrollData')\n public data: TData|undefined|null;\n\n /**\n * Indication that this node is clone\n */\n @Input()\n public clone: boolean = false;\n\n //######################### constructor #########################\n constructor(public element: ElementRef<HTMLElement>)\n {\n }\n}"]}
1
+ {"version":3,"file":"loopScrollData.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;;AAE3D;;GAEG;AAMH,MAAM,OAAO,uBAAuB;IAgBhC,iEAAiE;IACjE,YAAmB,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;QAPnD;;WAEG;QAEI,UAAK,GAAY,KAAK,CAAC;IAK9B,CAAC;8GAnBQ,uBAAuB;kGAAvB,uBAAuB;;2FAAvB,uBAAuB;kBALnC,SAAS;mBACV;oBACI,QAAQ,EAAE,kBAAkB;oBAC5B,UAAU,EAAE,IAAI;iBACnB;+EASU,IAAI;sBADV,KAAK;uBAAC,gBAAgB;gBAOhB,KAAK;sBADX,KAAK","sourcesContent":["import {Directive, ElementRef, Input} from '@angular/core';\n\n/**\n * Loop scroll data that are used inside LoopScrollDirective\n */\n@Directive(\n{\n selector: '[loopScrollData]',\n standalone: true,\n})\nexport class LoopScrollDataDirective<TData = unknown>\n{\n //######################### public properties - inputs #########################\n\n /**\n * Data for loop\n */\n @Input('loopScrollData')\n public data: TData|undefined|null;\n\n /**\n * Indication that this node is clone\n */\n @Input()\n public clone: boolean = false;\n\n //######################### constructor #########################\n constructor(public element: ElementRef<HTMLElement>)\n {\n }\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"periodData.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/interfaces/periodData/periodData.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {DateApiObject} from '../../../../services';\n\n/**\n * Data that represents data for any picker type\n */\nexport interface PeriodData<TDate = unknown>\n{\n /**\n * Indication that this period item is active and selected\n */\n active: boolean;\n\n /**\n * Indication that this period item is disabled\n */\n disabled: boolean;\n\n //TODO: remove\n\n /**\n * Date for this period item\n */\n date: TDate;\n\n /**\n * Date for this period item as date api object\n */\n dateObj: DateApiObject<TDate>;\n}\n\n/**\n * Data that represents day in date picker\n */\nexport interface DayData<TDate = unknown> extends PeriodData<TDate>\n{\n\n /**\n * Indication that this day is out of currently selected month\n */\n otherMonth: boolean;\n\n /**\n * Indication that this day is today\n */\n today: boolean;\n\n /**\n * Indication that this day is weekend day\n */\n weekend: boolean;\n\n /**\n * Day number of month\n */\n day: number;\n}\n\n/**\n * Data that represents month in date picker\n */\nexport interface MonthData<TDate = unknown> extends PeriodData<TDate>\n{\n /**\n * Name of month\n */\n name: string;\n}\n\n/**\n * Data that represents year in date picker\n */\nexport interface YearData<TDate = unknown> extends PeriodData<TDate>\n{\n /**\n * Value of year\n */\n value: number;\n}"]}
1
+ {"version":3,"file":"periodData.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/interfaces/periodData/periodData.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {DateApiObject} from '../../../../services';\n\n/**\n * Data that represents data for any picker type\n */\nexport interface PeriodData<TDate = unknown>\n{\n /**\n * Indication that this period item is active and selected\n */\n active: boolean;\n\n /**\n * Indication that this period item is disabled\n */\n disabled: boolean;\n\n /**\n * Date for this period item\n */\n date: TDate;\n\n /**\n * Date for this period item as date api object\n */\n dateObj: DateApiObject<TDate>;\n}\n\n/**\n * Data that represents day in date picker\n */\nexport interface DayData<TDate = unknown> extends PeriodData<TDate>\n{\n\n /**\n * Indication that this day is out of currently selected month\n */\n otherMonth: boolean;\n\n /**\n * Indication that this day is today\n */\n today: boolean;\n\n /**\n * Indication that this day is weekend day\n */\n weekend: boolean;\n\n /**\n * Day number of month\n */\n day: number;\n}\n\n/**\n * Data that represents month in date picker\n */\nexport interface MonthData<TDate = unknown> extends PeriodData<TDate>\n{\n /**\n * Name of month\n */\n name: string;\n}\n\n/**\n * Data that represents year in date picker\n */\nexport interface YearData<TDate = unknown> extends PeriodData<TDate>\n{\n /**\n * Value of year\n */\n value: number;\n}"]}
@@ -1,28 +1,27 @@
1
1
  import { NgModule } from '@angular/core';
2
2
  import { DateTimePickerComponent } from '../components';
3
- import { DateTimePickerSADirective } from '../directives';
3
+ import { DateTimePickerDirective } from '../directives';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * Module for components that are used as date time picker
7
7
  */
8
8
  export class DateTimePickerModule {
9
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DateTimePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
10
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: DateTimePickerModule, declarations: [DateTimePickerComponent], imports: [DateTimePickerSADirective], exports: [DateTimePickerComponent,
11
- DateTimePickerSADirective] });
12
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DateTimePickerModule });
9
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: DateTimePickerModule, imports: [DateTimePickerDirective,
11
+ DateTimePickerComponent], exports: [DateTimePickerComponent,
12
+ DateTimePickerDirective] }); }
13
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimePickerModule }); }
13
14
  }
14
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DateTimePickerModule, decorators: [{
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimePickerModule, decorators: [{
15
16
  type: NgModule,
16
17
  args: [{
17
18
  imports: [
18
- DateTimePickerSADirective,
19
- ],
20
- declarations: [
19
+ DateTimePickerDirective,
21
20
  DateTimePickerComponent,
22
21
  ],
23
22
  exports: [
24
23
  DateTimePickerComponent,
25
- DateTimePickerSADirective,
24
+ DateTimePickerDirective,
26
25
  ],
27
26
  }]
28
27
  }] });
@@ -1 +1 @@
1
- {"version":3,"file":"dateTimePicker.module.js","sourceRoot":"","sources":["../../../../../src/modules/dateTimePicker/modules/dateTimePicker.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,yBAAyB,EAAC,MAAM,eAAe,CAAC;;AAExD;;GAEG;AAiBH,MAAM,OAAO,oBAAoB;uGAApB,oBAAoB;wGAApB,oBAAoB,iBARzB,uBAAuB,aAJvB,yBAAyB,aAQzB,uBAAuB;YACvB,yBAAyB;wGAGpB,oBAAoB;;2FAApB,oBAAoB;kBAhBhC,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,yBAAyB;qBAC5B;oBACD,YAAY,EACZ;wBACI,uBAAuB;qBAC1B;oBACD,OAAO,EACP;wBACI,uBAAuB;wBACvB,yBAAyB;qBAC5B;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {DateTimePickerComponent} from '../components';\nimport {DateTimePickerSADirective} from '../directives';\n\n/**\n * Module for components that are used as date time picker\n */\n@NgModule(\n{\n imports:\n [\n DateTimePickerSADirective,\n ],\n declarations:\n [\n DateTimePickerComponent,\n ],\n exports:\n [\n DateTimePickerComponent,\n DateTimePickerSADirective,\n ],\n})\nexport class DateTimePickerModule\n{\n}"]}
1
+ {"version":3,"file":"dateTimePicker.module.js","sourceRoot":"","sources":["../../../../../src/modules/dateTimePicker/modules/dateTimePicker.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;;AAEtD;;GAEG;AAcH,MAAM,OAAO,oBAAoB;8GAApB,oBAAoB;+GAApB,oBAAoB,YATzB,uBAAuB;YACvB,uBAAuB,aAIvB,uBAAuB;YACvB,uBAAuB;+GAGlB,oBAAoB;;2FAApB,oBAAoB;kBAbhC,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,uBAAuB;wBACvB,uBAAuB;qBAC1B;oBACD,OAAO,EACP;wBACI,uBAAuB;wBACvB,uBAAuB;qBAC1B;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {DateTimePickerComponent} from '../components';\nimport {DateTimePickerDirective} from '../directives';\n\n/**\n * Module for components that are used as date time picker\n */\n@NgModule(\n{\n imports:\n [\n DateTimePickerDirective,\n DateTimePickerComponent,\n ],\n exports:\n [\n DateTimePickerComponent,\n DateTimePickerDirective,\n ],\n})\nexport class DateTimePickerModule\n{\n}"]}
@@ -5,7 +5,6 @@ import * as i0 from "@angular/core";
5
5
  * Pipe that is used for converting date
6
6
  */
7
7
  export class DateConvertPipe {
8
- _dateApi;
9
8
  //######################### constructors #########################
10
9
  constructor(_dateApi) {
11
10
  this._dateApi = _dateApi;
@@ -23,12 +22,12 @@ export class DateConvertPipe {
23
22
  }
24
23
  return null;
25
24
  }
26
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DateConvertPipe, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Pipe });
27
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: DateConvertPipe, name: "dateConvert" });
25
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateConvertPipe, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Pipe }); }
26
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: DateConvertPipe, isStandalone: true, name: "dateConvert" }); }
28
27
  }
29
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DateConvertPipe, decorators: [{
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateConvertPipe, decorators: [{
30
29
  type: Pipe,
31
- args: [{ name: 'dateConvert' }]
30
+ args: [{ name: 'dateConvert', standalone: true }]
32
31
  }], ctorParameters: () => [{ type: undefined, decorators: [{
33
32
  type: Inject,
34
33
  args: [DATE_API]
@@ -1 +1 @@
1
- {"version":3,"file":"dateConvert.pipe.js","sourceRoot":"","sources":["../../../src/pipes/dateConvert.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAGxC;;GAEG;AAEH,MAAM,OAAO,eAAe;IAGc;IADtC,kEAAkE;IAClE,YAAsC,QAAwB;QAAxB,aAAQ,GAAR,QAAQ,CAAgB;IAE9D,CAAC;IAED,sGAAsG;IAEtG;;;;OAIG;IACI,SAAS,CAAC,KAAsB,EAAE,WAAoB;QAEzD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAG,OAAO,CAAC,OAAO,EAAE,EACpB;YACI,OAAO,OAAO,CAAC;SAClB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;uGAxBQ,eAAe,kBAGJ,QAAQ;qGAHnB,eAAe;;2FAAf,eAAe;kBAD3B,IAAI;mBAAC,EAAC,IAAI,EAAE,aAAa,EAAC;;0BAIV,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\n\nimport {DATE_API} from '../misc/tokens';\nimport {DateApi, DateApiObject, DateValue} from '../services';\n\n/**\n * Pipe that is used for converting date\n */\n@Pipe({name: 'dateConvert'})\nexport class DateConvertPipe<TDate = unknown> implements PipeTransform\n{\n //######################### constructors #########################\n constructor(@Inject(DATE_API) private _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Transforms value into date object\n * @param value - value to be transformed\n * @param parseFormat - format used for parsing string date\n */\n public transform(value: TDate|DateValue, parseFormat?: string): DateApiObject<TDate>|null\n {\n const dateObj = this._dateApi.getValue(value, parseFormat);\n\n if(dateObj.isValid())\n {\n return dateObj;\n }\n\n return null;\n }\n}"]}
1
+ {"version":3,"file":"dateConvert.pipe.js","sourceRoot":"","sources":["../../../src/pipes/dateConvert.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAGxC;;GAEG;AAEH,MAAM,OAAO,eAAe;IAExB,kEAAkE;IAClE,YAAsC,QAAwB;QAAxB,aAAQ,GAAR,QAAQ,CAAgB;IAE9D,CAAC;IAED,sGAAsG;IAEtG;;;;OAIG;IACI,SAAS,CAAC,KAAsB,EAAE,WAAoB;QAEzD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAG,OAAO,CAAC,OAAO,EAAE,EACpB,CAAC;YACG,OAAO,OAAO,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;8GAxBQ,eAAe,kBAGJ,QAAQ;4GAHnB,eAAe;;2FAAf,eAAe;kBAD3B,IAAI;mBAAC,EAAC,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAC;;0BAI5B,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\n\nimport {DATE_API} from '../misc/tokens';\nimport {DateApi, DateApiObject, DateValue} from '../services';\n\n/**\n * Pipe that is used for converting date\n */\n@Pipe({name: 'dateConvert', standalone: true})\nexport class DateConvertPipe<TDate = unknown> implements PipeTransform\n{\n //######################### constructors #########################\n constructor(@Inject(DATE_API) private _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Transforms value into date object\n * @param value - value to be transformed\n * @param parseFormat - format used for parsing string date\n */\n public transform(value: TDate|DateValue, parseFormat?: string): DateApiObject<TDate>|null\n {\n const dateObj = this._dateApi.getValue(value, parseFormat);\n\n if(dateObj.isValid())\n {\n return dateObj;\n }\n\n return null;\n }\n}"]}
@@ -6,8 +6,6 @@ import * as i0 from "@angular/core";
6
6
  * Pipe that is used for formatting date
7
7
  */
8
8
  export class DateFormatPipe {
9
- _formatProvider;
10
- _dateApi;
11
9
  //######################### constructors #########################
12
10
  constructor(_formatProvider, _dateApi) {
13
11
  this._formatProvider = _formatProvider;
@@ -25,12 +23,12 @@ export class DateFormatPipe {
25
23
  }
26
24
  return '';
27
25
  }
28
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DateFormatPipe, deps: [{ token: FORMAT_PROVIDER }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Pipe });
29
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: DateFormatPipe, name: "dateFormat" });
26
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateFormatPipe, deps: [{ token: FORMAT_PROVIDER }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Pipe }); }
27
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: DateFormatPipe, isStandalone: true, name: "dateFormat" }); }
30
28
  }
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DateFormatPipe, decorators: [{
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateFormatPipe, decorators: [{
32
30
  type: Pipe,
33
- args: [{ name: 'dateFormat' }]
31
+ args: [{ name: 'dateFormat', standalone: true }]
34
32
  }], ctorParameters: () => [{ type: undefined, decorators: [{
35
33
  type: Inject,
36
34
  args: [FORMAT_PROVIDER]
@@ -1 +1 @@
1
- {"version":3,"file":"dateFormat.pipe.js","sourceRoot":"","sources":["../../../src/pipes/dateFormat.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;;AAGzD;;GAEG;AAEH,MAAM,OAAO,cAAc;IAGsB;IACP;IAFtC,kEAAkE;IAClE,YAA6C,eAA+B,EACtC,QAAwB;QADjB,oBAAe,GAAf,eAAe,CAAgB;QACtC,aAAQ,GAAR,QAAQ,CAAgB;IAE9D,CAAC;IAqCM,SAAS,CAAC,KAAsB,EAAE,SAAsC,MAAM,CAAiB,MAAM,CAAC,EAAE,yBAA0C,EAAE,aAAuB;QAE9K,MAAM,WAAW,GAAqB,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,CAAC;QAElH,uBAAuB;QACvB,IAAG,MAAM,IAAI,IAAI,CAAC,eAAe,EACjC;YACI,MAAM,GAAS,IAAI,CAAC,eAAgB,CAAC,MAAM,CAAC,CAAC;SAChD;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAG,OAAO,CAAC,OAAO,EAAE,EACpB;YACI,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;SAC1D;QAED,OAAO,EAAE,CAAC;IACd,CAAC;uGA7DQ,cAAc,kBAGH,eAAe,aACf,QAAQ;qGAJnB,cAAc;;2FAAd,cAAc;kBAD1B,IAAI;mBAAC,EAAC,IAAI,EAAE,YAAY,EAAC;;0BAIT,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {isString, nameof} from '@jscrpt/common';\n\nimport {FormatProvider} from '../interfaces';\nimport {DATE_API, FORMAT_PROVIDER} from '../misc/tokens';\nimport {DateApi, DateValue} from '../services';\n\n/**\n * Pipe that is used for formatting date\n */\n@Pipe({name: 'dateFormat'})\nexport class DateFormatPipe<TDate = unknown> implements PipeTransform\n{\n //######################### constructors #########################\n constructor(@Inject(FORMAT_PROVIDER) private _formatProvider: FormatProvider,\n @Inject(DATE_API) private _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Formats provided date into formatted string, with default format 'date'\n * @param value - value to be transformed\n */\n public transform(value: TDate|DateValue): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys\n */\n public transform(value: TDate|DateValue, format: keyof FormatProvider): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys\n * @param parseFormat - format used for parsing string date\n */\n public transform(value: TDate|DateValue, format: keyof FormatProvider, parseFormat: string): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - format that is used for formatting\n * @param customFormat - indication that custom format is used\n */\n public transform(value: TDate|DateValue, format: string, customFormat: true): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - format that is used for formatting\n * @param parseFormat - format used for parsing string date\n * @param customFormat - indication that custom format is used\n */\n public transform(value: TDate|DateValue, format: string, parseFormat: string, customFormat: true): string\n public transform(value: TDate|DateValue, format: string|keyof FormatProvider = nameof<FormatProvider>('date'), parseFormatOrCustomFormat?: string|boolean, _customFormat?: boolean): string\n {\n const parseFormat: string|undefined = isString(parseFormatOrCustomFormat) ? parseFormatOrCustomFormat : undefined;\n \n //format provider value\n if(format in this._formatProvider)\n {\n format = (<any>this._formatProvider)[format];\n }\n\n const dateObj = this._dateApi.getValue(value, parseFormat);\n\n if(dateObj.isValid())\n {\n return dateObj.format(this._dateApi.getFormat(format));\n }\n\n return '';\n }\n}"]}
1
+ {"version":3,"file":"dateFormat.pipe.js","sourceRoot":"","sources":["../../../src/pipes/dateFormat.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;;AAGzD;;GAEG;AAEH,MAAM,OAAO,cAAc;IAEvB,kEAAkE;IAClE,YAA6C,eAA+B,EACtC,QAAwB;QADjB,oBAAe,GAAf,eAAe,CAAgB;QACtC,aAAQ,GAAR,QAAQ,CAAgB;IAE9D,CAAC;IAqCM,SAAS,CAAC,KAAsB,EAAE,SAAsC,MAAM,CAAiB,MAAM,CAAC,EAAE,yBAA0C,EAAE,aAAuB;QAE9K,MAAM,WAAW,GAAqB,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,CAAC;QAElH,uBAAuB;QACvB,IAAG,MAAM,IAAI,IAAI,CAAC,eAAe,EACjC,CAAC;YACG,MAAM,GAAS,IAAI,CAAC,eAAgB,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAG,OAAO,CAAC,OAAO,EAAE,EACpB,CAAC;YACG,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,EAAE,CAAC;IACd,CAAC;8GA7DQ,cAAc,kBAGH,eAAe,aACf,QAAQ;4GAJnB,cAAc;;2FAAd,cAAc;kBAD1B,IAAI;mBAAC,EAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAC;;0BAI3B,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {isString, nameof} from '@jscrpt/common';\n\nimport {FormatProvider} from '../interfaces';\nimport {DATE_API, FORMAT_PROVIDER} from '../misc/tokens';\nimport {DateApi, DateValue} from '../services';\n\n/**\n * Pipe that is used for formatting date\n */\n@Pipe({name: 'dateFormat', standalone: true})\nexport class DateFormatPipe<TDate = unknown> implements PipeTransform\n{\n //######################### constructors #########################\n constructor(@Inject(FORMAT_PROVIDER) private _formatProvider: FormatProvider,\n @Inject(DATE_API) private _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Formats provided date into formatted string, with default format 'date'\n * @param value - value to be transformed\n */\n public transform(value: TDate|DateValue): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys\n */\n public transform(value: TDate|DateValue, format: keyof FormatProvider): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys\n * @param parseFormat - format used for parsing string date\n */\n public transform(value: TDate|DateValue, format: keyof FormatProvider, parseFormat: string): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - format that is used for formatting\n * @param customFormat - indication that custom format is used\n */\n public transform(value: TDate|DateValue, format: string, customFormat: true): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - format that is used for formatting\n * @param parseFormat - format used for parsing string date\n * @param customFormat - indication that custom format is used\n */\n public transform(value: TDate|DateValue, format: string, parseFormat: string, customFormat: true): string\n public transform(value: TDate|DateValue, format: string|keyof FormatProvider = nameof<FormatProvider>('date'), parseFormatOrCustomFormat?: string|boolean, _customFormat?: boolean): string\n {\n const parseFormat: string|undefined = isString(parseFormatOrCustomFormat) ? parseFormatOrCustomFormat : undefined;\n \n //format provider value\n if(format in this._formatProvider)\n {\n format = (<any>this._formatProvider)[format];\n }\n\n const dateObj = this._dateApi.getValue(value, parseFormat);\n\n if(dateObj.isValid())\n {\n return dateObj.format(this._dateApi.getFormat(format));\n }\n\n return '';\n }\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dateApi.interface.js","sourceRoot":"","sources":["../../../../src/services/dateApi/dateApi.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Date can be represented as formatted string, timestamp or javascript Date object\n */\nexport type DateValue = Date|string|number;\n\n/**\n * Type that represents date object, either as date api or plain\n */\nexport type DateObject<TDate> = TDate|DateApiObject<TDate>;\n\n/**\n * Definition of type, that is used for creating instance of DateApiObject\n */\nexport interface DateApiObjectCtor<TDate = unknown, TObject extends DateApiObject<TDate> = DateApiObject<TDate>>\n{\n new (value: TDate|DateValue, format?: string, ...additionalParams: any[]): TObject;\n}\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport interface DateApiObject<TDate = unknown>\n{\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n readonly originalValue: TDate;\n\n /**\n * Instance of date\n */\n readonly value: TDate;\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n isValid(): boolean;\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n isWeekend(): boolean;\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n format(format: string): string;\n\n /**\n * Formats date value as ISO string representation\n */\n formatISO(): string;\n\n /**\n * Gets value of date time as unix timestamp\n */\n unixTimestamp(): number;\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n startOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n endOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n startOfYear(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n endOfYear(): DateApiObject<TDate>;\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n addYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n subtractYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n startOfMonth(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n endOfMonth(): DateApiObject<TDate>;\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n addMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n subtractMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n startOfWeek(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n endOfWeek(): DateApiObject<TDate>;\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n addWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n subtractWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n startOfDay(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n endOfDay(): DateApiObject<TDate>;\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n addDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n subtractDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n startOfHour(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n endOfHour(): DateApiObject<TDate>;\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n addHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n subtractHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n startOfMinute(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n endOfMinute(): DateApiObject<TDate>;\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n addMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n subtractMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Gets number of days in month\n */\n daysInMonth(): number;\n\n /**\n * Gets year\n */\n year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n year(year: number): DateApiObject<TDate>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n year(year?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets month\n */\n month(): number;\n /**\n * Sets month\n * @param month - Month to be set\n */\n month(month: number): DateApiObject<TDate>;\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n month(month?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of month one based\n */\n dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n dayOfMonth(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n dayOfMonth(day?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of week zero based, first is monday\n */\n dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n dayOfWeek(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n dayOfWeek(day?: number): number|DateApiObject<TDate>;\n\n /**\n * Gets hours zero based\n */\n hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n hour(hour: number): DateApiObject<TDate>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n hour(hour?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets minutes zero based\n */\n minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n minute(minute: number): DateApiObject<TDate>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n minute(minute?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n isBefore(date: DateObject<TDate>): boolean;\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n isAfter(date: DateObject<TDate>): boolean;\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n diffDays(date: DateObject<TDate>): number;\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n isSameWeek(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n isSameDecade(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n isSameYear(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n isSameMonth(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n isSameDay(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether is date same as provided date\n * @param date - Date which is used for comparison whether is same date time\n */\n isSame(date: DateObject<TDate>): boolean;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n clone(): DateApiObject<TDate>;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n cloneOriginal(): DateApiObject<TDate>;\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n updateOriginal(value?: DateObject<TDate>): DateApiObject<TDate>;\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n resetOriginal(): DateApiObject<TDate>;\n}\n\n/**\n * Date api abstraction, used for obtaining DateApi wrapper object\n */\nexport interface DateApi<TDate = unknown, TDateApiObject extends DateApiObject<TDate> = DateApiObject<TDate>>\n{\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n getValue(value: DateValue|TDate, format?: string): TDateApiObject;\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n now(): TDateApiObject;\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n getFormat(pseudoFormat: string): string;\n\n /**\n * Gets information\n */\n weekStartsOnMonday(): boolean;\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n weekdaysShort(): string[];\n\n /**\n * Tests whether is value TDate\n * @param value - Value to be tested whether is TDate\n */\n isDate(value: unknown): value is TDate;\n}"]}
1
+ {"version":3,"file":"dateApi.interface.js","sourceRoot":"","sources":["../../../../src/services/dateApi/dateApi.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Date can be represented as formatted string, timestamp or javascript Date object\n */\nexport type DateValue = Date|string|number;\n\n/**\n * Type that represents date object, either as date api or plain\n */\nexport type DateObject<TDate> = TDate|DateApiObject<TDate>;\n\n/**\n * Definition of type, that is used for creating instance of DateApiObject\n */\nexport interface DateApiObjectCtor<TDate = unknown, TObject extends DateApiObject<TDate> = DateApiObject<TDate>>\n{\n new (value: TDate|DateValue, format?: string, ...additionalParams: any[]): TObject;\n}\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport interface DateApiObject<TDate = unknown>\n{\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n readonly originalValue: TDate;\n\n /**\n * Instance of date\n */\n readonly value: TDate;\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n isValid(): boolean;\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n isWeekend(): boolean;\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n format(format: string): string;\n\n /**\n * Formats date value as ISO string representation\n */\n formatISO(): string;\n\n /**\n * Gets value of date time as unix timestamp (in seconds)\n */\n unixTimestamp(): number;\n\n /**\n * Gets value of date time as timestamp (in miliseconds)\n */\n timestamp(): number;\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n startOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n endOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n startOfYear(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n endOfYear(): DateApiObject<TDate>;\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n addYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n subtractYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n startOfMonth(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n endOfMonth(): DateApiObject<TDate>;\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n addMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n subtractMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n startOfWeek(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n endOfWeek(): DateApiObject<TDate>;\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n addWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n subtractWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n startOfDay(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n endOfDay(): DateApiObject<TDate>;\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n addDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n subtractDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n startOfHour(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n endOfHour(): DateApiObject<TDate>;\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n addHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n subtractHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n startOfMinute(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n endOfMinute(): DateApiObject<TDate>;\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n addMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n subtractMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Gets number of days in month\n */\n daysInMonth(): number;\n\n /**\n * Gets year\n */\n year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n year(year: number): DateApiObject<TDate>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n year(year?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets month\n */\n month(): number;\n /**\n * Sets month\n * @param month - Month to be set\n */\n month(month: number): DateApiObject<TDate>;\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n month(month?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of month one based\n */\n dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n dayOfMonth(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n dayOfMonth(day?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of week zero based, first is monday\n */\n dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n dayOfWeek(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n dayOfWeek(day?: number): number|DateApiObject<TDate>;\n\n /**\n * Gets hours zero based\n */\n hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n hour(hour: number): DateApiObject<TDate>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n hour(hour?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets minutes zero based\n */\n minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n minute(minute: number): DateApiObject<TDate>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n minute(minute?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n isBefore(date: DateObject<TDate>): boolean;\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n isAfter(date: DateObject<TDate>): boolean;\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n diffDays(date: DateObject<TDate>): number;\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n isSameWeek(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n isSameDecade(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n isSameYear(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n isSameMonth(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n isSameDay(date: DateObject<TDate>): boolean;\n\n /**\n * Compares whether is date same as provided date\n * @param date - Date which is used for comparison whether is same date time\n */\n isSame(date: DateObject<TDate>): boolean;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n clone(): DateApiObject<TDate>;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n cloneOriginal(): DateApiObject<TDate>;\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n updateOriginal(value?: DateObject<TDate>): DateApiObject<TDate>;\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n resetOriginal(): DateApiObject<TDate>;\n}\n\n/**\n * Date api abstraction, used for obtaining DateApi wrapper object\n */\nexport interface DateApi<TDate = unknown, TDateApiObject extends DateApiObject<TDate> = DateApiObject<TDate>>\n{\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n getValue(value: DateValue|TDate, format?: string): TDateApiObject;\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n now(): TDateApiObject;\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n getFormat(pseudoFormat: string): string;\n\n /**\n * Gets information\n */\n weekStartsOnMonday(): boolean;\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n weekdaysShort(): string[];\n\n /**\n * Tests whether is value TDate\n * @param value - Value to be tested whether is TDate\n */\n isDate(value: unknown): value is TDate;\n}"]}
@@ -13,10 +13,10 @@ export class DatePositionParserService {
13
13
  createParser(format) {
14
14
  return new DefaultDatePositionParser(format);
15
15
  }
16
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DatePositionParserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DatePositionParserService, providedIn: 'root' });
16
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePositionParserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
17
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePositionParserService, providedIn: 'root' }); }
18
18
  }
19
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DatePositionParserService, decorators: [{
19
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePositionParserService, decorators: [{
20
20
  type: Injectable,
21
21
  args: [{ providedIn: 'root' }]
22
22
  }] });
@@ -24,23 +24,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImpor
24
24
  * Default implementation of DatePositionParser
25
25
  */
26
26
  export class DefaultDatePositionParser {
27
- _format;
28
- //######################### protected fields #########################
29
- /**
30
- * Indication whether format contains separators
31
- */
32
- _hasSeparator = false;
33
- /**
34
- * Array of date parts of parsed date format
35
- */
36
- _datePartsIndexes = [];
37
- /**
38
- * Object storing indexes for strict date parts of parsed date format
39
- */
40
- _strictDatePartsIndexes = {};
41
27
  //######################### constructor #########################
42
28
  constructor(_format) {
43
29
  this._format = _format;
30
+ //######################### protected fields #########################
31
+ /**
32
+ * Indication whether format contains separators
33
+ */
34
+ this._hasSeparator = false;
35
+ /**
36
+ * Array of date parts of parsed date format
37
+ */
38
+ this._datePartsIndexes = [];
39
+ /**
40
+ * Object storing indexes for strict date parts of parsed date format
41
+ */
42
+ this._strictDatePartsIndexes = {};
44
43
  this._initialize();
45
44
  }
46
45
  //######################### public methods - implementation of DatePositionParser #########################
@@ -1 +1 @@
1
- {"version":3,"file":"datePositionParser.service.js","sourceRoot":"","sources":["../../../../src/services/datePositionParser/datePositionParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAIvC;;GAEG;AAEH,MAAM,OAAO,yBAAyB;IAElC,oEAAoE;IAEpE;;;OAGG;IACI,YAAY,CAAC,MAAc;QAE9B,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;uGAXQ,yBAAyB;2GAAzB,yBAAyB,cADb,MAAM;;2FAClB,yBAAyB;kBADrC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;AAehC;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAoBZ;IAlBtB,sEAAsE;IAEtE;;OAEG;IACO,aAAa,GAAY,KAAK,CAAC;IAEzC;;OAEG;IACO,iBAAiB,GAAa,EAAE,CAAC;IAE3C;;OAEG;IACO,uBAAuB,GAAsD,EAAE,CAAC;IAE1F,iEAAiE;IACjE,YAAsB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAEjC,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED,2GAA2G;IAE3G;;;;OAIG;IACI,IAAI,CAAC,IAA2B,EAAE,cAAsB;QAE3D,IAAG,OAAO,CAAC,IAAI,CAAC,EAChB;YACI,OAAO,IAAI,CAAC;SACf;QAED,mBAAmB;QACnB,IAAG,IAAI,CAAC,aAAa,EACrB;YACI,IAAI,OAAO,GAAG,KAAK,CAAC;YAEpB,iDAAiD;YACjD,OAAM,IAAI,EACV;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IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAC3C;gBACI,WAAW;gBACX,IAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,EAC9B;oBACI,IAAG,CAAC,GAAG,CAAC,EACR;wBACI,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;qBAClE;oBAED,SAAS,GAAG,CAAC,CAAC;oBACd,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBAE3B,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;wBAC/B;4BACI,MAAM,EAAE,CAAC;4BACT,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;yBACxB,CAAC;iBACL;aACJ;YAED,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;SACpF;IACL,CAAC;CACJ","sourcesContent":["import {Injectable} from '@angular/core';\nimport {isBlank} from '@jscrpt/common';\n\nimport {DatePositionParser, DatePositionParserResult} from './datePositionParser.interface';\n\n/**\n * Service used for parsing date\n */\n@Injectable({providedIn: 'root'})\nexport class DatePositionParserService\n{\n //######################### public methods #########################\n\n /**\n * Creates parser instance for specified format\n * @param format - Format to be used for parsing date string\n */\n public createParser(format: string): DatePositionParser\n {\n return new DefaultDatePositionParser(format);\n }\n}\n\n/**\n * Default implementation of DatePositionParser\n */\nexport class DefaultDatePositionParser implements DatePositionParser\n{\n //######################### protected fields #########################\n\n /**\n * Indication whether format contains separators\n */\n protected _hasSeparator: boolean = false;\n\n /**\n * Array of date parts of parsed date format\n */\n protected _datePartsIndexes: string[] = [];\n\n /**\n * Object storing indexes for strict date parts of parsed date format\n */\n protected _strictDatePartsIndexes: {[index: number]: {part: string, length: number}} = {};\n\n //######################### constructor #########################\n constructor(protected _format: string)\n {\n this._initialize();\n }\n\n //######################### public methods - implementation of DatePositionParser #########################\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to next part, if it was last part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public next(date: string|null|undefined, cursorPosition: number): null|DatePositionParserResult\n {\n if(isBlank(date))\n {\n return null;\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n let useNext = false;\n\n // eslint-disable-next-line no-constant-condition\n while(true)\n {\n if(cursorPosition == date.length)\n {\n return null;\n }\n\n if(useNext && !isNaN(+date[cursorPosition]))\n {\n return this.parse(date, cursorPosition);\n }\n\n if(isNaN(+date[cursorPosition]))\n {\n useNext = true;\n }\n\n cursorPosition++;\n }\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition < index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to previous part, if it was first part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public previous(date: string|null|undefined, cursorPosition: number): null|DatePositionParserResult\n {\n if(isBlank(date))\n {\n return null;\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n let useNext = false;\n\n // eslint-disable-next-line no-constant-condition\n while(true)\n {\n if(cursorPosition < 0)\n {\n return null;\n }\n\n if(useNext && !isNaN(+date[cursorPosition]))\n {\n return this.parse(date, cursorPosition);\n }\n\n if(isNaN(+date[cursorPosition]))\n {\n useNext = true;\n }\n\n cursorPosition--;\n }\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).reverse().map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition > index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Parse date as string and returns information about positions and selected part of date\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public parse(date: string|null|undefined, cursorPosition: number): DatePositionParserResult\n {\n if(isBlank(date))\n {\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n //fix cursor position if is clicked on separator\n if(cursorPosition != date.length &&\n /[^0-9ɵ]/.test(date[cursorPosition]) &&\n /[^0-9ɵ]/.test(date[cursorPosition - 1]))\n {\n let breakCycle = false;\n cursorPosition++;\n\n while(/[^0-9ɵ]/.test(date[cursorPosition]))\n {\n if(cursorPosition >= date.length)\n {\n if(breakCycle)\n {\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n breakCycle = true;\n cursorPosition = 0;\n }\n\n cursorPosition++;\n }\n }\n\n const updateDate = [date.substr(0, cursorPosition), 'ɵ', date.substr(cursorPosition)].join('');\n const indexed = updateDate.replace(/[^0-9ɵ]/g, ' ').split(' ');\n let partIndex = 0;\n let startPosition = 0;\n let selectionLength = 0;\n\n for(const itm of indexed)\n {\n //this segment contains cursor\n if(itm.indexOf('ɵ') >= 0)\n {\n selectionLength = itm.length - 1;\n\n break;\n }\n\n startPosition++;\n\n //separator\n if(!itm.length)\n {\n continue;\n }\n\n partIndex++;\n startPosition += itm.length;\n }\n\n return {\n part: this._datePartsIndexes[partIndex],\n positionFrom: startPosition,\n positionTo: startPosition + selectionLength\n };\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).reverse().map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition >= index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n /**\n * Initialize parser, process format\n */\n protected _initialize(): void\n {\n this._hasSeparator = /[^yqmwdhs]/i.test(this._format);\n\n //non strict format\n if(this._hasSeparator)\n {\n this._datePartsIndexes = this._format.replace(/[^yqmwdhs]+/gi, ' ')\n .split(' ')\n .filter(itm => !!itm)\n .map(itm => itm[0]);\n }\n //strict format\n else\n {\n let lastPart: string|null = null;\n let lastIndex: number = 0;\n\n for(let x = 0; x < this._format.length; x++)\n {\n //next part\n if(this._format[x] != lastPart)\n {\n if(x > 0)\n {\n this._strictDatePartsIndexes[lastIndex].length = x - lastIndex;\n }\n\n lastIndex = x;\n lastPart = this._format[x];\n\n this._strictDatePartsIndexes[x] =\n {\n length: 0,\n part: this._format[x]\n };\n }\n }\n\n this._strictDatePartsIndexes[lastIndex].length = this._format.length - lastIndex;\n }\n }\n}"]}
1
+ {"version":3,"file":"datePositionParser.service.js","sourceRoot":"","sources":["../../../../src/services/datePositionParser/datePositionParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAIvC;;GAEG;AAEH,MAAM,OAAO,yBAAyB;IAElC,oEAAoE;IAEpE;;;OAGG;IACI,YAAY,CAAC,MAAc;QAE9B,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;8GAXQ,yBAAyB;kHAAzB,yBAAyB,cADb,MAAM;;2FAClB,yBAAyB;kBADrC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;AAehC;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAmBlC,iEAAiE;IACjE,YAAsB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAlBrC,sEAAsE;QAEtE;;WAEG;QACO,kBAAa,GAAY,KAAK,CAAC;QAEzC;;WAEG;QACO,sBAAiB,GAAa,EAAE,CAAC;QAE3C;;WAEG;QACO,4BAAuB,GAAsD,EAAE,CAAC;QAKtF,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED,2G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AG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;QACrF,CAAC;IACL,CAAC;CACJ","sourcesContent":["import {Injectable} from '@angular/core';\nimport {isBlank} from '@jscrpt/common';\n\nimport {DatePositionParser, DatePositionParserResult} from './datePositionParser.interface';\n\n/**\n * Service used for parsing date\n */\n@Injectable({providedIn: 'root'})\nexport class DatePositionParserService\n{\n //######################### public methods #########################\n\n /**\n * Creates parser instance for specified format\n * @param format - Format to be used for parsing date string\n */\n public createParser(format: string): DatePositionParser\n {\n return new DefaultDatePositionParser(format);\n }\n}\n\n/**\n * Default implementation of DatePositionParser\n */\nexport class DefaultDatePositionParser implements DatePositionParser\n{\n //######################### protected fields #########################\n\n /**\n * Indication whether format contains separators\n */\n protected _hasSeparator: boolean = false;\n\n /**\n * Array of date parts of parsed date format\n */\n protected _datePartsIndexes: string[] = [];\n\n /**\n * Object storing indexes for strict date parts of parsed date format\n */\n protected _strictDatePartsIndexes: {[index: number]: {part: string, length: number}} = {};\n\n //######################### constructor #########################\n constructor(protected _format: string)\n {\n this._initialize();\n }\n\n //######################### public methods - implementation of DatePositionParser #########################\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to next part, if it was last part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public next(date: string|null|undefined, cursorPosition: number): null|DatePositionParserResult\n {\n if(isBlank(date))\n {\n return null;\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n let useNext = false;\n\n // eslint-disable-next-line no-constant-condition\n while(true)\n {\n if(cursorPosition == date.length)\n {\n return null;\n }\n\n if(useNext && !isNaN(+date[cursorPosition]))\n {\n return this.parse(date, cursorPosition);\n }\n\n if(isNaN(+date[cursorPosition]))\n {\n useNext = true;\n }\n\n cursorPosition++;\n }\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition < index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Parse date as string and returns information about position and selected part of date, while moving it to previous part, if it was first part returns null\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public previous(date: string|null|undefined, cursorPosition: number): null|DatePositionParserResult\n {\n if(isBlank(date))\n {\n return null;\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n let useNext = false;\n\n // eslint-disable-next-line no-constant-condition\n while(true)\n {\n if(cursorPosition < 0)\n {\n return null;\n }\n\n if(useNext && !isNaN(+date[cursorPosition]))\n {\n return this.parse(date, cursorPosition);\n }\n\n if(isNaN(+date[cursorPosition]))\n {\n useNext = true;\n }\n\n cursorPosition--;\n }\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).reverse().map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition > index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return null;\n }\n\n /**\n * Parse date as string and returns information about positions and selected part of date\n * @param date - String date to be parsed\n * @param cursorPosition - Current cursor position\n */\n public parse(date: string|null|undefined, cursorPosition: number): DatePositionParserResult\n {\n if(isBlank(date))\n {\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n //non strict format\n if(this._hasSeparator)\n {\n //fix cursor position if is clicked on separator\n if(cursorPosition != date.length &&\n /[^0-9ɵ]/.test(date[cursorPosition]) &&\n /[^0-9ɵ]/.test(date[cursorPosition - 1]))\n {\n let breakCycle = false;\n cursorPosition++;\n\n while(/[^0-9ɵ]/.test(date[cursorPosition]))\n {\n if(cursorPosition >= date.length)\n {\n if(breakCycle)\n {\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n breakCycle = true;\n cursorPosition = 0;\n }\n\n cursorPosition++;\n }\n }\n\n const updateDate = [date.substr(0, cursorPosition), 'ɵ', date.substr(cursorPosition)].join('');\n const indexed = updateDate.replace(/[^0-9ɵ]/g, ' ').split(' ');\n let partIndex = 0;\n let startPosition = 0;\n let selectionLength = 0;\n\n for(const itm of indexed)\n {\n //this segment contains cursor\n if(itm.indexOf('ɵ') >= 0)\n {\n selectionLength = itm.length - 1;\n\n break;\n }\n\n startPosition++;\n\n //separator\n if(!itm.length)\n {\n continue;\n }\n\n partIndex++;\n startPosition += itm.length;\n }\n\n return {\n part: this._datePartsIndexes[partIndex],\n positionFrom: startPosition,\n positionTo: startPosition + selectionLength\n };\n }\n //strict format\n else\n {\n const indexes = Object.keys(this._strictDatePartsIndexes).reverse().map(itm => +itm);\n\n for(const index of indexes)\n {\n if(cursorPosition >= index)\n {\n return {\n part: this._strictDatePartsIndexes[index].part,\n positionFrom: index,\n positionTo: index + this._strictDatePartsIndexes[index].length\n };\n }\n }\n }\n\n return {\n part: '',\n positionFrom: 0,\n positionTo: 0\n };\n }\n\n /**\n * Initialize parser, process format\n */\n protected _initialize(): void\n {\n this._hasSeparator = /[^yqmwdhs]/i.test(this._format);\n\n //non strict format\n if(this._hasSeparator)\n {\n this._datePartsIndexes = this._format.replace(/[^yqmwdhs]+/gi, ' ')\n .split(' ')\n .filter(itm => !!itm)\n .map(itm => itm[0]);\n }\n //strict format\n else\n {\n let lastPart: string|null = null;\n let lastIndex: number = 0;\n\n for(let x = 0; x < this._format.length; x++)\n {\n //next part\n if(this._format[x] != lastPart)\n {\n if(x > 0)\n {\n this._strictDatePartsIndexes[lastIndex].length = x - lastIndex;\n }\n\n lastIndex = x;\n lastPart = this._format[x];\n\n this._strictDatePartsIndexes[x] =\n {\n length: 0,\n part: this._format[x]\n };\n }\n }\n\n this._strictDatePartsIndexes[lastIndex].length = this._format.length - lastIndex;\n }\n }\n}"]}