@syncfusion/ej2-inputs 24.2.9 → 25.1.37

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 (181) hide show
  1. package/CHANGELOG.md +3 -33
  2. package/dist/ej2-inputs.min.js +2 -2
  3. package/dist/ej2-inputs.umd.min.js +2 -2
  4. package/dist/ej2-inputs.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-inputs.es2015.js +1098 -269
  6. package/dist/es6/ej2-inputs.es2015.js.map +1 -1
  7. package/dist/es6/ej2-inputs.es5.js +1124 -274
  8. package/dist/es6/ej2-inputs.es5.js.map +1 -1
  9. package/dist/global/ej2-inputs.min.js +2 -2
  10. package/dist/global/ej2-inputs.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +10 -10
  13. package/src/common/signature-base.d.ts +1 -0
  14. package/src/common/signature-base.js +4 -3
  15. package/src/index.d.ts +1 -0
  16. package/src/index.js +1 -0
  17. package/src/input/input.d.ts +18 -1
  18. package/src/input/input.js +234 -69
  19. package/src/maskedtextbox/base/mask-base.js +1 -0
  20. package/src/maskedtextbox/maskedtextbox/maskedtextbox.d.ts +1 -0
  21. package/src/maskedtextbox/maskedtextbox/maskedtextbox.js +9 -2
  22. package/src/numerictextbox/numerictextbox.d.ts +1 -0
  23. package/src/numerictextbox/numerictextbox.js +8 -1
  24. package/src/rating/rating.js +1 -0
  25. package/src/signature/signature.js +2 -0
  26. package/src/slider/slider-model.d.ts +3 -2
  27. package/src/slider/slider.d.ts +3 -2
  28. package/src/slider/slider.js +6 -1
  29. package/src/textarea/index.d.ts +5 -0
  30. package/src/textarea/index.js +4 -0
  31. package/src/textarea/textarea-model.d.ts +155 -0
  32. package/src/textarea/textarea.d.ts +231 -0
  33. package/src/textarea/textarea.js +696 -0
  34. package/src/textbox/textbox-model.d.ts +1 -1
  35. package/src/textbox/textbox.d.ts +3 -5
  36. package/src/textbox/textbox.js +21 -57
  37. package/styles/bootstrap-dark.css +69 -8
  38. package/styles/bootstrap-dark.scss +1 -0
  39. package/styles/bootstrap.css +69 -8
  40. package/styles/bootstrap.scss +1 -0
  41. package/styles/bootstrap4.css +69 -8
  42. package/styles/bootstrap4.scss +1 -0
  43. package/styles/bootstrap5-dark.css +69 -8
  44. package/styles/bootstrap5-dark.scss +1 -0
  45. package/styles/bootstrap5.css +69 -8
  46. package/styles/bootstrap5.scss +1 -0
  47. package/styles/color-picker/_bds-definition.scss +133 -0
  48. package/styles/color-picker/icons/_bds.scss +9 -0
  49. package/styles/data-form/_bds-definition.scss +41 -0
  50. package/styles/data-form/_layout.scss +3 -3
  51. package/styles/data-form/bootstrap-dark.css +8 -8
  52. package/styles/data-form/bootstrap.css +8 -8
  53. package/styles/data-form/bootstrap4.css +8 -8
  54. package/styles/data-form/bootstrap5-dark.css +8 -8
  55. package/styles/data-form/bootstrap5.css +8 -8
  56. package/styles/data-form/fabric-dark.css +8 -8
  57. package/styles/data-form/fabric.css +8 -8
  58. package/styles/data-form/fluent-dark.css +8 -8
  59. package/styles/data-form/fluent.css +8 -8
  60. package/styles/data-form/highcontrast-light.css +8 -8
  61. package/styles/data-form/highcontrast.css +8 -8
  62. package/styles/data-form/material-dark.css +8 -8
  63. package/styles/data-form/material.css +8 -8
  64. package/styles/data-form/material3-dark.css +8 -8
  65. package/styles/data-form/material3.css +8 -8
  66. package/styles/data-form/tailwind-dark.css +8 -8
  67. package/styles/data-form/tailwind.css +8 -8
  68. package/styles/fabric-dark.css +69 -8
  69. package/styles/fabric-dark.scss +1 -0
  70. package/styles/fabric.css +69 -8
  71. package/styles/fabric.scss +1 -0
  72. package/styles/fluent-dark.css +69 -8
  73. package/styles/fluent-dark.scss +1 -0
  74. package/styles/fluent.css +69 -8
  75. package/styles/fluent.scss +1 -0
  76. package/styles/highcontrast-light.css +69 -8
  77. package/styles/highcontrast-light.scss +1 -0
  78. package/styles/highcontrast.css +69 -8
  79. package/styles/highcontrast.scss +1 -0
  80. package/styles/input/_bds-definition.scss +482 -0
  81. package/styles/input/icons/_bds.scss +17 -0
  82. package/styles/maskedtextbox/_bds-definition.scss +7 -0
  83. package/styles/material-dark.css +75 -8
  84. package/styles/material-dark.scss +1 -0
  85. package/styles/material.css +83 -8
  86. package/styles/material.scss +1 -0
  87. package/styles/material3-dark.css +83 -8
  88. package/styles/material3-dark.scss +1 -0
  89. package/styles/material3.css +83 -8
  90. package/styles/material3.scss +1 -0
  91. package/styles/numerictextbox/_bds-definition.scss +3 -0
  92. package/styles/numerictextbox/icons/_bds.scss +11 -0
  93. package/styles/rating/_bds-definition.scss +47 -0
  94. package/styles/signature/_bds-definition.scss +3 -0
  95. package/styles/slider/_bds-definition.scss +88 -0
  96. package/styles/tailwind-dark.css +69 -8
  97. package/styles/tailwind-dark.scss +1 -0
  98. package/styles/tailwind.css +69 -8
  99. package/styles/tailwind.scss +1 -0
  100. package/styles/textarea/_all.scss +1 -0
  101. package/styles/textarea/_bds-definition.scss +1 -0
  102. package/styles/textarea/_bootstrap-dark-definition.scss +1 -0
  103. package/styles/textarea/_bootstrap-definition.scss +1 -0
  104. package/styles/textarea/_bootstrap4-definition.scss +1 -0
  105. package/styles/textarea/_bootstrap5-dark-definition.scss +1 -0
  106. package/styles/textarea/_bootstrap5-definition.scss +1 -0
  107. package/styles/textarea/_fabric-dark-definition.scss +1 -0
  108. package/styles/textarea/_fabric-definition.scss +1 -0
  109. package/styles/textarea/_fluent-dark-definition.scss +1 -0
  110. package/styles/textarea/_fluent-definition.scss +1 -0
  111. package/styles/textarea/_fusionnew-definition.scss +1 -0
  112. package/styles/textarea/_highcontrast-definition.scss +1 -0
  113. package/styles/textarea/_highcontrast-light-definition.scss +1 -0
  114. package/styles/textarea/_layout.scss +36 -0
  115. package/styles/textarea/_material-dark-definition.scss +1 -0
  116. package/styles/textarea/_material-definition.scss +1 -0
  117. package/styles/textarea/_material3-dark-definition.scss +1 -0
  118. package/styles/textarea/_material3-definition.scss +1 -0
  119. package/styles/textarea/_tailwind-dark-definition.scss +1 -0
  120. package/styles/textarea/_tailwind-definition.scss +1 -0
  121. package/styles/textarea/_theme.scss +1 -0
  122. package/styles/textarea/bootstrap-dark.css +33 -0
  123. package/styles/textarea/bootstrap-dark.scss +5 -0
  124. package/styles/textarea/bootstrap.css +33 -0
  125. package/styles/textarea/bootstrap.scss +5 -0
  126. package/styles/textarea/bootstrap4.css +33 -0
  127. package/styles/textarea/bootstrap4.scss +5 -0
  128. package/styles/textarea/bootstrap5-dark.css +33 -0
  129. package/styles/textarea/bootstrap5-dark.scss +5 -0
  130. package/styles/textarea/bootstrap5.css +33 -0
  131. package/styles/textarea/bootstrap5.scss +5 -0
  132. package/styles/textarea/fabric-dark.css +33 -0
  133. package/styles/textarea/fabric-dark.scss +5 -0
  134. package/styles/textarea/fabric.css +33 -0
  135. package/styles/textarea/fabric.scss +5 -0
  136. package/styles/textarea/fluent-dark.css +33 -0
  137. package/styles/textarea/fluent-dark.scss +5 -0
  138. package/styles/textarea/fluent.css +33 -0
  139. package/styles/textarea/fluent.scss +5 -0
  140. package/styles/textarea/highcontrast-light.css +33 -0
  141. package/styles/textarea/highcontrast-light.scss +5 -0
  142. package/styles/textarea/highcontrast.css +33 -0
  143. package/styles/textarea/highcontrast.scss +5 -0
  144. package/styles/textarea/material-dark.css +39 -0
  145. package/styles/textarea/material-dark.scss +5 -0
  146. package/styles/textarea/material.css +47 -0
  147. package/styles/textarea/material.scss +5 -0
  148. package/styles/textarea/material3-dark.css +102 -0
  149. package/styles/textarea/material3-dark.scss +6 -0
  150. package/styles/textarea/material3.css +158 -0
  151. package/styles/textarea/material3.scss +6 -0
  152. package/styles/textarea/tailwind-dark.css +33 -0
  153. package/styles/textarea/tailwind-dark.scss +5 -0
  154. package/styles/textarea/tailwind.css +33 -0
  155. package/styles/textarea/tailwind.scss +5 -0
  156. package/styles/textbox/_all.scss +1 -1
  157. package/styles/textbox/_bds-definition.scss +4 -0
  158. package/styles/textbox/_layout.scss +0 -11
  159. package/styles/textbox/bootstrap-dark.css +27 -1
  160. package/styles/textbox/bootstrap.css +27 -1
  161. package/styles/textbox/bootstrap4.css +27 -1
  162. package/styles/textbox/bootstrap5-dark.css +27 -1
  163. package/styles/textbox/bootstrap5.css +27 -1
  164. package/styles/textbox/fabric-dark.css +27 -1
  165. package/styles/textbox/fabric.css +27 -1
  166. package/styles/textbox/fluent-dark.css +27 -1
  167. package/styles/textbox/fluent.css +27 -1
  168. package/styles/textbox/highcontrast-light.css +27 -1
  169. package/styles/textbox/highcontrast.css +27 -1
  170. package/styles/textbox/material-dark.css +27 -1
  171. package/styles/textbox/material.css +27 -1
  172. package/styles/textbox/material3-dark.css +27 -1
  173. package/styles/textbox/material3.css +27 -1
  174. package/styles/textbox/tailwind-dark.css +27 -1
  175. package/styles/textbox/tailwind.css +27 -1
  176. package/styles/uploader/_bds-definition.scss +232 -0
  177. package/styles/uploader/icons/_bds.scss +34 -0
  178. package/textarea.d.ts +4 -0
  179. package/textarea.js +4 -0
  180. package/.eslintrc.json +0 -260
  181. package/tslint.json +0 -111
@@ -21,6 +21,14 @@ const CLASSNAMES = {
21
21
  INPUTCUSTOMTAG: 'e-input-custom-tag',
22
22
  FLOATCUSTOMTAG: 'e-float-custom-tag'
23
23
  };
24
+ /**
25
+ * Defines the constant attributes for the input element container.
26
+ */
27
+ const containerAttributes = ['title', 'style', 'class'];
28
+ /**
29
+ * Defines the constant focus class for the input element.
30
+ */
31
+ const TEXTBOX_FOCUS = 'e-input-focus';
24
32
  /**
25
33
  * Base for Input creation through util methods.
26
34
  */
@@ -37,6 +45,7 @@ var Input;
37
45
  *
38
46
  */
39
47
  function createInput(args, internalCreateElement) {
48
+ args.element.__eventHandlers = {};
40
49
  const makeElement = !isNullOrUndefined(internalCreateElement) ? internalCreateElement : createElement;
41
50
  let inputObject = { container: null, buttons: [], clearButton: null };
42
51
  floatType = args.floatLabelType;
@@ -74,37 +83,64 @@ var Input;
74
83
  return inputObject;
75
84
  }
76
85
  Input.createInput = createInput;
86
+ function bindFocusEventHandler(args) {
87
+ const parent = getParentNode(args.element);
88
+ if (parent.classList.contains('e-input-group') || parent.classList.contains('e-outline') || parent.classList.contains('e-filled')) {
89
+ parent.classList.add('e-input-focus');
90
+ }
91
+ if (args.floatLabelType === 'Auto') {
92
+ setTimeout(() => {
93
+ Input.calculateWidth(args.element, parent);
94
+ }, 80);
95
+ }
96
+ }
97
+ function bindBlurEventHandler(args) {
98
+ const parent = getParentNode(args.element);
99
+ if (parent.classList.contains('e-input-group') || parent.classList.contains('e-outline') || parent.classList.contains('e-filled')) {
100
+ parent.classList.remove('e-input-focus');
101
+ }
102
+ if (args.floatLabelType === 'Auto' && args.element.value === '') {
103
+ setTimeout(() => {
104
+ Input.calculateWidth(args.element, parent);
105
+ }, 80);
106
+ }
107
+ }
108
+ function bindInputEventHandler(args) {
109
+ checkInputValue(args.floatLabelType, args.element);
110
+ }
77
111
  function bindInitialEvent(args) {
78
112
  checkInputValue(args.floatLabelType, args.element);
79
- args.element.addEventListener('focus', function () {
80
- const parent = getParentNode(this);
81
- if (parent.classList.contains('e-input-group') || parent.classList.contains('e-outline')
82
- || parent.classList.contains('e-filled')) {
83
- parent.classList.add('e-input-focus');
84
- }
85
- if (args.floatLabelType === 'Auto') {
86
- setTimeout(() => {
87
- Input.calculateWidth(args.element, parent);
88
- }, 80);
89
- }
90
- });
91
- args.element.addEventListener('blur', function () {
92
- const parent = getParentNode(this);
93
- if (parent.classList.contains('e-input-group') || parent.classList.contains('e-outline')
94
- || parent.classList.contains('e-filled')) {
95
- parent.classList.remove('e-input-focus');
96
- }
97
- if (args.floatLabelType === 'Auto' && args.element.value === '') {
98
- setTimeout(() => {
99
- Input.calculateWidth(args.element, parent);
100
- }, 80);
101
- }
102
- });
103
- args.element.addEventListener('input', () => {
104
- checkInputValue(floatType, args.element);
105
- });
113
+ const focusHandler = () => bindFocusEventHandler(args);
114
+ const blurHandler = () => bindBlurEventHandler(args);
115
+ const inputHandler = () => bindInputEventHandler(args);
116
+ args.element.addEventListener('focus', focusHandler);
117
+ args.element.addEventListener('blur', blurHandler);
118
+ args.element.addEventListener('input', inputHandler);
119
+ args.element.__eventHandlers["inputFocusHandler"] = { focusHandler };
120
+ args.element.__eventHandlers["inputBlurHandler"] = { blurHandler };
121
+ args.element.__eventHandlers["inputHandler"] = { inputHandler };
106
122
  }
107
123
  Input.bindInitialEvent = bindInitialEvent;
124
+ function unbindInitialEvent(args) {
125
+ if (!isNullOrUndefined(args.element)) {
126
+ if (!isNullOrUndefined(args.element.__eventHandlers)) {
127
+ if (!isNullOrUndefined(args.element.__eventHandlers["inputFocusHandler"])
128
+ && !isNullOrUndefined(args.element.__eventHandlers["inputBlurHandler"])
129
+ && !isNullOrUndefined(args.element.__eventHandlers["inputHandler"])) {
130
+ const focusHandler = args.element.__eventHandlers["inputFocusHandler"].focusHandler;
131
+ const blurHandler = args.element.__eventHandlers["inputBlurHandler"].blurHandler;
132
+ const inputHandler = args.element.__eventHandlers["inputHandler"].inputHandler;
133
+ args.element.removeEventListener('focus', focusHandler);
134
+ args.element.removeEventListener('blur', blurHandler);
135
+ args.element.removeEventListener('input', inputHandler);
136
+ // Clean up stored bound functions
137
+ delete args.element.__eventHandlers["inputFocusHandler"];
138
+ delete args.element.__eventHandlers["inputBlurHandler"];
139
+ delete args.element.__eventHandlers["inputHandler"];
140
+ }
141
+ }
142
+ }
143
+ }
108
144
  function checkInputValue(floatLabelType, inputElement) {
109
145
  const inputValue = inputElement.value;
110
146
  const inputParent = inputElement.parentElement;
@@ -154,8 +190,16 @@ var Input;
154
190
  }
155
191
  Input.wireFloatingEvents = wireFloatingEvents;
156
192
  function unwireFloatingEvents(element) {
157
- element.removeEventListener('focus', _focusFn);
158
- element.removeEventListener('blur', _blurFn);
193
+ if (!isNullOrUndefined(element)) {
194
+ element.removeEventListener('focus', _focusFn);
195
+ element.removeEventListener('blur', _blurFn);
196
+ }
197
+ }
198
+ function inputEventHandler(args) {
199
+ validateLabel(args.element, args.floatLabelType);
200
+ }
201
+ function blurEventHandler(args) {
202
+ validateLabel(args.element, args.floatLabelType);
159
203
  }
160
204
  function createFloatingInput(args, inputObject, internalCreateElement) {
161
205
  const makeElement = !isNullOrUndefined(internalCreateElement) ? internalCreateElement : createElement;
@@ -211,19 +255,36 @@ var Input;
211
255
  addClass([floatLabelElement], CLASSNAMES.LABELTOP);
212
256
  }
213
257
  if (args.floatLabelType === 'Auto') {
214
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
215
- args.element.addEventListener('input', (event) => {
216
- validateLabel(args.element, args.floatLabelType);
217
- });
218
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
219
- args.element.addEventListener('blur', (event) => {
220
- validateLabel(args.element, args.floatLabelType);
221
- });
258
+ const inputFloatHandler = () => inputEventHandler(args);
259
+ const blurFloatHandler = () => blurEventHandler(args);
260
+ // Add event listeners using the defined functions
261
+ args.element.addEventListener('input', inputFloatHandler);
262
+ args.element.addEventListener('blur', blurFloatHandler);
263
+ // Store the event handler functions to remove them later
264
+ args.element.__eventHandlers["floatInputHandler"] = { inputFloatHandler };
265
+ args.element.__eventHandlers["floatBlurHandler"] = { blurFloatHandler };
266
+ }
267
+ else {
268
+ unWireFloatLabelEvents(args);
222
269
  }
223
270
  if (!isNullOrUndefined(args.element.getAttribute('id'))) {
224
271
  floatLabelElement.setAttribute('for', args.element.getAttribute('id'));
225
272
  }
226
273
  }
274
+ function unWireFloatLabelEvents(args) {
275
+ if (!isNullOrUndefined(args.element) && !isNullOrUndefined(args.element.__eventHandlers)
276
+ && !isNullOrUndefined(args.element.__eventHandlers["floatInputHandler"])
277
+ && !isNullOrUndefined(args.element.__eventHandlers["floatBlurHandler"])) {
278
+ const inputFloatHandler = args.element.__eventHandlers["floatInputHandler"].inputFloatHandler;
279
+ const blurFloatHandler = args.element.__eventHandlers["floatBlurHandler"].blurFloatHandler;
280
+ // Remove the event listeners using the defined functions
281
+ args.element.removeEventListener('input', inputFloatHandler);
282
+ args.element.removeEventListener('blur', blurFloatHandler);
283
+ // Clean up stored event handler functions
284
+ delete args.element.__eventHandlers["floatInputHandler"];
285
+ delete args.element.__eventHandlers["floatBlurHandler"];
286
+ }
287
+ }
227
288
  function checkFloatLabelType(type, container) {
228
289
  if (type === 'Always' && container.classList.contains('e-outline')) {
229
290
  container.classList.add('e-valid-input');
@@ -309,40 +370,88 @@ var Input;
309
370
  button.setAttribute('aria-label', 'close');
310
371
  return button;
311
372
  }
373
+ function clickHandler(event, element, button) {
374
+ if (!(element.classList.contains(CLASSNAMES.DISABLE) || element.readOnly)) {
375
+ event.preventDefault();
376
+ if (element !== document.activeElement) {
377
+ element.focus();
378
+ }
379
+ element.value = '';
380
+ addClass([button], CLASSNAMES.CLEARICONHIDE);
381
+ }
382
+ }
383
+ function inputHandler(element, button) {
384
+ updateIconState(element.value, button);
385
+ }
386
+ function focusHandler(element, button) {
387
+ updateIconState(element.value, button, element.readOnly);
388
+ }
389
+ function blurHandler(element, button) {
390
+ setTimeout(() => {
391
+ if (!isNullOrUndefined(button)) {
392
+ addClass([button], CLASSNAMES.CLEARICONHIDE);
393
+ button = !isNullOrUndefined(element) && element.classList.contains('e-combobox') ? null : button;
394
+ }
395
+ }, 200);
396
+ }
312
397
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
313
398
  function wireClearBtnEvents(element, button, container) {
314
399
  if (isBindClearAction === undefined || isBindClearAction) {
315
- button.addEventListener('click', (event) => {
316
- if (!(element.classList.contains(CLASSNAMES.DISABLE) || element.readOnly)) {
317
- event.preventDefault();
318
- if (element !== document.activeElement) {
319
- element.focus();
400
+ const clickHandlerEvent = (e) => clickHandler(e, element, button);
401
+ button.addEventListener('click', clickHandlerEvent);
402
+ element.__eventHandlers["clearClickHandler"] = { clickHandlerEvent };
403
+ }
404
+ const inputHandlerEvent = () => inputHandler(element, button);
405
+ const focusHandlerEvent = () => focusHandler(element, button);
406
+ const blurHandlerEvent = () => blurHandler(element, button);
407
+ element.addEventListener('input', inputHandlerEvent);
408
+ element.addEventListener('focus', focusHandlerEvent);
409
+ element.addEventListener('blur', blurHandlerEvent);
410
+ // Store the bound functions to remove them later
411
+ element.__eventHandlers["clearInputHandler"] = { inputHandlerEvent };
412
+ element.__eventHandlers["clearFocusHandler"] = { focusHandlerEvent };
413
+ element.__eventHandlers["clearBlurHandler"] = { blurHandlerEvent };
414
+ }
415
+ Input.wireClearBtnEvents = wireClearBtnEvents;
416
+ function unWireClearBtnEvents(element, button) {
417
+ if (!isNullOrUndefined(element) && !isNullOrUndefined(element.__eventHandlers)) {
418
+ if (!isNullOrUndefined(element.__eventHandlers["clearClickHandler"])) {
419
+ const clickHandlerEvent = element.__eventHandlers["clearClickHandler"].clickHandlerEvent;
420
+ if (isBindClearAction === undefined || isBindClearAction) {
421
+ if (!isNullOrUndefined(button)) {
422
+ button.removeEventListener('click', clickHandlerEvent);
320
423
  }
321
- element.value = '';
322
- addClass([button], CLASSNAMES.CLEARICONHIDE);
323
424
  }
324
- });
425
+ delete element.__eventHandlers["clearClickHandler"];
426
+ }
427
+ if (!isNullOrUndefined(element.__eventHandlers["clearInputHandler"])
428
+ && !isNullOrUndefined(element.__eventHandlers["clearFocusHandler"])
429
+ && !isNullOrUndefined(element.__eventHandlers["clearBlurHandler"])) {
430
+ const inputHandlerEvent = element.__eventHandlers["clearInputHandler"].inputHandlerEvent;
431
+ const focusHandlerEvent = element.__eventHandlers["clearFocusHandler"].focusHandlerEvent;
432
+ const blurHandlerEvent = element.__eventHandlers["clearBlurHandler"].blurHandlerEvent;
433
+ element.removeEventListener('input', inputHandlerEvent);
434
+ element.removeEventListener('focus', focusHandlerEvent);
435
+ element.removeEventListener('blur', blurHandlerEvent);
436
+ // Clean up stored Event functions
437
+ delete element.__eventHandlers["clearInputHandler"];
438
+ delete element.__eventHandlers["clearFocusHandler"];
439
+ delete element.__eventHandlers["clearBlurHandler"];
440
+ }
441
+ }
442
+ }
443
+ function destroy(args, button = null) {
444
+ unbindInitialEvent(args);
445
+ if (args.floatLabelType === 'Auto') {
446
+ unWireFloatLabelEvents(args);
447
+ }
448
+ if (args.properties.showClearButton) {
449
+ unWireClearBtnEvents(args.element, button);
450
+ }
451
+ unwireFloatingEvents(args.element);
452
+ if (!isNullOrUndefined(args.element)) {
453
+ delete args.element.__eventHandlers;
325
454
  }
326
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
327
- element.addEventListener('input', (event) => {
328
- updateIconState(element.value, button);
329
- });
330
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
331
- element.addEventListener('focus', (event) => {
332
- updateIconState(element.value, button, element.readOnly);
333
- });
334
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
335
- element.addEventListener('blur', (event) => {
336
- setTimeout(() => {
337
- if (!isNullOrUndefined(button)) {
338
- addClass([button], CLASSNAMES.CLEARICONHIDE);
339
- button = !isNullOrUndefined(element) && element.classList.contains('e-combobox') ? null : button;
340
- }
341
- }, 200);
342
- });
343
- }
344
- Input.wireClearBtnEvents = wireClearBtnEvents;
345
- function destroy() {
346
455
 
347
456
  }
348
457
  Input.destroy = destroy;
@@ -563,7 +672,7 @@ var Input;
563
672
  * - Element to be enabled or disabled.
564
673
  */
565
674
  function setEnabled(isEnable, element, floatLabelType, inputContainer) {
566
- const disabledAttrs = { 'disabled': 'disabled', 'aria-disabled': 'true' };
675
+ const disabledAttrs = { 'disabled': '', 'aria-disabled': 'true' };
567
676
  const considerWrapper = isNullOrUndefined(inputContainer) ? false : true;
568
677
  if (isEnable) {
569
678
  element.classList.remove(CLASSNAMES.DISABLE);
@@ -676,11 +785,11 @@ var Input;
676
785
  const makeElement = !isNullOrUndefined(internalCreateElement) ? internalCreateElement : createElement;
677
786
  const container = closest(input, '.' + CLASSNAMES.INPUTGROUP);
678
787
  floatType = type;
788
+ let customTag = container.tagName;
789
+ customTag = customTag !== 'DIV' && customTag !== 'SPAN' ? customTag : null;
790
+ const args = { element: input, floatLabelType: type,
791
+ customTag: customTag, properties: { placeholder: placeholder } };
679
792
  if (type !== 'Never') {
680
- let customTag = container.tagName;
681
- customTag = customTag !== 'DIV' && customTag !== 'SPAN' ? customTag : null;
682
- const args = { element: input, floatLabelType: type,
683
- customTag: customTag, properties: { placeholder: placeholder } };
684
793
  let iconEle = container.querySelector('.e-clear-icon');
685
794
  const inputObj = { container: container };
686
795
  input.classList.remove(CLASSNAMES.INPUT);
@@ -711,6 +820,9 @@ var Input;
711
820
  wrapper.insertBefore(floatText, iconEle);
712
821
  }
713
822
  }
823
+ else {
824
+ unWireFloatLabelEvents(args);
825
+ }
714
826
  checkFloatLabelType(type, input.parentElement);
715
827
  }
716
828
  Input.addFloating = addFloating;
@@ -892,6 +1004,56 @@ var Input;
892
1004
  }
893
1005
  }
894
1006
  Input.validateInputType = validateInputType;
1007
+ function updateHTMLAttributesToElement(htmlAttributes, element) {
1008
+ if (!isNullOrUndefined(htmlAttributes)) {
1009
+ for (const key of Object.keys(htmlAttributes)) {
1010
+ if (containerAttributes.indexOf(key) < 0) {
1011
+ element.setAttribute(key, htmlAttributes[`${key}`]);
1012
+ }
1013
+ }
1014
+ }
1015
+ }
1016
+ Input.updateHTMLAttributesToElement = updateHTMLAttributesToElement;
1017
+ function updateCssClass(newClass, oldClass, container) {
1018
+ setCssClass(getInputValidClassList(newClass), [container], getInputValidClassList(oldClass));
1019
+ }
1020
+ Input.updateCssClass = updateCssClass;
1021
+ function getInputValidClassList(inputClassName) {
1022
+ let result = inputClassName;
1023
+ if (!isNullOrUndefined(inputClassName) && inputClassName !== '') {
1024
+ result = (inputClassName.replace(/\s+/g, ' ')).trim();
1025
+ }
1026
+ return result;
1027
+ }
1028
+ Input.getInputValidClassList = getInputValidClassList;
1029
+ function updateHTMLAttributesToWrapper(htmlAttributes, container) {
1030
+ if (!isNullOrUndefined(htmlAttributes)) {
1031
+ for (const key of Object.keys(htmlAttributes)) {
1032
+ if (containerAttributes.indexOf(key) > -1) {
1033
+ if (key === 'class') {
1034
+ const updatedClassValues = this.getInputValidClassList(htmlAttributes[`${key}`]);
1035
+ if (updatedClassValues !== '') {
1036
+ addClass([container], updatedClassValues.split(' '));
1037
+ }
1038
+ }
1039
+ else if (key === 'style') {
1040
+ let setStyle = container.getAttribute(key);
1041
+ setStyle = !isNullOrUndefined(setStyle) ? (setStyle + htmlAttributes[`${key}`]) :
1042
+ htmlAttributes[`${key}`];
1043
+ container.setAttribute(key, setStyle);
1044
+ }
1045
+ else {
1046
+ container.setAttribute(key, htmlAttributes[`${key}`]);
1047
+ }
1048
+ }
1049
+ }
1050
+ }
1051
+ }
1052
+ Input.updateHTMLAttributesToWrapper = updateHTMLAttributesToWrapper;
1053
+ function isBlank(inputString) {
1054
+ return (!inputString || /^\s*$/.test(inputString));
1055
+ }
1056
+ Input.isBlank = isBlank;
895
1057
  })(Input || (Input = {}));
896
1058
  /* eslint-enable valid-jsdoc, jsdoc/require-jsdoc, jsdoc/require-returns, jsdoc/require-param */
897
1059
 
@@ -1979,6 +2141,9 @@ let NumericTextBox = class NumericTextBox extends Component {
1979
2141
  */
1980
2142
  destroy() {
1981
2143
  this.unwireEvents();
2144
+ if (this.showClearButton) {
2145
+ this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
2146
+ }
1982
2147
  detach(this.hiddenInput);
1983
2148
  if (this.showSpinButton) {
1984
2149
  this.unwireSpinBtnEvents();
@@ -2002,7 +2167,11 @@ let NumericTextBox = class NumericTextBox extends Component {
2002
2167
  this.blurEventArgs = null;
2003
2168
  this.focusEventArgs = null;
2004
2169
  this.inputWrapper = null;
2005
- Input.destroy();
2170
+ Input.destroy({
2171
+ element: this.element,
2172
+ floatLabelType: this.floatLabelType,
2173
+ properties: this.properties
2174
+ }, this.clearButton);
2006
2175
  super.destroy();
2007
2176
  }
2008
2177
  /* eslint-disable valid-jsdoc, jsdoc/require-returns */
@@ -2426,6 +2595,7 @@ function unwireEvents() {
2426
2595
  EventHandler.remove(this.element, 'focus', maskInputFocusHandler);
2427
2596
  EventHandler.remove(this.element, 'blur', maskInputBlurHandler);
2428
2597
  EventHandler.remove(this.element, 'paste', maskInputPasteHandler);
2598
+ EventHandler.remove(this.element, 'drop', maskInputDropHandler);
2429
2599
  EventHandler.remove(this.element, 'cut', maskInputCutHandler);
2430
2600
  EventHandler.remove(this.element, 'mousedown', maskInputMouseDownHandler);
2431
2601
  EventHandler.remove(this.element, 'mouseup', maskInputMouseUpHandler);
@@ -3718,7 +3888,7 @@ let MaskedTextBox = class MaskedTextBox extends Component {
3718
3888
  if (this.placeholder && !this.isFocus) {
3719
3889
  this.setMaskPlaceholder(false, false);
3720
3890
  }
3721
- if (this.value === "") {
3891
+ if (this.value === "" && oldProp.value != null) {
3722
3892
  this.element.selectionStart = 0;
3723
3893
  this.element.selectionEnd = 0;
3724
3894
  }
@@ -3841,6 +4011,9 @@ let MaskedTextBox = class MaskedTextBox extends Component {
3841
4011
  */
3842
4012
  destroy() {
3843
4013
  unwireEvents.call(this);
4014
+ if (this.showClearButton) {
4015
+ this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
4016
+ }
3844
4017
  const attrArray = ['aria-labelledby', 'role', 'autocomplete', 'aria-readonly',
3845
4018
  'aria-disabled', 'autocapitalize', 'spellcheck', 'aria-autocomplete', 'aria-live', 'aria-invalid'];
3846
4019
  for (let i = 0; i < attrArray.length; i++) {
@@ -3852,7 +4025,11 @@ let MaskedTextBox = class MaskedTextBox extends Component {
3852
4025
  detach(this.inputObj.container);
3853
4026
  }
3854
4027
  this.blurEventArgs = null;
3855
- Input.destroy();
4028
+ Input.destroy({
4029
+ element: this.element,
4030
+ floatLabelType: this.floatLabelType,
4031
+ properties: this.properties
4032
+ }, this.clearButton);
3856
4033
  this.changeEventArgs = null;
3857
4034
  this.inputObj = null;
3858
4035
  super.destroy();
@@ -6474,6 +6651,10 @@ let Slider = class Slider extends Component {
6474
6651
  if (args !== 'tooltip') {
6475
6652
  this.updateConfig();
6476
6653
  }
6654
+ if (this.readonly) {
6655
+ this.sliderContainer.classList.remove(classNames.readonly);
6656
+ this.setReadOnly();
6657
+ }
6477
6658
  }
6478
6659
  changeRtl() {
6479
6660
  if (!this.enableRtl && this.type === 'Range') {
@@ -6615,6 +6796,7 @@ let Slider = class Slider extends Component {
6615
6796
  break;
6616
6797
  case 'tooltip':
6617
6798
  if (!isNullOrUndefined(newProp.tooltip) && !isNullOrUndefined(oldProp.tooltip)) {
6799
+ this.initialTooltip = true;
6618
6800
  this.setTooltip(prop);
6619
6801
  if (!this.showButtons) {
6620
6802
  this.wireEvents();
@@ -6858,7 +7040,7 @@ __decorate$2([
6858
7040
  Property('')
6859
7041
  ], Slider.prototype, "cssClass", void 0);
6860
7042
  __decorate$2([
6861
- Property(false)
7043
+ Property(true)
6862
7044
  ], Slider.prototype, "enableHtmlSanitizer", void 0);
6863
7045
  __decorate$2([
6864
7046
  Event()
@@ -13176,8 +13358,6 @@ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators,
13176
13358
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13177
13359
  };
13178
13360
  const HIDE_CLEAR = 'e-clear-icon-hide';
13179
- const TEXTBOX_FOCUS = 'e-input-focus';
13180
- const containerAttr = ['title', 'style', 'class'];
13181
13361
  /**
13182
13362
  * Represents the TextBox component that allows the user to enter the values based on it's type.
13183
13363
  * ```html
@@ -13233,7 +13413,7 @@ let TextBox = class TextBox extends Component {
13233
13413
  {
13234
13414
  const prevOnChange = this.isProtectedOnChange;
13235
13415
  this.isProtectedOnChange = true;
13236
- if (!this.isBlank(this.value)) {
13416
+ if (!Input.isBlank(this.value)) {
13237
13417
  this.value = this.value.toString();
13238
13418
  }
13239
13419
  this.isProtectedOnChange = prevOnChange;
@@ -13255,8 +13435,8 @@ let TextBox = class TextBox extends Component {
13255
13435
  break;
13256
13436
  case 'htmlAttributes':
13257
13437
  {
13258
- this.updateHTMLAttrToElement();
13259
- this.updateHTMLAttrToWrapper();
13438
+ this.updateHTMLAttributesToElement();
13439
+ this.updateHTMLAttributesToWrapper();
13260
13440
  this.checkAttributes(true);
13261
13441
  this.multiline && !isNullOrUndefined(this.textarea) ? Input.validateInputType(this.textboxWrapper.container, this.textarea) : Input.validateInputType(this.textboxWrapper.container, this.element);
13262
13442
  }
@@ -13291,7 +13471,7 @@ let TextBox = class TextBox extends Component {
13291
13471
  }
13292
13472
  break;
13293
13473
  case 'cssClass':
13294
- this.updateCssClass(newProp.cssClass, oldProp.cssClass);
13474
+ Input.updateCssClass(newProp.cssClass, oldProp.cssClass, this.textboxWrapper.container);
13295
13475
  break;
13296
13476
  case 'locale':
13297
13477
  this.globalize = new Internationalization(this.locale);
@@ -13311,9 +13491,6 @@ let TextBox = class TextBox extends Component {
13311
13491
  getModuleName() {
13312
13492
  return 'textbox';
13313
13493
  }
13314
- isBlank(str) {
13315
- return (!str || /^\s*$/.test(str));
13316
- }
13317
13494
  preRender() {
13318
13495
  this.cloneElement = this.element.cloneNode(true);
13319
13496
  this.formElement = closest(this.element, 'form');
@@ -13344,7 +13521,7 @@ let TextBox = class TextBox extends Component {
13344
13521
  this.element = inputElement;
13345
13522
  setValue('ej2_instances', ejInstance, this.element);
13346
13523
  }
13347
- this.updateHTMLAttrToElement();
13524
+ this.updateHTMLAttributesToElement();
13348
13525
  this.checkAttributes(false);
13349
13526
  if ((isNullOrUndefined(this.textboxOptions) || (this.textboxOptions['value'] === undefined)) && this.element.value !== '') {
13350
13527
  this.setProperties({ value: this.element.value }, true);
@@ -13380,7 +13557,7 @@ let TextBox = class TextBox extends Component {
13380
13557
  const apiAttributes = ['placeholder', 'disabled', 'value', 'readonly', 'type', 'autocomplete'];
13381
13558
  for (let index = 0; index < this.element.attributes.length; index++) {
13382
13559
  const attributeName = this.element.attributes[index].nodeName;
13383
- if (this.element.hasAttribute(attributeName) && containerAttr.indexOf(attributeName) < 0 &&
13560
+ if (this.element.hasAttribute(attributeName) && containerAttributes.indexOf(attributeName) < 0 &&
13384
13561
  !(attributeName === 'id' || attributeName === 'type' || attributeName === 'e-mappinguid')) {
13385
13562
  // e-mappinguid attribute is handled for Grid component.
13386
13563
  this.textarea.setAttribute(attributeName, this.element.attributes[index].nodeValue);
@@ -13446,7 +13623,7 @@ let TextBox = class TextBox extends Component {
13446
13623
  render() {
13447
13624
  let updatedCssClassValue = this.cssClass;
13448
13625
  if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
13449
- updatedCssClassValue = this.getInputValidClassList(this.cssClass);
13626
+ updatedCssClassValue = Input.getInputValidClassList(this.cssClass);
13450
13627
  }
13451
13628
  this.respectiveElement = (this.isHiddenInput) ? this.textarea : this.element;
13452
13629
  this.textboxWrapper = Input.createInput({
@@ -13461,7 +13638,7 @@ let TextBox = class TextBox extends Component {
13461
13638
  showClearButton: this.showClearButton
13462
13639
  }
13463
13640
  });
13464
- this.updateHTMLAttrToWrapper();
13641
+ this.updateHTMLAttributesToWrapper();
13465
13642
  if (this.isHiddenInput) {
13466
13643
  this.respectiveElement.parentNode.insertBefore(this.element, this.respectiveElement);
13467
13644
  }
@@ -13491,47 +13668,11 @@ let TextBox = class TextBox extends Component {
13491
13668
  }
13492
13669
  this.renderComplete();
13493
13670
  }
13494
- updateHTMLAttrToWrapper() {
13495
- if (!isNullOrUndefined(this.htmlAttributes)) {
13496
- for (const key of Object.keys(this.htmlAttributes)) {
13497
- if (containerAttr.indexOf(key) > -1) {
13498
- if (key === 'class') {
13499
- const updatedClassValues = this.getInputValidClassList(this.htmlAttributes[`${key}`]);
13500
- if (updatedClassValues !== '') {
13501
- addClass([this.textboxWrapper.container], updatedClassValues.split(' '));
13502
- }
13503
- }
13504
- else if (key === 'style') {
13505
- let setStyle = this.textboxWrapper.container.getAttribute(key);
13506
- setStyle = !isNullOrUndefined(setStyle) ? (setStyle + this.htmlAttributes[`${key}`]) :
13507
- this.htmlAttributes[`${key}`];
13508
- this.textboxWrapper.container.setAttribute(key, setStyle);
13509
- }
13510
- else {
13511
- this.textboxWrapper.container.setAttribute(key, this.htmlAttributes[`${key}`]);
13512
- }
13513
- }
13514
- }
13515
- }
13516
- }
13517
- updateHTMLAttrToElement() {
13518
- if (!isNullOrUndefined(this.htmlAttributes)) {
13519
- for (const key of Object.keys(this.htmlAttributes)) {
13520
- if (containerAttr.indexOf(key) < 0) {
13521
- this.multiline && !isNullOrUndefined(this.textarea) ? this.textarea.setAttribute(key, this.htmlAttributes[`${key}`]) : this.element.setAttribute(key, this.htmlAttributes[`${key}`]);
13522
- }
13523
- }
13524
- }
13525
- }
13526
- updateCssClass(newClass, oldClass) {
13527
- Input.setCssClass(this.getInputValidClassList(newClass), [this.textboxWrapper.container], this.getInputValidClassList(oldClass));
13671
+ updateHTMLAttributesToWrapper() {
13672
+ Input.updateHTMLAttributesToWrapper(this.htmlAttributes, this.textboxWrapper.container);
13528
13673
  }
13529
- getInputValidClassList(inputClassName) {
13530
- let result = inputClassName;
13531
- if (!isNullOrUndefined(inputClassName) && inputClassName !== '') {
13532
- result = (inputClassName.replace(/\s+/g, ' ')).trim();
13533
- }
13534
- return result;
13674
+ updateHTMLAttributesToElement() {
13675
+ Input.updateHTMLAttributesToElement(this.htmlAttributes, this.respectiveElement ? this.respectiveElement : (this.multiline && !isNullOrUndefined(this.textarea) ? this.textarea : this.element));
13535
13676
  }
13536
13677
  setInitialValue() {
13537
13678
  if (!this.isAngular) {
@@ -13723,6 +13864,9 @@ let TextBox = class TextBox extends Component {
13723
13864
  */
13724
13865
  destroy() {
13725
13866
  this.unWireEvents();
13867
+ if (this.showClearButton) {
13868
+ this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
13869
+ }
13726
13870
  if (this.element.tagName === 'INPUT' && this.multiline) {
13727
13871
  detach(this.textboxWrapper.container.getElementsByTagName('textarea')[0]);
13728
13872
  this.respectiveElement = this.element;
@@ -13736,7 +13880,11 @@ let TextBox = class TextBox extends Component {
13736
13880
  detach(this.textboxWrapper.container);
13737
13881
  }
13738
13882
  this.textboxWrapper = null;
13739
- Input.destroy();
13883
+ Input.destroy({
13884
+ element: this.respectiveElement,
13885
+ floatLabelType: this.floatLabelType,
13886
+ properties: this.properties
13887
+ }, this.clearButton);
13740
13888
  super.destroy();
13741
13889
  }
13742
13890
  /**
@@ -13912,107 +14060,785 @@ TextBox = __decorate$6([
13912
14060
  * Uploader modules
13913
14061
  */
13914
14062
 
13915
- class SignatureBase extends Component {
13916
- constructor() {
13917
- super(...arguments);
13918
- /* minDistance(distance between the two point) was calaculated for smoothness.*/
13919
- this.minDistance = 5;
13920
- this.previous = 0;
13921
- /* interval handles for the smoothness in the mouse move event.*/
13922
- this.interval = 30;
13923
- this.timeout = null;
13924
- this.isSignatureEmpty = true;
13925
- this.backgroundLoaded = null;
13926
- this.isBlazor = false;
13927
- this.isResponsive = false;
13928
- this.signPointsColl = [];
13929
- this.signRatioPointsColl = [];
14063
+ var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14064
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14065
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14066
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14067
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
14068
+ };
14069
+ const HIDE_CLEAR$1 = 'e-clear-icon-hide';
14070
+ const AUTO_WIDTH = 'e-auto-width';
14071
+ const RESIZE_X = 'e-resize-x';
14072
+ const RESIZE_Y = 'e-resize-y';
14073
+ const RESIZE_XY = 'e-resize-xy';
14074
+ const RESIZE_NONE = 'e-resize-none';
14075
+ let TextArea = class TextArea extends Component {
14076
+ constructor(options, element) {
14077
+ super(options, element);
14078
+ this.previousValue = null;
14079
+ this.isForm = false;
14080
+ this.inputPreviousValue = null;
14081
+ this.isAngular = false;
14082
+ this.isVue = false;
14083
+ this.textareaOptions = options;
13930
14084
  }
13931
14085
  /**
13932
- * To Initialize the component rendering
14086
+ * Calls internally if any of the property value is changed.
13933
14087
  *
13934
- * @private
13935
- * @param {HTMLCanvasElement} element - Specifies the canvas element.
13936
- * @param {BlazorDotnetObject} dotnetRef - Specifies for blazor client to server communication.
14088
+ * @param {TextAreaModel} newProp - Returns the dynamic property value of the component.
14089
+ * @param {TextAreaModel} oldProp - Returns the previous property value of the component.
13937
14090
  * @returns {void}
14091
+ * @private
13938
14092
  */
13939
- initialize(element, dotnetRef) {
13940
- this.clearArray = [];
13941
- this.element = element;
13942
- this.canvasContext = this.element.getContext('2d');
13943
- this.canvasContext.canvas.tabIndex = -1;
13944
- if (dotnetRef) {
13945
- this.dotnetRef = dotnetRef;
13946
- this.isBlazor = true;
13947
- if (this.signatureValue) {
13948
- this.loadPersistedSignature();
13949
- }
13950
- }
13951
- this.setHTMLProperties();
13952
- if (isNullOrUndefined(this.signatureValue)) {
13953
- this.updateSnapCollection(true);
13954
- }
13955
- this.wireEvents();
13956
- if (!this.isBlazor) {
13957
- this.trigger('created', null);
13958
- }
13959
- }
13960
- wireEvents() {
13961
- if (isNullOrUndefined(this.pointColl) && !this.isReadOnly && !this.disabled) {
13962
- EventHandler.add(this.canvasContext.canvas, 'mousedown touchstart', this.mouseDownHandler, this);
13963
- EventHandler.add(this.canvasContext.canvas, 'keydown', this.keyboardHandler, this);
13964
- window.addEventListener('resize', this.resizeHandler.bind(this));
13965
- }
13966
- else if (this.pointColl) {
13967
- EventHandler.add(this.canvasContext.canvas, 'mousemove touchmove', this.mouseMoveHandler, this);
13968
- EventHandler.add(this.canvasContext.canvas, 'mouseup touchend', this.mouseUpHandler, this);
13969
- EventHandler.add(document, 'mouseup', this.mouseUpHandler, this);
13970
- }
13971
- }
13972
- unwireEvents(type) {
13973
- if (type === 'mouseup' || type === 'touchend') {
13974
- EventHandler.remove(this.canvasContext.canvas, 'mousemove touchmove', this.mouseMoveHandler);
13975
- EventHandler.remove(this.canvasContext.canvas, 'mouseup touchend', this.mouseUpHandler);
13976
- EventHandler.remove(document, 'mouseup', this.mouseUpHandler);
13977
- }
13978
- else {
13979
- EventHandler.remove(this.canvasContext.canvas, 'mousedown touchstart', this.mouseDownHandler);
13980
- EventHandler.remove(this.canvasContext.canvas, 'keydown', this.keyboardHandler);
13981
- window.removeEventListener('resize', this.resizeHandler);
13982
- }
13983
- }
13984
- setHTMLProperties() {
13985
- if (this.element.height === 150 && this.element.width === 300 && this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
13986
- this.element.height = this.element.offsetHeight;
13987
- this.element.width = this.element.offsetWidth;
13988
- this.isResponsive = true;
13989
- }
13990
- else if ((this.element.height !== this.element.offsetHeight - 1 || this.element.width !== this.element.offsetWidth - 1)
13991
- && this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
13992
- this.element.height = this.element.offsetHeight;
13993
- this.element.width = this.element.offsetWidth;
13994
- }
13995
- this.canvasContext.fillStyle = this.strokeColor;
13996
- this.tempCanvas = this.createElement('canvas', { className: 'e-' + this.getModuleName() + '-temp' });
13997
- this.tempContext = this.tempCanvas.getContext('2d');
13998
- this.tempCanvas.width = this.element.width;
13999
- this.tempCanvas.height = this.element.height;
14000
- if (this.backgroundImage) {
14001
- this.canvasContext.canvas.style.backgroundImage = 'url(' + this.backgroundImage + ')';
14002
- this.canvasContext.canvas.style.backgroundRepeat = 'no-repeat';
14003
- if (this.saveWithBackground) {
14004
- this.setBackgroundImage(this.backgroundImage, 'temp');
14005
- }
14006
- }
14007
- else if (this.backgroundColor) {
14008
- this.canvasContext.canvas.style.backgroundColor = this.backgroundColor;
14009
- }
14010
- }
14011
- // eslint-disable-next-line
14012
- mouseDownHandler(e) {
14013
- if (e.buttons === 1 || e.buttons === 2 || e.type === 'touchstart') {
14014
- if (e.type === 'touchstart') {
14015
- e.preventDefault();
14093
+ onPropertyChanged(newProp, oldProp) {
14094
+ for (const prop of Object.keys(newProp)) {
14095
+ switch (prop) {
14096
+ case 'floatLabelType':
14097
+ Input.removeFloating(this.textareaWrapper);
14098
+ Input.addFloating(this.element, this.floatLabelType, this.placeholder);
14099
+ if (this.floatLabelType === 'Never') {
14100
+ this.element.removeAttribute('aria-labelledby');
14101
+ }
14102
+ break;
14103
+ case 'enabled':
14104
+ Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
14105
+ this.bindClearEvent();
14106
+ if (!this.enabled && this.resizeMode !== 'None') {
14107
+ this.element.classList.remove(this.getCurrentResizeClass(this.resizeMode));
14108
+ this.element.classList.add(RESIZE_NONE);
14109
+ }
14110
+ else {
14111
+ this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
14112
+ }
14113
+ break;
14114
+ case 'width':
14115
+ if (this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') {
14116
+ this.setElementWidth(newProp.width);
14117
+ this.textareaWrapper.container.classList.add(AUTO_WIDTH);
14118
+ }
14119
+ else {
14120
+ if (this.textareaWrapper.container.classList.contains(AUTO_WIDTH)) {
14121
+ this.textareaWrapper.container.classList.remove(AUTO_WIDTH);
14122
+ }
14123
+ Input.setWidth(newProp.width, this.textareaWrapper.container);
14124
+ }
14125
+ break;
14126
+ case 'value':
14127
+ {
14128
+ const prevOnChange = this.isProtectedOnChange;
14129
+ this.isProtectedOnChange = true;
14130
+ if (!Input.isBlank(this.value)) {
14131
+ this.value = this.value.toString();
14132
+ }
14133
+ this.isProtectedOnChange = prevOnChange;
14134
+ Input.setValue(this.value, this.element, this.floatLabelType, this.showClearButton);
14135
+ this.inputPreviousValue = this.element.value;
14136
+ /* istanbul ignore next */
14137
+ if ((this.isAngular || this.isVue) && this.preventChange === true) {
14138
+ this.previousValue = this.isAngular ? this.value : this.previousValue;
14139
+ this.preventChange = false;
14140
+ }
14141
+ else if (isNullOrUndefined(this.isAngular) || !this.isAngular
14142
+ || (this.isAngular && !this.preventChange) || (this.isAngular && isNullOrUndefined(this.preventChange))) {
14143
+ this.raiseChangeEvent();
14144
+ }
14145
+ }
14146
+ break;
14147
+ case 'htmlAttributes':
14148
+ {
14149
+ this.updateHTMLAttributesToElement();
14150
+ this.updateHTMLAttributesToWrapper();
14151
+ this.checkAttributes(true);
14152
+ Input.validateInputType(this.textareaWrapper.container, this.element);
14153
+ }
14154
+ break;
14155
+ case 'readonly':
14156
+ Input.setReadonly(this.readonly, this.element);
14157
+ if (this.readonly) {
14158
+ this.element.setAttribute('aria-readonly', 'true');
14159
+ }
14160
+ else {
14161
+ this.element.removeAttribute('aria-readonly');
14162
+ }
14163
+ break;
14164
+ case 'showClearButton':
14165
+ Input.setClearButton(this.showClearButton, this.element, this.textareaWrapper);
14166
+ this.bindClearEvent();
14167
+ break;
14168
+ case 'enableRtl':
14169
+ Input.setEnableRtl(this.enableRtl, [this.textareaWrapper.container]);
14170
+ break;
14171
+ case 'placeholder':
14172
+ Input.setPlaceholder(this.placeholder, this.element);
14173
+ Input.calculateWidth(this.element, this.textareaWrapper.container);
14174
+ break;
14175
+ case 'cssClass':
14176
+ Input.updateCssClass(newProp.cssClass, oldProp.cssClass, this.textareaWrapper.container);
14177
+ break;
14178
+ case 'locale':
14179
+ this.globalize = new Internationalization(this.locale);
14180
+ this.l10n.setLocale(this.locale);
14181
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
14182
+ Input.setPlaceholder(this.placeholder, this.element);
14183
+ break;
14184
+ case 'rowsCount':
14185
+ if (this.rowsCount) {
14186
+ this.element.setAttribute('rows', this.rowsCount.toString());
14187
+ }
14188
+ break;
14189
+ case 'columnsCount':
14190
+ if (this.columnsCount) {
14191
+ this.element.setAttribute('cols', this.columnsCount.toString());
14192
+ if (this.width == null) {
14193
+ this.textareaWrapper.container.classList.add(AUTO_WIDTH);
14194
+ }
14195
+ }
14196
+ break;
14197
+ case 'maxLength':
14198
+ if (this.maxLength) {
14199
+ this.element.setAttribute('maxlength', this.maxLength.toString());
14200
+ }
14201
+ break;
14202
+ case 'resizeMode':
14203
+ if (this.enabled) {
14204
+ if (this.element.classList.contains(this.getCurrentResizeClass(oldProp.resizeMode))) {
14205
+ this.element.classList.remove(this.getCurrentResizeClass(oldProp.resizeMode));
14206
+ }
14207
+ this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
14208
+ if (this.element.style.width && (this.resizeMode === 'None' || this.resizeMode === 'Vertical')) {
14209
+ Input.setWidth(this.element.style.width, this.textareaWrapper.container);
14210
+ }
14211
+ else {
14212
+ const currentWidth = this.element.offsetWidth;
14213
+ this.element.style.width = currentWidth + 'px';
14214
+ if (this.textareaWrapper.container.style.width) {
14215
+ this.textareaWrapper.container.style.width = '';
14216
+ }
14217
+ }
14218
+ this.setWrapperWidth();
14219
+ }
14220
+ break;
14221
+ }
14222
+ }
14223
+ }
14224
+ preRender() {
14225
+ this.formElement = closest(this.element, 'form');
14226
+ if (!isNullOrUndefined(this.formElement)) {
14227
+ this.isForm = true;
14228
+ }
14229
+ /* istanbul ignore next */
14230
+ if (this.element.tagName === 'EJS-TEXTAREA') {
14231
+ const ejInstance = getValue('ej2_instances', this.element);
14232
+ const inputElement = this.createElement('textarea');
14233
+ let index = 0;
14234
+ for (index; index < this.element.attributes.length; index++) {
14235
+ const attributeName = this.element.attributes[index].nodeName;
14236
+ if (attributeName !== 'id' && attributeName !== 'class') {
14237
+ inputElement.setAttribute(attributeName, this.element.attributes[index].nodeValue);
14238
+ inputElement.innerHTML = this.element.innerHTML;
14239
+ if (attributeName === 'name') {
14240
+ this.element.removeAttribute('name');
14241
+ }
14242
+ }
14243
+ else if (attributeName === 'class') {
14244
+ inputElement.setAttribute(attributeName, this.element.className.split(' ').filter((item) => item.indexOf('ng-') !== 0).join(' '));
14245
+ }
14246
+ }
14247
+ this.element.appendChild(inputElement);
14248
+ this.element = inputElement;
14249
+ setValue('ej2_instances', ejInstance, this.element);
14250
+ }
14251
+ this.updateHTMLAttributesToElement();
14252
+ this.checkAttributes(false);
14253
+ if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['value'] === undefined)) && this.element.value !== '') {
14254
+ this.setProperties({ value: this.element.value }, true);
14255
+ }
14256
+ this.globalize = new Internationalization(this.locale);
14257
+ const localeText = { placeholder: this.placeholder };
14258
+ this.l10n = new L10n('textarea', localeText, this.locale);
14259
+ if (this.l10n.getConstant('placeholder') !== '') {
14260
+ this.setProperties({ placeholder: this.placeholder || this.l10n.getConstant('placeholder') }, true);
14261
+ }
14262
+ if (!this.element.hasAttribute('id')) {
14263
+ this.element.setAttribute('id', getUniqueID('textbox'));
14264
+ }
14265
+ if (!this.element.hasAttribute('name')) {
14266
+ this.element.setAttribute('name', this.element.getAttribute('id'));
14267
+ }
14268
+ if (this.rowsCount) {
14269
+ this.element.setAttribute('rows', this.rowsCount.toString());
14270
+ }
14271
+ if (this.columnsCount) {
14272
+ this.element.setAttribute('cols', this.columnsCount.toString());
14273
+ }
14274
+ if (this.maxLength) {
14275
+ this.element.setAttribute('maxlength', this.maxLength.toString());
14276
+ }
14277
+ if (!this.element.style.resize && this.enabled) {
14278
+ this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
14279
+ }
14280
+ if (this.enabled) {
14281
+ this.element.setAttribute('aria-multiline', 'true');
14282
+ }
14283
+ }
14284
+ /**
14285
+ * To Initialize the control rendering
14286
+ *
14287
+ * @returns {void}
14288
+ * @private
14289
+ */
14290
+ render() {
14291
+ let updatedCssClassValue = this.cssClass;
14292
+ if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
14293
+ updatedCssClassValue = Input.getInputValidClassList(this.cssClass);
14294
+ }
14295
+ this.textareaWrapper = Input.createInput({
14296
+ element: this.element,
14297
+ floatLabelType: this.floatLabelType,
14298
+ properties: {
14299
+ enabled: this.enabled,
14300
+ enableRtl: this.enableRtl,
14301
+ cssClass: updatedCssClassValue,
14302
+ readonly: this.readonly,
14303
+ placeholder: this.placeholder,
14304
+ showClearButton: this.showClearButton
14305
+ }
14306
+ });
14307
+ this.updateHTMLAttributesToWrapper();
14308
+ this.wireEvents();
14309
+ if (!isNullOrUndefined(this.value)) {
14310
+ Input.setValue(this.value, this.element, this.floatLabelType, this.showClearButton);
14311
+ }
14312
+ if (!isNullOrUndefined(this.value)) {
14313
+ this.initialValue = this.value;
14314
+ if (!this.isAngular) {
14315
+ this.element.setAttribute('value', this.initialValue);
14316
+ }
14317
+ }
14318
+ this.previousValue = this.value;
14319
+ this.inputPreviousValue = this.value;
14320
+ this.element.defaultValue = this.element.value;
14321
+ Input.setWidth(this.width, this.textareaWrapper.container);
14322
+ this.setWrapperWidth();
14323
+ this.renderComplete();
14324
+ }
14325
+ getModuleName() {
14326
+ return 'textarea';
14327
+ }
14328
+ /* eslint-disable valid-jsdoc, jsdoc/require-returns */
14329
+ /**
14330
+ * Gets the properties to be maintained in the persisted state.
14331
+ *
14332
+ */
14333
+ getPersistData() {
14334
+ const keyEntity = ['value'];
14335
+ return this.addOnPersist(keyEntity);
14336
+ }
14337
+ checkAttributes(isDynamic) {
14338
+ const attrs = isDynamic ? isNullOrUndefined(this.htmlAttributes) ? [] : Object.keys(this.htmlAttributes) :
14339
+ ['placeholder', 'disabled', 'value', 'readonly'];
14340
+ for (const key of attrs) {
14341
+ if (!isNullOrUndefined(this.element.getAttribute(key))) {
14342
+ switch (key) {
14343
+ case 'disabled':
14344
+ if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['enabled'] === undefined)) || isDynamic) {
14345
+ const enabled = this.element.getAttribute(key) === 'disabled' || this.element.getAttribute(key) === '' ||
14346
+ this.element.getAttribute(key) === 'true' ? false : true;
14347
+ this.setProperties({ enabled: enabled }, !isDynamic);
14348
+ }
14349
+ break;
14350
+ case 'readonly':
14351
+ if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['readonly'] === undefined)) || isDynamic) {
14352
+ const readonly = this.element.getAttribute(key) === 'readonly' || this.element.getAttribute(key) === ''
14353
+ || this.element.getAttribute(key) === 'true' ? true : false;
14354
+ this.setProperties({ readonly: readonly }, !isDynamic);
14355
+ }
14356
+ break;
14357
+ case 'placeholder':
14358
+ if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['placeholder'] === undefined)) || isDynamic) {
14359
+ this.setProperties({ placeholder: this.element.placeholder }, !isDynamic);
14360
+ }
14361
+ break;
14362
+ case 'value':
14363
+ if (((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['value'] === undefined)) || isDynamic) && this.element.value !== '') {
14364
+ this.setProperties({ value: this.element.value }, !isDynamic);
14365
+ }
14366
+ break;
14367
+ }
14368
+ }
14369
+ }
14370
+ }
14371
+ wireEvents() {
14372
+ EventHandler.add(this.element, 'focus', this.focusHandler, this);
14373
+ EventHandler.add(this.element, 'blur', this.focusOutHandler, this);
14374
+ EventHandler.add(this.element, 'keydown', this.keydownHandler, this);
14375
+ EventHandler.add(this.element, 'input', this.inputHandler, this);
14376
+ EventHandler.add(this.element, 'change', this.changeHandler, this);
14377
+ if (this.isForm) {
14378
+ EventHandler.add(this.formElement, 'reset', this.resetForm, this);
14379
+ }
14380
+ this.bindClearEvent();
14381
+ }
14382
+ unWireEvents() {
14383
+ EventHandler.remove(this.element, 'focus', this.focusHandler);
14384
+ EventHandler.remove(this.element, 'blur', this.focusOutHandler);
14385
+ EventHandler.remove(this.element, 'keydown', this.keydownHandler);
14386
+ EventHandler.remove(this.element, 'input', this.inputHandler);
14387
+ EventHandler.remove(this.element, 'change', this.changeHandler);
14388
+ if (this.isForm) {
14389
+ EventHandler.remove(this.formElement, 'reset', this.resetForm);
14390
+ }
14391
+ }
14392
+ /**
14393
+ * Removes the component from the DOM and detaches all its related event handlers.
14394
+ * Also, it maintains the initial TextArea element from the DOM.
14395
+ *
14396
+ * @method destroy
14397
+ * @returns {void}
14398
+ */
14399
+ destroy() {
14400
+ this.unWireEvents();
14401
+ if (this.showClearButton) {
14402
+ this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
14403
+ }
14404
+ this.element.value = this.element.defaultValue;
14405
+ this.element.classList.remove('e-input', RESIZE_X, RESIZE_Y, RESIZE_XY, RESIZE_NONE);
14406
+ this.removeAttributes(['aria-disabled', 'aria-readonly', 'aria-labelledby', 'aria-multiline']);
14407
+ if (!isNullOrUndefined(this.textareaWrapper)) {
14408
+ this.textareaWrapper.container.insertAdjacentElement('afterend', this.element);
14409
+ detach(this.textareaWrapper.container);
14410
+ }
14411
+ this.textareaWrapper = null;
14412
+ this.formElement = null;
14413
+ Input.destroy({
14414
+ element: this.element,
14415
+ floatLabelType: this.floatLabelType,
14416
+ properties: this.properties
14417
+ }, this.clearButton);
14418
+ super.destroy();
14419
+ }
14420
+ focusHandler(args) {
14421
+ const eventArgs = {
14422
+ container: this.textareaWrapper.container,
14423
+ event: args,
14424
+ value: this.value
14425
+ };
14426
+ this.trigger('focus', eventArgs);
14427
+ }
14428
+ focusOutHandler(args) {
14429
+ if (!(this.previousValue === null && this.value === null) &&
14430
+ (this.previousValue !== this.value)) {
14431
+ this.raiseChangeEvent(args, true);
14432
+ }
14433
+ const eventArgs = {
14434
+ container: this.textareaWrapper.container,
14435
+ event: args,
14436
+ value: this.value
14437
+ };
14438
+ this.trigger('blur', eventArgs);
14439
+ }
14440
+ keydownHandler(args) {
14441
+ if ((args.keyCode === 13 || args.keyCode === 9) && !((this.previousValue === null || this.previousValue === '') && (this.value === null || this.value === '') && this.element.value === '')) {
14442
+ this.setProperties({ value: this.element.value }, true);
14443
+ }
14444
+ }
14445
+ inputHandler(args) {
14446
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias
14447
+ const textareaObj = this;
14448
+ const eventArgs = {
14449
+ event: args,
14450
+ value: this.element.value,
14451
+ previousValue: this.inputPreviousValue,
14452
+ container: this.textareaWrapper.container
14453
+ };
14454
+ this.inputPreviousValue = this.element.value;
14455
+ /* istanbul ignore next */
14456
+ if (this.isAngular) {
14457
+ textareaObj.localChange({ value: this.element.value });
14458
+ this.preventChange = true;
14459
+ }
14460
+ if (this.isVue) {
14461
+ this.preventChange = true;
14462
+ }
14463
+ this.trigger('input', eventArgs);
14464
+ args.stopPropagation();
14465
+ }
14466
+ changeHandler(args) {
14467
+ this.setProperties({ value: this.element.value }, true);
14468
+ if (this.previousValue !== this.value) {
14469
+ this.raiseChangeEvent(args, true);
14470
+ }
14471
+ args.stopPropagation();
14472
+ }
14473
+ raiseChangeEvent(event, interaction) {
14474
+ const eventArgs = {
14475
+ event: event,
14476
+ value: this.value,
14477
+ previousValue: this.previousValue,
14478
+ container: this.textareaWrapper.container,
14479
+ isInteraction: interaction ? interaction : false,
14480
+ isInteracted: interaction ? interaction : false
14481
+ };
14482
+ this.preventChange = false;
14483
+ this.trigger('change', eventArgs);
14484
+ this.previousValue = this.value;
14485
+ }
14486
+ updateHTMLAttributesToWrapper() {
14487
+ Input.updateHTMLAttributesToWrapper(this.htmlAttributes, this.textareaWrapper.container);
14488
+ }
14489
+ updateHTMLAttributesToElement() {
14490
+ Input.updateHTMLAttributesToElement(this.htmlAttributes, this.element);
14491
+ }
14492
+ bindClearEvent() {
14493
+ if (this.showClearButton) {
14494
+ if (this.enabled) {
14495
+ EventHandler.add(this.textareaWrapper.clearButton, 'mousedown touchstart', this.resetInputHandler, this);
14496
+ }
14497
+ else {
14498
+ EventHandler.remove(this.textareaWrapper.clearButton, 'mousedown touchstart', this.resetInputHandler);
14499
+ }
14500
+ }
14501
+ }
14502
+ resetInputHandler(event) {
14503
+ event.preventDefault();
14504
+ if (!(this.textareaWrapper.clearButton.classList.contains(HIDE_CLEAR$1)) || this.textareaWrapper.container.classList.contains('e-static-clear')) {
14505
+ Input.setValue('', this.element, this.floatLabelType, this.showClearButton);
14506
+ this.setProperties({ value: this.element.value }, true);
14507
+ }
14508
+ const eventArgs = {
14509
+ event: event,
14510
+ value: this.element.value,
14511
+ previousValue: this.inputPreviousValue,
14512
+ container: this.textareaWrapper.container
14513
+ };
14514
+ this.trigger('input', eventArgs);
14515
+ this.inputPreviousValue = this.element.value;
14516
+ this.raiseChangeEvent(event, true);
14517
+ if (closest(this.element, 'form')) {
14518
+ const element = this.element;
14519
+ const keyupEvent = document.createEvent('KeyboardEvent');
14520
+ keyupEvent.initEvent('keyup', false, true);
14521
+ element.dispatchEvent(keyupEvent);
14522
+ }
14523
+ }
14524
+ /* eslint-enable valid-jsdoc, jsdoc/require-returns */
14525
+ /**
14526
+ * Adding the multiple attributes as key-value pair to the TextArea element.
14527
+ *
14528
+ * @param {string} attributes - Specifies the attributes to be add to TextArea element.
14529
+ * @returns {void}
14530
+ */
14531
+ addAttributes(attributes$$1) {
14532
+ for (const key of Object.keys(attributes$$1)) {
14533
+ if (key === 'disabled') {
14534
+ this.setProperties({ enabled: false }, true);
14535
+ Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
14536
+ }
14537
+ else if (key === 'readonly') {
14538
+ this.setProperties({ readonly: true }, true);
14539
+ Input.setReadonly(this.readonly, this.element);
14540
+ }
14541
+ else if (key === 'class') {
14542
+ this.element.classList.add(attributes$$1[`${key}`]);
14543
+ }
14544
+ else if (key === 'placeholder') {
14545
+ this.setProperties({ placeholder: attributes$$1[`${key}`] }, true);
14546
+ Input.setPlaceholder(this.placeholder, this.element);
14547
+ }
14548
+ else {
14549
+ this.element.setAttribute(key, attributes$$1[`${key}`]);
14550
+ }
14551
+ }
14552
+ }
14553
+ /**
14554
+ * Removing the multiple attributes as key-value pair to the TextArea element.
14555
+ *
14556
+ * @param { string[] } attributes - Specifies the attributes name to be removed from TextArea element.
14557
+ * @returns {void}
14558
+ */
14559
+ removeAttributes(attributes$$1) {
14560
+ for (const key of attributes$$1) {
14561
+ if (key === 'disabled') {
14562
+ this.setProperties({ enabled: true }, true);
14563
+ Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
14564
+ }
14565
+ else if (key === 'readonly') {
14566
+ this.setProperties({ readonly: false }, true);
14567
+ Input.setReadonly(this.readonly, this.element);
14568
+ }
14569
+ else if (key === 'placeholder') {
14570
+ this.setProperties({ placeholder: null }, true);
14571
+ Input.setPlaceholder(this.placeholder, this.element);
14572
+ }
14573
+ else {
14574
+ this.element.removeAttribute(key);
14575
+ }
14576
+ }
14577
+ }
14578
+ /**
14579
+ * Sets the focus to widget for interaction.
14580
+ *
14581
+ * @returns {void}
14582
+ */
14583
+ focusIn() {
14584
+ if (document.activeElement !== this.element && this.enabled) {
14585
+ this.element.focus();
14586
+ if (this.textareaWrapper.container.classList.contains('e-input-group')
14587
+ || this.textareaWrapper.container.classList.contains('e-outline')
14588
+ || this.textareaWrapper.container.classList.contains('e-filled')) {
14589
+ addClass([this.textareaWrapper.container], [TEXTBOX_FOCUS]);
14590
+ }
14591
+ }
14592
+ }
14593
+ /**
14594
+ * Remove the focus from widget, if the widget is in focus state.
14595
+ *
14596
+ * @returns {void}
14597
+ */
14598
+ focusOut() {
14599
+ if (document.activeElement === this.element && this.enabled) {
14600
+ this.element.blur();
14601
+ if (this.textareaWrapper.container.classList.contains('e-input-group')
14602
+ || this.textareaWrapper.container.classList.contains('e-outline')
14603
+ || this.textareaWrapper.container.classList.contains('e-filled')) {
14604
+ removeClass([this.textareaWrapper.container], [TEXTBOX_FOCUS]);
14605
+ }
14606
+ }
14607
+ }
14608
+ /**
14609
+ * Sets up the width for the textarea wrapper.
14610
+ *
14611
+ * @returns {void}
14612
+ */
14613
+ setWrapperWidth() {
14614
+ if (this.enabled && ((this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') || (this.columnsCount || this.element.getAttribute('cols')))) {
14615
+ if (this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') {
14616
+ if (this.textareaWrapper.container.style.width) {
14617
+ this.setElementWidth(this.textareaWrapper.container.style.width);
14618
+ this.textareaWrapper.container.style.width = '';
14619
+ this.textareaWrapper.container.classList.add(AUTO_WIDTH);
14620
+ }
14621
+ }
14622
+ this.textareaWrapper.container.classList.add(AUTO_WIDTH);
14623
+ }
14624
+ else {
14625
+ if (this.textareaWrapper.container.classList.contains(AUTO_WIDTH)) {
14626
+ this.textareaWrapper.container.classList.remove(AUTO_WIDTH);
14627
+ }
14628
+ }
14629
+ }
14630
+ resetForm() {
14631
+ if (this.isAngular) {
14632
+ this.resetValue('');
14633
+ }
14634
+ else {
14635
+ this.resetValue(this.initialValue);
14636
+ }
14637
+ if (!isNullOrUndefined(this.textareaWrapper)) {
14638
+ const label = this.textareaWrapper.container.querySelector('.e-float-text');
14639
+ if (!isNullOrUndefined(label) && this.floatLabelType !== 'Always') {
14640
+ if ((isNullOrUndefined(this.initialValue) || this.initialValue === '')) {
14641
+ label.classList.add('e-label-bottom');
14642
+ label.classList.remove('e-label-top');
14643
+ }
14644
+ else if (this.initialValue !== '') {
14645
+ label.classList.add('e-label-top');
14646
+ label.classList.remove('e-label-bottom');
14647
+ }
14648
+ }
14649
+ }
14650
+ }
14651
+ resetValue(value) {
14652
+ const prevOnChange = this.isProtectedOnChange;
14653
+ this.isProtectedOnChange = true;
14654
+ this.value = value;
14655
+ if (value == null && this.textareaWrapper.container.classList.contains('e-valid-input')) {
14656
+ this.textareaWrapper.container.classList.remove('e-valid-input');
14657
+ }
14658
+ this.isProtectedOnChange = prevOnChange;
14659
+ }
14660
+ setElementWidth(width) {
14661
+ if (typeof width === 'number') {
14662
+ this.element.style.width = formatUnit(width);
14663
+ }
14664
+ else if (typeof width === 'string') {
14665
+ this.element.style.width = (width.match(/px|%|em/)) ? (width) : (formatUnit(width));
14666
+ }
14667
+ }
14668
+ getCurrentResizeClass(resizeMode) {
14669
+ return resizeMode === 'None' ? RESIZE_NONE : (resizeMode === 'Both' ? RESIZE_XY : resizeMode === 'Horizontal' ? RESIZE_X : RESIZE_Y);
14670
+ }
14671
+ };
14672
+ __decorate$7([
14673
+ Property(false)
14674
+ ], TextArea.prototype, "readonly", void 0);
14675
+ __decorate$7([
14676
+ Property(null)
14677
+ ], TextArea.prototype, "value", void 0);
14678
+ __decorate$7([
14679
+ Property('Never')
14680
+ ], TextArea.prototype, "floatLabelType", void 0);
14681
+ __decorate$7([
14682
+ Property('')
14683
+ ], TextArea.prototype, "cssClass", void 0);
14684
+ __decorate$7([
14685
+ Property(null)
14686
+ ], TextArea.prototype, "placeholder", void 0);
14687
+ __decorate$7([
14688
+ Property({})
14689
+ ], TextArea.prototype, "htmlAttributes", void 0);
14690
+ __decorate$7([
14691
+ Property(true)
14692
+ ], TextArea.prototype, "enabled", void 0);
14693
+ __decorate$7([
14694
+ Property(false)
14695
+ ], TextArea.prototype, "showClearButton", void 0);
14696
+ __decorate$7([
14697
+ Property(false)
14698
+ ], TextArea.prototype, "enablePersistence", void 0);
14699
+ __decorate$7([
14700
+ Property(null)
14701
+ ], TextArea.prototype, "width", void 0);
14702
+ __decorate$7([
14703
+ Property('Vertical')
14704
+ ], TextArea.prototype, "resizeMode", void 0);
14705
+ __decorate$7([
14706
+ Property(null)
14707
+ ], TextArea.prototype, "maxLength", void 0);
14708
+ __decorate$7([
14709
+ Property(null)
14710
+ ], TextArea.prototype, "columnsCount", void 0);
14711
+ __decorate$7([
14712
+ Property(null)
14713
+ ], TextArea.prototype, "rowsCount", void 0);
14714
+ __decorate$7([
14715
+ Event()
14716
+ ], TextArea.prototype, "created", void 0);
14717
+ __decorate$7([
14718
+ Event()
14719
+ ], TextArea.prototype, "destroyed", void 0);
14720
+ __decorate$7([
14721
+ Event()
14722
+ ], TextArea.prototype, "change", void 0);
14723
+ __decorate$7([
14724
+ Event()
14725
+ ], TextArea.prototype, "blur", void 0);
14726
+ __decorate$7([
14727
+ Event()
14728
+ ], TextArea.prototype, "focus", void 0);
14729
+ __decorate$7([
14730
+ Event()
14731
+ ], TextArea.prototype, "input", void 0);
14732
+ TextArea = __decorate$7([
14733
+ NotifyPropertyChanges
14734
+ ], TextArea);
14735
+
14736
+ /**
14737
+ * Uploader modules
14738
+ */
14739
+
14740
+ class SignatureBase extends Component {
14741
+ constructor() {
14742
+ super(...arguments);
14743
+ /* minDistance(distance between the two point) was calaculated for smoothness.*/
14744
+ this.minDistance = 5;
14745
+ this.previous = 0;
14746
+ /* interval handles for the smoothness in the mouse move event.*/
14747
+ this.interval = 30;
14748
+ this.timeout = null;
14749
+ this.isSignatureEmpty = true;
14750
+ this.backgroundLoaded = null;
14751
+ this.isBlazor = false;
14752
+ this.isResponsive = false;
14753
+ this.signPointsColl = [];
14754
+ this.signRatioPointsColl = [];
14755
+ this.canRedraw = true;
14756
+ }
14757
+ /**
14758
+ * To Initialize the component rendering
14759
+ *
14760
+ * @private
14761
+ * @param {HTMLCanvasElement} element - Specifies the canvas element.
14762
+ * @param {BlazorDotnetObject} dotnetRef - Specifies for blazor client to server communication.
14763
+ * @returns {void}
14764
+ */
14765
+ initialize(element, dotnetRef) {
14766
+ this.clearArray = [];
14767
+ this.element = element;
14768
+ this.canvasContext = this.element.getContext('2d');
14769
+ this.canvasContext.canvas.tabIndex = -1;
14770
+ if (dotnetRef) {
14771
+ this.dotnetRef = dotnetRef;
14772
+ this.isBlazor = true;
14773
+ if (this.signatureValue) {
14774
+ this.loadPersistedSignature();
14775
+ }
14776
+ }
14777
+ this.setHTMLProperties();
14778
+ if (isNullOrUndefined(this.signatureValue)) {
14779
+ this.updateSnapCollection(true);
14780
+ }
14781
+ this.wireEvents();
14782
+ if (!this.isBlazor) {
14783
+ this.trigger('created', null);
14784
+ }
14785
+ }
14786
+ wireEvents() {
14787
+ if (isNullOrUndefined(this.pointColl) && !this.isReadOnly && !this.disabled) {
14788
+ EventHandler.add(this.canvasContext.canvas, 'mousedown touchstart', this.mouseDownHandler, this);
14789
+ EventHandler.add(this.canvasContext.canvas, 'keydown', this.keyboardHandler, this);
14790
+ window.addEventListener('resize', this.resizeHandler.bind(this));
14791
+ }
14792
+ else if (this.pointColl) {
14793
+ EventHandler.add(this.canvasContext.canvas, 'mousemove touchmove', this.mouseMoveHandler, this);
14794
+ EventHandler.add(this.canvasContext.canvas, 'mouseup touchend', this.mouseUpHandler, this);
14795
+ EventHandler.add(document, 'mouseup', this.mouseUpHandler, this);
14796
+ }
14797
+ }
14798
+ unwireEvents(type) {
14799
+ if (type === 'mouseup' || type === 'touchend') {
14800
+ EventHandler.remove(this.canvasContext.canvas, 'mousemove touchmove', this.mouseMoveHandler);
14801
+ EventHandler.remove(this.canvasContext.canvas, 'mouseup touchend', this.mouseUpHandler);
14802
+ EventHandler.remove(document, 'mouseup', this.mouseUpHandler);
14803
+ }
14804
+ else {
14805
+ EventHandler.remove(this.canvasContext.canvas, 'mousedown touchstart', this.mouseDownHandler);
14806
+ EventHandler.remove(this.canvasContext.canvas, 'keydown', this.keyboardHandler);
14807
+ window.removeEventListener('resize', this.resizeHandler);
14808
+ }
14809
+ }
14810
+ setHTMLProperties() {
14811
+ if (this.element.height === 150 && this.element.width === 300 && this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
14812
+ this.element.height = this.element.offsetHeight;
14813
+ this.element.width = this.element.offsetWidth;
14814
+ this.isResponsive = true;
14815
+ }
14816
+ else if ((this.element.height !== this.element.offsetHeight - 1 || this.element.width !== this.element.offsetWidth - 1)
14817
+ && this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
14818
+ this.element.height = this.element.offsetHeight;
14819
+ this.element.width = this.element.offsetWidth;
14820
+ }
14821
+ this.canvasContext.fillStyle = this.strokeColor;
14822
+ this.tempCanvas = this.createElement('canvas', { className: 'e-' + this.getModuleName() + '-temp' });
14823
+ this.tempContext = this.tempCanvas.getContext('2d');
14824
+ this.tempCanvas.width = this.element.width;
14825
+ this.tempCanvas.height = this.element.height;
14826
+ if (this.backgroundImage) {
14827
+ this.canvasContext.canvas.style.backgroundImage = 'url(' + this.backgroundImage + ')';
14828
+ this.canvasContext.canvas.style.backgroundRepeat = 'no-repeat';
14829
+ if (this.saveWithBackground) {
14830
+ this.setBackgroundImage(this.backgroundImage, 'temp');
14831
+ }
14832
+ }
14833
+ else if (this.backgroundColor) {
14834
+ this.canvasContext.canvas.style.backgroundColor = this.backgroundColor;
14835
+ }
14836
+ }
14837
+ // eslint-disable-next-line
14838
+ mouseDownHandler(e) {
14839
+ if (e.buttons === 1 || e.buttons === 2 || e.type === 'touchstart') {
14840
+ if (e.type === 'touchstart') {
14841
+ e.preventDefault();
14016
14842
  e.stopPropagation();
14017
14843
  }
14018
14844
  this.beginStroke(e);
@@ -14086,7 +14912,7 @@ class SignatureBase extends Component {
14086
14912
  resizeHandler() {
14087
14913
  // eslint-disable-next-line @typescript-eslint/no-this-alias
14088
14914
  const proxy = this;
14089
- if (this.isResponsive) {
14915
+ if (this.isResponsive && this.canRedraw) {
14090
14916
  this.canvasContext.canvas.width = this.element.offsetWidth;
14091
14917
  this.canvasContext.canvas.height = this.element.offsetHeight;
14092
14918
  this.canvasContext.scale(1, 1);
@@ -14466,7 +15292,7 @@ class SignatureBase extends Component {
14466
15292
  this.internalRefresh();
14467
15293
  this.signRatioPointsColl = [];
14468
15294
  this.updateSnapCollection(true);
14469
- this.isSignatureEmpty = true;
15295
+ this.isSignatureEmpty = this.canRedraw = true;
14470
15296
  if (!this.isBlazor) {
14471
15297
  this.trigger('change', args);
14472
15298
  }
@@ -14630,7 +15456,7 @@ class SignatureBase extends Component {
14630
15456
  proxy.updateSnapCollection();
14631
15457
  });
14632
15458
  };
14633
- this.isSignatureEmpty = false;
15459
+ this.isSignatureEmpty = this.canRedraw = false;
14634
15460
  }
14635
15461
  saveBackground(savebg) {
14636
15462
  let imageSrc;
@@ -14879,7 +15705,7 @@ class SignatureBase extends Component {
14879
15705
  }
14880
15706
  }
14881
15707
 
14882
- var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
15708
+ var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14883
15709
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14884
15710
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14885
15711
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -14924,6 +15750,8 @@ let Signature = class Signature extends SignatureBase {
14924
15750
  this.initialize();
14925
15751
  }
14926
15752
  initialize() {
15753
+ this.element.setAttribute('role', 'img');
15754
+ this.element.setAttribute('aria-label', 'signature');
14927
15755
  addClass([this.element], 'e-' + this.getModuleName());
14928
15756
  super.initialize(this.element);
14929
15757
  if (this.enablePersistence) {
@@ -14982,52 +15810,52 @@ let Signature = class Signature extends SignatureBase {
14982
15810
  }
14983
15811
  }
14984
15812
  };
14985
- __decorate$7([
15813
+ __decorate$8([
14986
15814
  Property('')
14987
15815
  ], Signature.prototype, "backgroundColor", void 0);
14988
- __decorate$7([
15816
+ __decorate$8([
14989
15817
  Property('')
14990
15818
  ], Signature.prototype, "backgroundImage", void 0);
14991
- __decorate$7([
15819
+ __decorate$8([
14992
15820
  Property(false)
14993
15821
  ], Signature.prototype, "disabled", void 0);
14994
- __decorate$7([
15822
+ __decorate$8([
14995
15823
  Property(false)
14996
15824
  ], Signature.prototype, "isReadOnly", void 0);
14997
- __decorate$7([
15825
+ __decorate$8([
14998
15826
  Property(true)
14999
15827
  ], Signature.prototype, "saveWithBackground", void 0);
15000
- __decorate$7([
15828
+ __decorate$8([
15001
15829
  Property('#000000')
15002
15830
  ], Signature.prototype, "strokeColor", void 0);
15003
- __decorate$7([
15831
+ __decorate$8([
15004
15832
  Property(0.5)
15005
15833
  ], Signature.prototype, "minStrokeWidth", void 0);
15006
- __decorate$7([
15834
+ __decorate$8([
15007
15835
  Property(2)
15008
15836
  ], Signature.prototype, "maxStrokeWidth", void 0);
15009
- __decorate$7([
15837
+ __decorate$8([
15010
15838
  Property(0.7)
15011
15839
  ], Signature.prototype, "velocity", void 0);
15012
- __decorate$7([
15840
+ __decorate$8([
15013
15841
  Property('en-US')
15014
15842
  ], Signature.prototype, "locale", void 0);
15015
- __decorate$7([
15843
+ __decorate$8([
15016
15844
  Property(false)
15017
15845
  ], Signature.prototype, "enableRtl", void 0);
15018
- __decorate$7([
15846
+ __decorate$8([
15019
15847
  Property(false)
15020
15848
  ], Signature.prototype, "enablePersistence", void 0);
15021
- __decorate$7([
15849
+ __decorate$8([
15022
15850
  Event()
15023
15851
  ], Signature.prototype, "beforeSave", void 0);
15024
- __decorate$7([
15852
+ __decorate$8([
15025
15853
  Event()
15026
15854
  ], Signature.prototype, "change", void 0);
15027
- __decorate$7([
15855
+ __decorate$8([
15028
15856
  Event()
15029
15857
  ], Signature.prototype, "created", void 0);
15030
- Signature = __decorate$7([
15858
+ Signature = __decorate$8([
15031
15859
  NotifyPropertyChanges
15032
15860
  ], Signature);
15033
15861
 
@@ -15035,7 +15863,7 @@ Signature = __decorate$7([
15035
15863
  * Signature modules
15036
15864
  */
15037
15865
 
15038
- var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
15866
+ var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
15039
15867
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15040
15868
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
15041
15869
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -15598,6 +16426,7 @@ let Rating = class Rating extends Component {
15598
16426
  });
15599
16427
  }
15600
16428
  keyActionHandler(e) {
16429
+ e.preventDefault();
15601
16430
  if (this.disabled || this.readOnly) {
15602
16431
  return;
15603
16432
  }
@@ -15784,73 +16613,73 @@ let Rating = class Rating extends Component {
15784
16613
  }
15785
16614
  }
15786
16615
  };
15787
- __decorate$8([
16616
+ __decorate$9([
15788
16617
  Property(false)
15789
16618
  ], Rating.prototype, "allowReset", void 0);
15790
- __decorate$8([
16619
+ __decorate$9([
15791
16620
  Property('')
15792
16621
  ], Rating.prototype, "cssClass", void 0);
15793
- __decorate$8([
16622
+ __decorate$9([
15794
16623
  Property(false)
15795
16624
  ], Rating.prototype, "disabled", void 0);
15796
- __decorate$8([
16625
+ __decorate$9([
15797
16626
  Property('')
15798
16627
  ], Rating.prototype, "emptyTemplate", void 0);
15799
- __decorate$8([
16628
+ __decorate$9([
15800
16629
  Property(true)
15801
16630
  ], Rating.prototype, "enableAnimation", void 0);
15802
- __decorate$8([
16631
+ __decorate$9([
15803
16632
  Property(false)
15804
16633
  ], Rating.prototype, "enableSingleSelection", void 0);
15805
- __decorate$8([
16634
+ __decorate$9([
15806
16635
  Property('')
15807
16636
  ], Rating.prototype, "fullTemplate", void 0);
15808
- __decorate$8([
16637
+ __decorate$9([
15809
16638
  Property(5)
15810
16639
  ], Rating.prototype, "itemsCount", void 0);
15811
- __decorate$8([
16640
+ __decorate$9([
15812
16641
  Property(LabelPosition.Right)
15813
16642
  ], Rating.prototype, "labelPosition", void 0);
15814
- __decorate$8([
16643
+ __decorate$9([
15815
16644
  Property('')
15816
16645
  ], Rating.prototype, "labelTemplate", void 0);
15817
- __decorate$8([
16646
+ __decorate$9([
15818
16647
  Property(0.0)
15819
16648
  ], Rating.prototype, "min", void 0);
15820
- __decorate$8([
16649
+ __decorate$9([
15821
16650
  Property(PrecisionType.Full)
15822
16651
  ], Rating.prototype, "precision", void 0);
15823
- __decorate$8([
16652
+ __decorate$9([
15824
16653
  Property(false)
15825
16654
  ], Rating.prototype, "readOnly", void 0);
15826
- __decorate$8([
16655
+ __decorate$9([
15827
16656
  Property(false)
15828
16657
  ], Rating.prototype, "showLabel", void 0);
15829
- __decorate$8([
16658
+ __decorate$9([
15830
16659
  Property(true)
15831
16660
  ], Rating.prototype, "showTooltip", void 0);
15832
- __decorate$8([
16661
+ __decorate$9([
15833
16662
  Property('')
15834
16663
  ], Rating.prototype, "tooltipTemplate", void 0);
15835
- __decorate$8([
16664
+ __decorate$9([
15836
16665
  Property(0.0)
15837
16666
  ], Rating.prototype, "value", void 0);
15838
- __decorate$8([
16667
+ __decorate$9([
15839
16668
  Property(true)
15840
16669
  ], Rating.prototype, "visible", void 0);
15841
- __decorate$8([
16670
+ __decorate$9([
15842
16671
  Event()
15843
16672
  ], Rating.prototype, "beforeItemRender", void 0);
15844
- __decorate$8([
16673
+ __decorate$9([
15845
16674
  Event()
15846
16675
  ], Rating.prototype, "created", void 0);
15847
- __decorate$8([
16676
+ __decorate$9([
15848
16677
  Event()
15849
16678
  ], Rating.prototype, "onItemHover", void 0);
15850
- __decorate$8([
16679
+ __decorate$9([
15851
16680
  Event()
15852
16681
  ], Rating.prototype, "valueChanged", void 0);
15853
- Rating = __decorate$8([
16682
+ Rating = __decorate$9([
15854
16683
  NotifyPropertyChanges
15855
16684
  ], Rating);
15856
16685
 
@@ -15866,5 +16695,5 @@ Rating = __decorate$8([
15866
16695
  * NumericTextBox all modules
15867
16696
  */
15868
16697
 
15869
- export { NumericTextBox, regularExpressions, createMask, applyMask, wireEvents, unwireEvents, bindClearEvent, unstrippedValue, strippedValue, maskInputMouseDownHandler, maskInputMouseUpHandler, maskInputFocusHandler, triggerFocus, escapeRegExp, maskInputBlurHandler, maskInputDropHandler, mobileRemoveFunction, setMaskValue, setElementValue, maskInput, getVal, getMaskedVal, MaskUndo, MaskedTextBox, Input, TicksData, ColorRangeData, LimitData, TooltipData, Slider, regex, ErrorOption, FormValidator, FilesProp, ButtonsProps, AsyncSettings, Uploader, ColorPicker, TextBox, Signature, LabelPosition, PrecisionType, Rating, SignatureBase };
16698
+ export { NumericTextBox, regularExpressions, createMask, applyMask, wireEvents, unwireEvents, bindClearEvent, unstrippedValue, strippedValue, maskInputMouseDownHandler, maskInputMouseUpHandler, maskInputFocusHandler, triggerFocus, escapeRegExp, maskInputBlurHandler, maskInputDropHandler, mobileRemoveFunction, setMaskValue, setElementValue, maskInput, getVal, getMaskedVal, MaskUndo, MaskedTextBox, containerAttributes, TEXTBOX_FOCUS, Input, TicksData, ColorRangeData, LimitData, TooltipData, Slider, regex, ErrorOption, FormValidator, FilesProp, ButtonsProps, AsyncSettings, Uploader, ColorPicker, TextBox, TextArea, Signature, LabelPosition, PrecisionType, Rating, SignatureBase };
15870
16699
  //# sourceMappingURL=ej2-inputs.es2015.js.map