@syncfusion/ej2-inputs 24.2.9 → 25.1.35
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.
- package/CHANGELOG.md +0 -38
- package/dist/ej2-inputs.min.js +2 -2
- package/dist/ej2-inputs.umd.min.js +2 -2
- package/dist/ej2-inputs.umd.min.js.map +1 -1
- package/dist/es6/ej2-inputs.es2015.js +1095 -271
- package/dist/es6/ej2-inputs.es2015.js.map +1 -1
- package/dist/es6/ej2-inputs.es5.js +1121 -276
- package/dist/es6/ej2-inputs.es5.js.map +1 -1
- package/dist/global/ej2-inputs.min.js +2 -2
- package/dist/global/ej2-inputs.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/common/signature-base.d.ts +1 -0
- package/src/common/signature-base.js +4 -3
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/input/input.d.ts +18 -1
- package/src/input/input.js +234 -69
- package/src/maskedtextbox/base/mask-base.js +1 -0
- package/src/maskedtextbox/maskedtextbox/maskedtextbox.d.ts +1 -0
- package/src/maskedtextbox/maskedtextbox/maskedtextbox.js +8 -1
- package/src/numerictextbox/numerictextbox.d.ts +1 -0
- package/src/numerictextbox/numerictextbox.js +8 -1
- package/src/rating/rating.js +1 -0
- package/src/signature/signature.js +2 -0
- package/src/slider/slider-model.d.ts +3 -2
- package/src/slider/slider.d.ts +3 -2
- package/src/slider/slider.js +1 -1
- package/src/textarea/index.d.ts +5 -0
- package/src/textarea/index.js +4 -0
- package/src/textarea/textarea-model.d.ts +155 -0
- package/src/textarea/textarea.d.ts +231 -0
- package/src/textarea/textarea.js +696 -0
- package/src/textbox/textbox-model.d.ts +1 -1
- package/src/textbox/textbox.d.ts +3 -5
- package/src/textbox/textbox.js +21 -57
- package/styles/bootstrap-dark.css +69 -8
- package/styles/bootstrap-dark.scss +1 -0
- package/styles/bootstrap.css +69 -8
- package/styles/bootstrap.scss +1 -0
- package/styles/bootstrap4.css +69 -8
- package/styles/bootstrap4.scss +1 -0
- package/styles/bootstrap5-dark.css +69 -8
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5.css +69 -8
- package/styles/bootstrap5.scss +1 -0
- package/styles/color-picker/_bds-definition.scss +133 -0
- package/styles/color-picker/icons/_bds.scss +9 -0
- package/styles/data-form/_bds-definition.scss +41 -0
- package/styles/data-form/_layout.scss +3 -3
- package/styles/data-form/bootstrap-dark.css +8 -8
- package/styles/data-form/bootstrap.css +8 -8
- package/styles/data-form/bootstrap4.css +8 -8
- package/styles/data-form/bootstrap5-dark.css +8 -8
- package/styles/data-form/bootstrap5.css +8 -8
- package/styles/data-form/fabric-dark.css +8 -8
- package/styles/data-form/fabric.css +8 -8
- package/styles/data-form/fluent-dark.css +8 -8
- package/styles/data-form/fluent.css +8 -8
- package/styles/data-form/highcontrast-light.css +8 -8
- package/styles/data-form/highcontrast.css +8 -8
- package/styles/data-form/material-dark.css +8 -8
- package/styles/data-form/material.css +8 -8
- package/styles/data-form/material3-dark.css +8 -8
- package/styles/data-form/material3.css +8 -8
- package/styles/data-form/tailwind-dark.css +8 -8
- package/styles/data-form/tailwind.css +8 -8
- package/styles/fabric-dark.css +69 -8
- package/styles/fabric-dark.scss +1 -0
- package/styles/fabric.css +69 -8
- package/styles/fabric.scss +1 -0
- package/styles/fluent-dark.css +69 -8
- package/styles/fluent-dark.scss +1 -0
- package/styles/fluent.css +69 -8
- package/styles/fluent.scss +1 -0
- package/styles/highcontrast-light.css +69 -8
- package/styles/highcontrast-light.scss +1 -0
- package/styles/highcontrast.css +69 -8
- package/styles/highcontrast.scss +1 -0
- package/styles/input/_bds-definition.scss +482 -0
- package/styles/input/icons/_bds.scss +17 -0
- package/styles/maskedtextbox/_bds-definition.scss +7 -0
- package/styles/material-dark.css +75 -8
- package/styles/material-dark.scss +1 -0
- package/styles/material.css +83 -8
- package/styles/material.scss +1 -0
- package/styles/material3-dark.css +83 -8
- package/styles/material3-dark.scss +1 -0
- package/styles/material3.css +83 -8
- package/styles/material3.scss +1 -0
- package/styles/numerictextbox/_bds-definition.scss +3 -0
- package/styles/numerictextbox/icons/_bds.scss +11 -0
- package/styles/rating/_bds-definition.scss +47 -0
- package/styles/signature/_bds-definition.scss +3 -0
- package/styles/slider/_bds-definition.scss +88 -0
- package/styles/tailwind-dark.css +69 -8
- package/styles/tailwind-dark.scss +1 -0
- package/styles/tailwind.css +69 -8
- package/styles/tailwind.scss +1 -0
- package/styles/textarea/_all.scss +1 -0
- package/styles/textarea/_bds-definition.scss +1 -0
- package/styles/textarea/_bootstrap-dark-definition.scss +1 -0
- package/styles/textarea/_bootstrap-definition.scss +1 -0
- package/styles/textarea/_bootstrap4-definition.scss +1 -0
- package/styles/textarea/_bootstrap5-dark-definition.scss +1 -0
- package/styles/textarea/_bootstrap5-definition.scss +1 -0
- package/styles/textarea/_fabric-dark-definition.scss +1 -0
- package/styles/textarea/_fabric-definition.scss +1 -0
- package/styles/textarea/_fluent-dark-definition.scss +1 -0
- package/styles/textarea/_fluent-definition.scss +1 -0
- package/styles/textarea/_fusionnew-definition.scss +1 -0
- package/styles/textarea/_highcontrast-definition.scss +1 -0
- package/styles/textarea/_highcontrast-light-definition.scss +1 -0
- package/styles/textarea/_layout.scss +36 -0
- package/styles/textarea/_material-dark-definition.scss +1 -0
- package/styles/textarea/_material-definition.scss +1 -0
- package/styles/textarea/_material3-dark-definition.scss +1 -0
- package/styles/textarea/_material3-definition.scss +1 -0
- package/styles/textarea/_tailwind-dark-definition.scss +1 -0
- package/styles/textarea/_tailwind-definition.scss +1 -0
- package/styles/textarea/_theme.scss +1 -0
- package/styles/textarea/bootstrap-dark.css +33 -0
- package/styles/textarea/bootstrap-dark.scss +5 -0
- package/styles/textarea/bootstrap.css +33 -0
- package/styles/textarea/bootstrap.scss +5 -0
- package/styles/textarea/bootstrap4.css +33 -0
- package/styles/textarea/bootstrap4.scss +5 -0
- package/styles/textarea/bootstrap5-dark.css +33 -0
- package/styles/textarea/bootstrap5-dark.scss +5 -0
- package/styles/textarea/bootstrap5.css +33 -0
- package/styles/textarea/bootstrap5.scss +5 -0
- package/styles/textarea/fabric-dark.css +33 -0
- package/styles/textarea/fabric-dark.scss +5 -0
- package/styles/textarea/fabric.css +33 -0
- package/styles/textarea/fabric.scss +5 -0
- package/styles/textarea/fluent-dark.css +33 -0
- package/styles/textarea/fluent-dark.scss +5 -0
- package/styles/textarea/fluent.css +33 -0
- package/styles/textarea/fluent.scss +5 -0
- package/styles/textarea/highcontrast-light.css +33 -0
- package/styles/textarea/highcontrast-light.scss +5 -0
- package/styles/textarea/highcontrast.css +33 -0
- package/styles/textarea/highcontrast.scss +5 -0
- package/styles/textarea/material-dark.css +39 -0
- package/styles/textarea/material-dark.scss +5 -0
- package/styles/textarea/material.css +47 -0
- package/styles/textarea/material.scss +5 -0
- package/styles/textarea/material3-dark.css +102 -0
- package/styles/textarea/material3-dark.scss +6 -0
- package/styles/textarea/material3.css +158 -0
- package/styles/textarea/material3.scss +6 -0
- package/styles/textarea/tailwind-dark.css +33 -0
- package/styles/textarea/tailwind-dark.scss +5 -0
- package/styles/textarea/tailwind.css +33 -0
- package/styles/textarea/tailwind.scss +5 -0
- package/styles/textbox/_all.scss +1 -1
- package/styles/textbox/_bds-definition.scss +4 -0
- package/styles/textbox/_layout.scss +0 -11
- package/styles/textbox/bootstrap-dark.css +27 -1
- package/styles/textbox/bootstrap.css +27 -1
- package/styles/textbox/bootstrap4.css +27 -1
- package/styles/textbox/bootstrap5-dark.css +27 -1
- package/styles/textbox/bootstrap5.css +27 -1
- package/styles/textbox/fabric-dark.css +27 -1
- package/styles/textbox/fabric.css +27 -1
- package/styles/textbox/fluent-dark.css +27 -1
- package/styles/textbox/fluent.css +27 -1
- package/styles/textbox/highcontrast-light.css +27 -1
- package/styles/textbox/highcontrast.css +27 -1
- package/styles/textbox/material-dark.css +27 -1
- package/styles/textbox/material.css +27 -1
- package/styles/textbox/material3-dark.css +27 -1
- package/styles/textbox/material3.css +27 -1
- package/styles/textbox/tailwind-dark.css +27 -1
- package/styles/textbox/tailwind.css +27 -1
- package/styles/uploader/_bds-definition.scss +232 -0
- package/styles/uploader/icons/_bds.scss +34 -0
- package/textarea.d.ts +4 -0
- package/textarea.js +4 -0
|
@@ -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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
|
158
|
-
|
|
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
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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': '
|
|
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);
|
|
@@ -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();
|
|
@@ -6858,7 +7035,7 @@ __decorate$2([
|
|
|
6858
7035
|
Property('')
|
|
6859
7036
|
], Slider.prototype, "cssClass", void 0);
|
|
6860
7037
|
__decorate$2([
|
|
6861
|
-
Property(
|
|
7038
|
+
Property(true)
|
|
6862
7039
|
], Slider.prototype, "enableHtmlSanitizer", void 0);
|
|
6863
7040
|
__decorate$2([
|
|
6864
7041
|
Event()
|
|
@@ -13176,8 +13353,6 @@ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
13176
13353
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13177
13354
|
};
|
|
13178
13355
|
const HIDE_CLEAR = 'e-clear-icon-hide';
|
|
13179
|
-
const TEXTBOX_FOCUS = 'e-input-focus';
|
|
13180
|
-
const containerAttr = ['title', 'style', 'class'];
|
|
13181
13356
|
/**
|
|
13182
13357
|
* Represents the TextBox component that allows the user to enter the values based on it's type.
|
|
13183
13358
|
* ```html
|
|
@@ -13233,7 +13408,7 @@ let TextBox = class TextBox extends Component {
|
|
|
13233
13408
|
{
|
|
13234
13409
|
const prevOnChange = this.isProtectedOnChange;
|
|
13235
13410
|
this.isProtectedOnChange = true;
|
|
13236
|
-
if (!
|
|
13411
|
+
if (!Input.isBlank(this.value)) {
|
|
13237
13412
|
this.value = this.value.toString();
|
|
13238
13413
|
}
|
|
13239
13414
|
this.isProtectedOnChange = prevOnChange;
|
|
@@ -13255,8 +13430,8 @@ let TextBox = class TextBox extends Component {
|
|
|
13255
13430
|
break;
|
|
13256
13431
|
case 'htmlAttributes':
|
|
13257
13432
|
{
|
|
13258
|
-
this.
|
|
13259
|
-
this.
|
|
13433
|
+
this.updateHTMLAttributesToElement();
|
|
13434
|
+
this.updateHTMLAttributesToWrapper();
|
|
13260
13435
|
this.checkAttributes(true);
|
|
13261
13436
|
this.multiline && !isNullOrUndefined(this.textarea) ? Input.validateInputType(this.textboxWrapper.container, this.textarea) : Input.validateInputType(this.textboxWrapper.container, this.element);
|
|
13262
13437
|
}
|
|
@@ -13291,7 +13466,7 @@ let TextBox = class TextBox extends Component {
|
|
|
13291
13466
|
}
|
|
13292
13467
|
break;
|
|
13293
13468
|
case 'cssClass':
|
|
13294
|
-
|
|
13469
|
+
Input.updateCssClass(newProp.cssClass, oldProp.cssClass, this.textboxWrapper.container);
|
|
13295
13470
|
break;
|
|
13296
13471
|
case 'locale':
|
|
13297
13472
|
this.globalize = new Internationalization(this.locale);
|
|
@@ -13311,9 +13486,6 @@ let TextBox = class TextBox extends Component {
|
|
|
13311
13486
|
getModuleName() {
|
|
13312
13487
|
return 'textbox';
|
|
13313
13488
|
}
|
|
13314
|
-
isBlank(str) {
|
|
13315
|
-
return (!str || /^\s*$/.test(str));
|
|
13316
|
-
}
|
|
13317
13489
|
preRender() {
|
|
13318
13490
|
this.cloneElement = this.element.cloneNode(true);
|
|
13319
13491
|
this.formElement = closest(this.element, 'form');
|
|
@@ -13344,7 +13516,7 @@ let TextBox = class TextBox extends Component {
|
|
|
13344
13516
|
this.element = inputElement;
|
|
13345
13517
|
setValue('ej2_instances', ejInstance, this.element);
|
|
13346
13518
|
}
|
|
13347
|
-
this.
|
|
13519
|
+
this.updateHTMLAttributesToElement();
|
|
13348
13520
|
this.checkAttributes(false);
|
|
13349
13521
|
if ((isNullOrUndefined(this.textboxOptions) || (this.textboxOptions['value'] === undefined)) && this.element.value !== '') {
|
|
13350
13522
|
this.setProperties({ value: this.element.value }, true);
|
|
@@ -13380,7 +13552,7 @@ let TextBox = class TextBox extends Component {
|
|
|
13380
13552
|
const apiAttributes = ['placeholder', 'disabled', 'value', 'readonly', 'type', 'autocomplete'];
|
|
13381
13553
|
for (let index = 0; index < this.element.attributes.length; index++) {
|
|
13382
13554
|
const attributeName = this.element.attributes[index].nodeName;
|
|
13383
|
-
if (this.element.hasAttribute(attributeName) &&
|
|
13555
|
+
if (this.element.hasAttribute(attributeName) && containerAttributes.indexOf(attributeName) < 0 &&
|
|
13384
13556
|
!(attributeName === 'id' || attributeName === 'type' || attributeName === 'e-mappinguid')) {
|
|
13385
13557
|
// e-mappinguid attribute is handled for Grid component.
|
|
13386
13558
|
this.textarea.setAttribute(attributeName, this.element.attributes[index].nodeValue);
|
|
@@ -13446,7 +13618,7 @@ let TextBox = class TextBox extends Component {
|
|
|
13446
13618
|
render() {
|
|
13447
13619
|
let updatedCssClassValue = this.cssClass;
|
|
13448
13620
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
13449
|
-
updatedCssClassValue =
|
|
13621
|
+
updatedCssClassValue = Input.getInputValidClassList(this.cssClass);
|
|
13450
13622
|
}
|
|
13451
13623
|
this.respectiveElement = (this.isHiddenInput) ? this.textarea : this.element;
|
|
13452
13624
|
this.textboxWrapper = Input.createInput({
|
|
@@ -13461,7 +13633,7 @@ let TextBox = class TextBox extends Component {
|
|
|
13461
13633
|
showClearButton: this.showClearButton
|
|
13462
13634
|
}
|
|
13463
13635
|
});
|
|
13464
|
-
this.
|
|
13636
|
+
this.updateHTMLAttributesToWrapper();
|
|
13465
13637
|
if (this.isHiddenInput) {
|
|
13466
13638
|
this.respectiveElement.parentNode.insertBefore(this.element, this.respectiveElement);
|
|
13467
13639
|
}
|
|
@@ -13491,47 +13663,11 @@ let TextBox = class TextBox extends Component {
|
|
|
13491
13663
|
}
|
|
13492
13664
|
this.renderComplete();
|
|
13493
13665
|
}
|
|
13494
|
-
|
|
13495
|
-
|
|
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));
|
|
13666
|
+
updateHTMLAttributesToWrapper() {
|
|
13667
|
+
Input.updateHTMLAttributesToWrapper(this.htmlAttributes, this.textboxWrapper.container);
|
|
13528
13668
|
}
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
if (!isNullOrUndefined(inputClassName) && inputClassName !== '') {
|
|
13532
|
-
result = (inputClassName.replace(/\s+/g, ' ')).trim();
|
|
13533
|
-
}
|
|
13534
|
-
return result;
|
|
13669
|
+
updateHTMLAttributesToElement() {
|
|
13670
|
+
Input.updateHTMLAttributesToElement(this.htmlAttributes, this.respectiveElement ? this.respectiveElement : (this.multiline && !isNullOrUndefined(this.textarea) ? this.textarea : this.element));
|
|
13535
13671
|
}
|
|
13536
13672
|
setInitialValue() {
|
|
13537
13673
|
if (!this.isAngular) {
|
|
@@ -13723,6 +13859,9 @@ let TextBox = class TextBox extends Component {
|
|
|
13723
13859
|
*/
|
|
13724
13860
|
destroy() {
|
|
13725
13861
|
this.unWireEvents();
|
|
13862
|
+
if (this.showClearButton) {
|
|
13863
|
+
this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
|
|
13864
|
+
}
|
|
13726
13865
|
if (this.element.tagName === 'INPUT' && this.multiline) {
|
|
13727
13866
|
detach(this.textboxWrapper.container.getElementsByTagName('textarea')[0]);
|
|
13728
13867
|
this.respectiveElement = this.element;
|
|
@@ -13736,7 +13875,11 @@ let TextBox = class TextBox extends Component {
|
|
|
13736
13875
|
detach(this.textboxWrapper.container);
|
|
13737
13876
|
}
|
|
13738
13877
|
this.textboxWrapper = null;
|
|
13739
|
-
Input.destroy(
|
|
13878
|
+
Input.destroy({
|
|
13879
|
+
element: this.respectiveElement,
|
|
13880
|
+
floatLabelType: this.floatLabelType,
|
|
13881
|
+
properties: this.properties
|
|
13882
|
+
}, this.clearButton);
|
|
13740
13883
|
super.destroy();
|
|
13741
13884
|
}
|
|
13742
13885
|
/**
|
|
@@ -13912,110 +14055,788 @@ TextBox = __decorate$6([
|
|
|
13912
14055
|
* Uploader modules
|
|
13913
14056
|
*/
|
|
13914
14057
|
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
14058
|
+
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
14059
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14060
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14061
|
+
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;
|
|
14062
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14063
|
+
};
|
|
14064
|
+
const HIDE_CLEAR$1 = 'e-clear-icon-hide';
|
|
14065
|
+
const AUTO_WIDTH = 'e-auto-width';
|
|
14066
|
+
const RESIZE_X = 'e-resize-x';
|
|
14067
|
+
const RESIZE_Y = 'e-resize-y';
|
|
14068
|
+
const RESIZE_XY = 'e-resize-xy';
|
|
14069
|
+
const RESIZE_NONE = 'e-resize-none';
|
|
14070
|
+
let TextArea = class TextArea extends Component {
|
|
14071
|
+
constructor(options, element) {
|
|
14072
|
+
super(options, element);
|
|
14073
|
+
this.previousValue = null;
|
|
14074
|
+
this.isForm = false;
|
|
14075
|
+
this.inputPreviousValue = null;
|
|
14076
|
+
this.isAngular = false;
|
|
14077
|
+
this.isVue = false;
|
|
14078
|
+
this.textareaOptions = options;
|
|
13930
14079
|
}
|
|
13931
14080
|
/**
|
|
13932
|
-
*
|
|
14081
|
+
* Calls internally if any of the property value is changed.
|
|
13933
14082
|
*
|
|
13934
|
-
* @
|
|
13935
|
-
* @param {
|
|
13936
|
-
* @param {BlazorDotnetObject} dotnetRef - Specifies for blazor client to server communication.
|
|
14083
|
+
* @param {TextAreaModel} newProp - Returns the dynamic property value of the component.
|
|
14084
|
+
* @param {TextAreaModel} oldProp - Returns the previous property value of the component.
|
|
13937
14085
|
* @returns {void}
|
|
14086
|
+
* @private
|
|
13938
14087
|
*/
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14088
|
+
onPropertyChanged(newProp, oldProp) {
|
|
14089
|
+
for (const prop of Object.keys(newProp)) {
|
|
14090
|
+
switch (prop) {
|
|
14091
|
+
case 'floatLabelType':
|
|
14092
|
+
Input.removeFloating(this.textareaWrapper);
|
|
14093
|
+
Input.addFloating(this.element, this.floatLabelType, this.placeholder);
|
|
14094
|
+
if (this.floatLabelType === 'Never') {
|
|
14095
|
+
this.element.removeAttribute('aria-labelledby');
|
|
14096
|
+
}
|
|
14097
|
+
break;
|
|
14098
|
+
case 'enabled':
|
|
14099
|
+
Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
|
|
14100
|
+
this.bindClearEvent();
|
|
14101
|
+
if (!this.enabled && this.resizeMode !== 'None') {
|
|
14102
|
+
this.element.classList.remove(this.getCurrentResizeClass(this.resizeMode));
|
|
14103
|
+
this.element.classList.add(RESIZE_NONE);
|
|
14104
|
+
}
|
|
14105
|
+
else {
|
|
14106
|
+
this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
|
|
14107
|
+
}
|
|
14108
|
+
break;
|
|
14109
|
+
case 'width':
|
|
14110
|
+
if (this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') {
|
|
14111
|
+
this.setElementWidth(newProp.width);
|
|
14112
|
+
this.textareaWrapper.container.classList.add(AUTO_WIDTH);
|
|
14113
|
+
}
|
|
14114
|
+
else {
|
|
14115
|
+
if (this.textareaWrapper.container.classList.contains(AUTO_WIDTH)) {
|
|
14116
|
+
this.textareaWrapper.container.classList.remove(AUTO_WIDTH);
|
|
14117
|
+
}
|
|
14118
|
+
Input.setWidth(newProp.width, this.textareaWrapper.container);
|
|
14119
|
+
}
|
|
14120
|
+
break;
|
|
14121
|
+
case 'value':
|
|
14122
|
+
{
|
|
14123
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
14124
|
+
this.isProtectedOnChange = true;
|
|
14125
|
+
if (!Input.isBlank(this.value)) {
|
|
14126
|
+
this.value = this.value.toString();
|
|
14127
|
+
}
|
|
14128
|
+
this.isProtectedOnChange = prevOnChange;
|
|
14129
|
+
Input.setValue(this.value, this.element, this.floatLabelType, this.showClearButton);
|
|
14130
|
+
this.inputPreviousValue = this.element.value;
|
|
14131
|
+
/* istanbul ignore next */
|
|
14132
|
+
if ((this.isAngular || this.isVue) && this.preventChange === true) {
|
|
14133
|
+
this.previousValue = this.isAngular ? this.value : this.previousValue;
|
|
14134
|
+
this.preventChange = false;
|
|
14135
|
+
}
|
|
14136
|
+
else if (isNullOrUndefined(this.isAngular) || !this.isAngular
|
|
14137
|
+
|| (this.isAngular && !this.preventChange) || (this.isAngular && isNullOrUndefined(this.preventChange))) {
|
|
14138
|
+
this.raiseChangeEvent();
|
|
14139
|
+
}
|
|
14140
|
+
}
|
|
14141
|
+
break;
|
|
14142
|
+
case 'htmlAttributes':
|
|
14143
|
+
{
|
|
14144
|
+
this.updateHTMLAttributesToElement();
|
|
14145
|
+
this.updateHTMLAttributesToWrapper();
|
|
14146
|
+
this.checkAttributes(true);
|
|
14147
|
+
Input.validateInputType(this.textareaWrapper.container, this.element);
|
|
14148
|
+
}
|
|
14149
|
+
break;
|
|
14150
|
+
case 'readonly':
|
|
14151
|
+
Input.setReadonly(this.readonly, this.element);
|
|
14152
|
+
if (this.readonly) {
|
|
14153
|
+
this.element.setAttribute('aria-readonly', 'true');
|
|
14154
|
+
}
|
|
14155
|
+
else {
|
|
14156
|
+
this.element.removeAttribute('aria-readonly');
|
|
14157
|
+
}
|
|
14158
|
+
break;
|
|
14159
|
+
case 'showClearButton':
|
|
14160
|
+
Input.setClearButton(this.showClearButton, this.element, this.textareaWrapper);
|
|
14161
|
+
this.bindClearEvent();
|
|
14162
|
+
break;
|
|
14163
|
+
case 'enableRtl':
|
|
14164
|
+
Input.setEnableRtl(this.enableRtl, [this.textareaWrapper.container]);
|
|
14165
|
+
break;
|
|
14166
|
+
case 'placeholder':
|
|
14167
|
+
Input.setPlaceholder(this.placeholder, this.element);
|
|
14168
|
+
Input.calculateWidth(this.element, this.textareaWrapper.container);
|
|
14169
|
+
break;
|
|
14170
|
+
case 'cssClass':
|
|
14171
|
+
Input.updateCssClass(newProp.cssClass, oldProp.cssClass, this.textareaWrapper.container);
|
|
14172
|
+
break;
|
|
14173
|
+
case 'locale':
|
|
14174
|
+
this.globalize = new Internationalization(this.locale);
|
|
14175
|
+
this.l10n.setLocale(this.locale);
|
|
14176
|
+
this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
|
|
14177
|
+
Input.setPlaceholder(this.placeholder, this.element);
|
|
14178
|
+
break;
|
|
14179
|
+
case 'rowsCount':
|
|
14180
|
+
if (this.rowsCount) {
|
|
14181
|
+
this.element.setAttribute('rows', this.rowsCount.toString());
|
|
14182
|
+
}
|
|
14183
|
+
break;
|
|
14184
|
+
case 'columnsCount':
|
|
14185
|
+
if (this.columnsCount) {
|
|
14186
|
+
this.element.setAttribute('cols', this.columnsCount.toString());
|
|
14187
|
+
if (this.width == null) {
|
|
14188
|
+
this.textareaWrapper.container.classList.add(AUTO_WIDTH);
|
|
14189
|
+
}
|
|
14190
|
+
}
|
|
14191
|
+
break;
|
|
14192
|
+
case 'maxLength':
|
|
14193
|
+
if (this.maxLength) {
|
|
14194
|
+
this.element.setAttribute('maxlength', this.maxLength.toString());
|
|
14195
|
+
}
|
|
14196
|
+
break;
|
|
14197
|
+
case 'resizeMode':
|
|
14198
|
+
if (this.enabled) {
|
|
14199
|
+
if (this.element.classList.contains(this.getCurrentResizeClass(oldProp.resizeMode))) {
|
|
14200
|
+
this.element.classList.remove(this.getCurrentResizeClass(oldProp.resizeMode));
|
|
14201
|
+
}
|
|
14202
|
+
this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
|
|
14203
|
+
if (this.element.style.width && (this.resizeMode === 'None' || this.resizeMode === 'Vertical')) {
|
|
14204
|
+
Input.setWidth(this.element.style.width, this.textareaWrapper.container);
|
|
14205
|
+
}
|
|
14206
|
+
else {
|
|
14207
|
+
const currentWidth = this.element.offsetWidth;
|
|
14208
|
+
this.element.style.width = currentWidth + 'px';
|
|
14209
|
+
if (this.textareaWrapper.container.style.width) {
|
|
14210
|
+
this.textareaWrapper.container.style.width = '';
|
|
14211
|
+
}
|
|
14212
|
+
}
|
|
14213
|
+
this.setWrapperWidth();
|
|
14214
|
+
}
|
|
14215
|
+
break;
|
|
14216
|
+
}
|
|
14217
|
+
}
|
|
14218
|
+
}
|
|
14219
|
+
preRender() {
|
|
14220
|
+
this.formElement = closest(this.element, 'form');
|
|
14221
|
+
if (!isNullOrUndefined(this.formElement)) {
|
|
14222
|
+
this.isForm = true;
|
|
14223
|
+
}
|
|
14224
|
+
/* istanbul ignore next */
|
|
14225
|
+
if (this.element.tagName === 'EJS-TEXTAREA') {
|
|
14226
|
+
const ejInstance = getValue('ej2_instances', this.element);
|
|
14227
|
+
const inputElement = this.createElement('textarea');
|
|
14228
|
+
let index = 0;
|
|
14229
|
+
for (index; index < this.element.attributes.length; index++) {
|
|
14230
|
+
const attributeName = this.element.attributes[index].nodeName;
|
|
14231
|
+
if (attributeName !== 'id' && attributeName !== 'class') {
|
|
14232
|
+
inputElement.setAttribute(attributeName, this.element.attributes[index].nodeValue);
|
|
14233
|
+
inputElement.innerHTML = this.element.innerHTML;
|
|
14234
|
+
if (attributeName === 'name') {
|
|
14235
|
+
this.element.removeAttribute('name');
|
|
14236
|
+
}
|
|
14237
|
+
}
|
|
14238
|
+
else if (attributeName === 'class') {
|
|
14239
|
+
inputElement.setAttribute(attributeName, this.element.className.split(' ').filter((item) => item.indexOf('ng-') !== 0).join(' '));
|
|
14240
|
+
}
|
|
14241
|
+
}
|
|
14242
|
+
this.element.appendChild(inputElement);
|
|
14243
|
+
this.element = inputElement;
|
|
14244
|
+
setValue('ej2_instances', ejInstance, this.element);
|
|
14245
|
+
}
|
|
14246
|
+
this.updateHTMLAttributesToElement();
|
|
14247
|
+
this.checkAttributes(false);
|
|
14248
|
+
if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['value'] === undefined)) && this.element.value !== '') {
|
|
14249
|
+
this.setProperties({ value: this.element.value }, true);
|
|
14250
|
+
}
|
|
14251
|
+
this.globalize = new Internationalization(this.locale);
|
|
14252
|
+
const localeText = { placeholder: this.placeholder };
|
|
14253
|
+
this.l10n = new L10n('textarea', localeText, this.locale);
|
|
14254
|
+
if (this.l10n.getConstant('placeholder') !== '') {
|
|
14255
|
+
this.setProperties({ placeholder: this.placeholder || this.l10n.getConstant('placeholder') }, true);
|
|
14256
|
+
}
|
|
14257
|
+
if (!this.element.hasAttribute('id')) {
|
|
14258
|
+
this.element.setAttribute('id', getUniqueID('textbox'));
|
|
14259
|
+
}
|
|
14260
|
+
if (!this.element.hasAttribute('name')) {
|
|
14261
|
+
this.element.setAttribute('name', this.element.getAttribute('id'));
|
|
14262
|
+
}
|
|
14263
|
+
if (this.rowsCount) {
|
|
14264
|
+
this.element.setAttribute('rows', this.rowsCount.toString());
|
|
14265
|
+
}
|
|
14266
|
+
if (this.columnsCount) {
|
|
14267
|
+
this.element.setAttribute('cols', this.columnsCount.toString());
|
|
14268
|
+
}
|
|
14269
|
+
if (this.maxLength) {
|
|
14270
|
+
this.element.setAttribute('maxlength', this.maxLength.toString());
|
|
14271
|
+
}
|
|
14272
|
+
if (!this.element.style.resize && this.enabled) {
|
|
14273
|
+
this.element.classList.add(this.getCurrentResizeClass(this.resizeMode));
|
|
14274
|
+
}
|
|
14275
|
+
if (this.enabled) {
|
|
14276
|
+
this.element.setAttribute('aria-multiline', 'true');
|
|
14277
|
+
}
|
|
14278
|
+
}
|
|
14279
|
+
/**
|
|
14280
|
+
* To Initialize the control rendering
|
|
14281
|
+
*
|
|
14282
|
+
* @returns {void}
|
|
14283
|
+
* @private
|
|
14284
|
+
*/
|
|
14285
|
+
render() {
|
|
14286
|
+
let updatedCssClassValue = this.cssClass;
|
|
14287
|
+
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
14288
|
+
updatedCssClassValue = Input.getInputValidClassList(this.cssClass);
|
|
14289
|
+
}
|
|
14290
|
+
this.textareaWrapper = Input.createInput({
|
|
14291
|
+
element: this.element,
|
|
14292
|
+
floatLabelType: this.floatLabelType,
|
|
14293
|
+
properties: {
|
|
14294
|
+
enabled: this.enabled,
|
|
14295
|
+
enableRtl: this.enableRtl,
|
|
14296
|
+
cssClass: updatedCssClassValue,
|
|
14297
|
+
readonly: this.readonly,
|
|
14298
|
+
placeholder: this.placeholder,
|
|
14299
|
+
showClearButton: this.showClearButton
|
|
14300
|
+
}
|
|
14301
|
+
});
|
|
14302
|
+
this.updateHTMLAttributesToWrapper();
|
|
14303
|
+
this.wireEvents();
|
|
14304
|
+
if (!isNullOrUndefined(this.value)) {
|
|
14305
|
+
Input.setValue(this.value, this.element, this.floatLabelType, this.showClearButton);
|
|
14306
|
+
}
|
|
14307
|
+
if (!isNullOrUndefined(this.value)) {
|
|
14308
|
+
this.initialValue = this.value;
|
|
14309
|
+
if (!this.isAngular) {
|
|
14310
|
+
this.element.setAttribute('value', this.initialValue);
|
|
14311
|
+
}
|
|
14312
|
+
}
|
|
14313
|
+
this.previousValue = this.value;
|
|
14314
|
+
this.inputPreviousValue = this.value;
|
|
14315
|
+
this.element.defaultValue = this.element.value;
|
|
14316
|
+
Input.setWidth(this.width, this.textareaWrapper.container);
|
|
14317
|
+
this.setWrapperWidth();
|
|
14318
|
+
this.renderComplete();
|
|
14319
|
+
}
|
|
14320
|
+
getModuleName() {
|
|
14321
|
+
return 'textarea';
|
|
14322
|
+
}
|
|
14323
|
+
/* eslint-disable valid-jsdoc, jsdoc/require-returns */
|
|
14324
|
+
/**
|
|
14325
|
+
* Gets the properties to be maintained in the persisted state.
|
|
14326
|
+
*
|
|
14327
|
+
*/
|
|
14328
|
+
getPersistData() {
|
|
14329
|
+
const keyEntity = ['value'];
|
|
14330
|
+
return this.addOnPersist(keyEntity);
|
|
14331
|
+
}
|
|
14332
|
+
checkAttributes(isDynamic) {
|
|
14333
|
+
const attrs = isDynamic ? isNullOrUndefined(this.htmlAttributes) ? [] : Object.keys(this.htmlAttributes) :
|
|
14334
|
+
['placeholder', 'disabled', 'value', 'readonly'];
|
|
14335
|
+
for (const key of attrs) {
|
|
14336
|
+
if (!isNullOrUndefined(this.element.getAttribute(key))) {
|
|
14337
|
+
switch (key) {
|
|
14338
|
+
case 'disabled':
|
|
14339
|
+
if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['enabled'] === undefined)) || isDynamic) {
|
|
14340
|
+
const enabled = this.element.getAttribute(key) === 'disabled' || this.element.getAttribute(key) === '' ||
|
|
14341
|
+
this.element.getAttribute(key) === 'true' ? false : true;
|
|
14342
|
+
this.setProperties({ enabled: enabled }, !isDynamic);
|
|
14343
|
+
}
|
|
14344
|
+
break;
|
|
14345
|
+
case 'readonly':
|
|
14346
|
+
if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['readonly'] === undefined)) || isDynamic) {
|
|
14347
|
+
const readonly = this.element.getAttribute(key) === 'readonly' || this.element.getAttribute(key) === ''
|
|
14348
|
+
|| this.element.getAttribute(key) === 'true' ? true : false;
|
|
14349
|
+
this.setProperties({ readonly: readonly }, !isDynamic);
|
|
14350
|
+
}
|
|
14351
|
+
break;
|
|
14352
|
+
case 'placeholder':
|
|
14353
|
+
if ((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['placeholder'] === undefined)) || isDynamic) {
|
|
14354
|
+
this.setProperties({ placeholder: this.element.placeholder }, !isDynamic);
|
|
14355
|
+
}
|
|
14356
|
+
break;
|
|
14357
|
+
case 'value':
|
|
14358
|
+
if (((isNullOrUndefined(this.textareaOptions) || (this.textareaOptions['value'] === undefined)) || isDynamic) && this.element.value !== '') {
|
|
14359
|
+
this.setProperties({ value: this.element.value }, !isDynamic);
|
|
14360
|
+
}
|
|
14361
|
+
break;
|
|
14362
|
+
}
|
|
14363
|
+
}
|
|
14364
|
+
}
|
|
14365
|
+
}
|
|
14366
|
+
wireEvents() {
|
|
14367
|
+
EventHandler.add(this.element, 'focus', this.focusHandler, this);
|
|
14368
|
+
EventHandler.add(this.element, 'blur', this.focusOutHandler, this);
|
|
14369
|
+
EventHandler.add(this.element, 'keydown', this.keydownHandler, this);
|
|
14370
|
+
EventHandler.add(this.element, 'input', this.inputHandler, this);
|
|
14371
|
+
EventHandler.add(this.element, 'change', this.changeHandler, this);
|
|
14372
|
+
if (this.isForm) {
|
|
14373
|
+
EventHandler.add(this.formElement, 'reset', this.resetForm, this);
|
|
14374
|
+
}
|
|
14375
|
+
this.bindClearEvent();
|
|
14376
|
+
}
|
|
14377
|
+
unWireEvents() {
|
|
14378
|
+
EventHandler.remove(this.element, 'focus', this.focusHandler);
|
|
14379
|
+
EventHandler.remove(this.element, 'blur', this.focusOutHandler);
|
|
14380
|
+
EventHandler.remove(this.element, 'keydown', this.keydownHandler);
|
|
14381
|
+
EventHandler.remove(this.element, 'input', this.inputHandler);
|
|
14382
|
+
EventHandler.remove(this.element, 'change', this.changeHandler);
|
|
14383
|
+
if (this.isForm) {
|
|
14384
|
+
EventHandler.remove(this.formElement, 'reset', this.resetForm);
|
|
14385
|
+
}
|
|
14386
|
+
}
|
|
14387
|
+
/**
|
|
14388
|
+
* Removes the component from the DOM and detaches all its related event handlers.
|
|
14389
|
+
* Also, it maintains the initial TextArea element from the DOM.
|
|
14390
|
+
*
|
|
14391
|
+
* @method destroy
|
|
14392
|
+
* @returns {void}
|
|
14393
|
+
*/
|
|
14394
|
+
destroy() {
|
|
14395
|
+
this.unWireEvents();
|
|
14396
|
+
if (this.showClearButton) {
|
|
14397
|
+
this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
|
|
14398
|
+
}
|
|
14399
|
+
this.element.value = this.element.defaultValue;
|
|
14400
|
+
this.element.classList.remove('e-input', RESIZE_X, RESIZE_Y, RESIZE_XY, RESIZE_NONE);
|
|
14401
|
+
this.removeAttributes(['aria-disabled', 'aria-readonly', 'aria-labelledby', 'aria-multiline']);
|
|
14402
|
+
if (!isNullOrUndefined(this.textareaWrapper)) {
|
|
14403
|
+
this.textareaWrapper.container.insertAdjacentElement('afterend', this.element);
|
|
14404
|
+
detach(this.textareaWrapper.container);
|
|
14405
|
+
}
|
|
14406
|
+
this.textareaWrapper = null;
|
|
14407
|
+
this.formElement = null;
|
|
14408
|
+
Input.destroy({
|
|
14409
|
+
element: this.element,
|
|
14410
|
+
floatLabelType: this.floatLabelType,
|
|
14411
|
+
properties: this.properties
|
|
14412
|
+
}, this.clearButton);
|
|
14413
|
+
super.destroy();
|
|
14414
|
+
}
|
|
14415
|
+
focusHandler(args) {
|
|
14416
|
+
const eventArgs = {
|
|
14417
|
+
container: this.textareaWrapper.container,
|
|
14418
|
+
event: args,
|
|
14419
|
+
value: this.value
|
|
14420
|
+
};
|
|
14421
|
+
this.trigger('focus', eventArgs);
|
|
14422
|
+
}
|
|
14423
|
+
focusOutHandler(args) {
|
|
14424
|
+
if (!(this.previousValue === null && this.value === null) &&
|
|
14425
|
+
(this.previousValue !== this.value)) {
|
|
14426
|
+
this.raiseChangeEvent(args, true);
|
|
14427
|
+
}
|
|
14428
|
+
const eventArgs = {
|
|
14429
|
+
container: this.textareaWrapper.container,
|
|
14430
|
+
event: args,
|
|
14431
|
+
value: this.value
|
|
14432
|
+
};
|
|
14433
|
+
this.trigger('blur', eventArgs);
|
|
14434
|
+
}
|
|
14435
|
+
keydownHandler(args) {
|
|
14436
|
+
if ((args.keyCode === 13 || args.keyCode === 9) && !((this.previousValue === null || this.previousValue === '') && (this.value === null || this.value === '') && this.element.value === '')) {
|
|
14437
|
+
this.setProperties({ value: this.element.value }, true);
|
|
14438
|
+
}
|
|
14439
|
+
}
|
|
14440
|
+
inputHandler(args) {
|
|
14441
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias
|
|
14442
|
+
const textareaObj = this;
|
|
14443
|
+
const eventArgs = {
|
|
14444
|
+
event: args,
|
|
14445
|
+
value: this.element.value,
|
|
14446
|
+
previousValue: this.inputPreviousValue,
|
|
14447
|
+
container: this.textareaWrapper.container
|
|
14448
|
+
};
|
|
14449
|
+
this.inputPreviousValue = this.element.value;
|
|
14450
|
+
/* istanbul ignore next */
|
|
14451
|
+
if (this.isAngular) {
|
|
14452
|
+
textareaObj.localChange({ value: this.element.value });
|
|
14453
|
+
this.preventChange = true;
|
|
14454
|
+
}
|
|
14455
|
+
if (this.isVue) {
|
|
14456
|
+
this.preventChange = true;
|
|
14457
|
+
}
|
|
14458
|
+
this.trigger('input', eventArgs);
|
|
14459
|
+
args.stopPropagation();
|
|
14460
|
+
}
|
|
14461
|
+
changeHandler(args) {
|
|
14462
|
+
this.setProperties({ value: this.element.value }, true);
|
|
14463
|
+
if (this.previousValue !== this.value) {
|
|
14464
|
+
this.raiseChangeEvent(args, true);
|
|
14465
|
+
}
|
|
14466
|
+
args.stopPropagation();
|
|
14467
|
+
}
|
|
14468
|
+
raiseChangeEvent(event, interaction) {
|
|
14469
|
+
const eventArgs = {
|
|
14470
|
+
event: event,
|
|
14471
|
+
value: this.value,
|
|
14472
|
+
previousValue: this.previousValue,
|
|
14473
|
+
container: this.textareaWrapper.container,
|
|
14474
|
+
isInteraction: interaction ? interaction : false,
|
|
14475
|
+
isInteracted: interaction ? interaction : false
|
|
14476
|
+
};
|
|
14477
|
+
this.preventChange = false;
|
|
14478
|
+
this.trigger('change', eventArgs);
|
|
14479
|
+
this.previousValue = this.value;
|
|
14480
|
+
}
|
|
14481
|
+
updateHTMLAttributesToWrapper() {
|
|
14482
|
+
Input.updateHTMLAttributesToWrapper(this.htmlAttributes, this.textareaWrapper.container);
|
|
14483
|
+
}
|
|
14484
|
+
updateHTMLAttributesToElement() {
|
|
14485
|
+
Input.updateHTMLAttributesToElement(this.htmlAttributes, this.element);
|
|
14486
|
+
}
|
|
14487
|
+
bindClearEvent() {
|
|
14488
|
+
if (this.showClearButton) {
|
|
14489
|
+
if (this.enabled) {
|
|
14490
|
+
EventHandler.add(this.textareaWrapper.clearButton, 'mousedown touchstart', this.resetInputHandler, this);
|
|
14491
|
+
}
|
|
14492
|
+
else {
|
|
14493
|
+
EventHandler.remove(this.textareaWrapper.clearButton, 'mousedown touchstart', this.resetInputHandler);
|
|
14494
|
+
}
|
|
14495
|
+
}
|
|
14496
|
+
}
|
|
14497
|
+
resetInputHandler(event) {
|
|
14498
|
+
event.preventDefault();
|
|
14499
|
+
if (!(this.textareaWrapper.clearButton.classList.contains(HIDE_CLEAR$1)) || this.textareaWrapper.container.classList.contains('e-static-clear')) {
|
|
14500
|
+
Input.setValue('', this.element, this.floatLabelType, this.showClearButton);
|
|
14501
|
+
this.setProperties({ value: this.element.value }, true);
|
|
14502
|
+
}
|
|
14503
|
+
const eventArgs = {
|
|
14504
|
+
event: event,
|
|
14505
|
+
value: this.element.value,
|
|
14506
|
+
previousValue: this.inputPreviousValue,
|
|
14507
|
+
container: this.textareaWrapper.container
|
|
14508
|
+
};
|
|
14509
|
+
this.trigger('input', eventArgs);
|
|
14510
|
+
this.inputPreviousValue = this.element.value;
|
|
14511
|
+
this.raiseChangeEvent(event, true);
|
|
14512
|
+
if (closest(this.element, 'form')) {
|
|
14513
|
+
const element = this.element;
|
|
14514
|
+
const keyupEvent = document.createEvent('KeyboardEvent');
|
|
14515
|
+
keyupEvent.initEvent('keyup', false, true);
|
|
14516
|
+
element.dispatchEvent(keyupEvent);
|
|
14517
|
+
}
|
|
14518
|
+
}
|
|
14519
|
+
/* eslint-enable valid-jsdoc, jsdoc/require-returns */
|
|
14520
|
+
/**
|
|
14521
|
+
* Adding the multiple attributes as key-value pair to the TextArea element.
|
|
14522
|
+
*
|
|
14523
|
+
* @param {string} attributes - Specifies the attributes to be add to TextArea element.
|
|
14524
|
+
* @returns {void}
|
|
14525
|
+
*/
|
|
14526
|
+
addAttributes(attributes$$1) {
|
|
14527
|
+
for (const key of Object.keys(attributes$$1)) {
|
|
14528
|
+
if (key === 'disabled') {
|
|
14529
|
+
this.setProperties({ enabled: false }, true);
|
|
14530
|
+
Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
|
|
14531
|
+
}
|
|
14532
|
+
else if (key === 'readonly') {
|
|
14533
|
+
this.setProperties({ readonly: true }, true);
|
|
14534
|
+
Input.setReadonly(this.readonly, this.element);
|
|
14535
|
+
}
|
|
14536
|
+
else if (key === 'class') {
|
|
14537
|
+
this.element.classList.add(attributes$$1[`${key}`]);
|
|
14538
|
+
}
|
|
14539
|
+
else if (key === 'placeholder') {
|
|
14540
|
+
this.setProperties({ placeholder: attributes$$1[`${key}`] }, true);
|
|
14541
|
+
Input.setPlaceholder(this.placeholder, this.element);
|
|
14542
|
+
}
|
|
14543
|
+
else {
|
|
14544
|
+
this.element.setAttribute(key, attributes$$1[`${key}`]);
|
|
14545
|
+
}
|
|
14546
|
+
}
|
|
14547
|
+
}
|
|
14548
|
+
/**
|
|
14549
|
+
* Removing the multiple attributes as key-value pair to the TextArea element.
|
|
14550
|
+
*
|
|
14551
|
+
* @param { string[] } attributes - Specifies the attributes name to be removed from TextArea element.
|
|
14552
|
+
* @returns {void}
|
|
14553
|
+
*/
|
|
14554
|
+
removeAttributes(attributes$$1) {
|
|
14555
|
+
for (const key of attributes$$1) {
|
|
14556
|
+
if (key === 'disabled') {
|
|
14557
|
+
this.setProperties({ enabled: true }, true);
|
|
14558
|
+
Input.setEnabled(this.enabled, this.element, this.floatLabelType, this.textareaWrapper.container);
|
|
14559
|
+
}
|
|
14560
|
+
else if (key === 'readonly') {
|
|
14561
|
+
this.setProperties({ readonly: false }, true);
|
|
14562
|
+
Input.setReadonly(this.readonly, this.element);
|
|
14563
|
+
}
|
|
14564
|
+
else if (key === 'placeholder') {
|
|
14565
|
+
this.setProperties({ placeholder: null }, true);
|
|
14566
|
+
Input.setPlaceholder(this.placeholder, this.element);
|
|
14567
|
+
}
|
|
14568
|
+
else {
|
|
14569
|
+
this.element.removeAttribute(key);
|
|
14570
|
+
}
|
|
14571
|
+
}
|
|
14572
|
+
}
|
|
14573
|
+
/**
|
|
14574
|
+
* Sets the focus to widget for interaction.
|
|
14575
|
+
*
|
|
14576
|
+
* @returns {void}
|
|
14577
|
+
*/
|
|
14578
|
+
focusIn() {
|
|
14579
|
+
if (document.activeElement !== this.element && this.enabled) {
|
|
14580
|
+
this.element.focus();
|
|
14581
|
+
if (this.textareaWrapper.container.classList.contains('e-input-group')
|
|
14582
|
+
|| this.textareaWrapper.container.classList.contains('e-outline')
|
|
14583
|
+
|| this.textareaWrapper.container.classList.contains('e-filled')) {
|
|
14584
|
+
addClass([this.textareaWrapper.container], [TEXTBOX_FOCUS]);
|
|
14585
|
+
}
|
|
14586
|
+
}
|
|
14587
|
+
}
|
|
14588
|
+
/**
|
|
14589
|
+
* Remove the focus from widget, if the widget is in focus state.
|
|
14590
|
+
*
|
|
14591
|
+
* @returns {void}
|
|
14592
|
+
*/
|
|
14593
|
+
focusOut() {
|
|
14594
|
+
if (document.activeElement === this.element && this.enabled) {
|
|
14595
|
+
this.element.blur();
|
|
14596
|
+
if (this.textareaWrapper.container.classList.contains('e-input-group')
|
|
14597
|
+
|| this.textareaWrapper.container.classList.contains('e-outline')
|
|
14598
|
+
|| this.textareaWrapper.container.classList.contains('e-filled')) {
|
|
14599
|
+
removeClass([this.textareaWrapper.container], [TEXTBOX_FOCUS]);
|
|
14600
|
+
}
|
|
14601
|
+
}
|
|
14602
|
+
}
|
|
14603
|
+
/**
|
|
14604
|
+
* Sets up the width for the textarea wrapper.
|
|
14605
|
+
*
|
|
14606
|
+
* @returns {void}
|
|
14607
|
+
*/
|
|
14608
|
+
setWrapperWidth() {
|
|
14609
|
+
if (this.enabled && ((this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') || (this.columnsCount || this.element.getAttribute('cols')))) {
|
|
14610
|
+
if (this.resizeMode !== 'None' && this.resizeMode !== 'Vertical') {
|
|
14611
|
+
if (this.textareaWrapper.container.style.width) {
|
|
14612
|
+
this.setElementWidth(this.textareaWrapper.container.style.width);
|
|
14613
|
+
this.textareaWrapper.container.style.width = '';
|
|
14614
|
+
this.textareaWrapper.container.classList.add(AUTO_WIDTH);
|
|
14615
|
+
}
|
|
14616
|
+
}
|
|
14617
|
+
this.textareaWrapper.container.classList.add(AUTO_WIDTH);
|
|
14618
|
+
}
|
|
14619
|
+
else {
|
|
14620
|
+
if (this.textareaWrapper.container.classList.contains(AUTO_WIDTH)) {
|
|
14621
|
+
this.textareaWrapper.container.classList.remove(AUTO_WIDTH);
|
|
14622
|
+
}
|
|
14623
|
+
}
|
|
14624
|
+
}
|
|
14625
|
+
resetForm() {
|
|
14626
|
+
if (this.isAngular) {
|
|
14627
|
+
this.resetValue('');
|
|
14628
|
+
}
|
|
14629
|
+
else {
|
|
14630
|
+
this.resetValue(this.initialValue);
|
|
14631
|
+
}
|
|
14632
|
+
if (!isNullOrUndefined(this.textareaWrapper)) {
|
|
14633
|
+
const label = this.textareaWrapper.container.querySelector('.e-float-text');
|
|
14634
|
+
if (!isNullOrUndefined(label) && this.floatLabelType !== 'Always') {
|
|
14635
|
+
if ((isNullOrUndefined(this.initialValue) || this.initialValue === '')) {
|
|
14636
|
+
label.classList.add('e-label-bottom');
|
|
14637
|
+
label.classList.remove('e-label-top');
|
|
14638
|
+
}
|
|
14639
|
+
else if (this.initialValue !== '') {
|
|
14640
|
+
label.classList.add('e-label-top');
|
|
14641
|
+
label.classList.remove('e-label-bottom');
|
|
14642
|
+
}
|
|
14643
|
+
}
|
|
14644
|
+
}
|
|
14645
|
+
}
|
|
14646
|
+
resetValue(value) {
|
|
14647
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
14648
|
+
this.isProtectedOnChange = true;
|
|
14649
|
+
this.value = value;
|
|
14650
|
+
if (value == null && this.textareaWrapper.container.classList.contains('e-valid-input')) {
|
|
14651
|
+
this.textareaWrapper.container.classList.remove('e-valid-input');
|
|
14652
|
+
}
|
|
14653
|
+
this.isProtectedOnChange = prevOnChange;
|
|
14654
|
+
}
|
|
14655
|
+
setElementWidth(width) {
|
|
14656
|
+
if (typeof width === 'number') {
|
|
14657
|
+
this.element.style.width = formatUnit(width);
|
|
14658
|
+
}
|
|
14659
|
+
else if (typeof width === 'string') {
|
|
14660
|
+
this.element.style.width = (width.match(/px|%|em/)) ? (width) : (formatUnit(width));
|
|
14661
|
+
}
|
|
14662
|
+
}
|
|
14663
|
+
getCurrentResizeClass(resizeMode) {
|
|
14664
|
+
return resizeMode === 'None' ? RESIZE_NONE : (resizeMode === 'Both' ? RESIZE_XY : resizeMode === 'Horizontal' ? RESIZE_X : RESIZE_Y);
|
|
14665
|
+
}
|
|
14666
|
+
};
|
|
14667
|
+
__decorate$7([
|
|
14668
|
+
Property(false)
|
|
14669
|
+
], TextArea.prototype, "readonly", void 0);
|
|
14670
|
+
__decorate$7([
|
|
14671
|
+
Property(null)
|
|
14672
|
+
], TextArea.prototype, "value", void 0);
|
|
14673
|
+
__decorate$7([
|
|
14674
|
+
Property('Never')
|
|
14675
|
+
], TextArea.prototype, "floatLabelType", void 0);
|
|
14676
|
+
__decorate$7([
|
|
14677
|
+
Property('')
|
|
14678
|
+
], TextArea.prototype, "cssClass", void 0);
|
|
14679
|
+
__decorate$7([
|
|
14680
|
+
Property(null)
|
|
14681
|
+
], TextArea.prototype, "placeholder", void 0);
|
|
14682
|
+
__decorate$7([
|
|
14683
|
+
Property({})
|
|
14684
|
+
], TextArea.prototype, "htmlAttributes", void 0);
|
|
14685
|
+
__decorate$7([
|
|
14686
|
+
Property(true)
|
|
14687
|
+
], TextArea.prototype, "enabled", void 0);
|
|
14688
|
+
__decorate$7([
|
|
14689
|
+
Property(false)
|
|
14690
|
+
], TextArea.prototype, "showClearButton", void 0);
|
|
14691
|
+
__decorate$7([
|
|
14692
|
+
Property(false)
|
|
14693
|
+
], TextArea.prototype, "enablePersistence", void 0);
|
|
14694
|
+
__decorate$7([
|
|
14695
|
+
Property(null)
|
|
14696
|
+
], TextArea.prototype, "width", void 0);
|
|
14697
|
+
__decorate$7([
|
|
14698
|
+
Property('Vertical')
|
|
14699
|
+
], TextArea.prototype, "resizeMode", void 0);
|
|
14700
|
+
__decorate$7([
|
|
14701
|
+
Property(null)
|
|
14702
|
+
], TextArea.prototype, "maxLength", void 0);
|
|
14703
|
+
__decorate$7([
|
|
14704
|
+
Property(null)
|
|
14705
|
+
], TextArea.prototype, "columnsCount", void 0);
|
|
14706
|
+
__decorate$7([
|
|
14707
|
+
Property(null)
|
|
14708
|
+
], TextArea.prototype, "rowsCount", void 0);
|
|
14709
|
+
__decorate$7([
|
|
14710
|
+
Event()
|
|
14711
|
+
], TextArea.prototype, "created", void 0);
|
|
14712
|
+
__decorate$7([
|
|
14713
|
+
Event()
|
|
14714
|
+
], TextArea.prototype, "destroyed", void 0);
|
|
14715
|
+
__decorate$7([
|
|
14716
|
+
Event()
|
|
14717
|
+
], TextArea.prototype, "change", void 0);
|
|
14718
|
+
__decorate$7([
|
|
14719
|
+
Event()
|
|
14720
|
+
], TextArea.prototype, "blur", void 0);
|
|
14721
|
+
__decorate$7([
|
|
14722
|
+
Event()
|
|
14723
|
+
], TextArea.prototype, "focus", void 0);
|
|
14724
|
+
__decorate$7([
|
|
14725
|
+
Event()
|
|
14726
|
+
], TextArea.prototype, "input", void 0);
|
|
14727
|
+
TextArea = __decorate$7([
|
|
14728
|
+
NotifyPropertyChanges
|
|
14729
|
+
], TextArea);
|
|
14730
|
+
|
|
14731
|
+
/**
|
|
14732
|
+
* Uploader modules
|
|
14733
|
+
*/
|
|
14734
|
+
|
|
14735
|
+
class SignatureBase extends Component {
|
|
14736
|
+
constructor() {
|
|
14737
|
+
super(...arguments);
|
|
14738
|
+
/* minDistance(distance between the two point) was calaculated for smoothness.*/
|
|
14739
|
+
this.minDistance = 5;
|
|
14740
|
+
this.previous = 0;
|
|
14741
|
+
/* interval handles for the smoothness in the mouse move event.*/
|
|
14742
|
+
this.interval = 30;
|
|
14743
|
+
this.timeout = null;
|
|
14744
|
+
this.isSignatureEmpty = true;
|
|
14745
|
+
this.backgroundLoaded = null;
|
|
14746
|
+
this.isBlazor = false;
|
|
14747
|
+
this.isResponsive = false;
|
|
14748
|
+
this.signPointsColl = [];
|
|
14749
|
+
this.signRatioPointsColl = [];
|
|
14750
|
+
this.canRedraw = true;
|
|
14751
|
+
}
|
|
14752
|
+
/**
|
|
14753
|
+
* To Initialize the component rendering
|
|
14754
|
+
*
|
|
14755
|
+
* @private
|
|
14756
|
+
* @param {HTMLCanvasElement} element - Specifies the canvas element.
|
|
14757
|
+
* @param {BlazorDotnetObject} dotnetRef - Specifies for blazor client to server communication.
|
|
14758
|
+
* @returns {void}
|
|
14759
|
+
*/
|
|
14760
|
+
initialize(element, dotnetRef) {
|
|
14761
|
+
this.clearArray = [];
|
|
14762
|
+
this.element = element;
|
|
14763
|
+
this.canvasContext = this.element.getContext('2d');
|
|
14764
|
+
this.canvasContext.canvas.tabIndex = -1;
|
|
14765
|
+
if (dotnetRef) {
|
|
14766
|
+
this.dotnetRef = dotnetRef;
|
|
14767
|
+
this.isBlazor = true;
|
|
14768
|
+
if (this.signatureValue) {
|
|
14769
|
+
this.loadPersistedSignature();
|
|
14770
|
+
}
|
|
14771
|
+
}
|
|
14772
|
+
this.setHTMLProperties();
|
|
14773
|
+
if (isNullOrUndefined(this.signatureValue)) {
|
|
14774
|
+
this.updateSnapCollection(true);
|
|
14775
|
+
}
|
|
14776
|
+
this.wireEvents();
|
|
14777
|
+
if (!this.isBlazor) {
|
|
14778
|
+
this.trigger('created', null);
|
|
14779
|
+
}
|
|
14780
|
+
}
|
|
14781
|
+
wireEvents() {
|
|
14782
|
+
if (isNullOrUndefined(this.pointColl) && !this.isReadOnly && !this.disabled) {
|
|
14783
|
+
EventHandler.add(this.canvasContext.canvas, 'mousedown touchstart', this.mouseDownHandler, this);
|
|
14784
|
+
EventHandler.add(this.canvasContext.canvas, 'keydown', this.keyboardHandler, this);
|
|
14785
|
+
window.addEventListener('resize', this.resizeHandler.bind(this));
|
|
14786
|
+
}
|
|
14787
|
+
else if (this.pointColl) {
|
|
14788
|
+
EventHandler.add(this.canvasContext.canvas, 'mousemove touchmove', this.mouseMoveHandler, this);
|
|
14789
|
+
EventHandler.add(this.canvasContext.canvas, 'mouseup touchend', this.mouseUpHandler, this);
|
|
14790
|
+
EventHandler.add(document, 'mouseup', this.mouseUpHandler, this);
|
|
14791
|
+
}
|
|
14792
|
+
}
|
|
14793
|
+
unwireEvents(type) {
|
|
14794
|
+
if (type === 'mouseup' || type === 'touchend') {
|
|
14795
|
+
EventHandler.remove(this.canvasContext.canvas, 'mousemove touchmove', this.mouseMoveHandler);
|
|
14796
|
+
EventHandler.remove(this.canvasContext.canvas, 'mouseup touchend', this.mouseUpHandler);
|
|
14797
|
+
EventHandler.remove(document, 'mouseup', this.mouseUpHandler);
|
|
14798
|
+
}
|
|
14799
|
+
else {
|
|
14800
|
+
EventHandler.remove(this.canvasContext.canvas, 'mousedown touchstart', this.mouseDownHandler);
|
|
14801
|
+
EventHandler.remove(this.canvasContext.canvas, 'keydown', this.keyboardHandler);
|
|
14802
|
+
window.removeEventListener('resize', this.resizeHandler);
|
|
14803
|
+
}
|
|
14804
|
+
}
|
|
14805
|
+
setHTMLProperties() {
|
|
14806
|
+
if (this.element.height === 150 && this.element.width === 300 && this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
|
|
14807
|
+
this.element.height = this.element.offsetHeight;
|
|
14808
|
+
this.element.width = this.element.offsetWidth;
|
|
14809
|
+
this.isResponsive = true;
|
|
14810
|
+
}
|
|
14811
|
+
else if ((this.element.height !== this.element.offsetHeight - 1 || this.element.width !== this.element.offsetWidth - 1)
|
|
14812
|
+
&& this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
|
|
14813
|
+
this.element.height = this.element.offsetHeight;
|
|
14814
|
+
this.element.width = this.element.offsetWidth;
|
|
14815
|
+
}
|
|
14816
|
+
this.canvasContext.fillStyle = this.strokeColor;
|
|
14817
|
+
this.tempCanvas = this.createElement('canvas', { className: 'e-' + this.getModuleName() + '-temp' });
|
|
14818
|
+
this.tempContext = this.tempCanvas.getContext('2d');
|
|
14819
|
+
this.tempCanvas.width = this.element.width;
|
|
14820
|
+
this.tempCanvas.height = this.element.height;
|
|
14821
|
+
if (this.backgroundImage) {
|
|
14822
|
+
this.canvasContext.canvas.style.backgroundImage = 'url(' + this.backgroundImage + ')';
|
|
14823
|
+
this.canvasContext.canvas.style.backgroundRepeat = 'no-repeat';
|
|
14824
|
+
if (this.saveWithBackground) {
|
|
14825
|
+
this.setBackgroundImage(this.backgroundImage, 'temp');
|
|
14826
|
+
}
|
|
14827
|
+
}
|
|
14828
|
+
else if (this.backgroundColor) {
|
|
14829
|
+
this.canvasContext.canvas.style.backgroundColor = this.backgroundColor;
|
|
14830
|
+
}
|
|
14831
|
+
}
|
|
14832
|
+
// eslint-disable-next-line
|
|
14833
|
+
mouseDownHandler(e) {
|
|
14834
|
+
if (e.buttons === 1 || e.buttons === 2 || e.type === 'touchstart') {
|
|
14835
|
+
if (e.type === 'touchstart') {
|
|
14836
|
+
e.preventDefault();
|
|
14837
|
+
e.stopPropagation();
|
|
14838
|
+
}
|
|
14839
|
+
this.beginStroke(e);
|
|
14019
14840
|
this.wireEvents();
|
|
14020
14841
|
}
|
|
14021
14842
|
}
|
|
@@ -14086,7 +14907,7 @@ class SignatureBase extends Component {
|
|
|
14086
14907
|
resizeHandler() {
|
|
14087
14908
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
14088
14909
|
const proxy = this;
|
|
14089
|
-
if (this.isResponsive) {
|
|
14910
|
+
if (this.isResponsive && this.canRedraw) {
|
|
14090
14911
|
this.canvasContext.canvas.width = this.element.offsetWidth;
|
|
14091
14912
|
this.canvasContext.canvas.height = this.element.offsetHeight;
|
|
14092
14913
|
this.canvasContext.scale(1, 1);
|
|
@@ -14466,7 +15287,7 @@ class SignatureBase extends Component {
|
|
|
14466
15287
|
this.internalRefresh();
|
|
14467
15288
|
this.signRatioPointsColl = [];
|
|
14468
15289
|
this.updateSnapCollection(true);
|
|
14469
|
-
this.isSignatureEmpty = true;
|
|
15290
|
+
this.isSignatureEmpty = this.canRedraw = true;
|
|
14470
15291
|
if (!this.isBlazor) {
|
|
14471
15292
|
this.trigger('change', args);
|
|
14472
15293
|
}
|
|
@@ -14630,7 +15451,7 @@ class SignatureBase extends Component {
|
|
|
14630
15451
|
proxy.updateSnapCollection();
|
|
14631
15452
|
});
|
|
14632
15453
|
};
|
|
14633
|
-
this.isSignatureEmpty = false;
|
|
15454
|
+
this.isSignatureEmpty = this.canRedraw = false;
|
|
14634
15455
|
}
|
|
14635
15456
|
saveBackground(savebg) {
|
|
14636
15457
|
let imageSrc;
|
|
@@ -14879,7 +15700,7 @@ class SignatureBase extends Component {
|
|
|
14879
15700
|
}
|
|
14880
15701
|
}
|
|
14881
15702
|
|
|
14882
|
-
var __decorate$
|
|
15703
|
+
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
14883
15704
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14884
15705
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14885
15706
|
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 +15745,8 @@ let Signature = class Signature extends SignatureBase {
|
|
|
14924
15745
|
this.initialize();
|
|
14925
15746
|
}
|
|
14926
15747
|
initialize() {
|
|
15748
|
+
this.element.setAttribute('role', 'img');
|
|
15749
|
+
this.element.setAttribute('aria-label', 'signature');
|
|
14927
15750
|
addClass([this.element], 'e-' + this.getModuleName());
|
|
14928
15751
|
super.initialize(this.element);
|
|
14929
15752
|
if (this.enablePersistence) {
|
|
@@ -14982,52 +15805,52 @@ let Signature = class Signature extends SignatureBase {
|
|
|
14982
15805
|
}
|
|
14983
15806
|
}
|
|
14984
15807
|
};
|
|
14985
|
-
__decorate$
|
|
15808
|
+
__decorate$8([
|
|
14986
15809
|
Property('')
|
|
14987
15810
|
], Signature.prototype, "backgroundColor", void 0);
|
|
14988
|
-
__decorate$
|
|
15811
|
+
__decorate$8([
|
|
14989
15812
|
Property('')
|
|
14990
15813
|
], Signature.prototype, "backgroundImage", void 0);
|
|
14991
|
-
__decorate$
|
|
15814
|
+
__decorate$8([
|
|
14992
15815
|
Property(false)
|
|
14993
15816
|
], Signature.prototype, "disabled", void 0);
|
|
14994
|
-
__decorate$
|
|
15817
|
+
__decorate$8([
|
|
14995
15818
|
Property(false)
|
|
14996
15819
|
], Signature.prototype, "isReadOnly", void 0);
|
|
14997
|
-
__decorate$
|
|
15820
|
+
__decorate$8([
|
|
14998
15821
|
Property(true)
|
|
14999
15822
|
], Signature.prototype, "saveWithBackground", void 0);
|
|
15000
|
-
__decorate$
|
|
15823
|
+
__decorate$8([
|
|
15001
15824
|
Property('#000000')
|
|
15002
15825
|
], Signature.prototype, "strokeColor", void 0);
|
|
15003
|
-
__decorate$
|
|
15826
|
+
__decorate$8([
|
|
15004
15827
|
Property(0.5)
|
|
15005
15828
|
], Signature.prototype, "minStrokeWidth", void 0);
|
|
15006
|
-
__decorate$
|
|
15829
|
+
__decorate$8([
|
|
15007
15830
|
Property(2)
|
|
15008
15831
|
], Signature.prototype, "maxStrokeWidth", void 0);
|
|
15009
|
-
__decorate$
|
|
15832
|
+
__decorate$8([
|
|
15010
15833
|
Property(0.7)
|
|
15011
15834
|
], Signature.prototype, "velocity", void 0);
|
|
15012
|
-
__decorate$
|
|
15835
|
+
__decorate$8([
|
|
15013
15836
|
Property('en-US')
|
|
15014
15837
|
], Signature.prototype, "locale", void 0);
|
|
15015
|
-
__decorate$
|
|
15838
|
+
__decorate$8([
|
|
15016
15839
|
Property(false)
|
|
15017
15840
|
], Signature.prototype, "enableRtl", void 0);
|
|
15018
|
-
__decorate$
|
|
15841
|
+
__decorate$8([
|
|
15019
15842
|
Property(false)
|
|
15020
15843
|
], Signature.prototype, "enablePersistence", void 0);
|
|
15021
|
-
__decorate$
|
|
15844
|
+
__decorate$8([
|
|
15022
15845
|
Event()
|
|
15023
15846
|
], Signature.prototype, "beforeSave", void 0);
|
|
15024
|
-
__decorate$
|
|
15847
|
+
__decorate$8([
|
|
15025
15848
|
Event()
|
|
15026
15849
|
], Signature.prototype, "change", void 0);
|
|
15027
|
-
__decorate$
|
|
15850
|
+
__decorate$8([
|
|
15028
15851
|
Event()
|
|
15029
15852
|
], Signature.prototype, "created", void 0);
|
|
15030
|
-
Signature = __decorate$
|
|
15853
|
+
Signature = __decorate$8([
|
|
15031
15854
|
NotifyPropertyChanges
|
|
15032
15855
|
], Signature);
|
|
15033
15856
|
|
|
@@ -15035,7 +15858,7 @@ Signature = __decorate$7([
|
|
|
15035
15858
|
* Signature modules
|
|
15036
15859
|
*/
|
|
15037
15860
|
|
|
15038
|
-
var __decorate$
|
|
15861
|
+
var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
15039
15862
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15040
15863
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15041
15864
|
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 +16421,7 @@ let Rating = class Rating extends Component {
|
|
|
15598
16421
|
});
|
|
15599
16422
|
}
|
|
15600
16423
|
keyActionHandler(e) {
|
|
16424
|
+
e.preventDefault();
|
|
15601
16425
|
if (this.disabled || this.readOnly) {
|
|
15602
16426
|
return;
|
|
15603
16427
|
}
|
|
@@ -15784,73 +16608,73 @@ let Rating = class Rating extends Component {
|
|
|
15784
16608
|
}
|
|
15785
16609
|
}
|
|
15786
16610
|
};
|
|
15787
|
-
__decorate$
|
|
16611
|
+
__decorate$9([
|
|
15788
16612
|
Property(false)
|
|
15789
16613
|
], Rating.prototype, "allowReset", void 0);
|
|
15790
|
-
__decorate$
|
|
16614
|
+
__decorate$9([
|
|
15791
16615
|
Property('')
|
|
15792
16616
|
], Rating.prototype, "cssClass", void 0);
|
|
15793
|
-
__decorate$
|
|
16617
|
+
__decorate$9([
|
|
15794
16618
|
Property(false)
|
|
15795
16619
|
], Rating.prototype, "disabled", void 0);
|
|
15796
|
-
__decorate$
|
|
16620
|
+
__decorate$9([
|
|
15797
16621
|
Property('')
|
|
15798
16622
|
], Rating.prototype, "emptyTemplate", void 0);
|
|
15799
|
-
__decorate$
|
|
16623
|
+
__decorate$9([
|
|
15800
16624
|
Property(true)
|
|
15801
16625
|
], Rating.prototype, "enableAnimation", void 0);
|
|
15802
|
-
__decorate$
|
|
16626
|
+
__decorate$9([
|
|
15803
16627
|
Property(false)
|
|
15804
16628
|
], Rating.prototype, "enableSingleSelection", void 0);
|
|
15805
|
-
__decorate$
|
|
16629
|
+
__decorate$9([
|
|
15806
16630
|
Property('')
|
|
15807
16631
|
], Rating.prototype, "fullTemplate", void 0);
|
|
15808
|
-
__decorate$
|
|
16632
|
+
__decorate$9([
|
|
15809
16633
|
Property(5)
|
|
15810
16634
|
], Rating.prototype, "itemsCount", void 0);
|
|
15811
|
-
__decorate$
|
|
16635
|
+
__decorate$9([
|
|
15812
16636
|
Property(LabelPosition.Right)
|
|
15813
16637
|
], Rating.prototype, "labelPosition", void 0);
|
|
15814
|
-
__decorate$
|
|
16638
|
+
__decorate$9([
|
|
15815
16639
|
Property('')
|
|
15816
16640
|
], Rating.prototype, "labelTemplate", void 0);
|
|
15817
|
-
__decorate$
|
|
16641
|
+
__decorate$9([
|
|
15818
16642
|
Property(0.0)
|
|
15819
16643
|
], Rating.prototype, "min", void 0);
|
|
15820
|
-
__decorate$
|
|
16644
|
+
__decorate$9([
|
|
15821
16645
|
Property(PrecisionType.Full)
|
|
15822
16646
|
], Rating.prototype, "precision", void 0);
|
|
15823
|
-
__decorate$
|
|
16647
|
+
__decorate$9([
|
|
15824
16648
|
Property(false)
|
|
15825
16649
|
], Rating.prototype, "readOnly", void 0);
|
|
15826
|
-
__decorate$
|
|
16650
|
+
__decorate$9([
|
|
15827
16651
|
Property(false)
|
|
15828
16652
|
], Rating.prototype, "showLabel", void 0);
|
|
15829
|
-
__decorate$
|
|
16653
|
+
__decorate$9([
|
|
15830
16654
|
Property(true)
|
|
15831
16655
|
], Rating.prototype, "showTooltip", void 0);
|
|
15832
|
-
__decorate$
|
|
16656
|
+
__decorate$9([
|
|
15833
16657
|
Property('')
|
|
15834
16658
|
], Rating.prototype, "tooltipTemplate", void 0);
|
|
15835
|
-
__decorate$
|
|
16659
|
+
__decorate$9([
|
|
15836
16660
|
Property(0.0)
|
|
15837
16661
|
], Rating.prototype, "value", void 0);
|
|
15838
|
-
__decorate$
|
|
16662
|
+
__decorate$9([
|
|
15839
16663
|
Property(true)
|
|
15840
16664
|
], Rating.prototype, "visible", void 0);
|
|
15841
|
-
__decorate$
|
|
16665
|
+
__decorate$9([
|
|
15842
16666
|
Event()
|
|
15843
16667
|
], Rating.prototype, "beforeItemRender", void 0);
|
|
15844
|
-
__decorate$
|
|
16668
|
+
__decorate$9([
|
|
15845
16669
|
Event()
|
|
15846
16670
|
], Rating.prototype, "created", void 0);
|
|
15847
|
-
__decorate$
|
|
16671
|
+
__decorate$9([
|
|
15848
16672
|
Event()
|
|
15849
16673
|
], Rating.prototype, "onItemHover", void 0);
|
|
15850
|
-
__decorate$
|
|
16674
|
+
__decorate$9([
|
|
15851
16675
|
Event()
|
|
15852
16676
|
], Rating.prototype, "valueChanged", void 0);
|
|
15853
|
-
Rating = __decorate$
|
|
16677
|
+
Rating = __decorate$9([
|
|
15854
16678
|
NotifyPropertyChanges
|
|
15855
16679
|
], Rating);
|
|
15856
16680
|
|
|
@@ -15866,5 +16690,5 @@ Rating = __decorate$8([
|
|
|
15866
16690
|
* NumericTextBox all modules
|
|
15867
16691
|
*/
|
|
15868
16692
|
|
|
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 };
|
|
16693
|
+
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
16694
|
//# sourceMappingURL=ej2-inputs.es2015.js.map
|