@syncfusion/ej2-inputs 24.2.7 → 25.1.35-579988

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 (180) hide show
  1. package/CHANGELOG.md +0 -32
  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 +1103 -270
  6. package/dist/es6/ej2-inputs.es2015.js.map +1 -1
  7. package/dist/es6/ej2-inputs.es5.js +1129 -275
  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/color-picker/color-picker.js +10 -1
  14. package/src/common/signature-base.d.ts +1 -0
  15. package/src/common/signature-base.js +4 -3
  16. package/src/index.d.ts +1 -0
  17. package/src/index.js +1 -0
  18. package/src/input/input.d.ts +18 -1
  19. package/src/input/input.js +234 -69
  20. package/src/maskedtextbox/base/mask-base.js +1 -0
  21. package/src/maskedtextbox/maskedtextbox/maskedtextbox.d.ts +1 -0
  22. package/src/maskedtextbox/maskedtextbox/maskedtextbox.js +8 -1
  23. package/src/numerictextbox/numerictextbox.d.ts +1 -0
  24. package/src/numerictextbox/numerictextbox.js +8 -1
  25. package/src/rating/rating.js +1 -0
  26. package/src/signature/signature.js +2 -0
  27. package/src/slider/slider-model.d.ts +3 -2
  28. package/src/slider/slider.d.ts +3 -2
  29. package/src/slider/slider.js +1 -1
  30. package/src/textarea/index.d.ts +5 -0
  31. package/src/textarea/index.js +4 -0
  32. package/src/textarea/textarea-model.d.ts +155 -0
  33. package/src/textarea/textarea.d.ts +231 -0
  34. package/src/textarea/textarea.js +696 -0
  35. package/src/textbox/textbox-model.d.ts +1 -1
  36. package/src/textbox/textbox.d.ts +3 -5
  37. package/src/textbox/textbox.js +21 -57
  38. package/styles/bootstrap-dark.css +69 -8
  39. package/styles/bootstrap-dark.scss +1 -0
  40. package/styles/bootstrap.css +69 -8
  41. package/styles/bootstrap.scss +1 -0
  42. package/styles/bootstrap4.css +69 -8
  43. package/styles/bootstrap4.scss +1 -0
  44. package/styles/bootstrap5-dark.css +69 -8
  45. package/styles/bootstrap5-dark.scss +1 -0
  46. package/styles/bootstrap5.css +69 -8
  47. package/styles/bootstrap5.scss +1 -0
  48. package/styles/color-picker/_bds-definition.scss +133 -0
  49. package/styles/color-picker/icons/_bds.scss +9 -0
  50. package/styles/data-form/_bds-definition.scss +41 -0
  51. package/styles/data-form/_layout.scss +3 -3
  52. package/styles/data-form/bootstrap-dark.css +8 -8
  53. package/styles/data-form/bootstrap.css +8 -8
  54. package/styles/data-form/bootstrap4.css +8 -8
  55. package/styles/data-form/bootstrap5-dark.css +8 -8
  56. package/styles/data-form/bootstrap5.css +8 -8
  57. package/styles/data-form/fabric-dark.css +8 -8
  58. package/styles/data-form/fabric.css +8 -8
  59. package/styles/data-form/fluent-dark.css +8 -8
  60. package/styles/data-form/fluent.css +8 -8
  61. package/styles/data-form/highcontrast-light.css +8 -8
  62. package/styles/data-form/highcontrast.css +8 -8
  63. package/styles/data-form/material-dark.css +8 -8
  64. package/styles/data-form/material.css +8 -8
  65. package/styles/data-form/material3-dark.css +8 -8
  66. package/styles/data-form/material3.css +8 -8
  67. package/styles/data-form/tailwind-dark.css +8 -8
  68. package/styles/data-form/tailwind.css +8 -8
  69. package/styles/fabric-dark.css +69 -8
  70. package/styles/fabric-dark.scss +1 -0
  71. package/styles/fabric.css +69 -8
  72. package/styles/fabric.scss +1 -0
  73. package/styles/fluent-dark.css +69 -8
  74. package/styles/fluent-dark.scss +1 -0
  75. package/styles/fluent.css +69 -8
  76. package/styles/fluent.scss +1 -0
  77. package/styles/highcontrast-light.css +69 -8
  78. package/styles/highcontrast-light.scss +1 -0
  79. package/styles/highcontrast.css +69 -8
  80. package/styles/highcontrast.scss +1 -0
  81. package/styles/input/_bds-definition.scss +482 -0
  82. package/styles/input/icons/_bds.scss +17 -0
  83. package/styles/maskedtextbox/_bds-definition.scss +7 -0
  84. package/styles/material-dark.css +75 -8
  85. package/styles/material-dark.scss +1 -0
  86. package/styles/material.css +83 -8
  87. package/styles/material.scss +1 -0
  88. package/styles/material3-dark.css +83 -8
  89. package/styles/material3-dark.scss +1 -0
  90. package/styles/material3.css +83 -8
  91. package/styles/material3.scss +1 -0
  92. package/styles/numerictextbox/_bds-definition.scss +3 -0
  93. package/styles/numerictextbox/icons/_bds.scss +11 -0
  94. package/styles/rating/_bds-definition.scss +47 -0
  95. package/styles/signature/_bds-definition.scss +3 -0
  96. package/styles/slider/_bds-definition.scss +88 -0
  97. package/styles/tailwind-dark.css +69 -8
  98. package/styles/tailwind-dark.scss +1 -0
  99. package/styles/tailwind.css +69 -8
  100. package/styles/tailwind.scss +1 -0
  101. package/styles/textarea/_all.scss +1 -0
  102. package/styles/textarea/_bds-definition.scss +1 -0
  103. package/styles/textarea/_bootstrap-dark-definition.scss +1 -0
  104. package/styles/textarea/_bootstrap-definition.scss +1 -0
  105. package/styles/textarea/_bootstrap4-definition.scss +1 -0
  106. package/styles/textarea/_bootstrap5-dark-definition.scss +1 -0
  107. package/styles/textarea/_bootstrap5-definition.scss +1 -0
  108. package/styles/textarea/_fabric-dark-definition.scss +1 -0
  109. package/styles/textarea/_fabric-definition.scss +1 -0
  110. package/styles/textarea/_fluent-dark-definition.scss +1 -0
  111. package/styles/textarea/_fluent-definition.scss +1 -0
  112. package/styles/textarea/_fusionnew-definition.scss +1 -0
  113. package/styles/textarea/_highcontrast-definition.scss +1 -0
  114. package/styles/textarea/_highcontrast-light-definition.scss +1 -0
  115. package/styles/textarea/_layout.scss +36 -0
  116. package/styles/textarea/_material-dark-definition.scss +1 -0
  117. package/styles/textarea/_material-definition.scss +1 -0
  118. package/styles/textarea/_material3-dark-definition.scss +1 -0
  119. package/styles/textarea/_material3-definition.scss +1 -0
  120. package/styles/textarea/_tailwind-dark-definition.scss +1 -0
  121. package/styles/textarea/_tailwind-definition.scss +1 -0
  122. package/styles/textarea/_theme.scss +1 -0
  123. package/styles/textarea/bootstrap-dark.css +33 -0
  124. package/styles/textarea/bootstrap-dark.scss +5 -0
  125. package/styles/textarea/bootstrap.css +33 -0
  126. package/styles/textarea/bootstrap.scss +5 -0
  127. package/styles/textarea/bootstrap4.css +33 -0
  128. package/styles/textarea/bootstrap4.scss +5 -0
  129. package/styles/textarea/bootstrap5-dark.css +33 -0
  130. package/styles/textarea/bootstrap5-dark.scss +5 -0
  131. package/styles/textarea/bootstrap5.css +33 -0
  132. package/styles/textarea/bootstrap5.scss +5 -0
  133. package/styles/textarea/fabric-dark.css +33 -0
  134. package/styles/textarea/fabric-dark.scss +5 -0
  135. package/styles/textarea/fabric.css +33 -0
  136. package/styles/textarea/fabric.scss +5 -0
  137. package/styles/textarea/fluent-dark.css +33 -0
  138. package/styles/textarea/fluent-dark.scss +5 -0
  139. package/styles/textarea/fluent.css +33 -0
  140. package/styles/textarea/fluent.scss +5 -0
  141. package/styles/textarea/highcontrast-light.css +33 -0
  142. package/styles/textarea/highcontrast-light.scss +5 -0
  143. package/styles/textarea/highcontrast.css +33 -0
  144. package/styles/textarea/highcontrast.scss +5 -0
  145. package/styles/textarea/material-dark.css +39 -0
  146. package/styles/textarea/material-dark.scss +5 -0
  147. package/styles/textarea/material.css +47 -0
  148. package/styles/textarea/material.scss +5 -0
  149. package/styles/textarea/material3-dark.css +102 -0
  150. package/styles/textarea/material3-dark.scss +6 -0
  151. package/styles/textarea/material3.css +158 -0
  152. package/styles/textarea/material3.scss +6 -0
  153. package/styles/textarea/tailwind-dark.css +33 -0
  154. package/styles/textarea/tailwind-dark.scss +5 -0
  155. package/styles/textarea/tailwind.css +33 -0
  156. package/styles/textarea/tailwind.scss +5 -0
  157. package/styles/textbox/_all.scss +1 -1
  158. package/styles/textbox/_bds-definition.scss +4 -0
  159. package/styles/textbox/_layout.scss +0 -11
  160. package/styles/textbox/bootstrap-dark.css +27 -1
  161. package/styles/textbox/bootstrap.css +27 -1
  162. package/styles/textbox/bootstrap4.css +27 -1
  163. package/styles/textbox/bootstrap5-dark.css +27 -1
  164. package/styles/textbox/bootstrap5.css +27 -1
  165. package/styles/textbox/fabric-dark.css +27 -1
  166. package/styles/textbox/fabric.css +27 -1
  167. package/styles/textbox/fluent-dark.css +27 -1
  168. package/styles/textbox/fluent.css +27 -1
  169. package/styles/textbox/highcontrast-light.css +27 -1
  170. package/styles/textbox/highcontrast.css +27 -1
  171. package/styles/textbox/material-dark.css +27 -1
  172. package/styles/textbox/material.css +27 -1
  173. package/styles/textbox/material3-dark.css +27 -1
  174. package/styles/textbox/material3.css +27 -1
  175. package/styles/textbox/tailwind-dark.css +27 -1
  176. package/styles/textbox/tailwind.css +27 -1
  177. package/styles/uploader/_bds-definition.scss +232 -0
  178. package/styles/uploader/icons/_bds.scss +34 -0
  179. package/textarea.d.ts +4 -0
  180. package/textarea.js +4 -0
@@ -0,0 +1,696 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ 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;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ };
20
+ import { Component, Property, NotifyPropertyChanges, isNullOrUndefined, setValue, getValue } from '@syncfusion/ej2-base';
21
+ import { detach, getUniqueID, Event, EventHandler, Internationalization, L10n, addClass, removeClass, closest, formatUnit } from '@syncfusion/ej2-base';
22
+ import { Input, TEXTBOX_FOCUS } from '../input/input';
23
+ var HIDE_CLEAR = 'e-clear-icon-hide';
24
+ var AUTO_WIDTH = 'e-auto-width';
25
+ var RESIZE_X = 'e-resize-x';
26
+ var RESIZE_Y = 'e-resize-y';
27
+ var RESIZE_XY = 'e-resize-xy';
28
+ var RESIZE_NONE = 'e-resize-none';
29
+ var TextArea = /** @class */ (function (_super) {
30
+ __extends(TextArea, _super);
31
+ function TextArea(options, element) {
32
+ var _this = _super.call(this, options, element) || this;
33
+ _this.previousValue = null;
34
+ _this.isForm = false;
35
+ _this.inputPreviousValue = null;
36
+ _this.isAngular = false;
37
+ _this.isVue = false;
38
+ _this.textareaOptions = options;
39
+ return _this;
40
+ }
41
+ /**
42
+ * Calls internally if any of the property value is changed.
43
+ *
44
+ * @param {TextAreaModel} newProp - Returns the dynamic property value of the component.
45
+ * @param {TextAreaModel} oldProp - Returns the previous property value of the component.
46
+ * @returns {void}
47
+ * @private
48
+ */
49
+ TextArea.prototype.onPropertyChanged = function (newProp, oldProp) {
50
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
51
+ var prop = _a[_i];
52
+ switch (prop) {
53
+ case 'floatLabelType':
54
+ Input.removeFloating(this.textareaWrapper);
55
+ Input.addFloating(this.element, this.floatLabelType, this.placeholder);
56
+ if (this.floatLabelType === 'Never') {
57
+ this.element.removeAttribute('aria-labelledby');
58
+ }
59
+ break;
60
+ case 'enabled':
61
+ Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
62
+ this.bindClearEvent();
63
+ if (!this.enabled && this.resizeMode !== 'None') {
64
+ this.element.classList.remove(this.getCurrentResizeClass(this.resizeMode));
65
+ this.element.classList.add(RESIZE_NONE);
66
+ }
67
+ else {
68
+ this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
69
+ }
70
+ break;
71
+ case 'width':
72
+ if (this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') {
73
+ this.setElementWidth(newProp.width);
74
+ this.textareaWrapper.container.classList.add(AUTO_WIDTH);
75
+ }
76
+ else {
77
+ if (this.textareaWrapper.container.classList.contains(AUTO_WIDTH)) {
78
+ this.textareaWrapper.container.classList.remove(AUTO_WIDTH);
79
+ }
80
+ Input.setWidth(newProp.width, this.textareaWrapper.container);
81
+ }
82
+ break;
83
+ case 'value':
84
+ {
85
+ var prevOnChange = this.isProtectedOnChange;
86
+ this.isProtectedOnChange = true;
87
+ if (!Input.isBlank(this.value)) {
88
+ this.value = this.value.toString();
89
+ }
90
+ this.isProtectedOnChange = prevOnChange;
91
+ Input.setValue(this.value, this.element, this.floatLabelType, this.showClearButton);
92
+ this.inputPreviousValue = this.element.value;
93
+ /* istanbul ignore next */
94
+ if ((this.isAngular || this.isVue) && this.preventChange === true) {
95
+ this.previousValue = this.isAngular ? this.value : this.previousValue;
96
+ this.preventChange = false;
97
+ }
98
+ else if (isNullOrUndefined(this.isAngular) || !this.isAngular
99
+ || (this.isAngular && !this.preventChange) || (this.isAngular && isNullOrUndefined(this.preventChange))) {
100
+ this.raiseChangeEvent();
101
+ }
102
+ }
103
+ break;
104
+ case 'htmlAttributes':
105
+ {
106
+ this.updateHTMLAttributesToElement();
107
+ this.updateHTMLAttributesToWrapper();
108
+ this.checkAttributes(true);
109
+ Input.validateInputType(this.textareaWrapper.container, this.element);
110
+ }
111
+ break;
112
+ case 'readonly':
113
+ Input.setReadonly(this.readonly, this.element);
114
+ if (this.readonly) {
115
+ this.element.setAttribute('aria-readonly', 'true');
116
+ }
117
+ else {
118
+ this.element.removeAttribute('aria-readonly');
119
+ }
120
+ break;
121
+ case 'showClearButton':
122
+ Input.setClearButton(this.showClearButton, this.element, this.textareaWrapper);
123
+ this.bindClearEvent();
124
+ break;
125
+ case 'enableRtl':
126
+ Input.setEnableRtl(this.enableRtl, [this.textareaWrapper.container]);
127
+ break;
128
+ case 'placeholder':
129
+ Input.setPlaceholder(this.placeholder, this.element);
130
+ Input.calculateWidth(this.element, this.textareaWrapper.container);
131
+ break;
132
+ case 'cssClass':
133
+ Input.updateCssClass(newProp.cssClass, oldProp.cssClass, this.textareaWrapper.container);
134
+ break;
135
+ case 'locale':
136
+ this.globalize = new Internationalization(this.locale);
137
+ this.l10n.setLocale(this.locale);
138
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
139
+ Input.setPlaceholder(this.placeholder, this.element);
140
+ break;
141
+ case 'rowsCount':
142
+ if (this.rowsCount) {
143
+ this.element.setAttribute('rows', this.rowsCount.toString());
144
+ }
145
+ break;
146
+ case 'columnsCount':
147
+ if (this.columnsCount) {
148
+ this.element.setAttribute('cols', this.columnsCount.toString());
149
+ if (this.width == null) {
150
+ this.textareaWrapper.container.classList.add(AUTO_WIDTH);
151
+ }
152
+ }
153
+ break;
154
+ case 'maxLength':
155
+ if (this.maxLength) {
156
+ this.element.setAttribute('maxlength', this.maxLength.toString());
157
+ }
158
+ break;
159
+ case 'resizeMode':
160
+ if (this.enabled) {
161
+ if (this.element.classList.contains(this.getCurrentResizeClass(oldProp.resizeMode))) {
162
+ this.element.classList.remove(this.getCurrentResizeClass(oldProp.resizeMode));
163
+ }
164
+ this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
165
+ if (this.element.style.width && (this.resizeMode === 'None' || this.resizeMode === 'Vertical')) {
166
+ Input.setWidth(this.element.style.width, this.textareaWrapper.container);
167
+ }
168
+ else {
169
+ var currentWidth = this.element.offsetWidth;
170
+ this.element.style.width = currentWidth + 'px';
171
+ if (this.textareaWrapper.container.style.width) {
172
+ this.textareaWrapper.container.style.width = '';
173
+ }
174
+ }
175
+ this.setWrapperWidth();
176
+ }
177
+ break;
178
+ }
179
+ }
180
+ };
181
+ TextArea.prototype.preRender = function () {
182
+ this.formElement = closest(this.element, 'form');
183
+ if (!isNullOrUndefined(this.formElement)) {
184
+ this.isForm = true;
185
+ }
186
+ /* istanbul ignore next */
187
+ if (this.element.tagName === 'EJS-TEXTAREA') {
188
+ var ejInstance = getValue('ej2_instances', this.element);
189
+ var inputElement = this.createElement('textarea');
190
+ var index = 0;
191
+ for (index; index < this.element.attributes.length; index++) {
192
+ var attributeName = this.element.attributes[index].nodeName;
193
+ if (attributeName !== 'id' && attributeName !== 'class') {
194
+ inputElement.setAttribute(attributeName, this.element.attributes[index].nodeValue);
195
+ inputElement.innerHTML = this.element.innerHTML;
196
+ if (attributeName === 'name') {
197
+ this.element.removeAttribute('name');
198
+ }
199
+ }
200
+ else if (attributeName === 'class') {
201
+ inputElement.setAttribute(attributeName, this.element.className.split(' ').filter(function (item) { return item.indexOf('ng-') !== 0; }).join(' '));
202
+ }
203
+ }
204
+ this.element.appendChild(inputElement);
205
+ this.element = inputElement;
206
+ setValue('ej2_instances', ejInstance, this.element);
207
+ }
208
+ this.updateHTMLAttributesToElement();
209
+ this.checkAttributes(false);
210
+ if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['value'] === undefined)) && this.element.value !== '') {
211
+ this.setProperties({ value: this.element.value }, true);
212
+ }
213
+ this.globalize = new Internationalization(this.locale);
214
+ var localeText = { placeholder: this.placeholder };
215
+ this.l10n = new L10n('textarea', localeText, this.locale);
216
+ if (this.l10n.getConstant('placeholder') !== '') {
217
+ this.setProperties({ placeholder: this.placeholder || this.l10n.getConstant('placeholder') }, true);
218
+ }
219
+ if (!this.element.hasAttribute('id')) {
220
+ this.element.setAttribute('id', getUniqueID('textbox'));
221
+ }
222
+ if (!this.element.hasAttribute('name')) {
223
+ this.element.setAttribute('name', this.element.getAttribute('id'));
224
+ }
225
+ if (this.rowsCount) {
226
+ this.element.setAttribute('rows', this.rowsCount.toString());
227
+ }
228
+ if (this.columnsCount) {
229
+ this.element.setAttribute('cols', this.columnsCount.toString());
230
+ }
231
+ if (this.maxLength) {
232
+ this.element.setAttribute('maxlength', this.maxLength.toString());
233
+ }
234
+ if (!this.element.style.resize && this.enabled) {
235
+ this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
236
+ }
237
+ if (this.enabled) {
238
+ this.element.setAttribute('aria-multiline', 'true');
239
+ }
240
+ };
241
+ /**
242
+ * To Initialize the control rendering
243
+ *
244
+ * @returns {void}
245
+ * @private
246
+ */
247
+ TextArea.prototype.render = function () {
248
+ var updatedCssClassValue = this.cssClass;
249
+ if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
250
+ updatedCssClassValue = Input.getInputValidClassList(this.cssClass);
251
+ }
252
+ this.textareaWrapper = Input.createInput({
253
+ element: this.element,
254
+ floatLabelType: this.floatLabelType,
255
+ properties: {
256
+ enabled: this.enabled,
257
+ enableRtl: this.enableRtl,
258
+ cssClass: updatedCssClassValue,
259
+ readonly: this.readonly,
260
+ placeholder: this.placeholder,
261
+ showClearButton: this.showClearButton
262
+ }
263
+ });
264
+ this.updateHTMLAttributesToWrapper();
265
+ this.wireEvents();
266
+ if (!isNullOrUndefined(this.value)) {
267
+ Input.setValue(this.value, this.element, this.floatLabelType, this.showClearButton);
268
+ }
269
+ if (!isNullOrUndefined(this.value)) {
270
+ this.initialValue = this.value;
271
+ if (!this.isAngular) {
272
+ this.element.setAttribute('value', this.initialValue);
273
+ }
274
+ }
275
+ this.previousValue = this.value;
276
+ this.inputPreviousValue = this.value;
277
+ this.element.defaultValue = this.element.value;
278
+ Input.setWidth(this.width, this.textareaWrapper.container);
279
+ this.setWrapperWidth();
280
+ this.renderComplete();
281
+ };
282
+ TextArea.prototype.getModuleName = function () {
283
+ return 'textarea';
284
+ };
285
+ /* eslint-disable valid-jsdoc, jsdoc/require-returns */
286
+ /**
287
+ * Gets the properties to be maintained in the persisted state.
288
+ *
289
+ */
290
+ TextArea.prototype.getPersistData = function () {
291
+ var keyEntity = ['value'];
292
+ return this.addOnPersist(keyEntity);
293
+ };
294
+ TextArea.prototype.checkAttributes = function (isDynamic) {
295
+ var attrs = isDynamic ? isNullOrUndefined(this.htmlAttributes) ? [] : Object.keys(this.htmlAttributes) :
296
+ ['placeholder', 'disabled', 'value', 'readonly'];
297
+ for (var _i = 0, attrs_1 = attrs; _i < attrs_1.length; _i++) {
298
+ var key = attrs_1[_i];
299
+ if (!isNullOrUndefined(this.element.getAttribute(key))) {
300
+ switch (key) {
301
+ case 'disabled':
302
+ if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['enabled'] === undefined)) || isDynamic) {
303
+ var enabled = this.element.getAttribute(key) === 'disabled' || this.element.getAttribute(key) === '' ||
304
+ this.element.getAttribute(key) === 'true' ? false : true;
305
+ this.setProperties({ enabled: enabled }, !isDynamic);
306
+ }
307
+ break;
308
+ case 'readonly':
309
+ if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['readonly'] === undefined)) || isDynamic) {
310
+ var readonly = this.element.getAttribute(key) === 'readonly' || this.element.getAttribute(key) === ''
311
+ || this.element.getAttribute(key) === 'true' ? true : false;
312
+ this.setProperties({ readonly: readonly }, !isDynamic);
313
+ }
314
+ break;
315
+ case 'placeholder':
316
+ if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['placeholder'] === undefined)) || isDynamic) {
317
+ this.setProperties({ placeholder: this.element.placeholder }, !isDynamic);
318
+ }
319
+ break;
320
+ case 'value':
321
+ if (((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['value'] === undefined)) || isDynamic) && this.element.value !== '') {
322
+ this.setProperties({ value: this.element.value }, !isDynamic);
323
+ }
324
+ break;
325
+ }
326
+ }
327
+ }
328
+ };
329
+ TextArea.prototype.wireEvents = function () {
330
+ EventHandler.add(this.element, 'focus', this.focusHandler, this);
331
+ EventHandler.add(this.element, 'blur', this.focusOutHandler, this);
332
+ EventHandler.add(this.element, 'keydown', this.keydownHandler, this);
333
+ EventHandler.add(this.element, 'input', this.inputHandler, this);
334
+ EventHandler.add(this.element, 'change', this.changeHandler, this);
335
+ if (this.isForm) {
336
+ EventHandler.add(this.formElement, 'reset', this.resetForm, this);
337
+ }
338
+ this.bindClearEvent();
339
+ };
340
+ TextArea.prototype.unWireEvents = function () {
341
+ EventHandler.remove(this.element, 'focus', this.focusHandler);
342
+ EventHandler.remove(this.element, 'blur', this.focusOutHandler);
343
+ EventHandler.remove(this.element, 'keydown', this.keydownHandler);
344
+ EventHandler.remove(this.element, 'input', this.inputHandler);
345
+ EventHandler.remove(this.element, 'change', this.changeHandler);
346
+ if (this.isForm) {
347
+ EventHandler.remove(this.formElement, 'reset', this.resetForm);
348
+ }
349
+ };
350
+ /**
351
+ * Removes the component from the DOM and detaches all its related event handlers.
352
+ * Also, it maintains the initial TextArea element from the DOM.
353
+ *
354
+ * @method destroy
355
+ * @returns {void}
356
+ */
357
+ TextArea.prototype.destroy = function () {
358
+ this.unWireEvents();
359
+ if (this.showClearButton) {
360
+ this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
361
+ }
362
+ this.element.value = this.element.defaultValue;
363
+ this.element.classList.remove('e-input', RESIZE_X, RESIZE_Y, RESIZE_XY, RESIZE_NONE);
364
+ this.removeAttributes(['aria-disabled', 'aria-readonly', 'aria-labelledby', 'aria-multiline']);
365
+ if (!isNullOrUndefined(this.textareaWrapper)) {
366
+ this.textareaWrapper.container.insertAdjacentElement('afterend', this.element);
367
+ detach(this.textareaWrapper.container);
368
+ }
369
+ this.textareaWrapper = null;
370
+ this.formElement = null;
371
+ Input.destroy({
372
+ element: this.element,
373
+ floatLabelType: this.floatLabelType,
374
+ properties: this.properties
375
+ }, this.clearButton);
376
+ _super.prototype.destroy.call(this);
377
+ };
378
+ TextArea.prototype.focusHandler = function (args) {
379
+ var eventArgs = {
380
+ container: this.textareaWrapper.container,
381
+ event: args,
382
+ value: this.value
383
+ };
384
+ this.trigger('focus', eventArgs);
385
+ };
386
+ TextArea.prototype.focusOutHandler = function (args) {
387
+ if (!(this.previousValue === null && this.value === null) &&
388
+ (this.previousValue !== this.value)) {
389
+ this.raiseChangeEvent(args, true);
390
+ }
391
+ var eventArgs = {
392
+ container: this.textareaWrapper.container,
393
+ event: args,
394
+ value: this.value
395
+ };
396
+ this.trigger('blur', eventArgs);
397
+ };
398
+ TextArea.prototype.keydownHandler = function (args) {
399
+ if ((args.keyCode === 13 || args.keyCode === 9) && !((this.previousValue === null || this.previousValue === '') && (this.value === null || this.value === '') && this.element.value === '')) {
400
+ this.setProperties({ value: this.element.value }, true);
401
+ }
402
+ };
403
+ TextArea.prototype.inputHandler = function (args) {
404
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias
405
+ var textareaObj = this;
406
+ var eventArgs = {
407
+ event: args,
408
+ value: this.element.value,
409
+ previousValue: this.inputPreviousValue,
410
+ container: this.textareaWrapper.container
411
+ };
412
+ this.inputPreviousValue = this.element.value;
413
+ /* istanbul ignore next */
414
+ if (this.isAngular) {
415
+ textareaObj.localChange({ value: this.element.value });
416
+ this.preventChange = true;
417
+ }
418
+ if (this.isVue) {
419
+ this.preventChange = true;
420
+ }
421
+ this.trigger('input', eventArgs);
422
+ args.stopPropagation();
423
+ };
424
+ TextArea.prototype.changeHandler = function (args) {
425
+ this.setProperties({ value: this.element.value }, true);
426
+ if (this.previousValue !== this.value) {
427
+ this.raiseChangeEvent(args, true);
428
+ }
429
+ args.stopPropagation();
430
+ };
431
+ TextArea.prototype.raiseChangeEvent = function (event, interaction) {
432
+ var eventArgs = {
433
+ event: event,
434
+ value: this.value,
435
+ previousValue: this.previousValue,
436
+ container: this.textareaWrapper.container,
437
+ isInteraction: interaction ? interaction : false,
438
+ isInteracted: interaction ? interaction : false
439
+ };
440
+ this.preventChange = false;
441
+ this.trigger('change', eventArgs);
442
+ this.previousValue = this.value;
443
+ };
444
+ TextArea.prototype.updateHTMLAttributesToWrapper = function () {
445
+ Input.updateHTMLAttributesToWrapper(this.htmlAttributes, this.textareaWrapper.container);
446
+ };
447
+ TextArea.prototype.updateHTMLAttributesToElement = function () {
448
+ Input.updateHTMLAttributesToElement(this.htmlAttributes, this.element);
449
+ };
450
+ TextArea.prototype.bindClearEvent = function () {
451
+ if (this.showClearButton) {
452
+ if (this.enabled) {
453
+ EventHandler.add(this.textareaWrapper.clearButton, 'mousedown touchstart', this.resetInputHandler, this);
454
+ }
455
+ else {
456
+ EventHandler.remove(this.textareaWrapper.clearButton, 'mousedown touchstart', this.resetInputHandler);
457
+ }
458
+ }
459
+ };
460
+ TextArea.prototype.resetInputHandler = function (event) {
461
+ event.preventDefault();
462
+ if (!(this.textareaWrapper.clearButton.classList.contains(HIDE_CLEAR)) || this.textareaWrapper.container.classList.contains('e-static-clear')) {
463
+ Input.setValue('', this.element, this.floatLabelType, this.showClearButton);
464
+ this.setProperties({ value: this.element.value }, true);
465
+ }
466
+ var eventArgs = {
467
+ event: event,
468
+ value: this.element.value,
469
+ previousValue: this.inputPreviousValue,
470
+ container: this.textareaWrapper.container
471
+ };
472
+ this.trigger('input', eventArgs);
473
+ this.inputPreviousValue = this.element.value;
474
+ this.raiseChangeEvent(event, true);
475
+ if (closest(this.element, 'form')) {
476
+ var element = this.element;
477
+ var keyupEvent = document.createEvent('KeyboardEvent');
478
+ keyupEvent.initEvent('keyup', false, true);
479
+ element.dispatchEvent(keyupEvent);
480
+ }
481
+ };
482
+ /* eslint-enable valid-jsdoc, jsdoc/require-returns */
483
+ /**
484
+ * Adding the multiple attributes as key-value pair to the TextArea element.
485
+ *
486
+ * @param {string} attributes - Specifies the attributes to be add to TextArea element.
487
+ * @returns {void}
488
+ */
489
+ TextArea.prototype.addAttributes = function (attributes) {
490
+ for (var _i = 0, _a = Object.keys(attributes); _i < _a.length; _i++) {
491
+ var key = _a[_i];
492
+ if (key === 'disabled') {
493
+ this.setProperties({ enabled: false }, true);
494
+ Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
495
+ }
496
+ else if (key === 'readonly') {
497
+ this.setProperties({ readonly: true }, true);
498
+ Input.setReadonly(this.readonly, this.element);
499
+ }
500
+ else if (key === 'class') {
501
+ this.element.classList.add(attributes["" + key]);
502
+ }
503
+ else if (key === 'placeholder') {
504
+ this.setProperties({ placeholder: attributes["" + key] }, true);
505
+ Input.setPlaceholder(this.placeholder, this.element);
506
+ }
507
+ else {
508
+ this.element.setAttribute(key, attributes["" + key]);
509
+ }
510
+ }
511
+ };
512
+ /**
513
+ * Removing the multiple attributes as key-value pair to the TextArea element.
514
+ *
515
+ * @param { string[] } attributes - Specifies the attributes name to be removed from TextArea element.
516
+ * @returns {void}
517
+ */
518
+ TextArea.prototype.removeAttributes = function (attributes) {
519
+ for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {
520
+ var key = attributes_1[_i];
521
+ if (key === 'disabled') {
522
+ this.setProperties({ enabled: true }, true);
523
+ Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
524
+ }
525
+ else if (key === 'readonly') {
526
+ this.setProperties({ readonly: false }, true);
527
+ Input.setReadonly(this.readonly, this.element);
528
+ }
529
+ else if (key === 'placeholder') {
530
+ this.setProperties({ placeholder: null }, true);
531
+ Input.setPlaceholder(this.placeholder, this.element);
532
+ }
533
+ else {
534
+ this.element.removeAttribute(key);
535
+ }
536
+ }
537
+ };
538
+ /**
539
+ * Sets the focus to widget for interaction.
540
+ *
541
+ * @returns {void}
542
+ */
543
+ TextArea.prototype.focusIn = function () {
544
+ if (document.activeElement !== this.element && this.enabled) {
545
+ this.element.focus();
546
+ if (this.textareaWrapper.container.classList.contains('e-input-group')
547
+ || this.textareaWrapper.container.classList.contains('e-outline')
548
+ || this.textareaWrapper.container.classList.contains('e-filled')) {
549
+ addClass([this.textareaWrapper.container], [TEXTBOX_FOCUS]);
550
+ }
551
+ }
552
+ };
553
+ /**
554
+ * Remove the focus from widget, if the widget is in focus state.
555
+ *
556
+ * @returns {void}
557
+ */
558
+ TextArea.prototype.focusOut = function () {
559
+ if (document.activeElement === this.element && this.enabled) {
560
+ this.element.blur();
561
+ if (this.textareaWrapper.container.classList.contains('e-input-group')
562
+ || this.textareaWrapper.container.classList.contains('e-outline')
563
+ || this.textareaWrapper.container.classList.contains('e-filled')) {
564
+ removeClass([this.textareaWrapper.container], [TEXTBOX_FOCUS]);
565
+ }
566
+ }
567
+ };
568
+ /**
569
+ * Sets up the width for the textarea wrapper.
570
+ *
571
+ * @returns {void}
572
+ */
573
+ TextArea.prototype.setWrapperWidth = function () {
574
+ if (this.enabled && ((this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') || (this.columnsCount || this.element.getAttribute('cols')))) {
575
+ if (this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') {
576
+ if (this.textareaWrapper.container.style.width) {
577
+ this.setElementWidth(this.textareaWrapper.container.style.width);
578
+ this.textareaWrapper.container.style.width = '';
579
+ this.textareaWrapper.container.classList.add(AUTO_WIDTH);
580
+ }
581
+ }
582
+ this.textareaWrapper.container.classList.add(AUTO_WIDTH);
583
+ }
584
+ else {
585
+ if (this.textareaWrapper.container.classList.contains(AUTO_WIDTH)) {
586
+ this.textareaWrapper.container.classList.remove(AUTO_WIDTH);
587
+ }
588
+ }
589
+ };
590
+ TextArea.prototype.resetForm = function () {
591
+ if (this.isAngular) {
592
+ this.resetValue('');
593
+ }
594
+ else {
595
+ this.resetValue(this.initialValue);
596
+ }
597
+ if (!isNullOrUndefined(this.textareaWrapper)) {
598
+ var label = this.textareaWrapper.container.querySelector('.e-float-text');
599
+ if (!isNullOrUndefined(label) && this.floatLabelType !== 'Always') {
600
+ if ((isNullOrUndefined(this.initialValue) || this.initialValue === '')) {
601
+ label.classList.add('e-label-bottom');
602
+ label.classList.remove('e-label-top');
603
+ }
604
+ else if (this.initialValue !== '') {
605
+ label.classList.add('e-label-top');
606
+ label.classList.remove('e-label-bottom');
607
+ }
608
+ }
609
+ }
610
+ };
611
+ TextArea.prototype.resetValue = function (value) {
612
+ var prevOnChange = this.isProtectedOnChange;
613
+ this.isProtectedOnChange = true;
614
+ this.value = value;
615
+ if (value == null && this.textareaWrapper.container.classList.contains('e-valid-input')) {
616
+ this.textareaWrapper.container.classList.remove('e-valid-input');
617
+ }
618
+ this.isProtectedOnChange = prevOnChange;
619
+ };
620
+ TextArea.prototype.setElementWidth = function (width) {
621
+ if (typeof width === 'number') {
622
+ this.element.style.width = formatUnit(width);
623
+ }
624
+ else if (typeof width === 'string') {
625
+ this.element.style.width = (width.match(/px|%|em/)) ? (width) : (formatUnit(width));
626
+ }
627
+ };
628
+ TextArea.prototype.getCurrentResizeClass = function (resizeMode) {
629
+ return resizeMode === 'None' ? RESIZE_NONE : (resizeMode === 'Both' ? RESIZE_XY : resizeMode === 'Horizontal' ? RESIZE_X : RESIZE_Y);
630
+ };
631
+ __decorate([
632
+ Property(false)
633
+ ], TextArea.prototype, "readonly", void 0);
634
+ __decorate([
635
+ Property(null)
636
+ ], TextArea.prototype, "value", void 0);
637
+ __decorate([
638
+ Property('Never')
639
+ ], TextArea.prototype, "floatLabelType", void 0);
640
+ __decorate([
641
+ Property('')
642
+ ], TextArea.prototype, "cssClass", void 0);
643
+ __decorate([
644
+ Property(null)
645
+ ], TextArea.prototype, "placeholder", void 0);
646
+ __decorate([
647
+ Property({})
648
+ ], TextArea.prototype, "htmlAttributes", void 0);
649
+ __decorate([
650
+ Property(true)
651
+ ], TextArea.prototype, "enabled", void 0);
652
+ __decorate([
653
+ Property(false)
654
+ ], TextArea.prototype, "showClearButton", void 0);
655
+ __decorate([
656
+ Property(false)
657
+ ], TextArea.prototype, "enablePersistence", void 0);
658
+ __decorate([
659
+ Property(null)
660
+ ], TextArea.prototype, "width", void 0);
661
+ __decorate([
662
+ Property('Vertical')
663
+ ], TextArea.prototype, "resizeMode", void 0);
664
+ __decorate([
665
+ Property(null)
666
+ ], TextArea.prototype, "maxLength", void 0);
667
+ __decorate([
668
+ Property(null)
669
+ ], TextArea.prototype, "columnsCount", void 0);
670
+ __decorate([
671
+ Property(null)
672
+ ], TextArea.prototype, "rowsCount", void 0);
673
+ __decorate([
674
+ Event()
675
+ ], TextArea.prototype, "created", void 0);
676
+ __decorate([
677
+ Event()
678
+ ], TextArea.prototype, "destroyed", void 0);
679
+ __decorate([
680
+ Event()
681
+ ], TextArea.prototype, "change", void 0);
682
+ __decorate([
683
+ Event()
684
+ ], TextArea.prototype, "blur", void 0);
685
+ __decorate([
686
+ Event()
687
+ ], TextArea.prototype, "focus", void 0);
688
+ __decorate([
689
+ Event()
690
+ ], TextArea.prototype, "input", void 0);
691
+ TextArea = __decorate([
692
+ NotifyPropertyChanges
693
+ ], TextArea);
694
+ return TextArea;
695
+ }(Component));
696
+ export { TextArea };