@progress/kendo-angular-inputs 13.2.1-develop.11 → 13.2.1-develop.13

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 (289) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +654 -0
  3. package/README.md +184 -0
  4. package/checkbox/checkbox.directive.d.ts +52 -0
  5. package/checkbox.module.d.ts +43 -0
  6. package/colorpicker/color-contrast-svg.component.d.ts +29 -0
  7. package/colorpicker/color-gradient-numeric-label.directive.d.ts +20 -0
  8. package/colorpicker/color-gradient.component.d.ts +281 -0
  9. package/colorpicker/color-input.component.d.ts +95 -0
  10. package/colorpicker/color-palette.component.d.ts +221 -0
  11. package/colorpicker/colorpicker.component.d.ts +383 -0
  12. package/colorpicker/constants.d.ts +41 -0
  13. package/colorpicker/contrast-validation.component.d.ts +24 -0
  14. package/colorpicker/contrast.component.d.ts +25 -0
  15. package/colorpicker/events/active-color-click-event.d.ts +53 -0
  16. package/colorpicker/events/cancel-event.d.ts +15 -0
  17. package/colorpicker/events/close-event.d.ts +10 -0
  18. package/colorpicker/events/kendo-drag-event.d.ts +21 -0
  19. package/colorpicker/events/open-event.d.ts +10 -0
  20. package/colorpicker/events.d.ts +8 -0
  21. package/colorpicker/flatcolorpicker-actions.component.d.ts +24 -0
  22. package/colorpicker/flatcolorpicker-header.component.d.ts +43 -0
  23. package/colorpicker/flatcolorpicker.component.d.ts +267 -0
  24. package/colorpicker/focus-on-dom-ready.directive.d.ts +18 -0
  25. package/colorpicker/localization/colorgradient-localization.service.d.ts +17 -0
  26. package/colorpicker/localization/colorpalette-localization.service.d.ts +17 -0
  27. package/colorpicker/localization/colorpicker-localization.service.d.ts +14 -0
  28. package/colorpicker/localization/custom-messages.component.d.ts +17 -0
  29. package/colorpicker/localization/flatcolorpicker-localization.service.d.ts +17 -0
  30. package/colorpicker/localization/localized-colorpicker-messages.directive.d.ts +16 -0
  31. package/colorpicker/localization/messages.d.ts +121 -0
  32. package/colorpicker/models/actions-layout.d.ts +8 -0
  33. package/colorpicker/models/colorpicker-view.d.ts +8 -0
  34. package/colorpicker/models/gradient-settings.d.ts +35 -0
  35. package/colorpicker/models/hsva.d.ts +13 -0
  36. package/colorpicker/models/output-format.d.ts +8 -0
  37. package/colorpicker/models/palette-presets.d.ts +61 -0
  38. package/colorpicker/models/palette-settings.d.ts +33 -0
  39. package/colorpicker/models/popup-settings.d.ts +18 -0
  40. package/colorpicker/models/rgb.d.ts +12 -0
  41. package/colorpicker/models/rgba.d.ts +13 -0
  42. package/colorpicker/models/table-cell.d.ts +11 -0
  43. package/colorpicker/models/tile-size.d.ts +11 -0
  44. package/colorpicker/models.d.ts +16 -0
  45. package/colorpicker/services/color-palette.service.d.ts +19 -0
  46. package/colorpicker/services/flatcolorpicker.service.d.ts +15 -0
  47. package/colorpicker/utils/color-parser.d.ts +77 -0
  48. package/colorpicker/utils/contrast-curve.d.ts +37 -0
  49. package/colorpicker/utils.d.ts +6 -0
  50. package/colorpicker.module.d.ts +35 -0
  51. package/common/dom-utils.d.ts +25 -0
  52. package/common/math.d.ts +36 -0
  53. package/common/models/fillmode.d.ts +9 -0
  54. package/common/models/rounded.d.ts +14 -0
  55. package/common/models/size.d.ts +9 -0
  56. package/common/models/styling-classes.d.ts +11 -0
  57. package/common/models.d.ts +8 -0
  58. package/common/utils.d.ts +56 -0
  59. package/esm2020/checkbox/checkbox.directive.mjs +94 -0
  60. package/esm2020/checkbox.module.mjs +52 -0
  61. package/esm2020/colorpicker/color-contrast-svg.component.mjs +97 -0
  62. package/esm2020/colorpicker/color-gradient-numeric-label.directive.mjs +31 -0
  63. package/esm2020/colorpicker/color-gradient.component.mjs +1003 -0
  64. package/esm2020/colorpicker/color-input.component.mjs +433 -0
  65. package/esm2020/colorpicker/color-palette.component.mjs +553 -0
  66. package/esm2020/colorpicker/colorpicker.component.mjs +1086 -0
  67. package/esm2020/colorpicker/constants.mjs +40 -0
  68. package/esm2020/colorpicker/contrast-validation.component.mjs +72 -0
  69. package/esm2020/colorpicker/contrast.component.mjs +100 -0
  70. package/esm2020/colorpicker/events/active-color-click-event.mjs +58 -0
  71. package/esm2020/colorpicker/events/cancel-event.mjs +14 -0
  72. package/esm2020/colorpicker/events/close-event.mjs +10 -0
  73. package/esm2020/colorpicker/events/kendo-drag-event.mjs +5 -0
  74. package/esm2020/colorpicker/events/open-event.mjs +10 -0
  75. package/esm2020/colorpicker/events.mjs +8 -0
  76. package/esm2020/colorpicker/flatcolorpicker-actions.component.mjs +93 -0
  77. package/esm2020/colorpicker/flatcolorpicker-header.component.mjs +217 -0
  78. package/esm2020/colorpicker/flatcolorpicker.component.mjs +829 -0
  79. package/esm2020/colorpicker/focus-on-dom-ready.directive.mjs +29 -0
  80. package/esm2020/colorpicker/localization/colorgradient-localization.service.mjs +45 -0
  81. package/esm2020/colorpicker/localization/colorpalette-localization.service.mjs +45 -0
  82. package/esm2020/colorpicker/localization/colorpicker-localization.service.mjs +31 -0
  83. package/esm2020/colorpicker/localization/custom-messages.component.mjs +41 -0
  84. package/esm2020/colorpicker/localization/flatcolorpicker-localization.service.mjs +45 -0
  85. package/esm2020/colorpicker/localization/localized-colorpicker-messages.directive.mjs +37 -0
  86. package/esm2020/colorpicker/localization/messages.mjs +75 -0
  87. package/esm2020/colorpicker/models/actions-layout.mjs +5 -0
  88. package/esm2020/colorpicker/models/colorpicker-view.mjs +5 -0
  89. package/esm2020/colorpicker/models/gradient-settings.mjs +5 -0
  90. package/esm2020/colorpicker/models/hsva.mjs +5 -0
  91. package/esm2020/colorpicker/models/output-format.mjs +5 -0
  92. package/esm2020/colorpicker/models/palette-presets.mjs +62 -0
  93. package/esm2020/colorpicker/models/palette-settings.mjs +5 -0
  94. package/esm2020/colorpicker/models/popup-settings.mjs +5 -0
  95. package/esm2020/colorpicker/models/rgb.mjs +5 -0
  96. package/esm2020/colorpicker/models/rgba.mjs +5 -0
  97. package/esm2020/colorpicker/models/table-cell.mjs +5 -0
  98. package/esm2020/colorpicker/models/tile-size.mjs +6 -0
  99. package/esm2020/colorpicker/models.mjs +16 -0
  100. package/esm2020/colorpicker/services/color-palette.service.mjs +67 -0
  101. package/esm2020/colorpicker/services/flatcolorpicker.service.mjs +39 -0
  102. package/esm2020/colorpicker/utils/color-parser.mjs +164 -0
  103. package/esm2020/colorpicker/utils/contrast-curve.mjs +85 -0
  104. package/esm2020/colorpicker/utils.mjs +6 -0
  105. package/esm2020/colorpicker.module.mjs +104 -0
  106. package/esm2020/common/dom-utils.mjs +36 -0
  107. package/esm2020/common/math.mjs +65 -0
  108. package/esm2020/common/models/fillmode.mjs +5 -0
  109. package/esm2020/common/models/rounded.mjs +5 -0
  110. package/esm2020/common/models/size.mjs +5 -0
  111. package/esm2020/common/models/styling-classes.mjs +5 -0
  112. package/esm2020/common/models.mjs +8 -0
  113. package/esm2020/common/utils.mjs +81 -0
  114. package/esm2020/formfield/error.component.mjs +68 -0
  115. package/esm2020/formfield/formfield.component.mjs +284 -0
  116. package/esm2020/formfield/hint.component.mjs +63 -0
  117. package/esm2020/formfield/models/message-align.mjs +5 -0
  118. package/esm2020/formfield/models/orientation.mjs +5 -0
  119. package/esm2020/formfield/models/show-options.mjs +5 -0
  120. package/esm2020/formfield.module.mjs +54 -0
  121. package/esm2020/index.mjs +66 -0
  122. package/esm2020/inputs.module.mjs +98 -0
  123. package/esm2020/maskedtextbox/maskedtextbox.component.mjs +711 -0
  124. package/esm2020/maskedtextbox/masking.service.mjs +191 -0
  125. package/esm2020/maskedtextbox/parsing/combinators.mjs +28 -0
  126. package/esm2020/maskedtextbox/parsing/parsers.mjs +147 -0
  127. package/esm2020/maskedtextbox/parsing/result.mjs +41 -0
  128. package/esm2020/maskedtextbox/parsing/stream.mjs +41 -0
  129. package/esm2020/maskedtextbox.module.mjs +53 -0
  130. package/esm2020/numerictextbox/arrow-direction.mjs +13 -0
  131. package/esm2020/numerictextbox/constants.mjs +28 -0
  132. package/esm2020/numerictextbox/localization/custom-messages.component.mjs +41 -0
  133. package/esm2020/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +37 -0
  134. package/esm2020/numerictextbox/localization/messages.mjs +25 -0
  135. package/esm2020/numerictextbox/numerictextbox.component.mjs +1105 -0
  136. package/esm2020/numerictextbox/utils.mjs +92 -0
  137. package/esm2020/numerictextbox.module.mjs +66 -0
  138. package/esm2020/package-metadata.mjs +15 -0
  139. package/esm2020/progress-kendo-angular-inputs.mjs +8 -0
  140. package/esm2020/radiobutton/radiobutton.directive.mjs +76 -0
  141. package/esm2020/radiobutton.module.mjs +52 -0
  142. package/esm2020/rangeslider/localization/custom-messages.component.mjs +41 -0
  143. package/esm2020/rangeslider/localization/localized-rangeslider-messages.directive.mjs +37 -0
  144. package/esm2020/rangeslider/localization/messages.mjs +25 -0
  145. package/esm2020/rangeslider/rangeslider-model.mjs +52 -0
  146. package/esm2020/rangeslider/rangeslider-value.type.mjs +5 -0
  147. package/esm2020/rangeslider/rangeslider.component.mjs +605 -0
  148. package/esm2020/rangeslider.module.mjs +71 -0
  149. package/esm2020/shared/input-separator.component.mjs +41 -0
  150. package/esm2020/shared/textarea.directive.mjs +260 -0
  151. package/esm2020/shared/utils.mjs +13 -0
  152. package/esm2020/shared.module.mjs +32 -0
  153. package/esm2020/signature/events/close-event.mjs +10 -0
  154. package/esm2020/signature/events/index.mjs +6 -0
  155. package/esm2020/signature/events/open-event.mjs +10 -0
  156. package/esm2020/signature/localization/custom-messages.component.mjs +41 -0
  157. package/esm2020/signature/localization/index.mjs +7 -0
  158. package/esm2020/signature/localization/localized-signature-messages.directive.mjs +37 -0
  159. package/esm2020/signature/localization/messages.mjs +29 -0
  160. package/esm2020/signature/signature.component.mjs +906 -0
  161. package/esm2020/signature.module.mjs +79 -0
  162. package/esm2020/slider/localization/custom-messages.component.mjs +41 -0
  163. package/esm2020/slider/localization/localized-slider-messages.directive.mjs +37 -0
  164. package/esm2020/slider/localization/messages.mjs +27 -0
  165. package/esm2020/slider/slider-model.mjs +34 -0
  166. package/esm2020/slider/slider.component.mjs +646 -0
  167. package/esm2020/slider.module.mjs +73 -0
  168. package/esm2020/sliders-common/label-template.directive.mjs +45 -0
  169. package/esm2020/sliders-common/slider-base.mjs +255 -0
  170. package/esm2020/sliders-common/slider-model.base.mjs +93 -0
  171. package/esm2020/sliders-common/slider-ticks.component.mjs +125 -0
  172. package/esm2020/sliders-common/sliders-common.module.mjs +42 -0
  173. package/esm2020/sliders-common/sliders-util.mjs +219 -0
  174. package/esm2020/sliders-common/title-callback.mjs +5 -0
  175. package/esm2020/switch/events/blur-event.mjs +9 -0
  176. package/esm2020/switch/events/focus-event.mjs +9 -0
  177. package/esm2020/switch/localization/custom-messages.component.mjs +41 -0
  178. package/esm2020/switch/localization/localized-switch-messages.directive.mjs +37 -0
  179. package/esm2020/switch/localization/messages.mjs +25 -0
  180. package/esm2020/switch/switch.component.mjs +577 -0
  181. package/esm2020/switch.module.mjs +68 -0
  182. package/esm2020/text-fields-common/text-fields-base.mjs +128 -0
  183. package/esm2020/textarea/models/flow.mjs +5 -0
  184. package/esm2020/textarea/models/resize.mjs +5 -0
  185. package/esm2020/textarea/textarea-suffix.component.mjs +40 -0
  186. package/esm2020/textarea/textarea.component.mjs +604 -0
  187. package/esm2020/textarea.module.mjs +68 -0
  188. package/esm2020/textbox/localization/custom-messages.component.mjs +41 -0
  189. package/esm2020/textbox/localization/localized-textbox-messages.directive.mjs +37 -0
  190. package/esm2020/textbox/localization/messages.mjs +23 -0
  191. package/esm2020/textbox/models/icon-show-options.mjs +5 -0
  192. package/esm2020/textbox/textbox-prefix.directive.mjs +38 -0
  193. package/esm2020/textbox/textbox-suffix.directive.mjs +37 -0
  194. package/esm2020/textbox/textbox.component.mjs +849 -0
  195. package/esm2020/textbox/textbox.directive.mjs +121 -0
  196. package/esm2020/textbox.module.mjs +89 -0
  197. package/esm2020/validators/max.validator.mjs +21 -0
  198. package/esm2020/validators/min.validator.mjs +21 -0
  199. package/fesm2015/progress-kendo-angular-inputs.mjs +15090 -0
  200. package/fesm2020/progress-kendo-angular-inputs.mjs +15055 -0
  201. package/formfield/error.component.d.ts +31 -0
  202. package/formfield/formfield.component.d.ts +98 -0
  203. package/formfield/hint.component.d.ts +29 -0
  204. package/formfield/models/message-align.d.ts +8 -0
  205. package/formfield/models/orientation.d.ts +9 -0
  206. package/formfield/models/show-options.d.ts +16 -0
  207. package/formfield.module.d.ts +45 -0
  208. package/index.d.ts +76 -0
  209. package/inputs.module.d.ts +55 -0
  210. package/maskedtextbox/maskedtextbox.component.d.ts +315 -0
  211. package/maskedtextbox/masking.service.d.ts +48 -0
  212. package/maskedtextbox/parsing/combinators.d.ts +13 -0
  213. package/maskedtextbox/parsing/parsers.d.ts +51 -0
  214. package/maskedtextbox/parsing/result.d.ts +27 -0
  215. package/maskedtextbox/parsing/stream.d.ts +26 -0
  216. package/maskedtextbox.module.d.ts +44 -0
  217. package/numerictextbox/arrow-direction.d.ts +12 -0
  218. package/numerictextbox/constants.d.ts +28 -0
  219. package/numerictextbox/localization/custom-messages.component.d.ts +17 -0
  220. package/numerictextbox/localization/localized-numerictextbox-messages.directive.d.ts +16 -0
  221. package/numerictextbox/localization/messages.d.ts +21 -0
  222. package/numerictextbox/numerictextbox.component.d.ts +364 -0
  223. package/numerictextbox/utils.d.ts +44 -0
  224. package/numerictextbox.module.d.ts +47 -0
  225. package/package-metadata.d.ts +9 -0
  226. package/package.json +74 -0
  227. package/progress-kendo-angular-inputs.d.ts +9 -0
  228. package/radiobutton/radiobutton.directive.d.ts +38 -0
  229. package/radiobutton.module.d.ts +43 -0
  230. package/rangeslider/localization/custom-messages.component.d.ts +17 -0
  231. package/rangeslider/localization/localized-rangeslider-messages.directive.d.ts +16 -0
  232. package/rangeslider/localization/messages.d.ts +21 -0
  233. package/rangeslider/rangeslider-model.d.ts +15 -0
  234. package/rangeslider/rangeslider-value.type.d.ts +9 -0
  235. package/rangeslider/rangeslider.component.d.ts +139 -0
  236. package/rangeslider.module.d.ts +48 -0
  237. package/schematics/collection.json +12 -0
  238. package/schematics/ngAdd/index.js +11 -0
  239. package/schematics/ngAdd/schema.json +28 -0
  240. package/shared/input-separator.component.d.ts +28 -0
  241. package/shared/textarea.directive.d.ts +99 -0
  242. package/shared/utils.d.ts +10 -0
  243. package/shared.module.d.ts +19 -0
  244. package/signature/events/close-event.d.ts +10 -0
  245. package/signature/events/index.d.ts +6 -0
  246. package/signature/events/open-event.d.ts +10 -0
  247. package/signature/localization/custom-messages.component.d.ts +17 -0
  248. package/signature/localization/index.d.ts +7 -0
  249. package/signature/localization/localized-signature-messages.directive.d.ts +16 -0
  250. package/signature/localization/messages.d.ts +29 -0
  251. package/signature/signature.component.d.ts +364 -0
  252. package/signature.module.d.ts +48 -0
  253. package/slider/localization/custom-messages.component.d.ts +17 -0
  254. package/slider/localization/localized-slider-messages.directive.d.ts +16 -0
  255. package/slider/localization/messages.d.ts +25 -0
  256. package/slider/slider-model.d.ts +14 -0
  257. package/slider/slider.component.d.ts +175 -0
  258. package/slider.module.d.ts +50 -0
  259. package/sliders-common/label-template.directive.d.ts +36 -0
  260. package/sliders-common/slider-base.d.ts +141 -0
  261. package/sliders-common/slider-model.base.d.ts +26 -0
  262. package/sliders-common/slider-ticks.component.d.ts +26 -0
  263. package/sliders-common/sliders-common.module.d.ts +17 -0
  264. package/sliders-common/sliders-util.d.ts +119 -0
  265. package/sliders-common/title-callback.d.ts +10 -0
  266. package/switch/events/blur-event.d.ts +13 -0
  267. package/switch/events/focus-event.d.ts +13 -0
  268. package/switch/localization/custom-messages.component.d.ts +17 -0
  269. package/switch/localization/localized-switch-messages.directive.d.ts +16 -0
  270. package/switch/localization/messages.d.ts +21 -0
  271. package/switch/switch.component.d.ts +216 -0
  272. package/switch.module.d.ts +46 -0
  273. package/text-fields-common/text-fields-base.d.ts +91 -0
  274. package/textarea/models/flow.d.ts +12 -0
  275. package/textarea/models/resize.d.ts +16 -0
  276. package/textarea/textarea-suffix.component.d.ts +26 -0
  277. package/textarea/textarea.component.d.ts +225 -0
  278. package/textarea.module.d.ts +48 -0
  279. package/textbox/localization/custom-messages.component.d.ts +17 -0
  280. package/textbox/localization/localized-textbox-messages.directive.d.ts +16 -0
  281. package/textbox/localization/messages.d.ts +17 -0
  282. package/textbox/models/icon-show-options.d.ts +13 -0
  283. package/textbox/textbox-prefix.directive.d.ts +29 -0
  284. package/textbox/textbox-suffix.directive.d.ts +28 -0
  285. package/textbox/textbox.component.d.ts +376 -0
  286. package/textbox/textbox.directive.d.ts +59 -0
  287. package/textbox.module.d.ts +53 -0
  288. package/validators/max.validator.d.ts +8 -0
  289. package/validators/min.validator.d.ts +8 -0
@@ -0,0 +1,711 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Component, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, Optional, Output, Renderer2, ViewChild, forwardRef, NgZone, Injector, isDevMode, ChangeDetectorRef } from '@angular/core';
6
+ import { NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
7
+ import { guid, hasObservers, isChanged, KendoInput } from '@progress/kendo-angular-common';
8
+ import { RTL } from '@progress/kendo-angular-l10n';
9
+ import { validatePackage } from '@progress/kendo-licensing';
10
+ import { packageMetadata } from '../package-metadata';
11
+ import { MaskingService } from './masking.service';
12
+ import { invokeElementMethod } from '../common/dom-utils';
13
+ import { requiresZoneOnBlur, isPresent, getStylingClasses } from '../common/utils';
14
+ import * as i0 from "@angular/core";
15
+ import * as i1 from "./masking.service";
16
+ import * as i2 from "@progress/kendo-angular-common";
17
+ const resolvedPromise = Promise.resolve(null);
18
+ const FOCUSED = 'k-focus';
19
+ const DEFAULT_SIZE = 'medium';
20
+ const DEFAULT_ROUNDED = 'medium';
21
+ const DEFAULT_FILL_MODE = 'solid';
22
+ /**
23
+ * Represents the [Kendo UI MaskedTextBox component for Angular]({% slug overview_maskedtextbox %}).
24
+ *
25
+ * @example
26
+ * ```ts-no-run
27
+ *
28
+ * _@Component({
29
+ * selector: 'my-app',
30
+ * template: `
31
+ * <kendo-maskedtextbox
32
+ * [mask]="mask"
33
+ * [value]="value">
34
+ * </kendo-maskedtextbox>
35
+ * `
36
+ * })
37
+ *
38
+ * class AppComponent {
39
+ * public value: string = "9580128055807792";
40
+ * public mask: string = "0000-0000-0000-0000";
41
+ * }
42
+ * ```
43
+ */
44
+ export class MaskedTextBoxComponent {
45
+ constructor(service, renderer, hostElement, ngZone, injector, changeDetector, rtl) {
46
+ this.service = service;
47
+ this.renderer = renderer;
48
+ this.hostElement = hostElement;
49
+ this.ngZone = ngZone;
50
+ this.injector = injector;
51
+ this.changeDetector = changeDetector;
52
+ /**
53
+ * @hidden
54
+ */
55
+ this.focusableId = `k-${guid()}`;
56
+ /**
57
+ * Determines whether the MaskedTextBox is disabled ([see example]({% slug disabled_maskedtextbox %})).
58
+ */
59
+ this.disabled = false;
60
+ /**
61
+ * Determines whether the MaskedTextBox is in its read-only state ([see example]({% slug readonly_maskedtextbox %})).
62
+ */
63
+ this.readonly = false;
64
+ /**
65
+ * Represents a prompt character for the masked value.
66
+ * @default `_`
67
+ */
68
+ this.prompt = '_';
69
+ /**
70
+ * Indicates a character which represents an empty position in the raw value.
71
+ * @default ' '
72
+ */
73
+ this.promptPlaceholder = ' ';
74
+ /**
75
+ * Indicates whether to include literals in the raw value ([see example]({% slug value_maskedtextbox %})).
76
+ * @default false
77
+ */
78
+ this.includeLiterals = false;
79
+ /**
80
+ * Specifies if the mask should be shown on focus for empty value.
81
+ */
82
+ this.maskOnFocus = false;
83
+ /**
84
+ * Determines whether the built-in mask validator is enforced when a form is validated
85
+ * ([see example]({% slug validation_maskedtextbox %})).
86
+ * @default true
87
+ */
88
+ this.maskValidation = true;
89
+ /**
90
+ * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
91
+ */
92
+ this.tabindex = 0;
93
+ /**
94
+ * Fires each time the user focuses the `input` element.
95
+ *
96
+ * > To wire the event programmatically, use the `onFocus` property.
97
+ *
98
+ * @example
99
+ * ```ts-no-run
100
+ * _@Component({
101
+ * selector: 'my-app',
102
+ * template: `
103
+ * <kendo-maskedtextbox (focus)="handleFocus()"></kendo-maskedtextbox>
104
+ * `
105
+ * })
106
+ * class AppComponent {
107
+ * public handleFocus(): void {
108
+ * console.log("Component is focused");
109
+ * }
110
+ * }
111
+ * ```
112
+ */
113
+ this.onFocus = new EventEmitter();
114
+ /**
115
+ * Fires each time the `input` element gets blurred.
116
+ *
117
+ * > To wire the event programmatically, use the `onBlur` property.
118
+ *
119
+ * @example
120
+ * ```ts-no-run
121
+ * _@Component({
122
+ * selector: 'my-app',
123
+ * template: `
124
+ * <kendo-maskedtextbox (blur)="handleBlur()"></kendo-maskedtextbox>
125
+ * `
126
+ * })
127
+ * class AppComponent {
128
+ * public handleBlur(): void {
129
+ * console.log("Component is blurred");
130
+ * }
131
+ * }
132
+ * ```
133
+ */
134
+ this.onBlur = new EventEmitter();
135
+ /**
136
+ * Fires each time the value changes.
137
+ */
138
+ this.valueChange = new EventEmitter();
139
+ this.hostClasses = true;
140
+ this.focusClick = false;
141
+ this.defaultRules = {
142
+ "#": /[\d\s\+\-]/,
143
+ "&": /[\S]/,
144
+ "0": /[\d]/,
145
+ "9": /[\d\s]/,
146
+ "?": /[a-zA-Z\s]/,
147
+ "A": /[a-zA-Z0-9]/,
148
+ "C": /./,
149
+ "L": /[a-zA-Z]/,
150
+ "a": /[a-zA-Z0-9\s]/
151
+ };
152
+ this.isPasted = false;
153
+ this.selection = [0, 0];
154
+ this._size = 'medium';
155
+ this._rounded = 'medium';
156
+ this._fillMode = 'solid';
157
+ /**
158
+ * @hidden
159
+ */
160
+ this.handleFocus = () => {
161
+ this.focused = true;
162
+ if (this.maskOnFocus && this.emptyMask) {
163
+ this.updateInput(this.service.maskRaw(this.value));
164
+ this.ngZone.runOutsideAngular(() => {
165
+ setTimeout(() => { this.setSelection(0, 0); }, 0);
166
+ });
167
+ }
168
+ if (hasObservers(this.onFocus)) {
169
+ this.ngZone.run(() => {
170
+ this.onFocus.emit();
171
+ });
172
+ }
173
+ };
174
+ /**
175
+ * @hidden
176
+ */
177
+ this.handleClick = () => {
178
+ if (this.focused && !this.focusClick) {
179
+ this.focusClick = true;
180
+ const { selectionStart, selectionEnd } = this.input.nativeElement;
181
+ if (selectionStart === selectionEnd) {
182
+ this.setFocusSelection();
183
+ }
184
+ }
185
+ };
186
+ /**
187
+ * @hidden
188
+ */
189
+ this.handleBlur = () => {
190
+ this.changeDetector.markForCheck();
191
+ this.focused = false;
192
+ this.focusClick = false;
193
+ if (this.maskOnFocus && this.emptyMask) {
194
+ this.updateInput(this.maskedValue);
195
+ }
196
+ if (hasObservers(this.onBlur) || requiresZoneOnBlur(this.control)) {
197
+ this.ngZone.run(() => {
198
+ this.onTouched();
199
+ this.onBlur.emit();
200
+ });
201
+ }
202
+ };
203
+ this.onChange = (_) => { };
204
+ this.onTouched = () => { };
205
+ validatePackage(packageMetadata);
206
+ this.direction = rtl ? 'rtl' : 'ltr';
207
+ this.updateService();
208
+ }
209
+ /**
210
+ * The size property specifies the padding of the MaskedTextBox internal input element
211
+ * ([see example]({% slug appearance_maskedtextbox %}#toc-size)).
212
+ * The possible values are:
213
+ * * `small`
214
+ * * `medium` (default)
215
+ * * `large`
216
+ * * `none`
217
+ */
218
+ set size(size) {
219
+ const newSize = size ? size : DEFAULT_SIZE;
220
+ this.handleClasses(newSize, 'size');
221
+ this._size = newSize;
222
+ }
223
+ get size() {
224
+ return this._size;
225
+ }
226
+ /**
227
+ * The rounded property specifies the border radius of the MaskedTextBox
228
+ * ([see example]({% slug appearance_maskedtextbox %}#toc-rounded)).
229
+ * The possible values are:
230
+ * * `small`
231
+ * * `medium` (default)
232
+ * * `large`
233
+ * * `none`
234
+ */
235
+ set rounded(rounded) {
236
+ const newRounded = rounded ? rounded : DEFAULT_ROUNDED;
237
+ this.handleClasses(newRounded, 'rounded');
238
+ this._rounded = newRounded;
239
+ }
240
+ get rounded() {
241
+ return this._rounded;
242
+ }
243
+ /**
244
+ * The fillMode property specifies the background and border styles of the MaskedTexBox
245
+ * ([see example]({% slug appearance_maskedtextbox %}#toc-fillMode)).
246
+ * The possible values are:
247
+ * * `flat`
248
+ * * `solid` (default)
249
+ * * `outline`
250
+ * * `none`
251
+ */
252
+ set fillMode(fillMode) {
253
+ const newFillMode = fillMode ? fillMode : DEFAULT_FILL_MODE;
254
+ this.handleClasses(newFillMode, 'fillMode');
255
+ this._fillMode = newFillMode;
256
+ }
257
+ get fillMode() {
258
+ return this._fillMode;
259
+ }
260
+ /**
261
+ * Exposes the RegExp-based mask validation array ([see example]({% slug masks_maskedtextbox %})).
262
+ */
263
+ set rules(value) {
264
+ this._rules = Object.assign({}, this.defaultRules, value);
265
+ }
266
+ get rules() {
267
+ return this._rules || this.defaultRules;
268
+ }
269
+ /**
270
+ * @hidden
271
+ */
272
+ set tabIndex(tabIndex) {
273
+ this.tabindex = tabIndex;
274
+ }
275
+ get tabIndex() {
276
+ return this.tabindex;
277
+ }
278
+ get hostDisabledClass() {
279
+ return this.disabled;
280
+ }
281
+ ngOnInit() {
282
+ if (this.hostElement) {
283
+ this.renderer.removeAttribute(this.hostElement.nativeElement, "tabindex");
284
+ }
285
+ this.control = this.injector.get(NgControl, null);
286
+ }
287
+ ngAfterViewInit() {
288
+ const stylingInputs = ['size', 'rounded', 'fillMode'];
289
+ stylingInputs.forEach(input => {
290
+ this.handleClasses(this[input], input);
291
+ });
292
+ }
293
+ /**
294
+ * @hidden
295
+ * Used by the FloatingLabel to determine if the MaskedTextBox is empty.
296
+ */
297
+ isEmpty() {
298
+ if (this.input) {
299
+ return !this.input.nativeElement.value;
300
+ }
301
+ }
302
+ /**
303
+ * @hidden
304
+ */
305
+ handleDragDrop() {
306
+ return false;
307
+ }
308
+ /**
309
+ * Focuses the MaskedTextBox.
310
+ *
311
+ * @example
312
+ * ```ts-no-run
313
+ * _@Component({
314
+ * selector: 'my-app',
315
+ * template: `
316
+ * <button (click)="maskedinput.focus()">Focus the input</button>
317
+ * <kendo-maskedtextbox #maskedinput></kendo-maskedtextbox>
318
+ * `
319
+ * })
320
+ * class AppComponent { }
321
+ * ```
322
+ */
323
+ focus() {
324
+ if (!this.input) {
325
+ return;
326
+ }
327
+ this.input.nativeElement.focus();
328
+ this.setFocusSelection();
329
+ }
330
+ /**
331
+ * Blurs the MaskedTextBox.
332
+ */
333
+ blur() {
334
+ if (!this.input) {
335
+ return;
336
+ }
337
+ this.input.nativeElement.blur();
338
+ }
339
+ /**
340
+ * @hidden
341
+ */
342
+ pasteHandler(e) {
343
+ const { selectionStart, selectionEnd } = e.target;
344
+ if (selectionEnd === selectionStart) {
345
+ return;
346
+ }
347
+ this.isPasted = true;
348
+ this.selection = [selectionStart, selectionEnd];
349
+ }
350
+ /**
351
+ * @hidden
352
+ */
353
+ inputHandler(e) {
354
+ const value = e.target.value;
355
+ const [start, end] = this.selection;
356
+ if (!this.mask) {
357
+ this.updateValueWithEvents(value);
358
+ this.isPasted = false;
359
+ return;
360
+ }
361
+ let result;
362
+ if (this.isPasted) {
363
+ this.isPasted = false;
364
+ const rightPart = this.maskedValue.length - end;
365
+ const to = value.length - rightPart;
366
+ result = this.service.maskInRange(value.slice(start, to), this.maskedValue, start, end);
367
+ }
368
+ else {
369
+ result = this.service.maskInput(value, this.maskedValue || '', e.target.selectionStart);
370
+ }
371
+ this.updateInput(result.value, result.selection);
372
+ this.updateValueWithEvents(result.value);
373
+ }
374
+ /**
375
+ * @hidden
376
+ */
377
+ ngOnChanges(changes) {
378
+ if (changes['value']) {
379
+ this.value = this.normalizeValue();
380
+ }
381
+ if (!this.mask) {
382
+ this.updateInput(this.value);
383
+ return;
384
+ }
385
+ const next = this.extractChanges(changes);
386
+ this.updateService(next);
387
+ const maskedValue = this.service.maskRaw(this.value);
388
+ this.updateInput(maskedValue, null, true);
389
+ if (changes['includeLiterals'] || isChanged('promptPlaceholder', changes)) {
390
+ resolvedPromise.then(() => {
391
+ this.updateValueWithEvents(this.maskedValue);
392
+ });
393
+ }
394
+ }
395
+ /**
396
+ * @hidden
397
+ * Writes a new value to the element.
398
+ */
399
+ writeValue(value) {
400
+ this.value = this.normalizeValue(value);
401
+ this.updateInput(this.service.maskRaw(this.value));
402
+ if (this.includeLiterals) {
403
+ this.updateValue(this.maskedValue);
404
+ }
405
+ }
406
+ /**
407
+ * @hidden
408
+ * Sets the function that will be called when a `change` event is triggered.
409
+ */
410
+ registerOnChange(fn) {
411
+ this.onChange = fn;
412
+ }
413
+ /**
414
+ * @hidden
415
+ * Sets the function that will be called when a `touch` event is triggered.
416
+ */
417
+ registerOnTouched(fn) {
418
+ this.onTouched = fn;
419
+ }
420
+ /**
421
+ * @hidden
422
+ * Called when the status of the component changes to or from `disabled`.
423
+ * Depending on the value, it enables or disables the appropriate DOM element.
424
+ *
425
+ * @param isDisabled
426
+ */
427
+ setDisabledState(isDisabled) {
428
+ this.changeDetector.markForCheck();
429
+ this.disabled = isDisabled;
430
+ }
431
+ /**
432
+ * @hidden
433
+ */
434
+ validate(_) {
435
+ if (this.maskValidation === false || !this.mask) {
436
+ return null;
437
+ }
438
+ if (!this.service.validationValue(this.maskedValue)) {
439
+ return null;
440
+ }
441
+ if (this.maskedValue.indexOf(this.prompt) !== -1) {
442
+ return {
443
+ patternError: {
444
+ mask: this.mask,
445
+ maskedValue: this.maskedValue,
446
+ value: this.value
447
+ }
448
+ };
449
+ }
450
+ return null;
451
+ }
452
+ /**
453
+ * @hidden
454
+ */
455
+ get isControlInvalid() {
456
+ return this.control && this.control.touched && !this.control.valid;
457
+ }
458
+ /**
459
+ * @hidden
460
+ */
461
+ updateValueWithEvents(maskedValue) {
462
+ this.updateValue(maskedValue);
463
+ if (hasObservers(this.valueChange)) {
464
+ this.valueChange.emit(this.value);
465
+ }
466
+ }
467
+ updateValue(value) {
468
+ if (this.mask && !this.service.validationValue(value) && !this.includeLiterals) {
469
+ this.value = '';
470
+ }
471
+ else {
472
+ this.value = this.service.rawValue(value);
473
+ }
474
+ this.onChange(this.value);
475
+ }
476
+ updateInput(maskedValue = '', selection, isFromOnChanges) {
477
+ if (isFromOnChanges && maskedValue === this.maskedValue) {
478
+ return;
479
+ }
480
+ this.maskedValue = maskedValue;
481
+ const value = this.maskOnFocus && !this.focused && this.emptyMask ? '' : maskedValue;
482
+ this.renderer.setProperty(this.input.nativeElement, "value", value);
483
+ if (selection !== undefined) {
484
+ this.setSelection(selection, selection);
485
+ }
486
+ }
487
+ extractChanges(changes) {
488
+ return Object.keys(changes).filter(key => key !== 'rules').reduce((obj, key) => {
489
+ obj[key] = changes[key].currentValue;
490
+ return obj;
491
+ }, {});
492
+ }
493
+ updateService(extra) {
494
+ const config = Object.assign({
495
+ includeLiterals: this.includeLiterals,
496
+ mask: this.mask,
497
+ prompt: this.prompt,
498
+ promptPlaceholder: this.promptPlaceholder,
499
+ rules: this.rules
500
+ }, extra);
501
+ this.service.update(config);
502
+ }
503
+ setSelection(start = this.selection[0], end = this.selection[1]) {
504
+ if (this.focused) {
505
+ invokeElementMethod(this.input, 'setSelectionRange', start, end);
506
+ }
507
+ }
508
+ get emptyMask() {
509
+ return this.service.maskRaw() === this.maskedValue;
510
+ }
511
+ setFocusSelection() {
512
+ const selectionStart = this.input.nativeElement.selectionStart;
513
+ const index = this.maskedValue ? this.maskedValue.indexOf(this.prompt) : 0;
514
+ if (index >= 0 && index < selectionStart) {
515
+ this.selection = [index, index];
516
+ this.setSelection();
517
+ }
518
+ }
519
+ get focused() {
520
+ return this.isFocused;
521
+ }
522
+ set focused(value) {
523
+ if (this.isFocused !== value && this.hostElement) {
524
+ const element = this.hostElement.nativeElement;
525
+ if (value) {
526
+ this.renderer.addClass(element, FOCUSED);
527
+ }
528
+ else {
529
+ this.renderer.removeClass(element, FOCUSED);
530
+ }
531
+ this.isFocused = value;
532
+ }
533
+ }
534
+ normalizeValue(value = this.value) {
535
+ const present = isPresent(value);
536
+ if (present && typeof value !== 'string') {
537
+ if (isDevMode()) {
538
+ throw new Error('The MaskedTextBox component supports only string values.');
539
+ }
540
+ return String(value);
541
+ }
542
+ return present ? value : '';
543
+ }
544
+ handleClasses(value, input) {
545
+ const elem = this.hostElement.nativeElement;
546
+ const classes = getStylingClasses('input', input, this[input], value);
547
+ if (classes.toRemove) {
548
+ this.renderer.removeClass(elem, classes.toRemove);
549
+ }
550
+ if (classes.toAdd) {
551
+ this.renderer.addClass(elem, classes.toAdd);
552
+ }
553
+ }
554
+ }
555
+ MaskedTextBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MaskedTextBoxComponent, deps: [{ token: i1.MaskingService }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: RTL, optional: true }], target: i0.ɵɵFactoryTarget.Component });
556
+ MaskedTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: MaskedTextBoxComponent, selector: "kendo-maskedtextbox", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", title: "title", size: "size", rounded: "rounded", fillMode: "fillMode", mask: "mask", value: "value", rules: "rules", prompt: "prompt", promptPlaceholder: "promptPlaceholder", includeLiterals: "includeLiterals", maskOnFocus: "maskOnFocus", maskValidation: "maskValidation", tabindex: "tabindex", tabIndex: "tabIndex" }, outputs: { onFocus: "focus", onBlur: "blur", valueChange: "valueChange" }, host: { listeners: { "paste": "pasteHandler($event)", "input": "inputHandler($event)" }, properties: { "attr.dir": "this.direction", "class.k-input": "this.hostClasses", "class.k-maskedtextbox": "this.hostClasses", "class.k-disabled": "this.hostDisabledClass" } }, providers: [
557
+ MaskingService,
558
+ {
559
+ multi: true,
560
+ provide: NG_VALUE_ACCESSOR,
561
+ useExisting: forwardRef(() => MaskedTextBoxComponent) /* eslint-disable-line*/
562
+ },
563
+ {
564
+ multi: true,
565
+ provide: NG_VALIDATORS,
566
+ useExisting: forwardRef(() => MaskedTextBoxComponent) /* eslint-disable-line*/
567
+ },
568
+ {
569
+ provide: KendoInput,
570
+ useExisting: forwardRef(() => MaskedTextBoxComponent)
571
+ }
572
+ ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, static: true }], exportAs: ["kendoMaskedTextBox"], usesOnChanges: true, ngImport: i0, template: `
573
+ <input type="text"
574
+ #input
575
+ autocomplete="off"
576
+ autocorrect="off"
577
+ autocapitalize="off"
578
+ spellcheck="false"
579
+ class="k-input-inner"
580
+ [id]="focusableId"
581
+ [tabindex]="tabIndex"
582
+ [attr.title]="title"
583
+ [attr.aria-placeholder]="mask"
584
+ [attr.aria-invalid]="isControlInvalid"
585
+ [disabled]="disabled"
586
+ [readonly]="readonly"
587
+ [kendoEventsOutsideAngular]="{
588
+ focus: handleFocus,
589
+ blur: handleBlur,
590
+ click: handleClick,
591
+ dragstart: handleDragDrop,
592
+ drop: handleDragDrop
593
+ }"
594
+ />
595
+ `, isInline: true, directives: [{ type: i2.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }] });
596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MaskedTextBoxComponent, decorators: [{
597
+ type: Component,
598
+ args: [{
599
+ exportAs: 'kendoMaskedTextBox',
600
+ providers: [
601
+ MaskingService,
602
+ {
603
+ multi: true,
604
+ provide: NG_VALUE_ACCESSOR,
605
+ useExisting: forwardRef(() => MaskedTextBoxComponent) /* eslint-disable-line*/
606
+ },
607
+ {
608
+ multi: true,
609
+ provide: NG_VALIDATORS,
610
+ useExisting: forwardRef(() => MaskedTextBoxComponent) /* eslint-disable-line*/
611
+ },
612
+ {
613
+ provide: KendoInput,
614
+ useExisting: forwardRef(() => MaskedTextBoxComponent)
615
+ }
616
+ ],
617
+ selector: 'kendo-maskedtextbox',
618
+ template: `
619
+ <input type="text"
620
+ #input
621
+ autocomplete="off"
622
+ autocorrect="off"
623
+ autocapitalize="off"
624
+ spellcheck="false"
625
+ class="k-input-inner"
626
+ [id]="focusableId"
627
+ [tabindex]="tabIndex"
628
+ [attr.title]="title"
629
+ [attr.aria-placeholder]="mask"
630
+ [attr.aria-invalid]="isControlInvalid"
631
+ [disabled]="disabled"
632
+ [readonly]="readonly"
633
+ [kendoEventsOutsideAngular]="{
634
+ focus: handleFocus,
635
+ blur: handleBlur,
636
+ click: handleClick,
637
+ dragstart: handleDragDrop,
638
+ drop: handleDragDrop
639
+ }"
640
+ />
641
+ `
642
+ }]
643
+ }], ctorParameters: function () { return [{ type: i1.MaskingService }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
644
+ type: Optional
645
+ }, {
646
+ type: Inject,
647
+ args: [RTL]
648
+ }] }]; }, propDecorators: { focusableId: [{
649
+ type: Input
650
+ }], disabled: [{
651
+ type: Input
652
+ }], readonly: [{
653
+ type: Input
654
+ }], title: [{
655
+ type: Input
656
+ }], size: [{
657
+ type: Input
658
+ }], rounded: [{
659
+ type: Input
660
+ }], fillMode: [{
661
+ type: Input
662
+ }], mask: [{
663
+ type: Input
664
+ }], value: [{
665
+ type: Input
666
+ }], rules: [{
667
+ type: Input
668
+ }], prompt: [{
669
+ type: Input
670
+ }], promptPlaceholder: [{
671
+ type: Input
672
+ }], includeLiterals: [{
673
+ type: Input
674
+ }], maskOnFocus: [{
675
+ type: Input
676
+ }], maskValidation: [{
677
+ type: Input
678
+ }], tabindex: [{
679
+ type: Input
680
+ }], tabIndex: [{
681
+ type: Input
682
+ }], onFocus: [{
683
+ type: Output,
684
+ args: ['focus']
685
+ }], onBlur: [{
686
+ type: Output,
687
+ args: ['blur']
688
+ }], valueChange: [{
689
+ type: Output
690
+ }], direction: [{
691
+ type: HostBinding,
692
+ args: ['attr.dir']
693
+ }], hostClasses: [{
694
+ type: HostBinding,
695
+ args: ['class.k-input']
696
+ }, {
697
+ type: HostBinding,
698
+ args: ['class.k-maskedtextbox']
699
+ }], hostDisabledClass: [{
700
+ type: HostBinding,
701
+ args: ['class.k-disabled']
702
+ }], input: [{
703
+ type: ViewChild,
704
+ args: ['input', { static: true }]
705
+ }], pasteHandler: [{
706
+ type: HostListener,
707
+ args: ['paste', ['$event']]
708
+ }], inputHandler: [{
709
+ type: HostListener,
710
+ args: ['input', ['$event']]
711
+ }] } });