@progress/kendo-angular-inputs 21.4.1 → 22.0.0-develop.1

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 (189) hide show
  1. package/colorpicker/localization/messages.d.ts +1 -1
  2. package/common/radio-checkbox.base.d.ts +1 -1
  3. package/fesm2022/progress-kendo-angular-inputs.mjs +321 -321
  4. package/numerictextbox/localization/messages.d.ts +1 -1
  5. package/otpinput/localization/messages.d.ts +1 -1
  6. package/package.json +17 -25
  7. package/rangeslider/localization/messages.d.ts +1 -1
  8. package/signature/localization/messages.d.ts +1 -1
  9. package/slider/localization/messages.d.ts +1 -1
  10. package/sliders-common/slider-base.d.ts +1 -1
  11. package/switch/localization/messages.d.ts +1 -1
  12. package/text-fields-common/text-fields-base.d.ts +1 -1
  13. package/textbox/localization/messages.d.ts +1 -1
  14. package/esm2022/checkbox/checkbox.component.mjs +0 -227
  15. package/esm2022/checkbox/checkbox.directive.mjs +0 -96
  16. package/esm2022/checkbox/checked-state.mjs +0 -5
  17. package/esm2022/checkbox.module.mjs +0 -42
  18. package/esm2022/colorpicker/adaptiveness/adaptive-close-button.component.mjs +0 -62
  19. package/esm2022/colorpicker/adaptiveness/adaptive-renderer.component.mjs +0 -219
  20. package/esm2022/colorpicker/color-contrast-svg.component.mjs +0 -108
  21. package/esm2022/colorpicker/color-gradient-numeric-label.directive.mjs +0 -37
  22. package/esm2022/colorpicker/color-gradient-text-label.directive.mjs +0 -34
  23. package/esm2022/colorpicker/color-gradient.component.mjs +0 -1110
  24. package/esm2022/colorpicker/color-input.component.mjs +0 -498
  25. package/esm2022/colorpicker/color-palette.component.mjs +0 -629
  26. package/esm2022/colorpicker/colorpicker.component.mjs +0 -1315
  27. package/esm2022/colorpicker/constants.mjs +0 -40
  28. package/esm2022/colorpicker/contrast-validation.component.mjs +0 -83
  29. package/esm2022/colorpicker/contrast.component.mjs +0 -114
  30. package/esm2022/colorpicker/events/active-color-click-event.mjs +0 -55
  31. package/esm2022/colorpicker/events/cancel-event.mjs +0 -18
  32. package/esm2022/colorpicker/events/close-event.mjs +0 -10
  33. package/esm2022/colorpicker/events/kendo-drag-event.mjs +0 -5
  34. package/esm2022/colorpicker/events/open-event.mjs +0 -10
  35. package/esm2022/colorpicker/events.mjs +0 -8
  36. package/esm2022/colorpicker/flatcolorpicker-actions.component.mjs +0 -112
  37. package/esm2022/colorpicker/flatcolorpicker-header.component.mjs +0 -244
  38. package/esm2022/colorpicker/flatcolorpicker.component.mjs +0 -942
  39. package/esm2022/colorpicker/localization/colorgradient-localization.service.mjs +0 -46
  40. package/esm2022/colorpicker/localization/colorpalette-localization.service.mjs +0 -46
  41. package/esm2022/colorpicker/localization/colorpicker-localization.service.mjs +0 -31
  42. package/esm2022/colorpicker/localization/custom-messages.component.mjs +0 -51
  43. package/esm2022/colorpicker/localization/flatcolorpicker-localization.service.mjs +0 -46
  44. package/esm2022/colorpicker/localization/localized-colorpicker-messages.directive.mjs +0 -39
  45. package/esm2022/colorpicker/localization/messages.mjs +0 -201
  46. package/esm2022/colorpicker/models/actions-layout.mjs +0 -5
  47. package/esm2022/colorpicker/models/adaptive-mode.mjs +0 -8
  48. package/esm2022/colorpicker/models/colorpicker-view.mjs +0 -5
  49. package/esm2022/colorpicker/models/gradient-settings.mjs +0 -5
  50. package/esm2022/colorpicker/models/hsva.mjs +0 -5
  51. package/esm2022/colorpicker/models/output-format.mjs +0 -5
  52. package/esm2022/colorpicker/models/palette-presets.mjs +0 -62
  53. package/esm2022/colorpicker/models/palette-settings.mjs +0 -5
  54. package/esm2022/colorpicker/models/popup-settings.mjs +0 -5
  55. package/esm2022/colorpicker/models/rgb.mjs +0 -5
  56. package/esm2022/colorpicker/models/rgba.mjs +0 -5
  57. package/esm2022/colorpicker/models/table-cell.mjs +0 -5
  58. package/esm2022/colorpicker/models/tile-size.mjs +0 -5
  59. package/esm2022/colorpicker/models.mjs +0 -16
  60. package/esm2022/colorpicker/services/color-palette.service.mjs +0 -65
  61. package/esm2022/colorpicker/services/flatcolorpicker.service.mjs +0 -39
  62. package/esm2022/colorpicker/utils/color-parser.mjs +0 -164
  63. package/esm2022/colorpicker/utils/contrast-curve.mjs +0 -85
  64. package/esm2022/colorpicker/utils.mjs +0 -6
  65. package/esm2022/colorpicker.module.mjs +0 -50
  66. package/esm2022/common/dom-utils.mjs +0 -36
  67. package/esm2022/common/formservice.service.mjs +0 -21
  68. package/esm2022/common/math.mjs +0 -65
  69. package/esm2022/common/models/fillmode.mjs +0 -5
  70. package/esm2022/common/models/gutters.mjs +0 -5
  71. package/esm2022/common/models/responsive-breakpoints.mjs +0 -5
  72. package/esm2022/common/models/rounded.mjs +0 -5
  73. package/esm2022/common/models/size.mjs +0 -5
  74. package/esm2022/common/models/styling-classes.mjs +0 -5
  75. package/esm2022/common/models/type.mjs +0 -5
  76. package/esm2022/common/models.mjs +0 -9
  77. package/esm2022/common/radio-checkbox.base.mjs +0 -295
  78. package/esm2022/common/utils.mjs +0 -88
  79. package/esm2022/directives.mjs +0 -430
  80. package/esm2022/form/form.component.mjs +0 -163
  81. package/esm2022/form/formseparator.component.mjs +0 -80
  82. package/esm2022/form/utils.mjs +0 -147
  83. package/esm2022/form.module.mjs +0 -46
  84. package/esm2022/formfield/error.component.mjs +0 -70
  85. package/esm2022/formfield/formfield.component.mjs +0 -353
  86. package/esm2022/formfield/hint.component.mjs +0 -65
  87. package/esm2022/formfield/models/message-align.mjs +0 -5
  88. package/esm2022/formfield/models/orientation.mjs +0 -5
  89. package/esm2022/formfield/models/show-options.mjs +0 -5
  90. package/esm2022/formfield.module.mjs +0 -43
  91. package/esm2022/formfieldset/formfieldset.component.mjs +0 -174
  92. package/esm2022/index.mjs +0 -91
  93. package/esm2022/inputs.module.mjs +0 -91
  94. package/esm2022/maskedtextbox/maskedtextbox.component.mjs +0 -876
  95. package/esm2022/maskedtextbox/masking.service.mjs +0 -189
  96. package/esm2022/maskedtextbox/parsing/combinators.mjs +0 -28
  97. package/esm2022/maskedtextbox/parsing/parsers.mjs +0 -148
  98. package/esm2022/maskedtextbox/parsing/result.mjs +0 -44
  99. package/esm2022/maskedtextbox/parsing/stream.mjs +0 -43
  100. package/esm2022/maskedtextbox.module.mjs +0 -43
  101. package/esm2022/numerictextbox/arrow-direction.mjs +0 -13
  102. package/esm2022/numerictextbox/constants.mjs +0 -28
  103. package/esm2022/numerictextbox/localization/custom-messages.component.mjs +0 -55
  104. package/esm2022/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +0 -39
  105. package/esm2022/numerictextbox/localization/messages.mjs +0 -33
  106. package/esm2022/numerictextbox/numerictextbox.component.mjs +0 -1314
  107. package/esm2022/numerictextbox/utils.mjs +0 -92
  108. package/esm2022/numerictextbox.module.mjs +0 -46
  109. package/esm2022/otp.module.mjs +0 -44
  110. package/esm2022/otpinput/localization/custom-messages.component.mjs +0 -45
  111. package/esm2022/otpinput/localization/localized-textbox-messages.directive.mjs +0 -39
  112. package/esm2022/otpinput/localization/messages.mjs +0 -34
  113. package/esm2022/otpinput/models/otpinput-type.mjs +0 -5
  114. package/esm2022/otpinput/models/separator-icon.mjs +0 -5
  115. package/esm2022/otpinput/otpinput-separator.component.mjs +0 -93
  116. package/esm2022/otpinput/otpinput.component.mjs +0 -936
  117. package/esm2022/package-metadata.mjs +0 -16
  118. package/esm2022/progress-kendo-angular-inputs.mjs +0 -8
  119. package/esm2022/radiobutton/radiobutton.component.mjs +0 -212
  120. package/esm2022/radiobutton/radiobutton.directive.mjs +0 -81
  121. package/esm2022/radiobutton.module.mjs +0 -43
  122. package/esm2022/rangeslider/localization/custom-messages.component.mjs +0 -53
  123. package/esm2022/rangeslider/localization/localized-rangeslider-messages.directive.mjs +0 -39
  124. package/esm2022/rangeslider/localization/messages.mjs +0 -33
  125. package/esm2022/rangeslider/rangeslider-model.mjs +0 -53
  126. package/esm2022/rangeslider/rangeslider-value.type.mjs +0 -5
  127. package/esm2022/rangeslider/rangeslider.component.mjs +0 -625
  128. package/esm2022/rangeslider.module.mjs +0 -46
  129. package/esm2022/rating/directives/rating-hovered-item.directive.mjs +0 -35
  130. package/esm2022/rating/directives/rating-item.directive.mjs +0 -34
  131. package/esm2022/rating/directives/rating-selected-item.directive.mjs +0 -36
  132. package/esm2022/rating/models/precision.mjs +0 -5
  133. package/esm2022/rating/models/rating-item.interface.mjs +0 -5
  134. package/esm2022/rating/models/selection.mjs +0 -5
  135. package/esm2022/rating/rating.component.mjs +0 -754
  136. package/esm2022/rating.module.mjs +0 -46
  137. package/esm2022/shared/input-separator.component.mjs +0 -55
  138. package/esm2022/shared/input-spacer.component.mjs +0 -56
  139. package/esm2022/shared/shared-events.directive.mjs +0 -102
  140. package/esm2022/shared/utils.mjs +0 -13
  141. package/esm2022/signature/events/close-event.mjs +0 -10
  142. package/esm2022/signature/events/index.mjs +0 -6
  143. package/esm2022/signature/events/open-event.mjs +0 -10
  144. package/esm2022/signature/localization/custom-messages.component.mjs +0 -43
  145. package/esm2022/signature/localization/index.mjs +0 -7
  146. package/esm2022/signature/localization/localized-signature-messages.directive.mjs +0 -39
  147. package/esm2022/signature/localization/messages.mjs +0 -45
  148. package/esm2022/signature/signature.component.mjs +0 -981
  149. package/esm2022/signature.module.mjs +0 -47
  150. package/esm2022/slider/localization/custom-messages.component.mjs +0 -43
  151. package/esm2022/slider/localization/localized-slider-messages.directive.mjs +0 -39
  152. package/esm2022/slider/localization/messages.mjs +0 -39
  153. package/esm2022/slider/slider-model.mjs +0 -32
  154. package/esm2022/slider/slider.component.mjs +0 -671
  155. package/esm2022/slider.module.mjs +0 -48
  156. package/esm2022/sliders-common/label-template.directive.mjs +0 -37
  157. package/esm2022/sliders-common/slider-base.mjs +0 -300
  158. package/esm2022/sliders-common/slider-model.base.mjs +0 -118
  159. package/esm2022/sliders-common/slider-ticks.component.mjs +0 -147
  160. package/esm2022/sliders-common/sliders-util.mjs +0 -206
  161. package/esm2022/sliders-common/title-callback.mjs +0 -5
  162. package/esm2022/switch/events/blur-event.mjs +0 -13
  163. package/esm2022/switch/events/focus-event.mjs +0 -13
  164. package/esm2022/switch/localization/custom-messages.component.mjs +0 -43
  165. package/esm2022/switch/localization/localized-switch-messages.directive.mjs +0 -39
  166. package/esm2022/switch/localization/messages.mjs +0 -33
  167. package/esm2022/switch/switch.component.mjs +0 -585
  168. package/esm2022/switch.module.mjs +0 -44
  169. package/esm2022/text-fields-common/text-fields-base.mjs +0 -150
  170. package/esm2022/textarea/models/adornments-orientation.mjs +0 -5
  171. package/esm2022/textarea/models/flow.mjs +0 -5
  172. package/esm2022/textarea/models/resize.mjs +0 -5
  173. package/esm2022/textarea/models/textarea-settings.mjs +0 -5
  174. package/esm2022/textarea/textarea-prefix.component.mjs +0 -67
  175. package/esm2022/textarea/textarea-suffix.component.mjs +0 -67
  176. package/esm2022/textarea/textarea.component.mjs +0 -740
  177. package/esm2022/textarea/textarea.directive.mjs +0 -288
  178. package/esm2022/textarea.module.mjs +0 -46
  179. package/esm2022/textbox/localization/custom-messages.component.mjs +0 -43
  180. package/esm2022/textbox/localization/localized-textbox-messages.directive.mjs +0 -39
  181. package/esm2022/textbox/localization/messages.mjs +0 -27
  182. package/esm2022/textbox/models/icon-show-options.mjs +0 -5
  183. package/esm2022/textbox/textbox-prefix.directive.mjs +0 -50
  184. package/esm2022/textbox/textbox-suffix.directive.mjs +0 -49
  185. package/esm2022/textbox/textbox.component.mjs +0 -933
  186. package/esm2022/textbox/textbox.directive.mjs +0 -125
  187. package/esm2022/textbox.module.mjs +0 -51
  188. package/esm2022/validators/max.validator.mjs +0 -21
  189. package/esm2022/validators/min.validator.mjs +0 -21
@@ -1,876 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 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, ContentChild } from '@angular/core';
6
- import { NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
7
- import { EventsOutsideAngularDirective, guid, hasObservers, isChanged, isControlRequired, isObjectPresent, KendoInput, parseAttributes, PrefixTemplateDirective, removeHTMLAttributes, setHTMLAttributes, SuffixTemplateDirective } 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 { InputSeparatorComponent } from '../shared/input-separator.component';
15
- import { NgTemplateOutlet } from '@angular/common';
16
- import { SharedInputEventsDirective } from '../shared/shared-events.directive';
17
- import * as i0 from "@angular/core";
18
- import * as i1 from "./masking.service";
19
- const resolvedPromise = Promise.resolve(null);
20
- const FOCUSED = 'k-focus';
21
- const DEFAULT_SIZE = 'medium';
22
- const DEFAULT_ROUNDED = 'medium';
23
- const DEFAULT_FILL_MODE = 'solid';
24
- /**
25
- * Represents the [Kendo UI MaskedTextBox component for Angular]({% slug overview_maskedtextbox %}).
26
- *
27
- * @example
28
- * ```typescript
29
- * import { Component } from '@angular/core';
30
- *
31
- * @Component({
32
- * selector: 'my-app',
33
- * template: `
34
- * <kendo-maskedtextbox
35
- * [mask]="mask"
36
- * [value]="value">
37
- * </kendo-maskedtextbox>
38
- * `
39
- * })
40
- * export class AppComponent {
41
- * public value: string = "9580128055807792";
42
- * public mask: string = "0000-0000-0000-0000";
43
- * }
44
- * ```
45
- */
46
- export class MaskedTextBoxComponent {
47
- service;
48
- renderer;
49
- hostElement;
50
- ngZone;
51
- injector;
52
- changeDetector;
53
- /**
54
- * @hidden
55
- */
56
- focusableId = `k-${guid()}`;
57
- /**
58
- * Disables the MaskedTextBox when you set it to `true` ([see example]({% slug disabled_maskedtextbox %})).
59
- * To disable the component in reactive forms, see [Forms Support](slug:formssupport_maskedtextbox#toc-managing-the-maskedtextbox-disabled-state-in-reactive-forms).
60
- * @default false
61
- */
62
- disabled = false;
63
- /**
64
- * When `true`, sets the MaskedTextBox to read-only mode ([see example]({% slug readonly_maskedtextbox %})).
65
- * @default false
66
- */
67
- readonly = false;
68
- /**
69
- * Sets the `title` attribute of the input element.
70
- */
71
- title;
72
- /**
73
- * Sets the padding size of the MaskedTextBox input element ([see example]({% slug appearance_maskedtextbox %}#toc-size)).
74
- * @default 'medium'
75
- */
76
- set size(size) {
77
- const newSize = size || DEFAULT_SIZE;
78
- this.handleClasses(newSize, 'size');
79
- this._size = newSize;
80
- }
81
- get size() {
82
- return this._size;
83
- }
84
- /**
85
- * Sets the border radius of the MaskedTextBox ([see example](slug:appearance_maskedtextbox#toc-roundness)).
86
- * @default 'medium'
87
- */
88
- set rounded(rounded) {
89
- const newRounded = rounded || DEFAULT_ROUNDED;
90
- this.handleClasses(newRounded, 'rounded');
91
- this._rounded = newRounded;
92
- }
93
- get rounded() {
94
- return this._rounded;
95
- }
96
- /**
97
- * Sets the background and border style of the MaskedTextBox ([see example]({% slug appearance_maskedtextbox %}#toc-fill-mode)).
98
- * @default 'solid'
99
- */
100
- set fillMode(fillMode) {
101
- const newFillMode = fillMode || DEFAULT_FILL_MODE;
102
- this.handleClasses(newFillMode, 'fillMode');
103
- this._fillMode = newFillMode;
104
- }
105
- get fillMode() {
106
- return this._fillMode;
107
- }
108
- /**
109
- * Sets the mask pattern for the MaskedTextBox ([see example]({% slug value_maskedtextbox %})).
110
- * If you do not set a mask, the component acts as a standard `type="text"` input.
111
- *
112
- * If the mask allows spaces, set the [`promptPlaceholder`]({% slug api_inputs_maskedtextboxcomponent %}#toc-promptplaceholder)
113
- * to a character that the mask does not accept.
114
- */
115
- mask;
116
- /**
117
- * Sets the value of the MaskedTextBox.
118
- */
119
- value;
120
- /**
121
- * Sets the RegExp-based mask validation rules ([see example]({% slug masks_maskedtextbox %})).
122
- */
123
- set rules(value) {
124
- this._rules = { ...this.defaultRules, ...value };
125
- }
126
- get rules() {
127
- return this._rules || this.defaultRules;
128
- }
129
- /**
130
- * Sets the prompt character for the masked value.
131
- * @default `_`
132
- */
133
- prompt = '_';
134
- /**
135
- * Sets the character that represents an empty position in the raw value.
136
- * @default ' '
137
- */
138
- promptPlaceholder = ' ';
139
- /**
140
- * When `true` includes literals in the raw value ([see example]({% slug value_maskedtextbox %})).
141
- * @default false
142
- */
143
- includeLiterals = false;
144
- /**
145
- * Shows the mask on focus when the value is empty.
146
- */
147
- maskOnFocus = false;
148
- /**
149
- * Enables the built-in mask validator when you set it to `true` ([see example]({% slug validation_maskedtextbox %})).
150
- * @default true
151
- */
152
- maskValidation = true;
153
- /**
154
- * Sets the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) attribute of the component.
155
- */
156
- tabindex = 0;
157
- /**
158
- * @hidden
159
- */
160
- set tabIndex(tabIndex) {
161
- this.tabindex = tabIndex;
162
- }
163
- get tabIndex() {
164
- return this.tabindex;
165
- }
166
- /**
167
- * Sets HTML attributes for the inner input element.
168
- * You cannot change attributes that are essential for component functionality.
169
- */
170
- set inputAttributes(attributes) {
171
- if (isObjectPresent(this.parsedAttributes)) {
172
- removeHTMLAttributes(this.parsedAttributes, this.renderer, this.input.nativeElement);
173
- }
174
- this._inputAttributes = attributes;
175
- this.parsedAttributes = this.inputAttributes ?
176
- parseAttributes(this.inputAttributes, this.defaultAttributes) :
177
- this.inputAttributes;
178
- this.setInputAttributes();
179
- }
180
- get inputAttributes() {
181
- return this._inputAttributes;
182
- }
183
- get defaultAttributes() {
184
- return {
185
- id: this.focusableId,
186
- disabled: this.disabled ? '' : null,
187
- readonly: this.readonly ? '' : null,
188
- tabindex: this.tabIndex,
189
- 'aria-invalid': this.isControlInvalid,
190
- title: this.title,
191
- required: this.isControlRequired ? '' : null
192
- };
193
- }
194
- get mutableAttributes() {
195
- return {
196
- 'aria-placeholder': this.mask,
197
- autocomplete: 'off',
198
- autocorrect: 'off',
199
- autocapitalize: 'off',
200
- spellcheck: 'false'
201
- };
202
- }
203
- /**
204
- * Fires when the MaskedTextBox gets focused.
205
- *
206
- * To subscribe programmatically, use the `onFocus` property.
207
- *
208
- */
209
- onFocus = new EventEmitter();
210
- /**
211
- * Fires when the MaskedTextBox gets blurred.
212
- *
213
- * To subscribe programmatically, use the `onBlur` property.
214
- *
215
- */
216
- onBlur = new EventEmitter();
217
- /**
218
- * Fires when the input element gets focused.
219
- */
220
- inputFocus = new EventEmitter();
221
- /**
222
- * Fires when the input element gets blurred.
223
- */
224
- inputBlur = new EventEmitter();
225
- /**
226
- * Fires when the value changes.
227
- */
228
- valueChange = new EventEmitter();
229
- direction;
230
- hostClasses = true;
231
- get hostDisabledClass() {
232
- return this.disabled;
233
- }
234
- /**
235
- * Returns the `ElementRef` of the visible `input` element.
236
- */
237
- input;
238
- /**
239
- * @hidden
240
- */
241
- suffixTemplate;
242
- /**
243
- * @hidden
244
- */
245
- prefixTemplate;
246
- isFocused;
247
- maskedValue;
248
- focusClick = false;
249
- defaultRules = {
250
- "#": /[\d\s\+\-]/,
251
- "&": /[\S]/,
252
- "0": /[\d]/,
253
- "9": /[\d\s]/,
254
- "?": /[a-zA-Z\s]/,
255
- "A": /[a-zA-Z0-9]/,
256
- "C": /./,
257
- "L": /[a-zA-Z]/,
258
- "a": /[a-zA-Z0-9\s]/
259
- };
260
- _rules;
261
- isPasted = false;
262
- selection = [0, 0];
263
- control;
264
- _size = 'medium';
265
- _rounded = 'medium';
266
- _fillMode = 'solid';
267
- _inputAttributes;
268
- parsedAttributes = {};
269
- constructor(service, renderer, hostElement, ngZone, injector, changeDetector, rtl) {
270
- this.service = service;
271
- this.renderer = renderer;
272
- this.hostElement = hostElement;
273
- this.ngZone = ngZone;
274
- this.injector = injector;
275
- this.changeDetector = changeDetector;
276
- validatePackage(packageMetadata);
277
- this.direction = rtl ? 'rtl' : 'ltr';
278
- this.updateService();
279
- }
280
- ngOnInit() {
281
- if (this.hostElement) {
282
- this.renderer.removeAttribute(this.hostElement.nativeElement, "tabindex");
283
- }
284
- this.control = this.injector.get(NgControl, null);
285
- }
286
- ngAfterViewInit() {
287
- const stylingInputs = ['size', 'rounded', 'fillMode'];
288
- stylingInputs.forEach(input => {
289
- this.handleClasses(this[input], input);
290
- });
291
- }
292
- /**
293
- * @hidden
294
- * Used by the FloatingLabel to determine if the MaskedTextBox is empty.
295
- */
296
- isEmpty() {
297
- if (this.input) {
298
- return !this.input.nativeElement.value;
299
- }
300
- }
301
- /**
302
- * @hidden
303
- */
304
- handleFocus = () => {
305
- this.ngZone.run(() => {
306
- if (!this.focused && hasObservers(this.onFocus)) {
307
- this.onFocus.emit();
308
- }
309
- this.focused = true;
310
- });
311
- if (this.maskOnFocus && this.emptyMask) {
312
- this.updateInput(this.service.maskRaw(this.value));
313
- this.ngZone.runOutsideAngular(() => {
314
- setTimeout(() => { this.setSelection(0, 0); }, 0);
315
- });
316
- }
317
- };
318
- /**
319
- * @hidden
320
- */
321
- handleInputFocus = () => {
322
- this.handleFocus();
323
- if (hasObservers(this.inputFocus)) {
324
- this.ngZone.run(() => {
325
- this.inputFocus.emit();
326
- });
327
- }
328
- };
329
- /**
330
- * @hidden
331
- */
332
- handleClick = () => {
333
- if (this.focused && !this.focusClick) {
334
- this.focusClick = true;
335
- }
336
- if (this.promptPlaceholder === null || this.promptPlaceholder === '') {
337
- const { selectionStart, selectionEnd } = this.input.nativeElement;
338
- if (selectionStart === selectionEnd) {
339
- this.setFocusSelection();
340
- }
341
- }
342
- };
343
- /**
344
- * @hidden
345
- */
346
- handleBlur = () => {
347
- this.changeDetector.markForCheck();
348
- this.focused = false;
349
- this.focusClick = false;
350
- if (this.maskOnFocus && this.emptyMask) {
351
- this.updateInput(this.maskedValue);
352
- }
353
- if (hasObservers(this.onBlur)) {
354
- this.ngZone.run(() => {
355
- this.onBlur.emit();
356
- });
357
- }
358
- this.ngZone.run(() => {
359
- if (this.control && !this.control.touched) {
360
- this.onTouched();
361
- }
362
- });
363
- };
364
- /**
365
- * @hidden
366
- */
367
- handleInputBlur = () => {
368
- this.changeDetector.markForCheck();
369
- if (hasObservers(this.inputBlur) || requiresZoneOnBlur(this.control)) {
370
- this.ngZone.run(() => {
371
- this.inputBlur.emit();
372
- });
373
- }
374
- };
375
- /**
376
- * @hidden
377
- */
378
- handleDragDrop() {
379
- return false;
380
- }
381
- /**
382
- * Focuses the MaskedTextBox.
383
- *
384
- * @example
385
- * ```ts-no-run
386
- * _@Component({
387
- * selector: 'my-app',
388
- * template: `
389
- * <button (click)="maskedinput.focus()">Focus the input</button>
390
- * <kendo-maskedtextbox #maskedinput></kendo-maskedtextbox>
391
- * `
392
- * })
393
- * class AppComponent { }
394
- * ```
395
- */
396
- focus() {
397
- if (!this.input) {
398
- return;
399
- }
400
- this.input.nativeElement.focus();
401
- this.focused = true;
402
- this.setFocusSelection();
403
- }
404
- /**
405
- * Blurs the MaskedTextBox.
406
- */
407
- blur() {
408
- if (!this.input) {
409
- return;
410
- }
411
- this.input.nativeElement.blur();
412
- this.focused = false;
413
- }
414
- /**
415
- * @hidden
416
- */
417
- pasteHandler(e) {
418
- const { selectionStart, selectionEnd } = e.target;
419
- if (selectionEnd === selectionStart) {
420
- return;
421
- }
422
- this.isPasted = true;
423
- this.selection = [selectionStart, selectionEnd];
424
- }
425
- /**
426
- * @hidden
427
- */
428
- inputHandler(e) {
429
- const value = e.target.value;
430
- const [start, end] = this.selection;
431
- if (!this.mask) {
432
- this.updateValueWithEvents(value);
433
- this.isPasted = false;
434
- return;
435
- }
436
- let result;
437
- if (this.isPasted) {
438
- this.isPasted = false;
439
- const rightPart = this.maskedValue.length - end;
440
- const to = value.length - rightPart;
441
- result = this.service.maskInRange(value.slice(start, to), this.maskedValue, start, end);
442
- }
443
- else {
444
- result = this.service.maskInput(value, this.maskedValue || '', e.target.selectionStart);
445
- }
446
- this.updateInput(result.value, result.selection);
447
- this.updateValueWithEvents(result.value);
448
- }
449
- /**
450
- * @hidden
451
- */
452
- ngOnChanges(changes) {
453
- if (changes['value']) {
454
- this.value = this.normalizeValue(this.value);
455
- }
456
- const next = this.extractChanges(changes);
457
- this.updateService(next);
458
- if (!this.mask) {
459
- this.updateInput(this.value);
460
- return;
461
- }
462
- const maskedValue = this.service.maskRaw(this.value);
463
- this.updateInput(maskedValue, null, true);
464
- if (changes['includeLiterals'] || isChanged('promptPlaceholder', changes)) {
465
- resolvedPromise.then(() => {
466
- this.updateValueWithEvents(this.maskedValue, false);
467
- });
468
- }
469
- }
470
- /**
471
- * @hidden
472
- * Writes a new value to the element.
473
- */
474
- writeValue(value) {
475
- this.value = this.normalizeValue(value);
476
- this.updateInput(this.service.maskRaw(this.value));
477
- if (this.includeLiterals) {
478
- this.updateValue(this.maskedValue, false);
479
- }
480
- this.changeDetector.markForCheck();
481
- }
482
- /**
483
- * @hidden
484
- * Sets the function that will be called when a `change` event is triggered.
485
- */
486
- registerOnChange(fn) {
487
- this.onChange = fn;
488
- }
489
- /**
490
- * @hidden
491
- * Sets the function that will be called when a `touch` event is triggered.
492
- */
493
- registerOnTouched(fn) {
494
- this.onTouched = fn;
495
- }
496
- /**
497
- * @hidden
498
- * Called when the status of the component changes to or from `disabled`.
499
- * Depending on the value, it enables or disables the appropriate DOM element.
500
- *
501
- * @param isDisabled
502
- */
503
- setDisabledState(isDisabled) {
504
- this.changeDetector.markForCheck();
505
- this.disabled = isDisabled;
506
- }
507
- /**
508
- * @hidden
509
- */
510
- validate(_) {
511
- if (this.maskValidation === false || !this.mask) {
512
- return null;
513
- }
514
- if (!this.service.validationValue(this.maskedValue)) {
515
- return null;
516
- }
517
- if (this.maskedValue.indexOf(this.prompt) !== -1) {
518
- return {
519
- patternError: {
520
- mask: this.mask,
521
- maskedValue: this.maskedValue,
522
- value: this.value
523
- }
524
- };
525
- }
526
- return null;
527
- }
528
- /**
529
- * @hidden
530
- */
531
- get isControlInvalid() {
532
- return this.control && this.control.touched && this.control.invalid;
533
- }
534
- /**
535
- * @hidden
536
- */
537
- get isControlRequired() {
538
- return isControlRequired(this.control?.control);
539
- }
540
- /**
541
- * @hidden
542
- */
543
- updateValueWithEvents(maskedValue, callOnChange = true) {
544
- const previousValue = this.value;
545
- this.updateValue(maskedValue, callOnChange);
546
- const valueChanged = this.value !== previousValue;
547
- if (valueChanged && hasObservers(this.valueChange)) {
548
- this.valueChange.emit(this.value);
549
- }
550
- }
551
- onChange = (_) => { };
552
- onTouched = () => { };
553
- updateValue(value, callOnChange = true) {
554
- if (this.mask && !this.service.validationValue(value) && !this.includeLiterals) {
555
- this.value = '';
556
- }
557
- else {
558
- this.value = this.service.rawValue(value);
559
- }
560
- callOnChange && this.onChange(this.value);
561
- }
562
- updateInput(maskedValue = '', selection, isFromOnChanges) {
563
- if (isFromOnChanges && maskedValue === this.maskedValue) {
564
- return;
565
- }
566
- this.maskedValue = maskedValue;
567
- const value = this.maskOnFocus && !this.focused && this.emptyMask ? '' : maskedValue;
568
- this.renderer.setProperty(this.input.nativeElement, "value", value);
569
- if (selection !== undefined) {
570
- this.setSelection(selection, selection);
571
- }
572
- }
573
- extractChanges(changes) {
574
- return Object.keys(changes).filter(key => key !== 'rules').reduce((obj, key) => {
575
- obj[key] = changes[key].currentValue;
576
- return obj;
577
- }, {});
578
- }
579
- updateService(extra) {
580
- const config = Object.assign({
581
- includeLiterals: this.includeLiterals,
582
- mask: this.mask,
583
- prompt: this.prompt,
584
- promptPlaceholder: this.promptPlaceholder,
585
- rules: this.rules
586
- }, extra);
587
- this.service.update(config);
588
- }
589
- setSelection(start = this.selection[0], end = this.selection[1]) {
590
- if (this.focused) {
591
- invokeElementMethod(this.input, 'setSelectionRange', start, end);
592
- }
593
- }
594
- get emptyMask() {
595
- return this.service.maskRaw() === this.maskedValue;
596
- }
597
- setFocusSelection() {
598
- const selectionStart = this.input.nativeElement.selectionStart;
599
- const index = this.maskedValue ? this.maskedValue.indexOf(this.prompt) : 0;
600
- if (index >= 0 && index < selectionStart) {
601
- this.selection = [index, index];
602
- this.setSelection();
603
- }
604
- }
605
- /**
606
- * @hidden
607
- */
608
- get focused() {
609
- return this.isFocused;
610
- }
611
- /**
612
- * @hidden
613
- */
614
- set focused(value) {
615
- if (this.isFocused !== value && this.hostElement) {
616
- const element = this.hostElement.nativeElement;
617
- if (value) {
618
- this.renderer.addClass(element, FOCUSED);
619
- }
620
- else {
621
- this.renderer.removeClass(element, FOCUSED);
622
- }
623
- this.isFocused = value;
624
- }
625
- }
626
- normalizeValue(value) {
627
- const present = isPresent(value);
628
- if (present && typeof value !== 'string') {
629
- if (isDevMode()) {
630
- throw new Error('The MaskedTextBox component supports only string values.');
631
- }
632
- return String(value);
633
- }
634
- return present ? value : '';
635
- }
636
- handleClasses(value, input) {
637
- const elem = this.hostElement.nativeElement;
638
- const classes = getStylingClasses('input', input, this[input], value);
639
- if (classes.toRemove) {
640
- this.renderer.removeClass(elem, classes.toRemove);
641
- }
642
- if (classes.toAdd) {
643
- this.renderer.addClass(elem, classes.toAdd);
644
- }
645
- }
646
- setInputAttributes() {
647
- const attributesToRender = Object.assign({}, this.mutableAttributes, this.parsedAttributes);
648
- setHTMLAttributes(attributesToRender, this.renderer, this.input.nativeElement, this.ngZone);
649
- }
650
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", 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 });
651
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: MaskedTextBoxComponent, isStandalone: true, 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", inputAttributes: "inputAttributes" }, outputs: { onFocus: "focus", onBlur: "blur", inputFocus: "inputFocus", inputBlur: "inputBlur", valueChange: "valueChange" }, host: { listeners: { "paste": "pasteHandler($event)", "input": "inputHandler($event)" }, properties: { "class.k-readonly": "this.readonly", "attr.dir": "this.direction", "class.k-input": "this.hostClasses", "class.k-maskedtextbox": "this.hostClasses", "class.k-disabled": "this.hostDisabledClass" } }, providers: [
652
- MaskingService,
653
- {
654
- multi: true,
655
- provide: NG_VALUE_ACCESSOR,
656
- useExisting: forwardRef(() => MaskedTextBoxComponent) /* eslint-disable-line*/
657
- },
658
- {
659
- multi: true,
660
- provide: NG_VALIDATORS,
661
- useExisting: forwardRef(() => MaskedTextBoxComponent) /* eslint-disable-line*/
662
- },
663
- {
664
- provide: KendoInput,
665
- useExisting: forwardRef(() => MaskedTextBoxComponent)
666
- }
667
- ], queries: [{ propertyName: "suffixTemplate", first: true, predicate: SuffixTemplateDirective, descendants: true }, { propertyName: "prefixTemplate", first: true, predicate: PrefixTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, static: true }], exportAs: ["kendoMaskedTextBox"], usesOnChanges: true, ngImport: i0, template: `
668
- <ng-container
669
- kendoInputSharedEvents
670
- [hostElement]="hostElement"
671
- [(isFocused)]="focused"
672
- (handleBlur)="handleBlur()"
673
- (onFocus)="handleFocus()"
674
- >
675
- @if (prefixTemplate) {
676
- <span class="k-input-prefix k-input-prefix-horizontal">
677
- <ng-template [ngTemplateOutlet]="prefixTemplate?.templateRef">
678
- </ng-template>
679
- </span>
680
- }
681
- @if (prefixTemplate && prefixTemplate.showSeparator) {
682
- <kendo-input-separator></kendo-input-separator>
683
- }
684
- <input #input
685
- class="k-input-inner"
686
- autocomplete="off"
687
- autocorrect="off"
688
- autocapitalize="off"
689
- spellcheck="false"
690
- [id]="focusableId"
691
- [tabindex]="tabIndex"
692
- [attr.title]="title"
693
- [attr.aria-placeholder]="mask"
694
- [attr.aria-invalid]="isControlInvalid"
695
- [attr.required]="isControlRequired ? '' : null"
696
- [disabled]="disabled"
697
- [readonly]="readonly"
698
- [kendoEventsOutsideAngular]="{
699
- focus: handleInputFocus,
700
- blur: handleInputBlur,
701
- click: handleClick,
702
- dragstart: handleDragDrop,
703
- drop: handleDragDrop
704
- }"
705
- />
706
- @if (suffixTemplate && suffixTemplate.showSeparator) {
707
- <kendo-input-separator></kendo-input-separator>
708
- }
709
- @if (suffixTemplate) {
710
- <span class="k-input-suffix k-input-suffix-horizontal">
711
- <ng-template [ngTemplateOutlet]="suffixTemplate?.templateRef">
712
- </ng-template>
713
- </span>
714
- }
715
- </ng-container>
716
- `, isInline: true, dependencies: [{ kind: "directive", type: SharedInputEventsDirective, selector: "[kendoInputSharedEvents]", inputs: ["hostElement", "clearButtonClicked", "isFocused"], outputs: ["isFocusedChange", "onFocus", "handleBlur"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: InputSeparatorComponent, selector: "kendo-input-separator, kendo-textbox-separator", inputs: ["orientation"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }] });
717
- }
718
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MaskedTextBoxComponent, decorators: [{
719
- type: Component,
720
- args: [{
721
- exportAs: 'kendoMaskedTextBox',
722
- providers: [
723
- MaskingService,
724
- {
725
- multi: true,
726
- provide: NG_VALUE_ACCESSOR,
727
- useExisting: forwardRef(() => MaskedTextBoxComponent) /* eslint-disable-line*/
728
- },
729
- {
730
- multi: true,
731
- provide: NG_VALIDATORS,
732
- useExisting: forwardRef(() => MaskedTextBoxComponent) /* eslint-disable-line*/
733
- },
734
- {
735
- provide: KendoInput,
736
- useExisting: forwardRef(() => MaskedTextBoxComponent)
737
- }
738
- ],
739
- selector: 'kendo-maskedtextbox',
740
- template: `
741
- <ng-container
742
- kendoInputSharedEvents
743
- [hostElement]="hostElement"
744
- [(isFocused)]="focused"
745
- (handleBlur)="handleBlur()"
746
- (onFocus)="handleFocus()"
747
- >
748
- @if (prefixTemplate) {
749
- <span class="k-input-prefix k-input-prefix-horizontal">
750
- <ng-template [ngTemplateOutlet]="prefixTemplate?.templateRef">
751
- </ng-template>
752
- </span>
753
- }
754
- @if (prefixTemplate && prefixTemplate.showSeparator) {
755
- <kendo-input-separator></kendo-input-separator>
756
- }
757
- <input #input
758
- class="k-input-inner"
759
- autocomplete="off"
760
- autocorrect="off"
761
- autocapitalize="off"
762
- spellcheck="false"
763
- [id]="focusableId"
764
- [tabindex]="tabIndex"
765
- [attr.title]="title"
766
- [attr.aria-placeholder]="mask"
767
- [attr.aria-invalid]="isControlInvalid"
768
- [attr.required]="isControlRequired ? '' : null"
769
- [disabled]="disabled"
770
- [readonly]="readonly"
771
- [kendoEventsOutsideAngular]="{
772
- focus: handleInputFocus,
773
- blur: handleInputBlur,
774
- click: handleClick,
775
- dragstart: handleDragDrop,
776
- drop: handleDragDrop
777
- }"
778
- />
779
- @if (suffixTemplate && suffixTemplate.showSeparator) {
780
- <kendo-input-separator></kendo-input-separator>
781
- }
782
- @if (suffixTemplate) {
783
- <span class="k-input-suffix k-input-suffix-horizontal">
784
- <ng-template [ngTemplateOutlet]="suffixTemplate?.templateRef">
785
- </ng-template>
786
- </span>
787
- }
788
- </ng-container>
789
- `,
790
- standalone: true,
791
- imports: [SharedInputEventsDirective, NgTemplateOutlet, InputSeparatorComponent, EventsOutsideAngularDirective]
792
- }]
793
- }], ctorParameters: () => [{ type: i1.MaskingService }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
794
- type: Optional
795
- }, {
796
- type: Inject,
797
- args: [RTL]
798
- }] }], propDecorators: { focusableId: [{
799
- type: Input
800
- }], disabled: [{
801
- type: Input
802
- }], readonly: [{
803
- type: Input
804
- }, {
805
- type: HostBinding,
806
- args: ['class.k-readonly']
807
- }], title: [{
808
- type: Input
809
- }], size: [{
810
- type: Input
811
- }], rounded: [{
812
- type: Input
813
- }], fillMode: [{
814
- type: Input
815
- }], mask: [{
816
- type: Input
817
- }], value: [{
818
- type: Input
819
- }], rules: [{
820
- type: Input
821
- }], prompt: [{
822
- type: Input
823
- }], promptPlaceholder: [{
824
- type: Input
825
- }], includeLiterals: [{
826
- type: Input
827
- }], maskOnFocus: [{
828
- type: Input
829
- }], maskValidation: [{
830
- type: Input
831
- }], tabindex: [{
832
- type: Input
833
- }], tabIndex: [{
834
- type: Input
835
- }], inputAttributes: [{
836
- type: Input
837
- }], onFocus: [{
838
- type: Output,
839
- args: ['focus']
840
- }], onBlur: [{
841
- type: Output,
842
- args: ['blur']
843
- }], inputFocus: [{
844
- type: Output
845
- }], inputBlur: [{
846
- type: Output
847
- }], valueChange: [{
848
- type: Output
849
- }], direction: [{
850
- type: HostBinding,
851
- args: ['attr.dir']
852
- }], hostClasses: [{
853
- type: HostBinding,
854
- args: ['class.k-input']
855
- }, {
856
- type: HostBinding,
857
- args: ['class.k-maskedtextbox']
858
- }], hostDisabledClass: [{
859
- type: HostBinding,
860
- args: ['class.k-disabled']
861
- }], input: [{
862
- type: ViewChild,
863
- args: ['input', { static: true }]
864
- }], suffixTemplate: [{
865
- type: ContentChild,
866
- args: [SuffixTemplateDirective]
867
- }], prefixTemplate: [{
868
- type: ContentChild,
869
- args: [PrefixTemplateDirective]
870
- }], pasteHandler: [{
871
- type: HostListener,
872
- args: ['paste', ['$event']]
873
- }], inputHandler: [{
874
- type: HostListener,
875
- args: ['input', ['$event']]
876
- }] } });