@anglr/datetime 5.0.0-beta.20221017112052 → 5.0.0-beta.20221018103539

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 (138) hide show
  1. package/changelog.md +46 -8
  2. package/es2015/src/index.js +0 -3
  3. package/es2015/src/index.js.map +1 -1
  4. package/es2015/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
  5. package/es2015/src/legacy/selector/components/inputDateTime/inputDateTime.component.js +4 -6
  6. package/es2015/src/legacy/selector/components/inputDateTime/inputDateTime.component.js.map +1 -1
  7. package/es2015/src/legacy/selector/components/selector/selector.component.js +2 -2
  8. package/es2015/src/legacy/selector/components/selector/selector.component.js.map +1 -1
  9. package/es2015/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +2 -2
  10. package/es2015/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +1 -1
  11. package/es2015/src/misc/enums.js +1 -1
  12. package/es2015/src/misc/enums.js.map +1 -1
  13. package/es2015/src/misc/types.js.map +1 -1
  14. package/es2015/src/misc/utils.js +10 -0
  15. package/es2015/src/misc/utils.js.map +1 -1
  16. package/es2015/src/misc/validators.js +79 -2
  17. package/es2015/src/misc/validators.js.map +1 -1
  18. package/es2015/src/modules/dateTime/directives/dateTimeBase.js +77 -0
  19. package/es2015/src/modules/dateTime/directives/dateTimeBase.js.map +1 -0
  20. package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +18 -59
  21. package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
  22. package/es2015/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +72 -0
  23. package/es2015/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -0
  24. package/es2015/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +71 -0
  25. package/es2015/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -0
  26. package/es2015/src/modules/dateTime/directives/dateTimeRestrictedBase.js +152 -0
  27. package/es2015/src/modules/dateTime/directives/dateTimeRestrictedBase.js.map +1 -0
  28. package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +17 -6
  29. package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
  30. package/es2015/src/modules/dateTime/directives/index.js +4 -0
  31. package/es2015/src/modules/dateTime/directives/index.js.map +1 -1
  32. package/es2015/src/modules/dateTime/modules/dateTime.module.js +9 -1
  33. package/es2015/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
  34. package/es2015/src/services/{datePositionParser.interface.js → datePositionParser/datePositionParser.interface.js} +0 -0
  35. package/es2015/src/services/datePositionParser/datePositionParser.interface.js.map +1 -0
  36. package/es2015/src/services/{datePositionParser.service.js → datePositionParser/datePositionParser.service.js} +0 -0
  37. package/es2015/src/services/datePositionParser/datePositionParser.service.js.map +1 -0
  38. package/es2015/src/services/{dateTimeRelativeParser.service.js → dateTimeRelativeParser/dateTimeRelativeParser.service.js} +8 -8
  39. package/es2015/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +1 -0
  40. package/es2015/src/services/{dateValueProvider.service.js → dateValueProvider/dateValueProvider.service.js} +1 -1
  41. package/es2015/src/services/dateValueProvider/dateValueProvider.service.js.map +1 -0
  42. package/es2015/src/services/index.js +4 -1
  43. package/es2015/src/services/index.js.map +1 -1
  44. package/es2020/src/index.js +0 -3
  45. package/es2020/src/index.js.map +1 -1
  46. package/es2020/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
  47. package/es2020/src/legacy/selector/components/inputDateTime/inputDateTime.component.js +4 -6
  48. package/es2020/src/legacy/selector/components/inputDateTime/inputDateTime.component.js.map +1 -1
  49. package/es2020/src/legacy/selector/components/selector/selector.component.js +2 -2
  50. package/es2020/src/legacy/selector/components/selector/selector.component.js.map +1 -1
  51. package/es2020/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +2 -2
  52. package/es2020/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +1 -1
  53. package/es2020/src/misc/enums.js +1 -1
  54. package/es2020/src/misc/enums.js.map +1 -1
  55. package/es2020/src/misc/types.js.map +1 -1
  56. package/es2020/src/misc/utils.js +10 -0
  57. package/es2020/src/misc/utils.js.map +1 -1
  58. package/es2020/src/misc/validators.js +79 -2
  59. package/es2020/src/misc/validators.js.map +1 -1
  60. package/es2020/src/modules/dateTime/directives/dateTimeBase.js +77 -0
  61. package/es2020/src/modules/dateTime/directives/dateTimeBase.js.map +1 -0
  62. package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +18 -59
  63. package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
  64. package/es2020/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +72 -0
  65. package/es2020/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -0
  66. package/es2020/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +71 -0
  67. package/es2020/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -0
  68. package/es2020/src/modules/dateTime/directives/dateTimeRestrictedBase.js +149 -0
  69. package/es2020/src/modules/dateTime/directives/dateTimeRestrictedBase.js.map +1 -0
  70. package/es2020/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +17 -6
  71. package/es2020/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
  72. package/es2020/src/modules/dateTime/directives/index.js +4 -0
  73. package/es2020/src/modules/dateTime/directives/index.js.map +1 -1
  74. package/es2020/src/modules/dateTime/modules/dateTime.module.js +9 -1
  75. package/es2020/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
  76. package/es2020/src/services/{datePositionParser.interface.js → datePositionParser/datePositionParser.interface.js} +0 -0
  77. package/es2020/src/services/datePositionParser/datePositionParser.interface.js.map +1 -0
  78. package/es2020/src/services/{datePositionParser.service.js → datePositionParser/datePositionParser.service.js} +0 -0
  79. package/es2020/src/services/datePositionParser/datePositionParser.service.js.map +1 -0
  80. package/es2020/src/services/{dateTimeRelativeParser.service.js → dateTimeRelativeParser/dateTimeRelativeParser.service.js} +8 -8
  81. package/es2020/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +1 -0
  82. package/es2020/src/services/{dateValueProvider.service.js → dateValueProvider/dateValueProvider.service.js} +1 -1
  83. package/es2020/src/services/dateValueProvider/dateValueProvider.service.js.map +1 -0
  84. package/es2020/src/services/index.js +4 -1
  85. package/es2020/src/services/index.js.map +1 -1
  86. package/package.json +1 -1
  87. package/src/index.d.ts +0 -3
  88. package/src/index.d.ts.map +1 -1
  89. package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts +14 -9
  90. package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts.map +1 -1
  91. package/src/legacy/selector/components/inputDateTime/inputDateTime.component.d.ts +1 -3
  92. package/src/legacy/selector/components/inputDateTime/inputDateTime.component.d.ts.map +1 -1
  93. package/src/legacy/selector/components/selector/selector.component.d.ts +1 -2
  94. package/src/legacy/selector/components/selector/selector.component.d.ts.map +1 -1
  95. package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts +1 -2
  96. package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts.map +1 -1
  97. package/src/misc/enums.d.ts +1 -1
  98. package/src/misc/types.d.ts +1 -1
  99. package/src/misc/types.d.ts.map +1 -1
  100. package/src/misc/utils.d.ts +5 -0
  101. package/src/misc/utils.d.ts.map +1 -1
  102. package/src/misc/validators.d.ts +17 -0
  103. package/src/misc/validators.d.ts.map +1 -1
  104. package/src/modules/dateTime/directives/dateTimeBase.d.ts +56 -0
  105. package/src/modules/dateTime/directives/dateTimeBase.d.ts.map +1 -0
  106. package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts +3 -39
  107. package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
  108. package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts +33 -0
  109. package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -0
  110. package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts +33 -0
  111. package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -0
  112. package/src/modules/dateTime/directives/dateTimeRestrictedBase.d.ts +74 -0
  113. package/src/modules/dateTime/directives/dateTimeRestrictedBase.d.ts.map +1 -0
  114. package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts +9 -2
  115. package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
  116. package/src/modules/dateTime/directives/index.d.ts +4 -0
  117. package/src/modules/dateTime/directives/index.d.ts.map +1 -1
  118. package/src/modules/dateTime/modules/dateTime.module.d.ts +4 -2
  119. package/src/modules/dateTime/modules/dateTime.module.d.ts.map +1 -1
  120. package/src/services/{datePositionParser.interface.d.ts → datePositionParser/datePositionParser.interface.d.ts} +0 -0
  121. package/src/services/{datePositionParser.interface.d.ts.map → datePositionParser/datePositionParser.interface.d.ts.map} +0 -0
  122. package/src/services/{datePositionParser.service.d.ts → datePositionParser/datePositionParser.service.d.ts} +0 -0
  123. package/src/services/{datePositionParser.service.d.ts.map → datePositionParser/datePositionParser.service.d.ts.map} +0 -0
  124. package/src/services/{dateTimeRelativeParser.service.d.ts → dateTimeRelativeParser/dateTimeRelativeParser.service.d.ts} +3 -3
  125. package/src/services/{dateTimeRelativeParser.service.d.ts.map → dateTimeRelativeParser/dateTimeRelativeParser.service.d.ts.map} +1 -1
  126. package/src/services/{dateValueProvider.service.d.ts → dateValueProvider/dateValueProvider.service.d.ts} +2 -2
  127. package/src/services/{dateValueProvider.service.d.ts.map → dateValueProvider/dateValueProvider.service.d.ts.map} +1 -1
  128. package/src/services/index.d.ts +4 -1
  129. package/src/services/index.d.ts.map +1 -1
  130. package/version.bak +1 -1
  131. package/es2015/src/services/datePositionParser.interface.js.map +0 -1
  132. package/es2015/src/services/datePositionParser.service.js.map +0 -1
  133. package/es2015/src/services/dateTimeRelativeParser.service.js.map +0 -1
  134. package/es2015/src/services/dateValueProvider.service.js.map +0 -1
  135. package/es2020/src/services/datePositionParser.interface.js.map +0 -1
  136. package/es2020/src/services/datePositionParser.service.js.map +0 -1
  137. package/es2020/src/services/dateTimeRelativeParser.service.js.map +0 -1
  138. package/es2020/src/services/dateValueProvider.service.js.map +0 -1
package/changelog.md CHANGED
@@ -1,33 +1,50 @@
1
1
  # Changelog
2
2
 
3
- ## Version 5.0.0 (2022-10-17)
3
+ ## Version 5.0.0 (2022-10-18)
4
4
 
5
5
  ### Features
6
6
 
7
+ - new `DateTimeInputValue` interface, which defines date time input value API
8
+ - **properties**
9
+ - `value` current value of date time, could be string, unix timestamp, Date, TDate object, or ranged DateTimeValue
10
+ - `valueChange` occurs when value changes
7
11
  - new `DateTimeInput` interface, which defines date time input and communication API for it
12
+ - **extends**
13
+ - `DateTimeInputValue`
8
14
  - **properties**
9
15
  - `rawValue` value of date time, raw string value which is visible to user
10
- - `value` current value of date time, could be string, TDate object, or ranged DateTimeValue
11
16
  - `disabled` indication whether is date time disabled
12
- - `valueChange` occurs when value changes
13
17
  - `focus` occurs when input gains focus
14
18
  - `blur` occurs when input loses focus
15
19
  - new `DateTimeModule` module for basic date time directives, components, pipes
16
20
  - **exports**
17
21
  - `DateTimeControlValueAccessorDirective`
18
22
  - `DateTimeInputDirective`
23
+ - `DateTimeMaxValidatorDirective`
24
+ - `DateTimeMinValidatorDirective`
19
25
  - `DateTimeValidatorDirective`
20
26
  - new `DATE_TIME_INPUT` injection token, that is used for injecting type that represents date time input
27
+ - new `DateTimeBase` class, that is base class for date time directives, contains basic shared data
28
+ - **implements**
29
+ - `DateTimeInputValue`
30
+ - **inputs**
31
+ - `valueFormat` gets or sets date time value format which is being worked with in this date time
32
+ - `format` gets or sets format of string representation of date
33
+ - `customFormat` custom format string representation of date
34
+ - new `DateTimeRestrictedBase` class, that is base class for date time directives with value restrictions
35
+ - **extends** `DateTimeBase`
36
+ - **implements**
37
+ - `OnDestroy`
38
+ - **inputs**
39
+ - `maxDateTime` gets or sets max allowed date for date time
40
+ - `minDateTime` gets or sets min allowed date for date time
21
41
  - new `DateTimeInputDirective` directive, that is used for setting up date time input
42
+ - **extends** `DateTimeBase`
22
43
  - **implements**
23
44
  - `DateTimeInput`
24
45
  - `OnDestroy`
25
46
  - **provides**
26
47
  - `DATE_TIME_INPUT` providing self
27
- - **inputs**
28
- - `valueFormat` gets or sets date time value format which is being worked with in this date time
29
- - `format` gets or sets format of string representation of date
30
- - `customFormat` custom format string representation of date
31
48
  - new `DateTimeControlValueAccessorDirective` directive, that is control value accessor that is used for getting and setting value for date time
32
49
  - **implements**
33
50
  - `ControlValueAccessor`
@@ -35,13 +52,29 @@
35
52
  - **provides**
36
53
  - `NG_VALUE_ACCESSOR` providing self
37
54
  - new `DateTimeValidatorDirective` directive, that applies validator for date time
55
+ - **extends** `DateTimeBase`
56
+ - **implements**
57
+ - `Validator`
58
+ - `OnInit`
59
+ - **provides**
60
+ - `NG_VALIDATORS` providing self
61
+ - new `DateTimeMaxValidatorDirective` directive, that applies validator for date time max value
62
+ - **extends** `DateTimeRestrictedBase`
63
+ - **implements**
64
+ - `Validator`
65
+ - `OnInit`
66
+ - **provides**
67
+ - `NG_VALIDATORS` providing self
68
+ - new `DateTimeMinValidatorDirective` directive, that applies validator for date time min value
69
+ - **extends** `DateTimeRestrictedBase`
38
70
  - **implements**
39
71
  - `Validator`
72
+ - `OnInit`
40
73
  - **provides**
41
74
  - `NG_VALIDATORS` providing self
42
75
  - new `DateTimeValueFormat` enum, that represents available formats for date time value
43
76
  - `DateInstance` instance of date
44
- - `UnixTimestamp` numeric unix timestamp in seconds
77
+ - `UnixTimestamp` numeric unix timestamp in miliseconds
45
78
  - `FormattedString` formatted date as string value
46
79
  - `RangeOfDateInstances` range of date instances from, to
47
80
  - new `DateTimeObjectValue` type that represents parsed date value or values in case of range
@@ -49,7 +82,10 @@
49
82
  - new `parseDateTime` function, that parses date time input output value
50
83
  - new `formatDateTime` function, that formats value into specified format of date time
51
84
  - new `isDateTimeValue` function, that tests whether value is `DateTimeValue`
85
+ - new `getSingleDateTimeValue` function, that gets single date time value, use in places where ranged date time can not be used
52
86
  - new `datetimeValidator` function, that is date time validator factory function, creates validator for checking validity of datetime
87
+ - new `datetimeMaxValidator` function, that is date time validator factory function, creates validator for checking validity of datetime max value
88
+ - new `datetimeMinValidator` function, that is date time validator factory function, creates validator for checking validity of datetime min value
53
89
  - updated `DateApiObject` interface
54
90
  - new `unixTimestamp` method, that gets value of date time as unix timestamp
55
91
  - *subpackage* `@anglr/datetime/moment`
@@ -74,6 +110,8 @@
74
110
  - updated `DateTimeValue` interface
75
111
  - `from` can now also be `undefined` or `null`
76
112
  - `to` can now also be `undefined` or `null`
113
+ - updated `DateTimeRelativeParser` service
114
+ - now `m` means minutes and `M` means months
77
115
 
78
116
  ## Version 4.0.0 (2022-10-14)
79
117
 
@@ -15,9 +15,6 @@ export * from './misc/utils';
15
15
  export * from './misc/validators';
16
16
  export * from './modules';
17
17
  export * from './services';
18
- export * from './services/datePositionParser.service';
19
- export * from './services/dateTimeRelativeParser.service';
20
- export * from './services/dateValueProvider.service';
21
18
  export * from './pipes/dateConvert.pipe';
22
19
  export * from './pipes/dateFormat.pipe';
23
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,uCAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './interfaces';\nexport * from './legacy/picker/directives';\nexport * from './legacy/picker/interfaces';\nexport * from './legacy/picker/modules/picker.module';\nexport * from './legacy/picker/types';\nexport * from './legacy/selector/interfaces';\nexport * from './legacy/selector/modules/basicSelector.module';\nexport * from './legacy/selector/modules/selector.module';\nexport * from './legacy/selector/types';\nexport * from './misc/constants';\nexport * from './misc/enums';\nexport * from './misc/tokens';\nexport * from './misc/types';\nexport * from './misc/utils';\nexport * from './misc/validators';\nexport * from './modules';\nexport * from './services';\nexport * from './services/datePositionParser.service';\nexport * from './services/dateTimeRelativeParser.service';\nexport * from './services/dateValueProvider.service';\nexport * from './pipes/dateConvert.pipe';\nexport * from './pipes/dateFormat.pipe';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './interfaces';\nexport * from './legacy/picker/directives';\nexport * from './legacy/picker/interfaces';\nexport * from './legacy/picker/modules/picker.module';\nexport * from './legacy/picker/types';\nexport * from './legacy/selector/interfaces';\nexport * from './legacy/selector/modules/basicSelector.module';\nexport * from './legacy/selector/modules/selector.module';\nexport * from './legacy/selector/types';\nexport * from './misc/constants';\nexport * from './misc/enums';\nexport * from './misc/tokens';\nexport * from './misc/types';\nexport * from './misc/utils';\nexport * from './misc/validators';\nexport * from './modules';\nexport * from './services';\nexport * from './pipes/dateConvert.pipe';\nexport * from './pipes/dateFormat.pipe';"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dateTimeInput.interface.js","sourceRoot":"","sources":["../../../../src/interfaces/dateTimeInput/dateTimeInput.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {EventEmitter} from '@angular/core';\n\nimport {DateTimeInputOutputValue} from '../../misc/types';\n\n/**\n * Defines date time input and communication API for it\n */\nexport interface DateTimeInput<TDate = unknown>\n{\n /**\n * Value of date time, raw string value which is visible to user\n */\n rawValue: string|undefined|null;\n\n /**\n * Current value of date time, could be string, TDate object, or ranged DateTimeValue\n */\n value: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Indication whether is date time disabled\n */\n disabled: boolean;\n\n /**\n * Occurs when value changes\n */\n valueChange: EventEmitter<void>;\n\n /**\n * Occurs when input gains focus\n */\n focus: EventEmitter<FocusEvent>;\n\n /**\n * Occurs when input loses focus\n */\n blur: EventEmitter<FocusEvent>;\n}"]}
1
+ {"version":3,"file":"dateTimeInput.interface.js","sourceRoot":"","sources":["../../../../src/interfaces/dateTimeInput/dateTimeInput.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {EventEmitter} from '@angular/core';\n\nimport {DateTimeInputOutputValue} from '../../misc/types';\n\n/**\n * Defines date time input value API\n */\nexport interface DateTimeInputValue<TDate = unknown>\n{\n /**\n * Current value of date time, could be string, unix timestamp, Date, TDate object, or ranged DateTimeValue\n */\n value: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Occurs when value changes\n */\n valueChange: EventEmitter<void>;\n}\n/**\n * Defines date time input and communication API for it\n */\nexport interface DateTimeInput<TDate = unknown> extends DateTimeInputValue<TDate>\n{\n /**\n * Value of date time, raw string value which is visible to user\n */\n rawValue: string|undefined|null;\n\n /**\n * Indication whether is date time disabled\n */\n disabled: boolean;\n\n /**\n * Occurs when input gains focus\n */\n focus: EventEmitter<FocusEvent>;\n\n /**\n * Occurs when input loses focus\n */\n blur: EventEmitter<FocusEvent>;\n}"]}
@@ -2,11 +2,9 @@ import { Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementR
2
2
  import { isPresent } from '@jscrpt/common';
3
3
  import { Subject } from 'rxjs';
4
4
  import { DATE_API } from '../../../../misc/tokens';
5
- import { DatePositionParserService } from '../../../../services/datePositionParser.service';
6
- import { DateValueProvider } from '../../../../services/dateValueProvider.service';
5
+ import { DatePositionParserService, DateValueProvider } from '../../../../services';
7
6
  import * as i0 from "@angular/core";
8
- import * as i1 from "../../../../services/datePositionParser.service";
9
- import * as i2 from "../../../../services/dateValueProvider.service";
7
+ import * as i1 from "../../../../services";
10
8
  /**
11
9
  * Component used as datetime selector with input
12
10
  */
@@ -424,7 +422,7 @@ export class InputDateTimeSelectorComponent {
424
422
  }
425
423
  }
426
424
  }
427
- InputDateTimeSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: InputDateTimeSelectorComponent, deps: [{ token: DATE_API }, { token: i1.DatePositionParserService }, { token: i2.DateValueProvider }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
425
+ InputDateTimeSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: InputDateTimeSelectorComponent, deps: [{ token: DATE_API }, { token: i1.DatePositionParserService }, { token: i1.DateValueProvider }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
428
426
  InputDateTimeSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: InputDateTimeSelectorComponent, selector: "input-date-time-selector", viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<input type=\"text\"\r\n #input\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"handleBlur()\"\r\n (input)=\"handleInput()\"\r\n (click)=\"handleClick()\"\r\n (select)=\"handleSelect()\"\r\n (keydown)=\"handleKeyboard($any($event))\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder ?? ''\">", styles: [":host\r\n{\r\n display: block;\r\n}\r\n\r\ninput\r\n{\r\n width: 100%;\r\n}"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
429
427
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: InputDateTimeSelectorComponent, decorators: [{
430
428
  type: Component,
@@ -432,7 +430,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
432
430
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
433
431
  type: Inject,
434
432
  args: [DATE_API]
435
- }] }, { type: i1.DatePositionParserService }, { type: i2.DateValueProvider }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { inputElement: [{
433
+ }] }, { type: i1.DatePositionParserService }, { type: i1.DateValueProvider }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { inputElement: [{
436
434
  type: ViewChild,
437
435
  args: ['input', { static: true }]
438
436
  }] } });
@@ -1 +1 @@
1
- {"version":3,"file":"inputDateTime.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/selector/components/inputDateTime/inputDateTime.component.ts","../../../../../../src/legacy/selector/components/inputDateTime/inputDateTime.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACnH,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAGzC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAC,yBAAyB,EAAC,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAC,iBAAiB,EAAC,MAAM,gDAAgD,CAAC;;;;AAGjF;;GAEG;AAQH,MAAM,OAAO,8BAA8B;IAmLvC,iEAAiE;IACjE,YAAwC,QAAwB,EAC1C,UAAqC,EACrC,cAAwC,EACxC,eAAkC;QAHhB,aAAQ,GAAR,QAAQ,CAAgB;QAC1C,eAAU,GAAV,UAAU,CAA2B;QACrC,mBAAc,GAAd,cAAc,CAA0B;QACxC,oBAAe,GAAf,eAAe,CAAmB;QArLxD,sEAAsE;QAEtE;;WAEG;QACO,iBAAY,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAE5D;;WAEG;QACO,aAAQ,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAExD;;WAEG;QACO,mBAAc,GAAqB,IAAI,OAAO,EAAW,CAAC;QAEpE;;WAEG;QACO,YAAO,GAA4B,IAAI,CAAC;QAElD;;WAEG;QACO,YAAO,GAAW,EAAE,CAAC;QAE/B;;WAEG;QACO,kBAAa,GAA8B,IAAI,CAAC;QAE1D;;WAEG;QACO,aAAQ,GAAY,IAAI,CAAC;QAEnC;;WAEG;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,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;oBAErH,MAAM;iBACT;YACD,KAAK,GAAG;gBACR;oBACI,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;oBAEzH,MAAM;iBACT;SACJ;IACL,CAAC;;2HA5iBQ,8BAA8B,kBAoLnB,QAAQ;+GApLnB,8BAA8B,qLCrB3C,iWASyC;2FDY5B,8BAA8B;kBAP1C,SAAS;+BAEI,0BAA0B,mBAGnB,uBAAuB,CAAC,MAAM;;0BAsLlC,MAAM;2BAAC,QAAQ;oJA5BrB,YAAY;sBADlB,SAAS;uBAAC,OAAO,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementRef, ViewChild} from '@angular/core';\nimport {isPresent} from '@jscrpt/common';\nimport {Observable, Subject} from 'rxjs';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject, DatePositionParser} from '../../../../services';\nimport {DatePositionParserService} from '../../../../services/datePositionParser.service';\nimport {DateValueProvider} from '../../../../services/dateValueProvider.service';\nimport {DateTimeSelector} from '../../misc/datetimeSelector.interface';\n\n/**\n * Component used as datetime selector with input\n */\n@Component(\n{\n selector: 'input-date-time-selector',\n templateUrl: 'inputDateTime.component.html',\n styleUrls: ['inputDateTime.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class InputDateTimeSelectorComponent<TDate = any> implements DateTimeSelector<TDate>\n{\n //######################### protected fields #########################\n\n /**\n * Occurs when value changes\n */\n protected _valueChange: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector is touched by user\n */\n protected _touched: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector requires picker to be displayed or hidden\n */\n protected _pickerRequest: Subject<boolean> = new Subject<boolean>();\n\n /**\n * Instance of parser created for specific format\n */\n protected _parser: DatePositionParser|null = null;\n\n /**\n * Currently used format for displaying data\n */\n protected _format: string = '';\n\n /**\n * Current value representation as date api wrapper\n */\n protected _dateApiValue: null|DateApiObject<TDate> = null;\n\n /**\n * Indication whether is current value valid value\n */\n protected _isValid: boolean = true;\n\n /**\n * Minimal possible value that can be picked\n */\n protected _minValue: TDate|null = null;\n\n /**\n * Maximal possible value that can be picked\n */\n protected _maxValue: TDate|null = null;\n\n //######################### public properties - implementation of DateTimeSelector #########################\n\n /**\n * Gets or sets currently used format for displaying data\n */\n public get format(): string\n {\n return this._format;\n }\n public set format(value: string)\n {\n if(isPresent(value))\n {\n value = this._dateApi.getFormat(value);\n }\n\n //only if format changes\n if(this._format != value)\n {\n this._parser = this._parserSvc.createParser(this._dateApi.getFormat(value));\n }\n\n this._format = value;\n }\n\n /**\n * Gets or sets placeholder that is displayed when there is no value selected\n */\n public placeholder: string|null = null;\n\n /**\n * Gets current value of datetime\n */\n public get value(): DateTimeValue<TDate>|null\n {\n if(!this._dateApiValue || !this._isValid)\n {\n return null;\n }\n\n return this._valueProvider.getValue(this._dateApiValue.value, this._format);\n }\n\n /**\n * Gets formatted value\n */\n public get formattedValue(): string|null\n {\n if(!this._isValid)\n {\n return null;\n }\n\n return this.currentValue;\n }\n\n /**\n * Gets indication whether is current value valid\n */\n public get valid(): boolean\n {\n return this._isValid;\n }\n\n /**\n * Occurs when value changes\n */\n public get valueChange(): Observable<void>\n {\n return this._valueChange.asObservable();\n }\n\n /**\n * Occurs when selector is touched by user\n */\n public get touched(): Observable<void>\n {\n return this._touched.asObservable();\n }\n\n /**\n * Occurs when selector requires picker to be displayed\n */\n public get pickerRequest(): Observable<boolean>\n {\n return this._pickerRequest.asObservable();\n }\n\n //######################### public properties - template bindings #########################\n\n /**\n * Indication whether is input disabled\n * @internal\n */\n public disabled: boolean = false;\n\n //######################### public properties - children #########################\n\n /**\n * Instance of html input element\n * @internal\n */\n @ViewChild('input', {static: true})\n public inputElement!: ElementRef<HTMLInputElement>;\n\n //######################### protected properties #########################\n\n /**\n * Gets or sets string representation current of value\n */\n protected get currentValue(): string|null\n {\n return this.input.value || null;\n }\n protected set currentValue(value: string|null)\n {\n if(this.input)\n {\n this.input.value = value ?? '';\n }\n }\n\n /**\n * Gets input element used for handling date time value\n */\n protected get input(): HTMLInputElement\n {\n return this.inputElement.nativeElement;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>,\n protected _parserSvc: DatePositionParserService,\n protected _valueProvider: DateValueProvider<TDate>,\n protected _changeDetector: ChangeDetectorRef)\n {\n }\n\n //######################### public methods - implementation of DateTimeSelector #########################\n\n /**\n * Sets minimal possible value for picker, that can be picked\n * @param value - Minimal possible value that can be picked\n */\n public setMinValue(value: TDate|null): void\n {\n this._minValue = value;\n }\n\n /**\n * Sets maximal possible value for picker, that can be picked\n * @param value - Maximal possible value that can be picked\n */\n public setMaxValue(value: TDate|null): void\n {\n this._maxValue = value;\n }\n\n /**\n * Sets value of datetime selector\n * @param value - Value to be set to this selector\n */\n public setValue(value: DateTimeValue<TDate>|null): void\n {\n if(value?.from)\n {\n this._dateApiValue = this._dateApi.getValue(value?.from, this._format);\n this._isValid = this._dateApiValue.isValid();\n \n this._show();\n }\n else\n {\n this._clearValue();\n }\n }\n\n /**\n * Sets as 'control' disabled\n * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true\n */\n public setDisabled(disabled: boolean = true): void\n {\n this.disabled = disabled;\n }\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n public invalidateVisuals(): void\n {\n this._changeDetector.detectChanges();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Handles gaining of focus\n * @internal\n */\n public handleFocus(): void\n {\n this._pickerRequest.next(true);\n\n //no value\n if(!this._dateApiValue)\n {\n this._dateApiValue = this._dateApi.now();\n this._isValid = this._dateApiValue.isValid();\n\n if(this._minMaxConstraintTest())\n {\n this._clearValue();\n }\n else\n {\n this._valueChange.next();\n }\n }\n\n if(!this._isValid)\n {\n return;\n }\n\n this._show();\n\n const result = this._parser!.parse(this.currentValue!, this.input.selectionStart!);\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n\n /**\n * Handles blur on input\n * @internal\n */\n public handleBlur(): void\n {\n this._pickerRequest.next(false);\n }\n\n /**\n * Handles user input\n * @internal\n */\n public handleInput(): void\n {\n //empty value\n if(!this.currentValue)\n {\n this._clearValue();\n this._valueChange.next();\n\n return;\n }\n\n this._dateApiValue = this._dateApi.getValue(this.currentValue, this._format);\n this._isValid = this._dateApiValue.isValid();\n this._valueChange.next();\n }\n\n /**\n * Handles selection of text inside of input\n * @internal\n */\n public handleSelect(): void\n {\n //handles when all text is selected\n if(this.currentValue && this.input.selectionStart == 0 && this.input.selectionEnd == this.input.value.length)\n {\n const result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n }\n\n /**\n * Handles click event inside of input\n * @internal\n */\n public handleClick(): void\n {\n this._pickerRequest.next(true);\n\n if(!this._dateApiValue)\n {\n return;\n }\n\n const result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n * @param input - Html input element that holds current value and selection\n * @internal\n */\n public handleKeyboard(event: KeyboardEvent): void\n {\n if(!this._dateApiValue?.isValid())\n {\n return;\n }\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n const result = event.key == 'ArrowLeft' ? this._parser!.previous(this.input.value, this.input.selectionStart!) : this._parser!.next(this.input.value, this.input.selectionStart!);\n\n if(result)\n {\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n let result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n const selectionStart = result.positionFrom;\n\n this._stepChangeValue(result.part, event.key == 'ArrowUp');\n this._show();\n\n result = this._parser!.parse(this.input.value, selectionStart);\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n\n break;\n }\n case 'Tab':\n {\n const result = event.shiftKey ? this._parser!.previous(this.input.value, this.input.selectionStart!) : this._parser!.next(this.input.value, this.input.selectionStart!);\n\n if(result)\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n\n break;\n }\n case 'a':\n {\n if(event.ctrlKey)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n\n break;\n }\n case 'Backspace':\n {\n this._clearValue();\n this._valueChange.next();\n\n break;\n }\n case 'Escape':\n {\n this._pickerRequest.next(false);\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this._pickerRequest.next(true);\n }\n\n break;\n }\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows current value in input\n */\n protected _show(): void\n {\n if(this._isValid)\n {\n this.currentValue = this._dateApiValue?.format(this._format) ?? null;\n }\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n */\n protected _minMaxConstraintTest(): boolean\n {\n return (!!this._minValue && this._dateApiValue!.isBefore(this._minValue)) ||\n (!!this._maxValue && this._dateApiValue!.isAfter(this._maxValue));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param code - Code that should be executed which can change current value\n */\n protected _withMinMaxConstraint(code: () => void): void\n {\n this._dateApiValue!.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this._minMaxConstraintTest())\n {\n this._dateApiValue?.resetOriginal();\n\n return;\n }\n\n this._valueChange.next();\n }\n\n /**\n * Clears current value\n */\n protected _clearValue(): void\n {\n this._dateApiValue = null;\n this._isValid = true;\n this.currentValue = null;\n }\n\n /**\n * Changes current value of date for for specified part by single step\n * @param part - Part of date that should be changed\n * @param increment - Indication whether value should be incremented or decremented\n */\n protected _stepChangeValue(part: string, increment: boolean): void\n {\n if(!this._dateApiValue?.isValid())\n {\n return;\n }\n\n switch(part)\n {\n case 'y':\n case 'Y':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addYears(1) : this._dateApiValue!.subtractYears(1));\n\n break;\n }\n case 'Q':\n {\n break;\n }\n case 'M':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addMonths(1) : this._dateApiValue!.subtractMonths(1));\n\n break;\n }\n case 'w':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addWeeks(1) : this._dateApiValue!.subtractWeeks(1));\n\n break;\n }\n case 'd':\n case 'D':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addDays(1) : this._dateApiValue!.subtractDays(1));\n\n break;\n }\n case 'H':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addHours(1) : this._dateApiValue!.subtractHours(1));\n\n break;\n }\n case 'm':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addMinutes(1) : this._dateApiValue!.subtractMinutes(1));\n\n break;\n }\n }\n }\n}","<input type=\"text\"\r\n #input\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"handleBlur()\"\r\n (input)=\"handleInput()\"\r\n (click)=\"handleClick()\"\r\n (select)=\"handleSelect()\"\r\n (keydown)=\"handleKeyboard($any($event))\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder ?? ''\">"]}
1
+ {"version":3,"file":"inputDateTime.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/selector/components/inputDateTime/inputDateTime.component.ts","../../../../../../src/legacy/selector/components/inputDateTime/inputDateTime.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACnH,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAGzC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAA6C,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;;;AAG9H;;GAEG;AAQH,MAAM,OAAO,8BAA8B;IAmLvC,iEAAiE;IACjE,YAAwC,QAAwB,EAC1C,UAAqC,EACrC,cAAwC,EACxC,eAAkC;QAHhB,aAAQ,GAAR,QAAQ,CAAgB;QAC1C,eAAU,GAAV,UAAU,CAA2B;QACrC,mBAAc,GAAd,cAAc,CAA0B;QACxC,oBAAe,GAAf,eAAe,CAAmB;QArLxD,sEAAsE;QAEtE;;WAEG;QACO,iBAAY,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAE5D;;WAEG;QACO,aAAQ,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAExD;;WAEG;QACO,mBAAc,GAAqB,IAAI,OAAO,EAAW,CAAC;QAEpE;;WAEG;QACO,YAAO,GAA4B,IAAI,CAAC;QAElD;;WAEG;QACO,YAAO,GAAW,EAAE,CAAC;QAE/B;;WAEG;QACO,kBAAa,GAA8B,IAAI,CAAC;QAE1D;;WAEG;QACO,aAAQ,GAAY,IAAI,CAAC;QAEnC;;WAEG;QACO,cAAS,GAAe,IAAI,CAAC;QAEvC;;WAEG;QACO,cAAS,GAAe,IAAI,CAAC;QA2BvC;;WAEG;QACI,gBAAW,GAAgB,IAAI,CAAC;QA4DvC,2FAA2F;QAE3F;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AC,CAAC,CAAC,CAAC,CAAC;oBAErH,MAAM;iBACT;YACD,KAAK,GAAG;gBACR;oBACI,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;oBAEzH,MAAM;iBACT;SACJ;IACL,CAAC;;2HA5iBQ,8BAA8B,kBAoLnB,QAAQ;+GApLnB,8BAA8B,qLCnB3C,iWASyC;2FDU5B,8BAA8B;kBAP1C,SAAS;+BAEI,0BAA0B,mBAGnB,uBAAuB,CAAC,MAAM;;0BAsLlC,MAAM;2BAAC,QAAQ;oJA5BrB,YAAY;sBADlB,SAAS;uBAAC,OAAO,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementRef, ViewChild} from '@angular/core';\nimport {isPresent} from '@jscrpt/common';\nimport {Observable, Subject} from 'rxjs';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject, DatePositionParser, DatePositionParserService, DateValueProvider} from '../../../../services';\nimport {DateTimeSelector} from '../../misc/datetimeSelector.interface';\n\n/**\n * Component used as datetime selector with input\n */\n@Component(\n{\n selector: 'input-date-time-selector',\n templateUrl: 'inputDateTime.component.html',\n styleUrls: ['inputDateTime.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class InputDateTimeSelectorComponent<TDate = any> implements DateTimeSelector<TDate>\n{\n //######################### protected fields #########################\n\n /**\n * Occurs when value changes\n */\n protected _valueChange: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector is touched by user\n */\n protected _touched: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector requires picker to be displayed or hidden\n */\n protected _pickerRequest: Subject<boolean> = new Subject<boolean>();\n\n /**\n * Instance of parser created for specific format\n */\n protected _parser: DatePositionParser|null = null;\n\n /**\n * Currently used format for displaying data\n */\n protected _format: string = '';\n\n /**\n * Current value representation as date api wrapper\n */\n protected _dateApiValue: null|DateApiObject<TDate> = null;\n\n /**\n * Indication whether is current value valid value\n */\n protected _isValid: boolean = true;\n\n /**\n * Minimal possible value that can be picked\n */\n protected _minValue: TDate|null = null;\n\n /**\n * Maximal possible value that can be picked\n */\n protected _maxValue: TDate|null = null;\n\n //######################### public properties - implementation of DateTimeSelector #########################\n\n /**\n * Gets or sets currently used format for displaying data\n */\n public get format(): string\n {\n return this._format;\n }\n public set format(value: string)\n {\n if(isPresent(value))\n {\n value = this._dateApi.getFormat(value);\n }\n\n //only if format changes\n if(this._format != value)\n {\n this._parser = this._parserSvc.createParser(this._dateApi.getFormat(value));\n }\n\n this._format = value;\n }\n\n /**\n * Gets or sets placeholder that is displayed when there is no value selected\n */\n public placeholder: string|null = null;\n\n /**\n * Gets current value of datetime\n */\n public get value(): DateTimeValue<TDate>|null\n {\n if(!this._dateApiValue || !this._isValid)\n {\n return null;\n }\n\n return this._valueProvider.getValue(this._dateApiValue.value, this._format);\n }\n\n /**\n * Gets formatted value\n */\n public get formattedValue(): string|null\n {\n if(!this._isValid)\n {\n return null;\n }\n\n return this.currentValue;\n }\n\n /**\n * Gets indication whether is current value valid\n */\n public get valid(): boolean\n {\n return this._isValid;\n }\n\n /**\n * Occurs when value changes\n */\n public get valueChange(): Observable<void>\n {\n return this._valueChange.asObservable();\n }\n\n /**\n * Occurs when selector is touched by user\n */\n public get touched(): Observable<void>\n {\n return this._touched.asObservable();\n }\n\n /**\n * Occurs when selector requires picker to be displayed\n */\n public get pickerRequest(): Observable<boolean>\n {\n return this._pickerRequest.asObservable();\n }\n\n //######################### public properties - template bindings #########################\n\n /**\n * Indication whether is input disabled\n * @internal\n */\n public disabled: boolean = false;\n\n //######################### public properties - children #########################\n\n /**\n * Instance of html input element\n * @internal\n */\n @ViewChild('input', {static: true})\n public inputElement!: ElementRef<HTMLInputElement>;\n\n //######################### protected properties #########################\n\n /**\n * Gets or sets string representation current of value\n */\n protected get currentValue(): string|null\n {\n return this.input.value || null;\n }\n protected set currentValue(value: string|null)\n {\n if(this.input)\n {\n this.input.value = value ?? '';\n }\n }\n\n /**\n * Gets input element used for handling date time value\n */\n protected get input(): HTMLInputElement\n {\n return this.inputElement.nativeElement;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>,\n protected _parserSvc: DatePositionParserService,\n protected _valueProvider: DateValueProvider<TDate>,\n protected _changeDetector: ChangeDetectorRef)\n {\n }\n\n //######################### public methods - implementation of DateTimeSelector #########################\n\n /**\n * Sets minimal possible value for picker, that can be picked\n * @param value - Minimal possible value that can be picked\n */\n public setMinValue(value: TDate|null): void\n {\n this._minValue = value;\n }\n\n /**\n * Sets maximal possible value for picker, that can be picked\n * @param value - Maximal possible value that can be picked\n */\n public setMaxValue(value: TDate|null): void\n {\n this._maxValue = value;\n }\n\n /**\n * Sets value of datetime selector\n * @param value - Value to be set to this selector\n */\n public setValue(value: DateTimeValue<TDate>|null): void\n {\n if(value?.from)\n {\n this._dateApiValue = this._dateApi.getValue(value?.from, this._format);\n this._isValid = this._dateApiValue.isValid();\n \n this._show();\n }\n else\n {\n this._clearValue();\n }\n }\n\n /**\n * Sets as 'control' disabled\n * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true\n */\n public setDisabled(disabled: boolean = true): void\n {\n this.disabled = disabled;\n }\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n public invalidateVisuals(): void\n {\n this._changeDetector.detectChanges();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Handles gaining of focus\n * @internal\n */\n public handleFocus(): void\n {\n this._pickerRequest.next(true);\n\n //no value\n if(!this._dateApiValue)\n {\n this._dateApiValue = this._dateApi.now();\n this._isValid = this._dateApiValue.isValid();\n\n if(this._minMaxConstraintTest())\n {\n this._clearValue();\n }\n else\n {\n this._valueChange.next();\n }\n }\n\n if(!this._isValid)\n {\n return;\n }\n\n this._show();\n\n const result = this._parser!.parse(this.currentValue!, this.input.selectionStart!);\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n\n /**\n * Handles blur on input\n * @internal\n */\n public handleBlur(): void\n {\n this._pickerRequest.next(false);\n }\n\n /**\n * Handles user input\n * @internal\n */\n public handleInput(): void\n {\n //empty value\n if(!this.currentValue)\n {\n this._clearValue();\n this._valueChange.next();\n\n return;\n }\n\n this._dateApiValue = this._dateApi.getValue(this.currentValue, this._format);\n this._isValid = this._dateApiValue.isValid();\n this._valueChange.next();\n }\n\n /**\n * Handles selection of text inside of input\n * @internal\n */\n public handleSelect(): void\n {\n //handles when all text is selected\n if(this.currentValue && this.input.selectionStart == 0 && this.input.selectionEnd == this.input.value.length)\n {\n const result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n }\n\n /**\n * Handles click event inside of input\n * @internal\n */\n public handleClick(): void\n {\n this._pickerRequest.next(true);\n\n if(!this._dateApiValue)\n {\n return;\n }\n\n const result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n * @param input - Html input element that holds current value and selection\n * @internal\n */\n public handleKeyboard(event: KeyboardEvent): void\n {\n if(!this._dateApiValue?.isValid())\n {\n return;\n }\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n const result = event.key == 'ArrowLeft' ? this._parser!.previous(this.input.value, this.input.selectionStart!) : this._parser!.next(this.input.value, this.input.selectionStart!);\n\n if(result)\n {\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n let result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n const selectionStart = result.positionFrom;\n\n this._stepChangeValue(result.part, event.key == 'ArrowUp');\n this._show();\n\n result = this._parser!.parse(this.input.value, selectionStart);\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n\n break;\n }\n case 'Tab':\n {\n const result = event.shiftKey ? this._parser!.previous(this.input.value, this.input.selectionStart!) : this._parser!.next(this.input.value, this.input.selectionStart!);\n\n if(result)\n {\n event.preventDefault();\n event.stopPropagation();\n\n this.input.selectionStart = result.positionFrom;\n this.input.selectionEnd = result.positionTo;\n }\n\n break;\n }\n case 'a':\n {\n if(event.ctrlKey)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n\n break;\n }\n case 'Backspace':\n {\n this._clearValue();\n this._valueChange.next();\n\n break;\n }\n case 'Escape':\n {\n this._pickerRequest.next(false);\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this._pickerRequest.next(true);\n }\n\n break;\n }\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows current value in input\n */\n protected _show(): void\n {\n if(this._isValid)\n {\n this.currentValue = this._dateApiValue?.format(this._format) ?? null;\n }\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n */\n protected _minMaxConstraintTest(): boolean\n {\n return (!!this._minValue && this._dateApiValue!.isBefore(this._minValue)) ||\n (!!this._maxValue && this._dateApiValue!.isAfter(this._maxValue));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param code - Code that should be executed which can change current value\n */\n protected _withMinMaxConstraint(code: () => void): void\n {\n this._dateApiValue!.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this._minMaxConstraintTest())\n {\n this._dateApiValue?.resetOriginal();\n\n return;\n }\n\n this._valueChange.next();\n }\n\n /**\n * Clears current value\n */\n protected _clearValue(): void\n {\n this._dateApiValue = null;\n this._isValid = true;\n this.currentValue = null;\n }\n\n /**\n * Changes current value of date for for specified part by single step\n * @param part - Part of date that should be changed\n * @param increment - Indication whether value should be incremented or decremented\n */\n protected _stepChangeValue(part: string, increment: boolean): void\n {\n if(!this._dateApiValue?.isValid())\n {\n return;\n }\n\n switch(part)\n {\n case 'y':\n case 'Y':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addYears(1) : this._dateApiValue!.subtractYears(1));\n\n break;\n }\n case 'Q':\n {\n break;\n }\n case 'M':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addMonths(1) : this._dateApiValue!.subtractMonths(1));\n\n break;\n }\n case 'w':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addWeeks(1) : this._dateApiValue!.subtractWeeks(1));\n\n break;\n }\n case 'd':\n case 'D':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addDays(1) : this._dateApiValue!.subtractDays(1));\n\n break;\n }\n case 'H':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addHours(1) : this._dateApiValue!.subtractHours(1));\n\n break;\n }\n case 'm':\n {\n this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addMinutes(1) : this._dateApiValue!.subtractMinutes(1));\n\n break;\n }\n }\n }\n}","<input type=\"text\"\r\n #input\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"handleBlur()\"\r\n (input)=\"handleInput()\"\r\n (click)=\"handleClick()\"\r\n (select)=\"handleSelect()\"\r\n (keydown)=\"handleKeyboard($any($event))\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder ?? ''\">"]}
@@ -6,12 +6,12 @@ import { DATE_API, FORMAT_PROVIDER } from '../../../../misc/tokens';
6
6
  import { DateTimeDayPickerComponent } from '../../../picker/components/dayPicker/dayPicker.component';
7
7
  import { DateTimeMonthPickerComponent } from '../../../picker/components/monthPicker/monthPicker.component';
8
8
  import { DateTimeYearPickerComponent } from '../../../picker/components/yearPicker/yearPicker.component';
9
- import { DateValueProvider } from '../../../../services/dateValueProvider.service';
9
+ import { DateValueProvider } from '../../../../services';
10
10
  import { DATE_TIME_SELECTOR_CONFIGURATION } from '../../misc/tokens';
11
11
  import { InputDateTimeSelectorComponent } from '../inputDateTime/inputDateTime.component';
12
12
  import { enterLeaveAnimateChildTrigger } from './selector.component.animations';
13
13
  import * as i0 from "@angular/core";
14
- import * as i1 from "../../../../services/dateValueProvider.service";
14
+ import * as i1 from "../../../../services";
15
15
  import * as i2 from "@angular/common";
16
16
  import * as i3 from "@anglr/common";
17
17
  import * as i4 from "../../directives/dateTimePickerRenderer/dateTimePickerRenderer.directive";
@@ -1 +1 @@
1
- {"version":3,"file":"selector.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/selector/components/selector/selector.component.ts","../../../../../../src/legacy/selector/components/selector/selector.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAqD,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAC5K,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAa,OAAO,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAGvD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAC,0BAA0B,EAAC,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAC,4BAA4B,EAAC,MAAM,8DAA8D,CAAC;AAC1G,OAAO,EAAC,2BAA2B,EAAC,MAAM,4DAA4D,CAAC;AAEvG,OAAO,EAAC,iBAAiB,EAAC,MAAM,gDAAgD,CAAC;AAEjF,OAAO,EAAC,gCAAgC,EAAC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAC,8BAA8B,EAAC,MA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A+CK,QAAQ;sBADlB,KAAK","sourcesContent":["import {Component, ChangeDetectionStrategy, Input, Inject, Optional, Type, OnInit, OnDestroy, OnChanges, SimpleChanges, ChangeDetectorRef, ElementRef} from '@angular/core';\nimport {PositionPlacement} from '@anglr/common';\nimport {extend, isBlank, isString, nameof} from '@jscrpt/common';\nimport {Observable, Subject, Subscription} from 'rxjs';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateTimeDayPickerComponent} from '../../../picker/components/dayPicker/dayPicker.component';\nimport {DateTimeMonthPickerComponent} from '../../../picker/components/monthPicker/monthPicker.component';\nimport {DateTimeYearPickerComponent} from '../../../picker/components/yearPicker/yearPicker.component';\nimport {DateApi} from '../../../../services';\nimport {DateValueProvider} from '../../../../services/dateValueProvider.service';\nimport {DateTimeSelector, DateTimeSelectorOptions} from '../../misc/datetimeSelector.interface';\nimport {DATE_TIME_SELECTOR_CONFIGURATION} from '../../misc/tokens';\nimport {InputDateTimeSelectorComponent} from '../inputDateTime/inputDateTime.component';\nimport {enterLeaveAnimateChildTrigger} from './selector.component.animations';\nimport {FormatProvider} from '../../../../interfaces';\n\n//TODO - add support for body absolute picker\n\n/**\n * Default configuration for selector\n */\nconst defaultConfiguration: DateTimeSelectorOptions<DateTimeSelector> =\n{\n selectorComponent: InputDateTimeSelectorComponent,\n pickerCloseOnValueSelect: false,\n pickerDisabled: false,\n pickerAbsolute: true,\n pickerAbsoluteContainer: 'body',\n positionOptions:\n {\n flip: true,\n placement: PositionPlacement.BottomStart,\n autoUpdate: true\n },\n defaultPeriod: 'day',\n pickerPeriodsOrder: null,\n pickerPeriodsDefinition:\n {\n 'day': DateTimeDayPickerComponent,\n 'month': DateTimeMonthPickerComponent,\n 'year': DateTimeYearPickerComponent\n },\n cssClasses:\n {\n }\n};\n\n/**\n * Component used for displaying and selecting date time\n */\n@Component(\n{\n selector: 'date-time-selector',\n templateUrl: 'selector.component.html',\n styleUrls: ['selector.component.css'],\n animations: [enterLeaveAnimateChildTrigger],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeSelectorComponent<TDate = any> implements OnInit, OnChanges ,OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Current value of datetime\n */\n protected _value: DateTimeValue<TDate>|null = null;\n\n /**\n * Occurs when selector is touched by user\n */\n protected _touched: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when value changes\n */\n protected _valueChange: Subject<void> = new Subject<void>();\n\n /**\n * Indication whether is control disabled\n */\n protected _disabled: boolean = false;\n\n /**\n * Instance of active date time selector\n */\n protected _activeSelector?: DateTimeSelector<TDate>;\n\n /**\n * All subscriptions for active selector\n */\n protected _activeSelectorSubscriptions: Subscription = new Subscription();\n\n /**\n * Subscription for changes of min value selector\n */\n protected _minValueChangeSubscription: Subscription|null = null;\n\n /**\n * Subscription for changes of max value selector\n */\n protected _maxValueChangeSubscription: Subscription|null = null;\n\n /**\n * Current options used by selector\n */\n protected _options: DateTimeSelectorOptions<DateTimeSelector<TDate>>;\n\n /**\n * Placeholder that is displayed when there is no value selected\n */\n protected _placeholder?: string;\n\n //######################### public properties #########################\n\n /**\n * Gets or sets current value of datetime\n */\n public get value(): DateTimeValue<TDate>|null\n {\n return this._value;\n }\n public set value(value: DateTimeValue<TDate>|null)\n {\n this._value = value;\n\n this._activeSelector?.setValue(this._value);\n }\n\n /**\n * Gets indication whether is current value valid\n */\n public get valid(): boolean\n {\n return this._activeSelector?.valid ?? true;\n }\n\n /**\n * Gets or sets formatted value\n */\n public get formattedValue(): string|null\n {\n return this._activeSelector?.formattedValue ?? null;\n }\n public set formattedValue(value: string|null)\n {\n if(value)\n {\n const val = this._dateApi.getValue(value, this.format);\n this.value = this._valueProvider.getValue(val.value, this.format);\n }\n else\n {\n this.value = null;\n }\n }\n\n /**\n * Occurs when selector is touched by user\n */\n public get touched(): Observable<void>\n {\n return this._touched.asObservable();\n }\n\n /**\n * Occurs when value changes\n */\n public get valueChange(): Observable<void>\n {\n return this._valueChange.asObservable();\n }\n\n //######################### public properties - template bindings #########################\n\n /**\n * Currently active date time selector component type\n * @internal\n */\n public activeSelectorComponent!: Type<DateTimeSelector<TDate>>;\n\n /**\n * Indication whether is picker visible or not\n * @internal\n */\n public pickerVisible: boolean = false;\n\n /**\n * Gets or sets minimal possible value for picker, that can be picked\n */\n public min: TDate|null = null;\n\n /**\n * Gets or sets maximal possible value for picker, that can be picked\n */\n public max: TDate|null = null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Format of displayed\n */\n @Input()\n public format: string;\n\n /**\n * Gets or sets placeholder that is displayed when there is no value selected\n */\n @Input()\n public get placeholder(): string|undefined\n {\n return this._placeholder;\n }\n public set placeholder(value: string|undefined)\n {\n this._placeholder = value;\n\n if(this._activeSelector)\n {\n this._activeSelector.placeholder = this._placeholder ?? null;\n\n this._activeSelector.invalidateVisuals();\n }\n }\n\n /**\n * Current options used by selector\n */\n @Input()\n public get options(): Partial<DateTimeSelectorOptions<DateTimeSelector<TDate>>>\n {\n return this._options;\n }\n public set options(value: Partial<DateTimeSelectorOptions<DateTimeSelector<TDate>>>)\n {\n this._options = extend(true, this._options, value);\n // without deep-copy for this attribute\n if (value?.pickerPeriodsDefinition)\n {\n this._options.pickerPeriodsDefinition = value.pickerPeriodsDefinition;\n }\n }\n\n /**\n * Gets or sets minimal possible value for picker, that can be picked\n */\n @Input()\n public get minValue(): TDate|string|null|DateTimeSelectorComponent<TDate>\n {\n return this.min;\n }\n public set minValue(value: TDate|string|null|DateTimeSelectorComponent<TDate>)\n {\n this._minValueChangeSubscription?.unsubscribe();\n this._minValueChangeSubscription = null;\n\n if(isBlank(value))\n {\n this.min = null;\n }\n else if(isString(value))\n {\n const date = this._dateApi.getValue(value);\n\n if(date.isValid())\n {\n this.min = date.value;\n }\n }\n else if(value instanceof DateTimeSelectorComponent)\n {\n this.min = value.valueOf();\n\n this._minValueChangeSubscription = value.valueChange.subscribe(() =>\n {\n this.min = value.valueOf();\n this._activeSelector?.setMinValue(this.min);\n\n this._changeDetector.detectChanges();\n });\n }\n else\n {\n this.min = value;\n }\n\n this._activeSelector?.setMinValue(this.min);\n }\n\n /**\n * Gets or sets maximal possible value for picker, that can be picked\n */\n @Input()\n public get maxValue(): TDate|string|null|DateTimeSelectorComponent<TDate>\n {\n return this.max;\n }\n public set maxValue(value: TDate|string|null|DateTimeSelectorComponent<TDate>)\n {\n this._maxValueChangeSubscription?.unsubscribe();\n this._maxValueChangeSubscription = null;\n\n if(isBlank(value))\n {\n this.max = null;\n }\n else if(isString(value))\n {\n const date = this._dateApi.getValue(value);\n\n if(date.isValid())\n {\n this.max = date.value;\n }\n }\n else if(value instanceof DateTimeSelectorComponent)\n {\n this.max = value.valueOf();\n\n this._maxValueChangeSubscription = value.valueChange.subscribe(() =>\n {\n this.max = value.valueOf();\n this._activeSelector?.setMaxValue(this.max);\n\n this._changeDetector.detectChanges();\n });\n }\n else\n {\n this.max = value;\n }\n\n this._activeSelector?.setMaxValue(this.max);\n }\n\n //######################### constructor #########################\n constructor(@Optional() @Inject(DATE_TIME_SELECTOR_CONFIGURATION) configuration: Partial<DateTimeSelectorOptions<DateTimeSelector<TDate>>>,\n protected _valueProvider: DateValueProvider<TDate>,\n protected _changeDetector: ChangeDetectorRef,\n public element: ElementRef<HTMLElement>,\n @Inject(DATE_API) protected _dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) formatProvider: FormatProvider)\n {\n this.format = formatProvider.date;\n this._options = extend(true, {}, defaultConfiguration, configuration);\n // without deep-copy for this attribute\n if (configuration?.pickerPeriodsDefinition)\n {\n this._options.pickerPeriodsDefinition = configuration.pickerPeriodsDefinition;\n }\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.activeSelectorComponent = this._options.selectorComponent;\n }\n\n //######################### public methods - implementation of OnChanges #########################\n\n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<DateTimeSelectorComponent>('format') in changes && this._activeSelector)\n {\n this._activeSelector.format = this.format;\n this._activeSelector.invalidateVisuals();\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._activeSelectorSubscriptions.unsubscribe();\n\n this._minValueChangeSubscription?.unsubscribe();\n this._minValueChangeSubscription = null;\n\n this._maxValueChangeSubscription?.unsubscribe();\n this._maxValueChangeSubscription = null;\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Handles created or destroyed date time selector instance\n * @param selector - Instance of selector or null\n * @internal\n */\n public selectorCreated(selector: DateTimeSelector<TDate>): void\n {\n this._activeSelector = selector;\n\n this._activeSelectorSubscriptions.unsubscribe();\n this._activeSelectorSubscriptions = new Subscription();\n\n this._activeSelectorSubscriptions.add(selector.touched.subscribe(() => this._touched.next()));\n this._activeSelectorSubscriptions.add(selector.pickerRequest.subscribe(visible => this.pickerVisible = visible));\n\n this._activeSelectorSubscriptions.add(selector.valueChange.subscribe(() =>\n {\n this._value = selector.value;\n this._valueChange.next();\n }));\n\n selector.format = this.format;\n selector.setMaxValue(this.max);\n selector.setMinValue(this.min);\n selector.setValue(this._value);\n selector.setDisabled(this._disabled);\n selector.placeholder = this._placeholder ?? null;\n\n selector.invalidateVisuals();\n }\n\n /**\n * Handles changed value by picker\n * @param value - Value that was changed\n * @internal\n */\n public pickerChangedValue(value: DateTimeValue<TDate>): void\n {\n this._activeSelector?.setValue(value);\n this._value = value;\n this._valueChange.next();\n\n if(this._options.pickerCloseOnValueSelect)\n {\n this.pickerVisible = false;\n }\n }\n\n //######################### public methods #########################\n\n /**\n * Sets as 'control' disabled\n * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true\n */\n public setDisabled(disabled: boolean = true): void\n {\n this._disabled = disabled;\n this._activeSelector?.setDisabled(disabled);\n this._activeSelector?.invalidateVisuals();\n }\n\n /**\n * Gets simple value of selector\n */\n public valueOf(): TDate|null\n {\n if(!this._value)\n {\n return null;\n }\n\n return this._value.from!;\n }\n}\n","<ng-template [ngComponentOutletEx]=\"activeSelectorComponent!\" (ngComponentOutletExCreated)=\"selectorCreated($event!)\"></ng-template>\r\n\r\n<ng-template [ngIf]=\"!options.pickerDisabled && pickerVisible\">\r\n <ng-template [dateTimePicker]=\"value\"\r\n [minValue]=\"min\"\r\n [maxValue]=\"max\"\r\n [options]=\"options\"\r\n [selectorElement]=\"element\"\r\n (valueChange)=\"pickerChangedValue($event)\"></ng-template>\r\n</ng-template>"]}
1
+ {"version":3,"file":"selector.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/selector/components/selector/selector.component.ts","../../../../../../src/legacy/selector/components/selector/selector.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAqD,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAC5K,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAa,OAAO,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAGvD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAC,0BAA0B,EAAC,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAC,4BAA4B,EAAC,MAAM,8DAA8D,CAAC;AAC1G,OAAO,EAAC,2BAA2B,EAAC,MAAM,4DAA4D,CAAC;AACvG,OAAO,EAAU,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAC,gCAAgC,EAAC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAC,8BAA8B,EAAC,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAC,6BAA6B,EAAC,MAAM,i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Input, Inject, Optional, Type, OnInit, OnDestroy, OnChanges, SimpleChanges, ChangeDetectorRef, ElementRef} from '@angular/core';\nimport {PositionPlacement} from '@anglr/common';\nimport {extend, isBlank, isString, nameof} from '@jscrpt/common';\nimport {Observable, Subject, Subscription} from 'rxjs';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateTimeDayPickerComponent} from '../../../picker/components/dayPicker/dayPicker.component';\nimport {DateTimeMonthPickerComponent} from '../../../picker/components/monthPicker/monthPicker.component';\nimport {DateTimeYearPickerComponent} from '../../../picker/components/yearPicker/yearPicker.component';\nimport {DateApi, DateValueProvider} from '../../../../services';\nimport {DateTimeSelector, DateTimeSelectorOptions} from '../../misc/datetimeSelector.interface';\nimport {DATE_TIME_SELECTOR_CONFIGURATION} from '../../misc/tokens';\nimport {InputDateTimeSelectorComponent} from '../inputDateTime/inputDateTime.component';\nimport {enterLeaveAnimateChildTrigger} from './selector.component.animations';\nimport {FormatProvider} from '../../../../interfaces';\n\n//TODO - add support for body absolute picker\n\n/**\n * Default configuration for selector\n */\nconst defaultConfiguration: DateTimeSelectorOptions<DateTimeSelector> =\n{\n selectorComponent: InputDateTimeSelectorComponent,\n pickerCloseOnValueSelect: false,\n pickerDisabled: false,\n pickerAbsolute: true,\n pickerAbsoluteContainer: 'body',\n positionOptions:\n {\n flip: true,\n placement: PositionPlacement.BottomStart,\n autoUpdate: true\n },\n defaultPeriod: 'day',\n pickerPeriodsOrder: null,\n pickerPeriodsDefinition:\n {\n 'day': DateTimeDayPickerComponent,\n 'month': DateTimeMonthPickerComponent,\n 'year': DateTimeYearPickerComponent\n },\n cssClasses:\n {\n }\n};\n\n/**\n * Component used for displaying and selecting date time\n */\n@Component(\n{\n selector: 'date-time-selector',\n templateUrl: 'selector.component.html',\n styleUrls: ['selector.component.css'],\n animations: [enterLeaveAnimateChildTrigger],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeSelectorComponent<TDate = any> implements OnInit, OnChanges ,OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Current value of datetime\n */\n protected _value: DateTimeValue<TDate>|null = null;\n\n /**\n * Occurs when selector is touched by user\n */\n protected _touched: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when value changes\n */\n protected _valueChange: Subject<void> = new Subject<void>();\n\n /**\n * Indication whether is control disabled\n */\n protected _disabled: boolean = false;\n\n /**\n * Instance of active date time selector\n */\n protected _activeSelector?: DateTimeSelector<TDate>;\n\n /**\n * All subscriptions for active selector\n */\n protected _activeSelectorSubscriptions: Subscription = new Subscription();\n\n /**\n * Subscription for changes of min value selector\n */\n protected _minValueChangeSubscription: Subscription|null = null;\n\n /**\n * Subscription for changes of max value selector\n */\n protected _maxValueChangeSubscription: Subscription|null = null;\n\n /**\n * Current options used by selector\n */\n protected _options: DateTimeSelectorOptions<DateTimeSelector<TDate>>;\n\n /**\n * Placeholder that is displayed when there is no value selected\n */\n protected _placeholder?: string;\n\n //######################### public properties #########################\n\n /**\n * Gets or sets current value of datetime\n */\n public get value(): DateTimeValue<TDate>|null\n {\n return this._value;\n }\n public set value(value: DateTimeValue<TDate>|null)\n {\n this._value = value;\n\n this._activeSelector?.setValue(this._value);\n }\n\n /**\n * Gets indication whether is current value valid\n */\n public get valid(): boolean\n {\n return this._activeSelector?.valid ?? true;\n }\n\n /**\n * Gets or sets formatted value\n */\n public get formattedValue(): string|null\n {\n return this._activeSelector?.formattedValue ?? null;\n }\n public set formattedValue(value: string|null)\n {\n if(value)\n {\n const val = this._dateApi.getValue(value, this.format);\n this.value = this._valueProvider.getValue(val.value, this.format);\n }\n else\n {\n this.value = null;\n }\n }\n\n /**\n * Occurs when selector is touched by user\n */\n public get touched(): Observable<void>\n {\n return this._touched.asObservable();\n }\n\n /**\n * Occurs when value changes\n */\n public get valueChange(): Observable<void>\n {\n return this._valueChange.asObservable();\n }\n\n //######################### public properties - template bindings #########################\n\n /**\n * Currently active date time selector component type\n * @internal\n */\n public activeSelectorComponent!: Type<DateTimeSelector<TDate>>;\n\n /**\n * Indication whether is picker visible or not\n * @internal\n */\n public pickerVisible: boolean = false;\n\n /**\n * Gets or sets minimal possible value for picker, that can be picked\n */\n public min: TDate|null = null;\n\n /**\n * Gets or sets maximal possible value for picker, that can be picked\n */\n public max: TDate|null = null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Format of displayed\n */\n @Input()\n public format: string;\n\n /**\n * Gets or sets placeholder that is displayed when there is no value selected\n */\n @Input()\n public get placeholder(): string|undefined\n {\n return this._placeholder;\n }\n public set placeholder(value: string|undefined)\n {\n this._placeholder = value;\n\n if(this._activeSelector)\n {\n this._activeSelector.placeholder = this._placeholder ?? null;\n\n this._activeSelector.invalidateVisuals();\n }\n }\n\n /**\n * Current options used by selector\n */\n @Input()\n public get options(): Partial<DateTimeSelectorOptions<DateTimeSelector<TDate>>>\n {\n return this._options;\n }\n public set options(value: Partial<DateTimeSelectorOptions<DateTimeSelector<TDate>>>)\n {\n this._options = extend(true, this._options, value);\n // without deep-copy for this attribute\n if (value?.pickerPeriodsDefinition)\n {\n this._options.pickerPeriodsDefinition = value.pickerPeriodsDefinition;\n }\n }\n\n /**\n * Gets or sets minimal possible value for picker, that can be picked\n */\n @Input()\n public get minValue(): TDate|string|null|DateTimeSelectorComponent<TDate>\n {\n return this.min;\n }\n public set minValue(value: TDate|string|null|DateTimeSelectorComponent<TDate>)\n {\n this._minValueChangeSubscription?.unsubscribe();\n this._minValueChangeSubscription = null;\n\n if(isBlank(value))\n {\n this.min = null;\n }\n else if(isString(value))\n {\n const date = this._dateApi.getValue(value);\n\n if(date.isValid())\n {\n this.min = date.value;\n }\n }\n else if(value instanceof DateTimeSelectorComponent)\n {\n this.min = value.valueOf();\n\n this._minValueChangeSubscription = value.valueChange.subscribe(() =>\n {\n this.min = value.valueOf();\n this._activeSelector?.setMinValue(this.min);\n\n this._changeDetector.detectChanges();\n });\n }\n else\n {\n this.min = value;\n }\n\n this._activeSelector?.setMinValue(this.min);\n }\n\n /**\n * Gets or sets maximal possible value for picker, that can be picked\n */\n @Input()\n public get maxValue(): TDate|string|null|DateTimeSelectorComponent<TDate>\n {\n return this.max;\n }\n public set maxValue(value: TDate|string|null|DateTimeSelectorComponent<TDate>)\n {\n this._maxValueChangeSubscription?.unsubscribe();\n this._maxValueChangeSubscription = null;\n\n if(isBlank(value))\n {\n this.max = null;\n }\n else if(isString(value))\n {\n const date = this._dateApi.getValue(value);\n\n if(date.isValid())\n {\n this.max = date.value;\n }\n }\n else if(value instanceof DateTimeSelectorComponent)\n {\n this.max = value.valueOf();\n\n this._maxValueChangeSubscription = value.valueChange.subscribe(() =>\n {\n this.max = value.valueOf();\n this._activeSelector?.setMaxValue(this.max);\n\n this._changeDetector.detectChanges();\n });\n }\n else\n {\n this.max = value;\n }\n\n this._activeSelector?.setMaxValue(this.max);\n }\n\n //######################### constructor #########################\n constructor(@Optional() @Inject(DATE_TIME_SELECTOR_CONFIGURATION) configuration: Partial<DateTimeSelectorOptions<DateTimeSelector<TDate>>>,\n protected _valueProvider: DateValueProvider<TDate>,\n protected _changeDetector: ChangeDetectorRef,\n public element: ElementRef<HTMLElement>,\n @Inject(DATE_API) protected _dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) formatProvider: FormatProvider)\n {\n this.format = formatProvider.date;\n this._options = extend(true, {}, defaultConfiguration, configuration);\n // without deep-copy for this attribute\n if (configuration?.pickerPeriodsDefinition)\n {\n this._options.pickerPeriodsDefinition = configuration.pickerPeriodsDefinition;\n }\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.activeSelectorComponent = this._options.selectorComponent;\n }\n\n //######################### public methods - implementation of OnChanges #########################\n\n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<DateTimeSelectorComponent>('format') in changes && this._activeSelector)\n {\n this._activeSelector.format = this.format;\n this._activeSelector.invalidateVisuals();\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._activeSelectorSubscriptions.unsubscribe();\n\n this._minValueChangeSubscription?.unsubscribe();\n this._minValueChangeSubscription = null;\n\n this._maxValueChangeSubscription?.unsubscribe();\n this._maxValueChangeSubscription = null;\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Handles created or destroyed date time selector instance\n * @param selector - Instance of selector or null\n * @internal\n */\n public selectorCreated(selector: DateTimeSelector<TDate>): void\n {\n this._activeSelector = selector;\n\n this._activeSelectorSubscriptions.unsubscribe();\n this._activeSelectorSubscriptions = new Subscription();\n\n this._activeSelectorSubscriptions.add(selector.touched.subscribe(() => this._touched.next()));\n this._activeSelectorSubscriptions.add(selector.pickerRequest.subscribe(visible => this.pickerVisible = visible));\n\n this._activeSelectorSubscriptions.add(selector.valueChange.subscribe(() =>\n {\n this._value = selector.value;\n this._valueChange.next();\n }));\n\n selector.format = this.format;\n selector.setMaxValue(this.max);\n selector.setMinValue(this.min);\n selector.setValue(this._value);\n selector.setDisabled(this._disabled);\n selector.placeholder = this._placeholder ?? null;\n\n selector.invalidateVisuals();\n }\n\n /**\n * Handles changed value by picker\n * @param value - Value that was changed\n * @internal\n */\n public pickerChangedValue(value: DateTimeValue<TDate>): void\n {\n this._activeSelector?.setValue(value);\n this._value = value;\n this._valueChange.next();\n\n if(this._options.pickerCloseOnValueSelect)\n {\n this.pickerVisible = false;\n }\n }\n\n //######################### public methods #########################\n\n /**\n * Sets as 'control' disabled\n * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true\n */\n public setDisabled(disabled: boolean = true): void\n {\n this._disabled = disabled;\n this._activeSelector?.setDisabled(disabled);\n this._activeSelector?.invalidateVisuals();\n }\n\n /**\n * Gets simple value of selector\n */\n public valueOf(): TDate|null\n {\n if(!this._value)\n {\n return null;\n }\n\n return this._value.from!;\n }\n}\n","<ng-template [ngComponentOutletEx]=\"activeSelectorComponent!\" (ngComponentOutletExCreated)=\"selectorCreated($event!)\"></ng-template>\r\n\r\n<ng-template [ngIf]=\"!options.pickerDisabled && pickerVisible\">\r\n <ng-template [dateTimePicker]=\"value\"\r\n [minValue]=\"min\"\r\n [maxValue]=\"max\"\r\n [options]=\"options\"\r\n [selectorElement]=\"element\"\r\n (valueChange)=\"pickerChangedValue($event)\"></ng-template>\r\n</ng-template>"]}
@@ -2,9 +2,9 @@ import { Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementR
2
2
  import { isPresent } from '@jscrpt/common';
3
3
  import { Subject } from 'rxjs';
4
4
  import { DATE_API } from '../../../../misc/tokens';
5
- import { DateValueProvider } from '../../../../services/dateValueProvider.service';
5
+ import { DateValueProvider } from '../../../../services';
6
6
  import * as i0 from "@angular/core";
7
- import * as i1 from "../../../../services/dateValueProvider.service";
7
+ import * as i1 from "../../../../services";
8
8
  /**
9
9
  * Component used as datetime selector with simple input
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"simpleInputDateTime.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.ts","../../../../../../src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACnH,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAGzC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,gDAAgD,CAAC;;;AAGjF;;GAEG;AAQH,MAAM,OAAO,oCAAoC;IAwK7C,iEAAiE;IACjE,YAAwC,QAAwB,EAC1C,cAAwC,EACxC,eAAkC;QAFhB,aAAQ,G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I,IAAI,CAAC,YAAY,GAAG,MAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,mCAAI,IAAI,CAAC;SACxE;IACL,CAAC;;iIAzZQ,oCAAoC,kBAyKzB,QAAQ;qHAzKnB,oCAAoC,4LCpBjD,2TAQyC;2FDY5B,oCAAoC;kBAPhD,SAAS;+BAEI,iCAAiC,mBAG1B,uBAAuB,CAAC,MAAM;;0BA2KlC,MAAM;2BAAC,QAAQ;4GA5BrB,YAAY;sBADlB,SAAS;uBAAC,OAAO,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementRef, ViewChild} from '@angular/core';\nimport {isPresent} from '@jscrpt/common';\nimport {Observable, Subject} from 'rxjs';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services';\nimport {DateValueProvider} from '../../../../services/dateValueProvider.service';\nimport {DateTimeSelector} from '../../misc/datetimeSelector.interface';\n\n/**\n * Component used as datetime selector with simple input\n */\n@Component(\n{\n selector: 'simple-input-date-time-selector',\n templateUrl: 'simpleInputDateTime.component.html',\n styleUrls: ['simpleInputDateTime.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SimpleInputDateTimeSelectorComponent<TDate = any> implements DateTimeSelector<TDate>\n{\n //######################### protected fields #########################\n\n /**\n * Occurs when value changes\n */\n protected _valueChange: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector is touched by user\n */\n protected _touched: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector requires picker to be displayed or hidden\n */\n protected _pickerRequest: Subject<boolean> = new Subject<boolean>();\n\n /**\n * Currently used format for displaying data\n */\n protected _format: string = '';\n\n /**\n * Current value representation as date api wrapper\n */\n protected _dateApiValue: null|DateApiObject<TDate> = null;\n\n /**\n * Indication whether is current value valid value\n */\n protected _isValid: boolean = true;\n\n /**\n * Minimal possible value that can be picked\n */\n protected _minValue: TDate|null = null;\n\n /**\n * Maximal possible value that can be picked\n */\n protected _maxValue: TDate|null = null;\n\n //######################### public properties - implementation of DateTimeSelector #########################\n\n /**\n * Gets or sets currently used format for displaying data\n */\n public get format(): string\n {\n return this._format;\n }\n public set format(value: string)\n {\n if(isPresent(value))\n {\n value = this._dateApi.getFormat(value);\n }\n\n this._format = value;\n }\n\n /**\n * Gets or sets placeholder that is displayed when there is no value selected\n */\n public placeholder: string|null = null;\n\n /**\n * Gets current value of datetime\n */\n public get value(): DateTimeValue<TDate>|null\n {\n if(!this._dateApiValue || !this._isValid)\n {\n return null;\n }\n\n return this._valueProvider.getValue(this._dateApiValue.value, this._format);\n }\n\n /**\n * Gets formatted value\n */\n public get formattedValue(): string|null\n {\n if(!this._isValid)\n {\n return null;\n }\n\n return this.currentValue;\n }\n\n /**\n * Gets indication whether is current value valid\n */\n public get valid(): boolean\n {\n return this._isValid;\n }\n\n /**\n * Occurs when value changes\n */\n public get valueChange(): Observable<void>\n {\n return this._valueChange.asObservable();\n }\n\n /**\n * Occurs when selector is touched by user\n */\n public get touched(): Observable<void>\n {\n return this._touched.asObservable();\n }\n\n /**\n * Occurs when selector requires picker to be displayed\n */\n public get pickerRequest(): Observable<boolean>\n {\n return this._pickerRequest.asObservable();\n }\n\n //######################### public properties - template bindings #########################\n\n /**\n * Indication whether is input disabled\n * @internal\n */\n public disabled: boolean = false;\n\n //######################### public properties - children #########################\n\n /**\n * Instance of html input element\n * @internal\n */\n @ViewChild('input', {static: true})\n public inputElement?: ElementRef<HTMLInputElement>;\n\n //######################### protected properties #########################\n\n /**\n * Gets or sets string representation current of value\n */\n protected get currentValue(): string|null\n {\n return this.input.value || null;\n }\n protected set currentValue(value: string|null)\n {\n if(this.input)\n {\n this.input.value = value ?? '';\n }\n }\n\n /**\n * Gets input element used for handling date time value\n */\n protected get input(): HTMLInputElement\n {\n return this.inputElement!.nativeElement;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>,\n protected _valueProvider: DateValueProvider<TDate>,\n protected _changeDetector: ChangeDetectorRef)\n {\n }\n\n //######################### public methods - implementation of DateTimeSelector #########################\n\n /**\n * Sets minimal possible value for picker, that can be picked\n * @param value - Minimal possible value that can be picked\n */\n public setMinValue(value: TDate|null): void\n {\n this._minValue = value;\n }\n\n /**\n * Sets maximal possible value for picker, that can be picked\n * @param value - Maximal possible value that can be picked\n */\n public setMaxValue(value: TDate|null): void\n {\n this._maxValue = value;\n }\n\n /**\n * Sets value of datetime selector\n * @param value - Value to be set to this selector\n */\n public setValue(value: DateTimeValue<TDate>|null): void\n {\n if(value?.from)\n {\n this._dateApiValue = this._dateApi.getValue(value?.from, this._format);\n this._isValid = this._dateApiValue.isValid();\n\n this._show();\n }\n else\n {\n this._clearValue();\n }\n }\n\n /**\n * Sets as 'control' disabled\n * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true\n */\n public setDisabled(disabled: boolean = true): void\n {\n this.disabled = disabled;\n }\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n public invalidateVisuals(): void\n {\n this._changeDetector.detectChanges();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Handles gaining of focus\n * @internal\n */\n public handleFocus(): void\n {\n this._pickerRequest.next(true);\n\n //no value\n if(!this._dateApiValue)\n {\n this._dateApiValue = this._dateApi.now();\n this._isValid = this._dateApiValue.isValid();\n\n if(this._minMaxConstraintTest())\n {\n this._clearValue();\n }\n else\n {\n this._valueChange.next();\n }\n }\n\n if(!this._isValid)\n {\n return;\n }\n\n this._show();\n }\n\n /**\n * Handles blur on input\n * @internal\n */\n public handleBlur(): void\n {\n this._pickerRequest.next(false);\n }\n\n /**\n * Handles user input\n * @internal\n */\n public handleInput(): void\n {\n //empty value\n if(!this.currentValue)\n {\n this._clearValue();\n this._valueChange.next();\n\n return;\n }\n\n this._dateApiValue = this._dateApi.getValue(this.currentValue, this._format);\n this._isValid = this._dateApiValue.isValid();\n this._valueChange.next();\n }\n\n /**\n * Handles click event inside of input\n * @internal\n */\n public handleClick(): void\n {\n this._pickerRequest.next(true);\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n * @param input - Html input element that holds current value and selection\n * @internal\n */\n public handleKeyboard(event: KeyboardEvent): void\n {\n if(!this._dateApiValue?.isValid())\n {\n return;\n }\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this._withMinMaxConstraint(() => event.key == 'ArrowLeft' ? this._dateApiValue!.subtractDays(1) : this._dateApiValue!.addDays(1));\n this._show();\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this._withMinMaxConstraint(() => event.key == 'ArrowUp' ? this._dateApiValue!.subtractWeeks(1) : this._dateApiValue!.addWeeks(1));\n this._show();\n\n break;\n }\n case 'Escape':\n {\n this._pickerRequest.next(false);\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this._pickerRequest.next(true);\n }\n\n break;\n }\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Clears current value\n */\n protected _clearValue(): void\n {\n this._dateApiValue = null;\n this._isValid = true;\n this.currentValue = null;\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n */\n protected _minMaxConstraintTest(): boolean\n {\n return (!!this._minValue && this._dateApiValue!.isBefore(this._minValue)) ||\n (!!this._maxValue && this._dateApiValue!.isAfter(this._maxValue));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param code - Code that should be executed which can change current value\n */\n protected _withMinMaxConstraint(code: () => void): void\n {\n this._dateApiValue!.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this._minMaxConstraintTest())\n {\n this._dateApiValue?.resetOriginal();\n\n return;\n }\n\n this._valueChange.next();\n }\n\n /**\n * Shows current value in input\n */\n protected _show(): void\n {\n if(this._isValid)\n {\n this.currentValue = this._dateApiValue?.format(this._format) ?? null;\n }\n }\n}","<input type=\"text\"\r\n #input\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"handleBlur()\"\r\n (input)=\"handleInput()\"\r\n (click)=\"handleClick()\"\r\n (keydown)=\"handleKeyboard($any($event))\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder ?? ''\">"]}
1
+ {"version":3,"file":"simpleInputDateTime.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.ts","../../../../../../src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACnH,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAGzC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAyB,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;;;AAG/E;;GAEG;AAQH,MAAM,OAAO,oCAAoC;IAwK7C,iEAAiE;IACjE,YAAwC,QAAwB,EAC1C,cAAwC,EACxC,eAAkC;QAFhB,aAAQ,GAAR,QAAQ,CAAgB;QAC1C,mBAAc,GAAd,cAAc,CAA0B;QACxC,oBAAe,GAAf,eAAe,CAAmB;QAzKxD,sEAAsE;QAEtE;;WAEG;QACO,iBAAY,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAE5D;;WAEG;QACO,aAAQ,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAExD;;WAEG;QACO,mBAAc,GAAqB,IAAI,OAAO,EAAW,CAAC;QAEpE;;WAEG;QACO,YAAO,GAAW,EAAE,CAAC;QAE/B;;WAEG;QACO,kBAAa,GAA8B,IAAI,CAAC;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AC,MAAM,EAAE,IAAI,EAAC","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementRef, ViewChild} from '@angular/core';\nimport {isPresent} from '@jscrpt/common';\nimport {Observable, Subject} from 'rxjs';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject, DateValueProvider} from '../../../../services';\nimport {DateTimeSelector} from '../../misc/datetimeSelector.interface';\n\n/**\n * Component used as datetime selector with simple input\n */\n@Component(\n{\n selector: 'simple-input-date-time-selector',\n templateUrl: 'simpleInputDateTime.component.html',\n styleUrls: ['simpleInputDateTime.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SimpleInputDateTimeSelectorComponent<TDate = any> implements DateTimeSelector<TDate>\n{\n //######################### protected fields #########################\n\n /**\n * Occurs when value changes\n */\n protected _valueChange: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector is touched by user\n */\n protected _touched: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector requires picker to be displayed or hidden\n */\n protected _pickerRequest: Subject<boolean> = new Subject<boolean>();\n\n /**\n * Currently used format for displaying data\n */\n protected _format: string = '';\n\n /**\n * Current value representation as date api wrapper\n */\n protected _dateApiValue: null|DateApiObject<TDate> = null;\n\n /**\n * Indication whether is current value valid value\n */\n protected _isValid: boolean = true;\n\n /**\n * Minimal possible value that can be picked\n */\n protected _minValue: TDate|null = null;\n\n /**\n * Maximal possible value that can be picked\n */\n protected _maxValue: TDate|null = null;\n\n //######################### public properties - implementation of DateTimeSelector #########################\n\n /**\n * Gets or sets currently used format for displaying data\n */\n public get format(): string\n {\n return this._format;\n }\n public set format(value: string)\n {\n if(isPresent(value))\n {\n value = this._dateApi.getFormat(value);\n }\n\n this._format = value;\n }\n\n /**\n * Gets or sets placeholder that is displayed when there is no value selected\n */\n public placeholder: string|null = null;\n\n /**\n * Gets current value of datetime\n */\n public get value(): DateTimeValue<TDate>|null\n {\n if(!this._dateApiValue || !this._isValid)\n {\n return null;\n }\n\n return this._valueProvider.getValue(this._dateApiValue.value, this._format);\n }\n\n /**\n * Gets formatted value\n */\n public get formattedValue(): string|null\n {\n if(!this._isValid)\n {\n return null;\n }\n\n return this.currentValue;\n }\n\n /**\n * Gets indication whether is current value valid\n */\n public get valid(): boolean\n {\n return this._isValid;\n }\n\n /**\n * Occurs when value changes\n */\n public get valueChange(): Observable<void>\n {\n return this._valueChange.asObservable();\n }\n\n /**\n * Occurs when selector is touched by user\n */\n public get touched(): Observable<void>\n {\n return this._touched.asObservable();\n }\n\n /**\n * Occurs when selector requires picker to be displayed\n */\n public get pickerRequest(): Observable<boolean>\n {\n return this._pickerRequest.asObservable();\n }\n\n //######################### public properties - template bindings #########################\n\n /**\n * Indication whether is input disabled\n * @internal\n */\n public disabled: boolean = false;\n\n //######################### public properties - children #########################\n\n /**\n * Instance of html input element\n * @internal\n */\n @ViewChild('input', {static: true})\n public inputElement?: ElementRef<HTMLInputElement>;\n\n //######################### protected properties #########################\n\n /**\n * Gets or sets string representation current of value\n */\n protected get currentValue(): string|null\n {\n return this.input.value || null;\n }\n protected set currentValue(value: string|null)\n {\n if(this.input)\n {\n this.input.value = value ?? '';\n }\n }\n\n /**\n * Gets input element used for handling date time value\n */\n protected get input(): HTMLInputElement\n {\n return this.inputElement!.nativeElement;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>,\n protected _valueProvider: DateValueProvider<TDate>,\n protected _changeDetector: ChangeDetectorRef)\n {\n }\n\n //######################### public methods - implementation of DateTimeSelector #########################\n\n /**\n * Sets minimal possible value for picker, that can be picked\n * @param value - Minimal possible value that can be picked\n */\n public setMinValue(value: TDate|null): void\n {\n this._minValue = value;\n }\n\n /**\n * Sets maximal possible value for picker, that can be picked\n * @param value - Maximal possible value that can be picked\n */\n public setMaxValue(value: TDate|null): void\n {\n this._maxValue = value;\n }\n\n /**\n * Sets value of datetime selector\n * @param value - Value to be set to this selector\n */\n public setValue(value: DateTimeValue<TDate>|null): void\n {\n if(value?.from)\n {\n this._dateApiValue = this._dateApi.getValue(value?.from, this._format);\n this._isValid = this._dateApiValue.isValid();\n\n this._show();\n }\n else\n {\n this._clearValue();\n }\n }\n\n /**\n * Sets as 'control' disabled\n * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true\n */\n public setDisabled(disabled: boolean = true): void\n {\n this.disabled = disabled;\n }\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n public invalidateVisuals(): void\n {\n this._changeDetector.detectChanges();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Handles gaining of focus\n * @internal\n */\n public handleFocus(): void\n {\n this._pickerRequest.next(true);\n\n //no value\n if(!this._dateApiValue)\n {\n this._dateApiValue = this._dateApi.now();\n this._isValid = this._dateApiValue.isValid();\n\n if(this._minMaxConstraintTest())\n {\n this._clearValue();\n }\n else\n {\n this._valueChange.next();\n }\n }\n\n if(!this._isValid)\n {\n return;\n }\n\n this._show();\n }\n\n /**\n * Handles blur on input\n * @internal\n */\n public handleBlur(): void\n {\n this._pickerRequest.next(false);\n }\n\n /**\n * Handles user input\n * @internal\n */\n public handleInput(): void\n {\n //empty value\n if(!this.currentValue)\n {\n this._clearValue();\n this._valueChange.next();\n\n return;\n }\n\n this._dateApiValue = this._dateApi.getValue(this.currentValue, this._format);\n this._isValid = this._dateApiValue.isValid();\n this._valueChange.next();\n }\n\n /**\n * Handles click event inside of input\n * @internal\n */\n public handleClick(): void\n {\n this._pickerRequest.next(true);\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n * @param input - Html input element that holds current value and selection\n * @internal\n */\n public handleKeyboard(event: KeyboardEvent): void\n {\n if(!this._dateApiValue?.isValid())\n {\n return;\n }\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this._withMinMaxConstraint(() => event.key == 'ArrowLeft' ? this._dateApiValue!.subtractDays(1) : this._dateApiValue!.addDays(1));\n this._show();\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this._withMinMaxConstraint(() => event.key == 'ArrowUp' ? this._dateApiValue!.subtractWeeks(1) : this._dateApiValue!.addWeeks(1));\n this._show();\n\n break;\n }\n case 'Escape':\n {\n this._pickerRequest.next(false);\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this._pickerRequest.next(true);\n }\n\n break;\n }\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Clears current value\n */\n protected _clearValue(): void\n {\n this._dateApiValue = null;\n this._isValid = true;\n this.currentValue = null;\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n */\n protected _minMaxConstraintTest(): boolean\n {\n return (!!this._minValue && this._dateApiValue!.isBefore(this._minValue)) ||\n (!!this._maxValue && this._dateApiValue!.isAfter(this._maxValue));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param code - Code that should be executed which can change current value\n */\n protected _withMinMaxConstraint(code: () => void): void\n {\n this._dateApiValue!.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this._minMaxConstraintTest())\n {\n this._dateApiValue?.resetOriginal();\n\n return;\n }\n\n this._valueChange.next();\n }\n\n /**\n * Shows current value in input\n */\n protected _show(): void\n {\n if(this._isValid)\n {\n this.currentValue = this._dateApiValue?.format(this._format) ?? null;\n }\n }\n}","<input type=\"text\"\r\n #input\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"handleBlur()\"\r\n (input)=\"handleInput()\"\r\n (click)=\"handleClick()\"\r\n (keydown)=\"handleKeyboard($any($event))\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder ?? ''\">"]}
@@ -8,7 +8,7 @@ export var DateTimeValueFormat;
8
8
  */
9
9
  DateTimeValueFormat[DateTimeValueFormat["DateInstance"] = 0] = "DateInstance";
10
10
  /**
11
- * Numeric unix timestamp in seconds
11
+ * Numeric unix timestamp in miliseconds
12
12
  */
13
13
  DateTimeValueFormat[DateTimeValueFormat["UnixTimestamp"] = 1] = "UnixTimestamp";
14
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/misc/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAqBX;AArBD,WAAY,mBAAmB;IAE3B;;OAEG;IACH,6EAAY,CAAA;IAEZ;;OAEG;IACH,+EAAa,CAAA;IAEb;;OAEG;IACH,mFAAe,CAAA;IAEf;;OAEG;IACH,6FAAoB,CAAA;AACxB,CAAC,EArBW,mBAAmB,KAAnB,mBAAmB,QAqB9B","sourcesContent":["/**\n * Available formats for date time value\n */\nexport enum DateTimeValueFormat\n{\n /**\n * Instance of date\n */\n DateInstance,\n\n /**\n * Numeric unix timestamp in seconds\n */\n UnixTimestamp,\n\n /**\n * Formatted date as string value\n */\n FormattedString,\n\n /**\n * Range of date instances from, to\n */\n RangeOfDateInstances,\n}"]}
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/misc/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAqBX;AArBD,WAAY,mBAAmB;IAE3B;;OAEG;IACH,6EAAY,CAAA;IAEZ;;OAEG;IACH,+EAAa,CAAA;IAEb;;OAEG;IACH,mFAAe,CAAA;IAEf;;OAEG;IACH,6FAAoB,CAAA;AACxB,CAAC,EArBW,mBAAmB,KAAnB,mBAAmB,QAqB9B","sourcesContent":["/**\n * Available formats for date time value\n */\nexport enum DateTimeValueFormat\n{\n /**\n * Instance of date\n */\n DateInstance,\n\n /**\n * Numeric unix timestamp in miliseconds\n */\n UnixTimestamp,\n\n /**\n * Formatted date as string value\n */\n FormattedString,\n\n /**\n * Range of date instances from, to\n */\n RangeOfDateInstances,\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/misc/types.ts"],"names":[],"mappings":"","sourcesContent":["import {DateTimeValue} from '../interfaces';\nimport {DateApiObject} from '../services';\n\n/**\n * Type that represents parsed date value or values in case of range\n */\nexport type DateTimeObjectValue<TDate = unknown> = DateApiObject<TDate>|[DateApiObject<TDate>|null, DateApiObject<TDate>|null];\n\n/**\n * Type that represents input output types that can be processed by date time\n */\nexport type DateTimeInputOutputValue<TDate = unknown> = string|number|DateTimeValue<TDate>|TDate;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/misc/types.ts"],"names":[],"mappings":"","sourcesContent":["import {DateTimeValue} from '../interfaces';\nimport {DateApiObject} from '../services';\n\n/**\n * Type that represents parsed date value or values in case of range\n */\nexport type DateTimeObjectValue<TDate = unknown> = DateApiObject<TDate>|[DateApiObject<TDate>|null, DateApiObject<TDate>|null];\n\n/**\n * Type that represents input output types that can be processed by date time\n */\nexport type DateTimeInputOutputValue<TDate = unknown> = string|number|DateTimeValue<TDate>|TDate|Date;\n"]}
@@ -99,4 +99,14 @@ export function isDateTimeValue(value) {
99
99
  nameof('from') in value &&
100
100
  nameof('to') in value;
101
101
  }
102
+ /**
103
+ * Gets single date time value, use in places where ranged date time can not be used
104
+ * @param value - Value to be examined
105
+ */
106
+ export function getSingleDateTimeValue(value) {
107
+ if (isDateTimeValue(value)) {
108
+ throw new Error('DateTime: Unable to apply ranged date time input as value restriction!');
109
+ }
110
+ return value;
111
+ }
102
112
  //# sourceMappingURL=utils.js.map