@syncfusion/ej2-inputs 20.3.57 → 20.4.40
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/.eslintrc.json +16 -1
- package/CHANGELOG.md +8 -15
- 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 +884 -63
- package/dist/es6/ej2-inputs.es2015.js.map +1 -1
- package/dist/es6/ej2-inputs.es5.js +908 -63
- 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 +11 -10
- package/rating.d.ts +4 -0
- package/rating.js +4 -0
- package/src/color-picker/color-picker-model.d.ts +4 -4
- package/src/color-picker/color-picker.d.ts +4 -4
- package/src/color-picker/color-picker.js +4 -2
- package/src/common/signature-base.d.ts +0 -1
- package/src/common/signature-base.js +3 -8
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/input/input.d.ts +1 -0
- package/src/input/input.js +5 -1
- package/src/maskedtextbox/base/mask-base.d.ts +1 -0
- package/src/maskedtextbox/base/mask-base.js +20 -13
- package/src/maskedtextbox/maskedtextbox/maskedtextbox-model.d.ts +1 -0
- package/src/maskedtextbox/maskedtextbox/maskedtextbox.d.ts +1 -0
- package/src/maskedtextbox/maskedtextbox/maskedtextbox.js +16 -7
- package/src/numerictextbox/numerictextbox.js +21 -9
- package/src/rating/index.d.ts +5 -0
- package/src/rating/index.js +4 -0
- package/src/rating/rating-model.d.ts +185 -0
- package/src/rating/rating.d.ts +344 -0
- package/src/rating/rating.js +783 -0
- package/src/slider/slider.js +4 -2
- package/src/textbox/textbox.js +10 -9
- package/src/uploader/uploader-model.d.ts +10 -1
- package/src/uploader/uploader.d.ts +8 -0
- package/src/uploader/uploader.js +41 -12
- package/styles/bootstrap-dark.css +265 -0
- package/styles/bootstrap-dark.scss +1 -0
- package/styles/bootstrap.css +265 -0
- package/styles/bootstrap.scss +1 -0
- package/styles/bootstrap4.css +268 -2
- package/styles/bootstrap4.scss +1 -0
- package/styles/bootstrap5-dark.css +266 -0
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5.css +266 -0
- package/styles/bootstrap5.scss +1 -0
- package/styles/color-picker/_theme.scss +2 -2
- package/styles/color-picker/bootstrap4.css +2 -2
- package/styles/fabric-dark.css +265 -0
- package/styles/fabric-dark.scss +1 -0
- package/styles/fabric.css +265 -0
- package/styles/fabric.scss +1 -0
- package/styles/fluent-dark.css +265 -0
- package/styles/fluent-dark.scss +1 -0
- package/styles/fluent.css +265 -0
- package/styles/fluent.scss +1 -0
- package/styles/highcontrast-light.css +265 -0
- package/styles/highcontrast-light.scss +1 -0
- package/styles/highcontrast.css +265 -0
- package/styles/highcontrast.scss +1 -0
- package/styles/material-dark.css +265 -0
- package/styles/material-dark.scss +1 -0
- package/styles/material.css +265 -0
- package/styles/material.scss +1 -0
- package/styles/rating/_all.scss +2 -0
- package/styles/rating/_bootstrap-dark-definition.scss +45 -0
- package/styles/rating/_bootstrap-definition.scss +45 -0
- package/styles/rating/_bootstrap4-definition.scss +45 -0
- package/styles/rating/_bootstrap5-dark-definition.scss +1 -0
- package/styles/rating/_bootstrap5-definition.scss +45 -0
- package/styles/rating/_fabric-dark-definition.scss +45 -0
- package/styles/rating/_fabric-definition.scss +45 -0
- package/styles/rating/_fluent-dark-definition.scss +1 -0
- package/styles/rating/_fluent-definition.scss +45 -0
- package/styles/rating/_fusionnew-definition.scss +45 -0
- package/styles/rating/_highcontrast-definition.scss +45 -0
- package/styles/rating/_highcontrast-light-definition.scss +45 -0
- package/styles/rating/_layout.scss +204 -0
- package/styles/rating/_material-dark-definition.scss +45 -0
- package/styles/rating/_material-definition.scss +45 -0
- package/styles/rating/_material3-definition.scss +45 -0
- package/styles/rating/_tailwind-dark-definition.scss +1 -0
- package/styles/rating/_tailwind-definition.scss +45 -0
- package/styles/rating/_theme.scss +158 -0
- package/styles/rating/bootstrap-dark.css +264 -0
- package/styles/rating/bootstrap-dark.scss +4 -0
- package/styles/rating/bootstrap.css +264 -0
- package/styles/rating/bootstrap.scss +4 -0
- package/styles/rating/bootstrap4.css +265 -0
- package/styles/rating/bootstrap4.scss +4 -0
- package/styles/rating/bootstrap5-dark.css +265 -0
- package/styles/rating/bootstrap5-dark.scss +4 -0
- package/styles/rating/bootstrap5.css +265 -0
- package/styles/rating/bootstrap5.scss +4 -0
- package/styles/rating/fabric-dark.css +264 -0
- package/styles/rating/fabric-dark.scss +4 -0
- package/styles/rating/fabric.css +264 -0
- package/styles/rating/fabric.scss +4 -0
- package/styles/rating/fluent-dark.css +264 -0
- package/styles/rating/fluent-dark.scss +4 -0
- package/styles/rating/fluent.css +264 -0
- package/styles/rating/fluent.scss +4 -0
- package/styles/rating/highcontrast-light.css +264 -0
- package/styles/rating/highcontrast-light.scss +4 -0
- package/styles/rating/highcontrast.css +264 -0
- package/styles/rating/highcontrast.scss +4 -0
- package/styles/rating/material-dark.css +265 -0
- package/styles/rating/material-dark.scss +4 -0
- package/styles/rating/material.css +265 -0
- package/styles/rating/material.scss +4 -0
- package/styles/rating/tailwind-dark.css +270 -0
- package/styles/rating/tailwind-dark.scss +4 -0
- package/styles/rating/tailwind.css +270 -0
- package/styles/rating/tailwind.scss +4 -0
- package/styles/tailwind-dark.css +271 -0
- package/styles/tailwind-dark.scss +1 -0
- package/styles/tailwind.css +271 -0
- package/styles/tailwind.scss +1 -0
|
@@ -324,6 +324,10 @@ var Input;
|
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
326
|
Input.wireClearBtnEvents = wireClearBtnEvents;
|
|
327
|
+
function destroy() {
|
|
328
|
+
|
|
329
|
+
}
|
|
330
|
+
Input.destroy = destroy;
|
|
327
331
|
function validateLabel(element, floatLabelType) {
|
|
328
332
|
const parent = getParentNode(element);
|
|
329
333
|
if (parent.classList.contains(CLASSNAMES.FLOATINPUT) && floatLabelType === 'Auto') {
|
|
@@ -379,7 +383,7 @@ var Input;
|
|
|
379
383
|
if (!isNullOrUndefined(parentElement)) {
|
|
380
384
|
const button = parentElement.getElementsByClassName(CLASSNAMES.CLEARICON)[0];
|
|
381
385
|
if (!isNullOrUndefined(button)) {
|
|
382
|
-
if (element.value && parentElement.classList.contains('e-input-focus')) {
|
|
386
|
+
if (element.value && !isNullOrUndefined(parentElement) && parentElement.classList.contains('e-input-focus')) {
|
|
383
387
|
removeClass([button], CLASSNAMES.CLEARICONHIDE);
|
|
384
388
|
}
|
|
385
389
|
else {
|
|
@@ -896,6 +900,7 @@ const CONTROL = 'e-control';
|
|
|
896
900
|
const NUMERIC_FOCUS = 'e-input-focus';
|
|
897
901
|
const HIDDENELEMENT = 'e-numeric-hidden';
|
|
898
902
|
const wrapperAttributes = ['title', 'style', 'class'];
|
|
903
|
+
let selectionTimeOut = 0;
|
|
899
904
|
/**
|
|
900
905
|
* Represents the NumericTextBox component that allows the user to enter only numeric values.
|
|
901
906
|
* ```html
|
|
@@ -956,7 +961,7 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
956
961
|
this.element = input;
|
|
957
962
|
setValue('ej2_instances', ejInstance, this.element);
|
|
958
963
|
}
|
|
959
|
-
attributes(this.element, { 'role': 'spinbutton', 'tabindex': '0', 'autocomplete': 'off'
|
|
964
|
+
attributes(this.element, { 'role': 'spinbutton', 'tabindex': '0', 'autocomplete': 'off' });
|
|
960
965
|
const localeText = {
|
|
961
966
|
incrementTitle: 'Increment value', decrementTitle: 'Decrement value', placeholder: this.placeholder
|
|
962
967
|
};
|
|
@@ -1157,7 +1162,7 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
1157
1162
|
}
|
|
1158
1163
|
for (const key of Object.keys(attr)) {
|
|
1159
1164
|
if (key.indexOf('data') === 0) {
|
|
1160
|
-
this.hiddenInput.setAttribute(key, attr[key]);
|
|
1165
|
+
this.hiddenInput.setAttribute(key, attr[`${key}`]);
|
|
1161
1166
|
}
|
|
1162
1167
|
}
|
|
1163
1168
|
}
|
|
@@ -1165,7 +1170,7 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
1165
1170
|
if (!isNullOrUndefined(this.htmlAttributes)) {
|
|
1166
1171
|
for (const pro of Object.keys(this.htmlAttributes)) {
|
|
1167
1172
|
if (wrapperAttributes.indexOf(pro) < 0) {
|
|
1168
|
-
this.element.setAttribute(pro, this.htmlAttributes[pro]);
|
|
1173
|
+
this.element.setAttribute(pro, this.htmlAttributes[`${pro}`]);
|
|
1169
1174
|
}
|
|
1170
1175
|
}
|
|
1171
1176
|
}
|
|
@@ -1185,19 +1190,19 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
1185
1190
|
for (const pro of Object.keys(this.htmlAttributes)) {
|
|
1186
1191
|
if (wrapperAttributes.indexOf(pro) > -1) {
|
|
1187
1192
|
if (pro === 'class') {
|
|
1188
|
-
const updatedClassValue = this.getNumericValidClassList(this.htmlAttributes[pro]);
|
|
1193
|
+
const updatedClassValue = this.getNumericValidClassList(this.htmlAttributes[`${pro}`]);
|
|
1189
1194
|
if (updatedClassValue !== '') {
|
|
1190
1195
|
addClass([this.container], updatedClassValue.split(' '));
|
|
1191
1196
|
}
|
|
1192
1197
|
}
|
|
1193
1198
|
else if (pro === 'style') {
|
|
1194
1199
|
let numericStyle = this.container.getAttribute(pro);
|
|
1195
|
-
numericStyle = !isNullOrUndefined(numericStyle) ? (numericStyle + this.htmlAttributes[pro]) :
|
|
1196
|
-
this.htmlAttributes[pro];
|
|
1200
|
+
numericStyle = !isNullOrUndefined(numericStyle) ? (numericStyle + this.htmlAttributes[`${pro}`]) :
|
|
1201
|
+
this.htmlAttributes[`${pro}`];
|
|
1197
1202
|
this.container.setAttribute(pro, numericStyle);
|
|
1198
1203
|
}
|
|
1199
1204
|
else {
|
|
1200
|
-
this.container.setAttribute(pro, this.htmlAttributes[pro]);
|
|
1205
|
+
this.container.setAttribute(pro, this.htmlAttributes[`${pro}`]);
|
|
1201
1206
|
}
|
|
1202
1207
|
}
|
|
1203
1208
|
}
|
|
@@ -1742,6 +1747,7 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
1742
1747
|
if (this.decimals && this.validateDecimalOnType) {
|
|
1743
1748
|
fractionRule = '{0,' + this.decimals + '}';
|
|
1744
1749
|
}
|
|
1750
|
+
// eslint-disable-next-line detect-non-literal-regexp
|
|
1745
1751
|
return new RegExp('^(-)?(((\\d+(' + decimalSeparator + '\\d' + fractionRule +
|
|
1746
1752
|
')?)|(' + decimalSeparator + '\\d' + fractionRule + ')))?$');
|
|
1747
1753
|
}
|
|
@@ -1765,6 +1771,7 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
1765
1771
|
this.cancelEvent(event);
|
|
1766
1772
|
}
|
|
1767
1773
|
focusHandler(event) {
|
|
1774
|
+
clearTimeout(selectionTimeOut);
|
|
1768
1775
|
this.focusEventArgs = { event: event, value: this.value, container: this.container };
|
|
1769
1776
|
this.trigger('focus', this.focusEventArgs);
|
|
1770
1777
|
if (!this.enabled || this.readonly) {
|
|
@@ -1782,7 +1789,7 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
1782
1789
|
}
|
|
1783
1790
|
else {
|
|
1784
1791
|
const delay = (Browser.isDevice && Browser.isIos) ? 600 : 0;
|
|
1785
|
-
setTimeout(() => {
|
|
1792
|
+
selectionTimeOut = setTimeout(() => {
|
|
1786
1793
|
this.element.setSelectionRange(0, formatValue.length);
|
|
1787
1794
|
}, delay);
|
|
1788
1795
|
}
|
|
@@ -1954,13 +1961,22 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
1954
1961
|
}
|
|
1955
1962
|
const attrArray = ['aria-labelledby', 'role', 'autocomplete', 'aria-readonly',
|
|
1956
1963
|
'aria-disabled', 'autocapitalize', 'spellcheck', 'aria-autocomplete', 'tabindex',
|
|
1957
|
-
'aria-valuemin', 'aria-valuemax', 'aria-
|
|
1964
|
+
'aria-valuemin', 'aria-valuemax', 'aria-valuenow', 'aria-invalid'];
|
|
1958
1965
|
for (let i = 0; i < attrArray.length; i++) {
|
|
1959
1966
|
this.element.removeAttribute(attrArray[i]);
|
|
1960
1967
|
}
|
|
1961
1968
|
this.element.classList.remove('e-input');
|
|
1962
1969
|
this.container.insertAdjacentElement('afterend', this.element);
|
|
1963
1970
|
detach(this.container);
|
|
1971
|
+
this.spinUp = null;
|
|
1972
|
+
this.spinDown = null;
|
|
1973
|
+
this.container = null;
|
|
1974
|
+
this.hiddenInput = null;
|
|
1975
|
+
this.changeEventArgs = null;
|
|
1976
|
+
this.blurEventArgs = null;
|
|
1977
|
+
this.focusEventArgs = null;
|
|
1978
|
+
this.inputWrapper = null;
|
|
1979
|
+
Input.destroy();
|
|
1964
1980
|
super.destroy();
|
|
1965
1981
|
}
|
|
1966
1982
|
/* eslint-disable valid-jsdoc, jsdoc/require-returns */
|
|
@@ -2302,6 +2318,7 @@ function createMask() {
|
|
|
2302
2318
|
if (!isNullOrUndefined(this.customCharacters)) {
|
|
2303
2319
|
for (let i = 0; i < this.promptMask.length; i++) {
|
|
2304
2320
|
if (!isNullOrUndefined(this.customCharacters[this.promptMask[i]])) {
|
|
2321
|
+
// eslint-disable-next-line detect-non-literal-regexp
|
|
2305
2322
|
this.promptMask = this.promptMask.replace(new RegExp(this.promptMask[i], 'g'), this.promptChar);
|
|
2306
2323
|
}
|
|
2307
2324
|
}
|
|
@@ -2496,7 +2513,7 @@ function maskInputFocusHandler(event) {
|
|
|
2496
2513
|
event: event,
|
|
2497
2514
|
value: this.value,
|
|
2498
2515
|
maskedValue: inputElement.value,
|
|
2499
|
-
container: this.inputObj.container,
|
|
2516
|
+
container: !isNullOrUndefined(this.inputObj) ? this.inputObj.container : this.inputObj,
|
|
2500
2517
|
selectionEnd: inputElement.selectionEnd
|
|
2501
2518
|
};
|
|
2502
2519
|
if (!this.isClicked) {
|
|
@@ -2563,21 +2580,21 @@ function maskInputFocusHandler(event) {
|
|
|
2563
2580
|
event: event,
|
|
2564
2581
|
value: this.value,
|
|
2565
2582
|
maskedValue: inputElement.value,
|
|
2566
|
-
container: this.inputObj.container,
|
|
2583
|
+
container: !isNullOrUndefined(this.inputObj) ? this.inputObj.container : this.inputObj,
|
|
2567
2584
|
selectionEnd: inputElement.selectionEnd
|
|
2568
2585
|
};
|
|
2569
2586
|
triggerFocus.call(this, eventArgs, inputElement);
|
|
2570
|
-
});
|
|
2587
|
+
}, 110);
|
|
2571
2588
|
break;
|
|
2572
2589
|
}
|
|
2573
2590
|
}
|
|
2574
|
-
if (isNullOrUndefined(inputElement.value.match(this.promptChar))) {
|
|
2591
|
+
if (isNullOrUndefined(inputElement.value.match(escapeRegExp(this.promptChar)))) {
|
|
2575
2592
|
eventArgs = {
|
|
2576
2593
|
selectionStart: inputElement.selectionStart,
|
|
2577
2594
|
event: event,
|
|
2578
2595
|
value: this.value,
|
|
2579
2596
|
maskedValue: inputElement.value,
|
|
2580
|
-
container: this.inputObj.container,
|
|
2597
|
+
container: !isNullOrUndefined(this.inputObj) ? this.inputObj.container : this.inputObj,
|
|
2581
2598
|
selectionEnd: inputElement.selectionEnd
|
|
2582
2599
|
};
|
|
2583
2600
|
triggerFocus.call(this, eventArgs, inputElement);
|
|
@@ -2592,12 +2609,15 @@ function triggerFocus(eventArgs, inputElement) {
|
|
|
2592
2609
|
inputElement.selectionEnd = eventArgs.selectionEnd;
|
|
2593
2610
|
});
|
|
2594
2611
|
}
|
|
2612
|
+
function escapeRegExp(text) {
|
|
2613
|
+
return !isNullOrUndefined(text) ? text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') : text;
|
|
2614
|
+
}
|
|
2595
2615
|
function maskInputBlurHandler(event) {
|
|
2596
2616
|
this.blurEventArgs = {
|
|
2597
2617
|
event: event,
|
|
2598
2618
|
value: this.value,
|
|
2599
2619
|
maskedValue: this.element.value,
|
|
2600
|
-
container: this.inputObj.container
|
|
2620
|
+
container: !isNullOrUndefined(this.inputObj) ? this.inputObj.container : this.inputObj,
|
|
2601
2621
|
};
|
|
2602
2622
|
this.trigger('blur', this.blurEventArgs);
|
|
2603
2623
|
if (this.mask) {
|
|
@@ -2830,8 +2850,8 @@ function removeMaskInputValues(event) {
|
|
|
2830
2850
|
++startIndex;
|
|
2831
2851
|
}
|
|
2832
2852
|
let oldValue = this.element.value[sIndex];
|
|
2833
|
-
if ((isNullOrUndefined(this.regExpCollec[curMask]) && (!isNullOrUndefined(this.customCharacters)
|
|
2834
|
-
&& isNullOrUndefined(this.customCharacters[curMask]))
|
|
2853
|
+
if ((isNullOrUndefined(this.regExpCollec[`${curMask}`]) && (!isNullOrUndefined(this.customCharacters)
|
|
2854
|
+
&& isNullOrUndefined(this.customCharacters[`${curMask}`]))
|
|
2835
2855
|
&& ((this.hiddenMask[sIndex] !== this.promptChar && this.customRegExpCollec[sIndex][0] !== '['
|
|
2836
2856
|
&& this.customRegExpCollec[sIndex][this.customRegExpCollec[sIndex].length - 1] !== ']')))
|
|
2837
2857
|
|| (this.promptMask[sIndex] !== this.promptChar && isNullOrUndefined(this.customCharacters))) {
|
|
@@ -3043,8 +3063,8 @@ function validateValue(key, isCtrlKey, event) {
|
|
|
3043
3063
|
if (this.hiddenMask[startIndex] === '\\' && this.hiddenMask[startIndex + 1] === key) {
|
|
3044
3064
|
isEqualVal = true;
|
|
3045
3065
|
}
|
|
3046
|
-
if ((isNullOrUndefined(this.regExpCollec[curMask]) && (isNullOrUndefined(this.customCharacters)
|
|
3047
|
-
|| (!isNullOrUndefined(this.customCharacters) && isNullOrUndefined(this.customCharacters[curMask])))
|
|
3066
|
+
if ((isNullOrUndefined(this.regExpCollec[`${curMask}`]) && (isNullOrUndefined(this.customCharacters)
|
|
3067
|
+
|| (!isNullOrUndefined(this.customCharacters) && isNullOrUndefined(this.customCharacters[`${curMask}`])))
|
|
3048
3068
|
&& ((this.hiddenMask[startIndex] !== this.promptChar && this.customRegExpCollec[startIndex][0] !== '['
|
|
3049
3069
|
&& this.customRegExpCollec[startIndex][this.customRegExpCollec[startIndex].length - 1] !== ']')))
|
|
3050
3070
|
|| ((this.promptMask[startIndex] !== this.promptChar) && isNullOrUndefined(this.customCharacters))
|
|
@@ -3054,22 +3074,25 @@ function validateValue(key, isCtrlKey, event) {
|
|
|
3054
3074
|
curMask = this.hiddenMask[startIndex];
|
|
3055
3075
|
}
|
|
3056
3076
|
}
|
|
3057
|
-
if (!isNullOrUndefined(this.customCharacters) && !isNullOrUndefined(this.customCharacters[curMask])) {
|
|
3058
|
-
const customValStr = this.customCharacters[curMask];
|
|
3077
|
+
if (!isNullOrUndefined(this.customCharacters) && !isNullOrUndefined(this.customCharacters[`${curMask}`])) {
|
|
3078
|
+
const customValStr = this.customCharacters[`${curMask}`];
|
|
3059
3079
|
const customValArr = customValStr.split(',');
|
|
3060
3080
|
for (let i = 0; i < customValArr.length; i++) {
|
|
3081
|
+
// eslint-disable-next-line detect-non-literal-regexp
|
|
3061
3082
|
if (keyValue.match(new RegExp('[' + customValArr[i] + ']'))) {
|
|
3062
3083
|
allowText = true;
|
|
3063
3084
|
break;
|
|
3064
3085
|
}
|
|
3065
3086
|
}
|
|
3087
|
+
// eslint-disable-next-line detect-non-literal-regexp
|
|
3066
3088
|
}
|
|
3067
|
-
else if (!isNullOrUndefined(this.regExpCollec[curMask]) && keyValue.match(new RegExp(this.regExpCollec[curMask]))
|
|
3089
|
+
else if (!isNullOrUndefined(this.regExpCollec[`${curMask}`]) && keyValue.match(new RegExp(this.regExpCollec[`${curMask}`]))
|
|
3068
3090
|
&& this.promptMask[startIndex] === this.promptChar) {
|
|
3069
3091
|
allowText = true;
|
|
3070
3092
|
}
|
|
3071
3093
|
else if (this.promptMask[startIndex] === this.promptChar && this.customRegExpCollec[startIndex][0] === '['
|
|
3072
3094
|
&& this.customRegExpCollec[startIndex][this.customRegExpCollec[startIndex].length - 1] === ']'
|
|
3095
|
+
// eslint-disable-next-line detect-non-literal-regexp
|
|
3073
3096
|
&& keyValue.match(new RegExp(this.customRegExpCollec[startIndex]))) {
|
|
3074
3097
|
allowText = true;
|
|
3075
3098
|
}
|
|
@@ -3514,7 +3537,7 @@ let MaskedTextBox = class MaskedTextBox extends Component {
|
|
|
3514
3537
|
if (!isNullOrUndefined(this.htmlAttributes)) {
|
|
3515
3538
|
for (const key of Object.keys(this.htmlAttributes)) {
|
|
3516
3539
|
if (wrapperAttr.indexOf(key) < 0) {
|
|
3517
|
-
this.element.setAttribute(key, this.htmlAttributes[key]);
|
|
3540
|
+
this.element.setAttribute(key, this.htmlAttributes[`${key}`]);
|
|
3518
3541
|
}
|
|
3519
3542
|
}
|
|
3520
3543
|
}
|
|
@@ -3534,19 +3557,19 @@ let MaskedTextBox = class MaskedTextBox extends Component {
|
|
|
3534
3557
|
for (const key of Object.keys(this.htmlAttributes)) {
|
|
3535
3558
|
if (wrapperAttr.indexOf(key) > -1) {
|
|
3536
3559
|
if (key === 'class') {
|
|
3537
|
-
const updatedClassValues = (this.htmlAttributes[key].replace(/\s+/g, ' ')).trim();
|
|
3560
|
+
const updatedClassValues = (this.htmlAttributes[`${key}`].replace(/\s+/g, ' ')).trim();
|
|
3538
3561
|
if (updatedClassValues !== '') {
|
|
3539
3562
|
addClass([this.inputObj.container], updatedClassValues.split(' '));
|
|
3540
3563
|
}
|
|
3541
3564
|
}
|
|
3542
3565
|
else if (key === 'style') {
|
|
3543
3566
|
let maskStyle = this.inputObj.container.getAttribute(key);
|
|
3544
|
-
maskStyle = !isNullOrUndefined(maskStyle) ? (maskStyle + this.htmlAttributes[key]) :
|
|
3545
|
-
this.htmlAttributes[key];
|
|
3567
|
+
maskStyle = !isNullOrUndefined(maskStyle) ? (maskStyle + this.htmlAttributes[`${key}`]) :
|
|
3568
|
+
this.htmlAttributes[`${key}`];
|
|
3546
3569
|
this.inputObj.container.setAttribute(key, maskStyle);
|
|
3547
3570
|
}
|
|
3548
3571
|
else {
|
|
3549
|
-
this.inputObj.container.setAttribute(key, this.htmlAttributes[key]);
|
|
3572
|
+
this.inputObj.container.setAttribute(key, this.htmlAttributes[`${key}`]);
|
|
3550
3573
|
}
|
|
3551
3574
|
}
|
|
3552
3575
|
}
|
|
@@ -3721,10 +3744,13 @@ let MaskedTextBox = class MaskedTextBox extends Component {
|
|
|
3721
3744
|
else {
|
|
3722
3745
|
this.promptChar = '_';
|
|
3723
3746
|
}
|
|
3747
|
+
// eslint-disable-next-line detect-non-literal-regexp
|
|
3724
3748
|
let value = this.element.value.replace(new RegExp('[' + oldProp.promptChar + ']', 'g'), this.promptChar);
|
|
3725
3749
|
if (this.promptMask === this.element.value) {
|
|
3750
|
+
// eslint-disable-next-line detect-non-literal-regexp
|
|
3726
3751
|
value = this.promptMask.replace(new RegExp('[' + oldProp.promptChar + ']', 'g'), this.promptChar);
|
|
3727
3752
|
}
|
|
3753
|
+
// eslint-disable-next-line detect-non-literal-regexp
|
|
3728
3754
|
this.promptMask = this.promptMask.replace(new RegExp('[' + oldProp.promptChar + ']', 'g'), this.promptChar);
|
|
3729
3755
|
this.undoCollec = this.redoCollec = [];
|
|
3730
3756
|
setElementValue.call(this, value);
|
|
@@ -3786,8 +3812,14 @@ let MaskedTextBox = class MaskedTextBox extends Component {
|
|
|
3786
3812
|
this.element.removeAttribute(attrArray[i]);
|
|
3787
3813
|
}
|
|
3788
3814
|
this.element.classList.remove('e-input');
|
|
3789
|
-
this.inputObj
|
|
3790
|
-
|
|
3815
|
+
if (this.inputObj) {
|
|
3816
|
+
this.inputObj.container.insertAdjacentElement('afterend', this.element);
|
|
3817
|
+
detach(this.inputObj.container);
|
|
3818
|
+
}
|
|
3819
|
+
this.blurEventArgs = null;
|
|
3820
|
+
Input.destroy();
|
|
3821
|
+
this.changeEventArgs = null;
|
|
3822
|
+
this.inputObj = null;
|
|
3791
3823
|
super.destroy();
|
|
3792
3824
|
}
|
|
3793
3825
|
};
|
|
@@ -4339,7 +4371,7 @@ let Slider = class Slider extends Component {
|
|
|
4339
4371
|
createSecondHandle() {
|
|
4340
4372
|
this.secondHandle = this.createElement('div', {
|
|
4341
4373
|
attrs: {
|
|
4342
|
-
class: classNames.sliderHandle, 'role': 'slider', tabIndex: '0'
|
|
4374
|
+
class: classNames.sliderHandle, 'role': 'slider', tabIndex: '0', 'aria-label': 'slider'
|
|
4343
4375
|
}
|
|
4344
4376
|
});
|
|
4345
4377
|
this.secondHandle.classList.add(classNames.sliderSecondHandle);
|
|
@@ -4348,7 +4380,7 @@ let Slider = class Slider extends Component {
|
|
|
4348
4380
|
createFirstHandle() {
|
|
4349
4381
|
this.firstHandle = this.createElement('div', {
|
|
4350
4382
|
attrs: {
|
|
4351
|
-
class: classNames.sliderHandle, 'role': 'slider', tabIndex: '0'
|
|
4383
|
+
class: classNames.sliderHandle, 'role': 'slider', tabIndex: '0', 'aria-label': 'slider'
|
|
4352
4384
|
}
|
|
4353
4385
|
});
|
|
4354
4386
|
this.firstHandle.classList.add(classNames.sliderFirstHandle);
|
|
@@ -4775,6 +4807,7 @@ let Slider = class Slider extends Component {
|
|
|
4775
4807
|
this.sliderContainer.classList.add(classNames.materialSlider);
|
|
4776
4808
|
this.tooltipValue();
|
|
4777
4809
|
this.tooltipObj.animation.close.effect = 'None';
|
|
4810
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe as no value holds user input
|
|
4778
4811
|
this.tooltipObj.open(this.firstHandle);
|
|
4779
4812
|
}
|
|
4780
4813
|
}
|
|
@@ -6098,6 +6131,7 @@ let Slider = class Slider extends Component {
|
|
|
6098
6131
|
openTooltip(target) {
|
|
6099
6132
|
if (this.tooltip.isVisible && this.tooltipObj && !this.isMaterialTooltip) {
|
|
6100
6133
|
this.tooltipValue();
|
|
6134
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe as no value holds user input
|
|
6101
6135
|
this.tooltipObj.open(target);
|
|
6102
6136
|
this.tooltipTarget = target;
|
|
6103
6137
|
}
|
|
@@ -7797,7 +7831,7 @@ let Uploader = class Uploader extends Component {
|
|
|
7797
7831
|
getKeyValue(val) {
|
|
7798
7832
|
let keyValue;
|
|
7799
7833
|
for (const key of Object.keys(this.preLocaleObj)) {
|
|
7800
|
-
if (this.preLocaleObj[key] === val) {
|
|
7834
|
+
if (this.preLocaleObj[`${key}`] === val) {
|
|
7801
7835
|
keyValue = key;
|
|
7802
7836
|
}
|
|
7803
7837
|
}
|
|
@@ -7848,7 +7882,7 @@ let Uploader = class Uploader extends Component {
|
|
|
7848
7882
|
}
|
|
7849
7883
|
}
|
|
7850
7884
|
preRender() {
|
|
7851
|
-
this.localeText = { Browse: 'Browse...', Clear: 'Clear', Upload: 'Upload',
|
|
7885
|
+
this.localeText = { Browse: 'Browse...', Clear: 'Clear', Upload: 'Upload', invalidFileName: 'File Name is not allowed',
|
|
7852
7886
|
dropFilesHint: 'Or drop files here', invalidMaxFileSize: 'File size is too large',
|
|
7853
7887
|
invalidMinFileSize: 'File size is too small', invalidFileType: 'File type is not allowed',
|
|
7854
7888
|
uploadFailedMessage: 'File failed to upload', uploadSuccessMessage: 'File uploaded successfully',
|
|
@@ -8173,7 +8207,7 @@ let Uploader = class Uploader extends Component {
|
|
|
8173
8207
|
if (!isNullOrUndefined(this.htmlAttributes)) {
|
|
8174
8208
|
for (const pro of Object.keys(this.htmlAttributes)) {
|
|
8175
8209
|
if (wrapperAttr$1.indexOf(pro) < 0) {
|
|
8176
|
-
this.element.setAttribute(pro, this.htmlAttributes[pro]);
|
|
8210
|
+
this.element.setAttribute(pro, this.htmlAttributes[`${pro}`]);
|
|
8177
8211
|
}
|
|
8178
8212
|
}
|
|
8179
8213
|
}
|
|
@@ -8183,19 +8217,19 @@ let Uploader = class Uploader extends Component {
|
|
|
8183
8217
|
for (const pro of Object.keys(this.htmlAttributes)) {
|
|
8184
8218
|
if (wrapperAttr$1.indexOf(pro) > -1) {
|
|
8185
8219
|
if (pro === 'class') {
|
|
8186
|
-
const updatedClassValues = (this.htmlAttributes[pro].replace(/\s+/g, ' ')).trim();
|
|
8220
|
+
const updatedClassValues = (this.htmlAttributes[`${pro}`].replace(/\s+/g, ' ')).trim();
|
|
8187
8221
|
if (updatedClassValues !== '') {
|
|
8188
8222
|
addClass([this.uploadWrapper], updatedClassValues.split(' '));
|
|
8189
8223
|
}
|
|
8190
8224
|
}
|
|
8191
8225
|
else if (pro === 'style') {
|
|
8192
8226
|
let uploadStyle = this.uploadWrapper.getAttribute(pro);
|
|
8193
|
-
uploadStyle = !isNullOrUndefined(uploadStyle) ? (uploadStyle + this.htmlAttributes[pro]) :
|
|
8194
|
-
this.htmlAttributes[pro];
|
|
8227
|
+
uploadStyle = !isNullOrUndefined(uploadStyle) ? (uploadStyle + this.htmlAttributes[`${pro}`]) :
|
|
8228
|
+
this.htmlAttributes[`${pro}`];
|
|
8195
8229
|
this.uploadWrapper.setAttribute(pro, uploadStyle);
|
|
8196
8230
|
}
|
|
8197
8231
|
else {
|
|
8198
|
-
this.uploadWrapper.setAttribute(pro, this.htmlAttributes[pro]);
|
|
8232
|
+
this.uploadWrapper.setAttribute(pro, this.htmlAttributes[`${pro}`]);
|
|
8199
8233
|
}
|
|
8200
8234
|
}
|
|
8201
8235
|
}
|
|
@@ -8230,7 +8264,9 @@ let Uploader = class Uploader extends Component {
|
|
|
8230
8264
|
sequenceUpload(fileData) {
|
|
8231
8265
|
if (this.filesData.length - fileData.length === 0 ||
|
|
8232
8266
|
this.filesData[(this.filesData.length - fileData.length - 1)].statusCode !== '1') {
|
|
8233
|
-
|
|
8267
|
+
if (this.multiple || this.count < 0) {
|
|
8268
|
+
++this.count;
|
|
8269
|
+
}
|
|
8234
8270
|
const isFileListCreated = this.showFileList ? false : true;
|
|
8235
8271
|
if (typeof this.filesData[this.count] === 'object') {
|
|
8236
8272
|
this.isFirstFileOnSelection = false;
|
|
@@ -8577,7 +8613,7 @@ let Uploader = class Uploader extends Component {
|
|
|
8577
8613
|
const data = customData[i];
|
|
8578
8614
|
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
8579
8615
|
const value = Object.keys(data).map(function (e) {
|
|
8580
|
-
return data[e];
|
|
8616
|
+
return data[`${e}`];
|
|
8581
8617
|
});
|
|
8582
8618
|
formData.append(Object.keys(data)[0], value);
|
|
8583
8619
|
}
|
|
@@ -8590,7 +8626,7 @@ let Uploader = class Uploader extends Component {
|
|
|
8590
8626
|
const data = currentRequest[i];
|
|
8591
8627
|
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
8592
8628
|
const value = Object.keys(data).map(function (e) {
|
|
8593
|
-
return data[e];
|
|
8629
|
+
return data[`${e}`];
|
|
8594
8630
|
});
|
|
8595
8631
|
request.setRequestHeader(Object.keys(data)[0], value);
|
|
8596
8632
|
}
|
|
@@ -8787,6 +8823,20 @@ let Uploader = class Uploader extends Component {
|
|
|
8787
8823
|
if (this.allowedExtensions.indexOf('*') > -1) {
|
|
8788
8824
|
this.allTypes = true;
|
|
8789
8825
|
}
|
|
8826
|
+
if (this.enableHtmlSanitizer) {
|
|
8827
|
+
for (let i = 0; i < fileData.length; i++) {
|
|
8828
|
+
let sanitizeFile = SanitizeHtmlHelper.beforeSanitize();
|
|
8829
|
+
let sanitizeFileName = SanitizeHtmlHelper.serializeValue(sanitizeFile, fileData[i].name);
|
|
8830
|
+
if (sanitizeFileName != fileData[i].name) {
|
|
8831
|
+
let encodedFileName = targetFiles[i].name.replace(/[\u00A0-\u9999<>\&]/g, function (i) {
|
|
8832
|
+
return '&#' + i.charCodeAt(0) + ';';
|
|
8833
|
+
});
|
|
8834
|
+
fileData[i].name = encodedFileName;
|
|
8835
|
+
fileData[i].status = this.localizedTexts('invalidFileName');
|
|
8836
|
+
fileData[i].statusCode = '0';
|
|
8837
|
+
}
|
|
8838
|
+
}
|
|
8839
|
+
}
|
|
8790
8840
|
if (!this.allTypes) {
|
|
8791
8841
|
fileData = this.checkExtension(fileData);
|
|
8792
8842
|
}
|
|
@@ -9550,7 +9600,9 @@ let Uploader = class Uploader extends Component {
|
|
|
9550
9600
|
this.pauseButton = null;
|
|
9551
9601
|
}
|
|
9552
9602
|
/* istanbul ignore next */
|
|
9553
|
-
liElement
|
|
9603
|
+
if (!isNullOrUndefined(liElement)) {
|
|
9604
|
+
liElement.classList.add(RESTRICT_RETRY);
|
|
9605
|
+
}
|
|
9554
9606
|
this.upload([file]);
|
|
9555
9607
|
}
|
|
9556
9608
|
/* istanbul ignore next */
|
|
@@ -10366,6 +10418,14 @@ let Uploader = class Uploader extends Component {
|
|
|
10366
10418
|
detach(this.uploadWrapper);
|
|
10367
10419
|
}
|
|
10368
10420
|
this.uploadWrapper = null;
|
|
10421
|
+
this.uploadWrapper = null;
|
|
10422
|
+
this.browseButton = null;
|
|
10423
|
+
this.dropAreaWrapper = null;
|
|
10424
|
+
this.dropZoneElement = null;
|
|
10425
|
+
this.dropArea = null;
|
|
10426
|
+
this.keyboardModule = null;
|
|
10427
|
+
this.clearButton = null;
|
|
10428
|
+
this.uploadButton = null;
|
|
10369
10429
|
super.destroy();
|
|
10370
10430
|
}
|
|
10371
10431
|
/**
|
|
@@ -10854,6 +10914,9 @@ __decorate$4([
|
|
|
10854
10914
|
__decorate$4([
|
|
10855
10915
|
Property(true)
|
|
10856
10916
|
], Uploader.prototype, "autoUpload", void 0);
|
|
10917
|
+
__decorate$4([
|
|
10918
|
+
Property(true)
|
|
10919
|
+
], Uploader.prototype, "enableHtmlSanitizer", void 0);
|
|
10857
10920
|
__decorate$4([
|
|
10858
10921
|
Complex({}, ButtonsProps)
|
|
10859
10922
|
], Uploader.prototype, "buttons", void 0);
|
|
@@ -11464,7 +11527,7 @@ let ColorPicker = class ColorPicker extends Component {
|
|
|
11464
11527
|
if (!wrapper.classList.contains(HIDEHEX)) {
|
|
11465
11528
|
const hexInput = this.createElement('input', {
|
|
11466
11529
|
className: HEX,
|
|
11467
|
-
attrs: { 'maxlength': '7', 'spellcheck': 'false' }
|
|
11530
|
+
attrs: { 'maxlength': '7', 'spellcheck': 'false', 'aria-label': 'HEX' }
|
|
11468
11531
|
});
|
|
11469
11532
|
container.appendChild(hexInput);
|
|
11470
11533
|
Input.createInput({
|
|
@@ -11506,7 +11569,8 @@ let ColorPicker = class ColorPicker extends Component {
|
|
|
11506
11569
|
}
|
|
11507
11570
|
appendValueSwitchBtn(targetEle) {
|
|
11508
11571
|
const valueSwitchBtn = this.createElement('button', {
|
|
11509
|
-
className: 'e-icons e-css e-btn e-flat e-icon-btn ' + FORMATSWITCH
|
|
11572
|
+
className: 'e-icons e-css e-btn e-flat e-icon-btn ' + FORMATSWITCH,
|
|
11573
|
+
attrs: { 'title': 'Toggle format' }
|
|
11510
11574
|
});
|
|
11511
11575
|
targetEle.appendChild(valueSwitchBtn);
|
|
11512
11576
|
if (this.isPicker() && !this.getWrapper().classList.contains(HIDERGBA)) {
|
|
@@ -11557,6 +11621,7 @@ let ColorPicker = class ColorPicker extends Component {
|
|
|
11557
11621
|
});
|
|
11558
11622
|
tooltip.createElement = this.createElement;
|
|
11559
11623
|
tooltip.appendTo(this.container);
|
|
11624
|
+
// eslint-disable-next-line
|
|
11560
11625
|
tooltip.open(this.container);
|
|
11561
11626
|
this.tooltipEle.style.zIndex = getZindexPartial(this.tooltipEle).toString();
|
|
11562
11627
|
select('.e-tip-content', this.tooltipEle).appendChild(this.createElement('div', { className: 'e-tip-transparent' }));
|
|
@@ -13144,19 +13209,19 @@ let TextBox = class TextBox extends Component {
|
|
|
13144
13209
|
for (const key of Object.keys(this.htmlAttributes)) {
|
|
13145
13210
|
if (containerAttr.indexOf(key) > -1) {
|
|
13146
13211
|
if (key === 'class') {
|
|
13147
|
-
const updatedClassValues = this.getInputValidClassList(this.htmlAttributes[key]);
|
|
13212
|
+
const updatedClassValues = this.getInputValidClassList(this.htmlAttributes[`${key}`]);
|
|
13148
13213
|
if (updatedClassValues !== '') {
|
|
13149
13214
|
addClass([this.textboxWrapper.container], updatedClassValues.split(' '));
|
|
13150
13215
|
}
|
|
13151
13216
|
}
|
|
13152
13217
|
else if (key === 'style') {
|
|
13153
13218
|
let setStyle = this.textboxWrapper.container.getAttribute(key);
|
|
13154
|
-
setStyle = !isNullOrUndefined(setStyle) ? (setStyle + this.htmlAttributes[key]) :
|
|
13155
|
-
this.htmlAttributes[key];
|
|
13219
|
+
setStyle = !isNullOrUndefined(setStyle) ? (setStyle + this.htmlAttributes[`${key}`]) :
|
|
13220
|
+
this.htmlAttributes[`${key}`];
|
|
13156
13221
|
this.textboxWrapper.container.setAttribute(key, setStyle);
|
|
13157
13222
|
}
|
|
13158
13223
|
else {
|
|
13159
|
-
this.textboxWrapper.container.setAttribute(key, this.htmlAttributes[key]);
|
|
13224
|
+
this.textboxWrapper.container.setAttribute(key, this.htmlAttributes[`${key}`]);
|
|
13160
13225
|
}
|
|
13161
13226
|
}
|
|
13162
13227
|
}
|
|
@@ -13166,7 +13231,7 @@ let TextBox = class TextBox extends Component {
|
|
|
13166
13231
|
if (!isNullOrUndefined(this.htmlAttributes)) {
|
|
13167
13232
|
for (const key of Object.keys(this.htmlAttributes)) {
|
|
13168
13233
|
if (containerAttr.indexOf(key) < 0) {
|
|
13169
|
-
this.element.setAttribute(key, this.htmlAttributes[key]);
|
|
13234
|
+
this.element.setAttribute(key, this.htmlAttributes[`${key}`]);
|
|
13170
13235
|
}
|
|
13171
13236
|
}
|
|
13172
13237
|
}
|
|
@@ -13372,6 +13437,7 @@ let TextBox = class TextBox extends Component {
|
|
|
13372
13437
|
detach(this.textboxWrapper.container);
|
|
13373
13438
|
}
|
|
13374
13439
|
this.textboxWrapper = null;
|
|
13440
|
+
Input.destroy();
|
|
13375
13441
|
super.destroy();
|
|
13376
13442
|
}
|
|
13377
13443
|
/**
|
|
@@ -13412,17 +13478,17 @@ let TextBox = class TextBox extends Component {
|
|
|
13412
13478
|
Input.setReadonly(this.readonly, this.respectiveElement);
|
|
13413
13479
|
}
|
|
13414
13480
|
else if (key === 'class') {
|
|
13415
|
-
this.respectiveElement.classList.add(attributes$$1[key]);
|
|
13481
|
+
this.respectiveElement.classList.add(attributes$$1[`${key}`]);
|
|
13416
13482
|
}
|
|
13417
13483
|
else if (key === 'placeholder') {
|
|
13418
|
-
this.setProperties({ placeholder: attributes$$1[key] }, true);
|
|
13484
|
+
this.setProperties({ placeholder: attributes$$1[`${key}`] }, true);
|
|
13419
13485
|
Input.setPlaceholder(this.placeholder, this.respectiveElement);
|
|
13420
13486
|
}
|
|
13421
13487
|
else if (key === 'rows' && this.respectiveElement.tagName === 'TEXTAREA') {
|
|
13422
|
-
this.respectiveElement.setAttribute(key, attributes$$1[key]);
|
|
13488
|
+
this.respectiveElement.setAttribute(key, attributes$$1[`${key}`]);
|
|
13423
13489
|
}
|
|
13424
13490
|
else {
|
|
13425
|
-
this.respectiveElement.setAttribute(key, attributes$$1[key]);
|
|
13491
|
+
this.respectiveElement.setAttribute(key, attributes$$1[`${key}`]);
|
|
13426
13492
|
}
|
|
13427
13493
|
}
|
|
13428
13494
|
}
|
|
@@ -13631,6 +13697,7 @@ class SignatureBase extends Component {
|
|
|
13631
13697
|
this.canvasContext.canvas.style.backgroundColor = this.backgroundColor;
|
|
13632
13698
|
}
|
|
13633
13699
|
}
|
|
13700
|
+
// eslint-disable-next-line
|
|
13634
13701
|
mouseDownHandler(e, canvas, panStart, zoomState) {
|
|
13635
13702
|
if (e.buttons === 1 || e.buttons === 2 || e.type === 'touchstart') {
|
|
13636
13703
|
if (e.type === 'touchstart') {
|
|
@@ -13960,20 +14027,14 @@ class SignatureBase extends Component {
|
|
|
13960
14027
|
enableOrDisable(isDisable) {
|
|
13961
14028
|
this.disabled = isDisable;
|
|
13962
14029
|
if (isDisable) {
|
|
13963
|
-
this.
|
|
14030
|
+
this.canvasContext.canvas.style.filter = "opacity(0.5)";
|
|
13964
14031
|
this.isRead(true);
|
|
13965
14032
|
}
|
|
13966
14033
|
else {
|
|
13967
|
-
this.
|
|
14034
|
+
this.canvasContext.canvas.style.filter = "";
|
|
13968
14035
|
this.isRead(false);
|
|
13969
14036
|
}
|
|
13970
14037
|
}
|
|
13971
|
-
reDraw(opacity) {
|
|
13972
|
-
const data = this.canvasContext.getImageData(0, 0, this.element.width, this.element.height);
|
|
13973
|
-
this.canvasContext.clearRect(0, 0, this.element.width, this.element.height);
|
|
13974
|
-
this.element.style.opacity = opacity;
|
|
13975
|
-
this.canvasContext.putImageData(data, 0, 0);
|
|
13976
|
-
}
|
|
13977
14038
|
updateSnapCollection(isClear) {
|
|
13978
14039
|
if (isNullOrUndefined(this.incStep)) {
|
|
13979
14040
|
this.incStep = -1;
|
|
@@ -14650,6 +14711,766 @@ Signature = __decorate$7([
|
|
|
14650
14711
|
* Signature modules
|
|
14651
14712
|
*/
|
|
14652
14713
|
|
|
14714
|
+
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
14715
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14716
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14717
|
+
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;
|
|
14718
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14719
|
+
};
|
|
14720
|
+
const ICONCSS = 'e-rating-icon e-icons e-star-filled';
|
|
14721
|
+
const ITEMLIST = 'e-rating-item-list';
|
|
14722
|
+
const ITEMCONTAINER = 'e-rating-item-container';
|
|
14723
|
+
const SELECTED = 'e-rating-selected';
|
|
14724
|
+
const INTERMEDIATE = 'e-rating-intermediate';
|
|
14725
|
+
const LABEL = 'e-rating-label';
|
|
14726
|
+
const RESET = 'e-icons e-reset';
|
|
14727
|
+
const HIDDEN = 'e-rating-hidden';
|
|
14728
|
+
const DISABLED$2 = 'e-disabled';
|
|
14729
|
+
const READONLY = 'e-rating-readonly';
|
|
14730
|
+
const RTL$2 = 'e-rtl';
|
|
14731
|
+
const ANIMATION = 'e-rating-animation';
|
|
14732
|
+
const FULLTEMPLATE = 'e-rating-full';
|
|
14733
|
+
const EMPTYTEMPLATE = 'e-rating-empty';
|
|
14734
|
+
const SELECTEDVALUE = 'e-selected-value';
|
|
14735
|
+
const RATINGVALUE = '--rating-value';
|
|
14736
|
+
/**
|
|
14737
|
+
* Defines the position of the label in the rating.
|
|
14738
|
+
*/
|
|
14739
|
+
var LabelPosition;
|
|
14740
|
+
(function (LabelPosition) {
|
|
14741
|
+
/**
|
|
14742
|
+
* Shows the label above the rating.
|
|
14743
|
+
*/
|
|
14744
|
+
LabelPosition["Top"] = "Top";
|
|
14745
|
+
/**
|
|
14746
|
+
* Shows the label below the rating.
|
|
14747
|
+
*/
|
|
14748
|
+
LabelPosition["Bottom"] = "Bottom";
|
|
14749
|
+
/**
|
|
14750
|
+
* Shows the label to the left of rating.
|
|
14751
|
+
*/
|
|
14752
|
+
LabelPosition["Left"] = "Left";
|
|
14753
|
+
/**
|
|
14754
|
+
* Shows the label to the right of rating.
|
|
14755
|
+
*/
|
|
14756
|
+
LabelPosition["Right"] = "Right";
|
|
14757
|
+
})(LabelPosition || (LabelPosition = {}));
|
|
14758
|
+
/**
|
|
14759
|
+
* Defines the minimum increase in the value in Rating Control.
|
|
14760
|
+
*/
|
|
14761
|
+
var PrecisionType;
|
|
14762
|
+
(function (PrecisionType) {
|
|
14763
|
+
/**
|
|
14764
|
+
* Process the value as whole numbers.
|
|
14765
|
+
*/
|
|
14766
|
+
PrecisionType["Full"] = "Full";
|
|
14767
|
+
/**
|
|
14768
|
+
* Process the value in terms of 0.5 (half).
|
|
14769
|
+
*/
|
|
14770
|
+
PrecisionType["Half"] = "Half";
|
|
14771
|
+
/**
|
|
14772
|
+
* Process the value in terms of 0.25 (quarter).
|
|
14773
|
+
*/
|
|
14774
|
+
PrecisionType["Quarter"] = "Quarter";
|
|
14775
|
+
/**
|
|
14776
|
+
* Process the value in terms of 0.1.
|
|
14777
|
+
*/
|
|
14778
|
+
PrecisionType["Exact"] = "Exact";
|
|
14779
|
+
})(PrecisionType || (PrecisionType = {}));
|
|
14780
|
+
let Rating = class Rating extends Component {
|
|
14781
|
+
/**
|
|
14782
|
+
* Constructor for creating the widget
|
|
14783
|
+
*
|
|
14784
|
+
* @param {RatingModel} options - Specifies the rating model
|
|
14785
|
+
* @param {string|HTMLButtonElement} element - Specifies the target element
|
|
14786
|
+
*/
|
|
14787
|
+
constructor(options, element) {
|
|
14788
|
+
super(options, element);
|
|
14789
|
+
this.itemElements = [];
|
|
14790
|
+
this.tooltipOpen = false;
|
|
14791
|
+
}
|
|
14792
|
+
preRender() {
|
|
14793
|
+
if (!this.element.id) {
|
|
14794
|
+
this.element.id = getUniqueID('e-' + this.getModuleName());
|
|
14795
|
+
}
|
|
14796
|
+
this.keyConfigs = {
|
|
14797
|
+
downarrow: 'downarrow',
|
|
14798
|
+
leftarrow: 'leftarrow',
|
|
14799
|
+
rightarrow: 'rightarrow',
|
|
14800
|
+
uparrow: 'uparrow',
|
|
14801
|
+
space: 'space'
|
|
14802
|
+
};
|
|
14803
|
+
}
|
|
14804
|
+
render() {
|
|
14805
|
+
this.initialize();
|
|
14806
|
+
this.updateMinValue();
|
|
14807
|
+
this.updateTemplateFunction();
|
|
14808
|
+
this.renderItems();
|
|
14809
|
+
this.updatePrecision();
|
|
14810
|
+
this.displayLabel();
|
|
14811
|
+
}
|
|
14812
|
+
initialize() {
|
|
14813
|
+
this.wrapper = this.createElement('div', { className: 'e-' + this.getModuleName() + '-container ' });
|
|
14814
|
+
this.element.parentNode.insertBefore(this.wrapper, this.element);
|
|
14815
|
+
this.wrapper.appendChild(this.element);
|
|
14816
|
+
if ((this.element.getAttribute('name') == null)) {
|
|
14817
|
+
this.element.setAttribute('name', this.element.id);
|
|
14818
|
+
}
|
|
14819
|
+
attributes(this.element, { 'aria-label': 'rating' });
|
|
14820
|
+
this.renderItemList();
|
|
14821
|
+
this.updateReset();
|
|
14822
|
+
this.updateDisabled();
|
|
14823
|
+
this.wrapper.classList[this.readOnly ? 'add' : 'remove'](READONLY);
|
|
14824
|
+
this.wrapper.classList[!this.visible ? 'add' : 'remove'](HIDDEN);
|
|
14825
|
+
this.wrapper.classList[this.enableRtl ? 'add' : 'remove'](RTL$2);
|
|
14826
|
+
this.wrapper.classList[this.enableAnimation ? 'add' : 'remove'](ANIMATION);
|
|
14827
|
+
if (this.cssClass) {
|
|
14828
|
+
addClass([this.wrapper], this.cssClass.split(' '));
|
|
14829
|
+
}
|
|
14830
|
+
this.updateTooltip();
|
|
14831
|
+
this.wireKeyboardEvent();
|
|
14832
|
+
}
|
|
14833
|
+
updateDisabled() {
|
|
14834
|
+
this.wrapper.classList[this.disabled ? 'add' : 'remove'](DISABLED$2);
|
|
14835
|
+
attributes(this.ratingItemList, { 'tabindex': (this.disabled) ? '-1' : '0' });
|
|
14836
|
+
if (this.allowReset) {
|
|
14837
|
+
this.updateResetButton();
|
|
14838
|
+
}
|
|
14839
|
+
}
|
|
14840
|
+
updateResetButton() {
|
|
14841
|
+
const isDisabled = (this.value <= this.min) || this.disabled;
|
|
14842
|
+
this.resetElement.classList[isDisabled ? 'add' : 'remove'](DISABLED$2);
|
|
14843
|
+
attributes(this.resetElement, { 'aria-label': 'resetbutton', 'role': 'button',
|
|
14844
|
+
'tabindex': (isDisabled ? '-1' : '0'), 'aria-hidden': isDisabled.toString() });
|
|
14845
|
+
}
|
|
14846
|
+
renderItemList() {
|
|
14847
|
+
this.ratingItemList = this.createElement('div', {
|
|
14848
|
+
className: ITEMLIST,
|
|
14849
|
+
id: this.element.id + '_item-list',
|
|
14850
|
+
attrs: { 'tabindex': '0' }
|
|
14851
|
+
});
|
|
14852
|
+
attributes(this.ratingItemList, { 'aria-label': 'rating', 'role': 'slider' });
|
|
14853
|
+
this.wrapper.appendChild(this.ratingItemList);
|
|
14854
|
+
EventHandler.add(this.ratingItemList, 'touchmove', (e) => this.touchMoveHandler(e), this);
|
|
14855
|
+
EventHandler.add(this.ratingItemList, 'touchend', this.touchEndHandler, this);
|
|
14856
|
+
}
|
|
14857
|
+
touchMoveHandler(e) {
|
|
14858
|
+
const rect = this.ratingItemList.getBoundingClientRect();
|
|
14859
|
+
const x = e.touches[0].clientX - rect.x;
|
|
14860
|
+
let currValue = (x / rect.width) * this.itemsCount;
|
|
14861
|
+
currValue = (this.enableRtl) ? (this.itemsCount - currValue) : currValue;
|
|
14862
|
+
currValue = currValue < this.min ? this.min : currValue > this.itemsCount ? this.itemsCount : currValue;
|
|
14863
|
+
currValue = this.validateValue(currValue);
|
|
14864
|
+
const element = currValue === 0 ? null : this.itemElements[parseInt((Math.ceil(currValue) - 1).toString(), 10)];
|
|
14865
|
+
if (currValue === this.currentValue) {
|
|
14866
|
+
if (this.showTooltip && element) {
|
|
14867
|
+
this.openRatingTooltip(element, false);
|
|
14868
|
+
}
|
|
14869
|
+
return;
|
|
14870
|
+
}
|
|
14871
|
+
const previousValue = this.currentValue;
|
|
14872
|
+
this.updateCurrentValue(currValue);
|
|
14873
|
+
this.triggerChange(e, currValue);
|
|
14874
|
+
if (this.showTooltip) {
|
|
14875
|
+
if (element) {
|
|
14876
|
+
if (Math.ceil(currValue) !== Math.ceil(previousValue)) {
|
|
14877
|
+
this.closeRatingTooltip();
|
|
14878
|
+
}
|
|
14879
|
+
this.openRatingTooltip(element, true);
|
|
14880
|
+
}
|
|
14881
|
+
else {
|
|
14882
|
+
this.closeRatingTooltip();
|
|
14883
|
+
}
|
|
14884
|
+
}
|
|
14885
|
+
}
|
|
14886
|
+
touchEndHandler() {
|
|
14887
|
+
this.closeRatingTooltip();
|
|
14888
|
+
}
|
|
14889
|
+
updateTemplateFunction() {
|
|
14890
|
+
this.emptyTemplateFunction = this.emptyTemplate ? this.getTemplateString(this.emptyTemplate) : null;
|
|
14891
|
+
this.fullTemplateFunction = this.fullTemplate ? this.getTemplateString(this.fullTemplate) : null;
|
|
14892
|
+
}
|
|
14893
|
+
renderItems() {
|
|
14894
|
+
for (let i = 0; i < this.itemsCount; i++) {
|
|
14895
|
+
const ratingItemContainer = this.createElement('span', { className: ITEMCONTAINER });
|
|
14896
|
+
const spanItem = this.createElement('span', { className: 'e-rating-item' });
|
|
14897
|
+
const ratingValue = this.getRatingValue(this.value, i);
|
|
14898
|
+
this.renderItemContent(spanItem, ratingValue, i);
|
|
14899
|
+
ratingItemContainer.appendChild(spanItem);
|
|
14900
|
+
this.wireItemsEvents(ratingItemContainer, i + 1);
|
|
14901
|
+
this.itemElements.push(ratingItemContainer);
|
|
14902
|
+
const eventArgs = { element: ratingItemContainer, value: i + 1 };
|
|
14903
|
+
this.trigger('beforeItemRender', eventArgs, (args) => {
|
|
14904
|
+
this.ratingItemList.appendChild(args.element);
|
|
14905
|
+
});
|
|
14906
|
+
}
|
|
14907
|
+
attributes(this.ratingItemList, { 'aria-valuemax': this.itemsCount.toString() });
|
|
14908
|
+
if (this.disabled) {
|
|
14909
|
+
attributes(this.ratingItemList, { 'tabindex': '-1' });
|
|
14910
|
+
}
|
|
14911
|
+
}
|
|
14912
|
+
renderItemContent(spanEle, val, index, isrerender = false) {
|
|
14913
|
+
if (isrerender) {
|
|
14914
|
+
this.removeItemContent(spanEle);
|
|
14915
|
+
}
|
|
14916
|
+
if (this.fullTemplate && val === 1) {
|
|
14917
|
+
spanEle.classList.add(FULLTEMPLATE);
|
|
14918
|
+
spanEle.append(this.fullTemplateFunction({ index: index, ratingValue: val }, this, 'ratingFullTemplate', (this.element.id + 'fullTemplate'), this.isStringTemplate)[0]);
|
|
14919
|
+
}
|
|
14920
|
+
else if (this.emptyTemplate) {
|
|
14921
|
+
spanEle.classList.add(EMPTYTEMPLATE);
|
|
14922
|
+
spanEle.append(this.emptyTemplateFunction({ index: index, ratingValue: val }, this, 'ratingEmptyTemplate', (this.element.id + 'emptyTemplate'), this.isStringTemplate)[0]);
|
|
14923
|
+
}
|
|
14924
|
+
else {
|
|
14925
|
+
addClass([spanEle], ICONCSS.split(' '));
|
|
14926
|
+
}
|
|
14927
|
+
}
|
|
14928
|
+
removeItemContent(spanEle) {
|
|
14929
|
+
spanEle.classList.remove(FULLTEMPLATE, EMPTYTEMPLATE);
|
|
14930
|
+
removeClass([spanEle], ICONCSS.split(' '));
|
|
14931
|
+
if (spanEle.firstChild) {
|
|
14932
|
+
spanEle.removeChild(spanEle.firstChild);
|
|
14933
|
+
}
|
|
14934
|
+
}
|
|
14935
|
+
updateTooltip() {
|
|
14936
|
+
if (this.showTooltip) {
|
|
14937
|
+
this.tooltipObj = new Tooltip({
|
|
14938
|
+
target: '.e-rating-item-container', windowCollision: true,
|
|
14939
|
+
opensOn: 'Custom', cssClass: 'e-rating-tooltip'
|
|
14940
|
+
});
|
|
14941
|
+
this.tooltipObj.appendTo('#' + this.ratingItemList.id);
|
|
14942
|
+
}
|
|
14943
|
+
else {
|
|
14944
|
+
if (!isNullOrUndefined(this.tooltipObj)) {
|
|
14945
|
+
this.tooltipObj.destroy();
|
|
14946
|
+
this.tooltipObj = null;
|
|
14947
|
+
}
|
|
14948
|
+
}
|
|
14949
|
+
}
|
|
14950
|
+
updateMinValue() {
|
|
14951
|
+
this.min = this.validateValue(this.min);
|
|
14952
|
+
if (this.min > 0 && this.value < this.min) {
|
|
14953
|
+
this.triggerChange(null, this.min, false);
|
|
14954
|
+
}
|
|
14955
|
+
attributes(this.ratingItemList, { 'aria-valuemin': this.min.toString() });
|
|
14956
|
+
}
|
|
14957
|
+
updatePrecision() {
|
|
14958
|
+
this.min = this.validateValue(this.min);
|
|
14959
|
+
this.triggerChange(null, this.validateValue(this.value), false);
|
|
14960
|
+
this.updateItemValue();
|
|
14961
|
+
}
|
|
14962
|
+
validateValue(currentValue) {
|
|
14963
|
+
if (currentValue > this.itemsCount) {
|
|
14964
|
+
currentValue = this.itemsCount;
|
|
14965
|
+
}
|
|
14966
|
+
else if (currentValue < 0) {
|
|
14967
|
+
currentValue = 0;
|
|
14968
|
+
}
|
|
14969
|
+
else {
|
|
14970
|
+
currentValue = (this.precision === PrecisionType.Full) ? Math.round(currentValue) :
|
|
14971
|
+
(this.precision === PrecisionType.Half) ? (Math.round(currentValue * 2) / 2) :
|
|
14972
|
+
(this.precision === PrecisionType.Quarter) ? (Math.round(currentValue * 4) / 4) : (Math.round(currentValue * 10) / 10);
|
|
14973
|
+
}
|
|
14974
|
+
return currentValue;
|
|
14975
|
+
}
|
|
14976
|
+
getRatingValue(value, i) {
|
|
14977
|
+
return (this.enableSingleSelection && this.precision === PrecisionType.Full) ? ((value === i + 1) ? 1 : 0) :
|
|
14978
|
+
(value >= i + 1) ? 1 : ((value < i) ? 0 : (value - i));
|
|
14979
|
+
}
|
|
14980
|
+
updateItemValue() {
|
|
14981
|
+
for (let i = 0; i < this.itemsCount; i++) {
|
|
14982
|
+
const itemElement = this.itemElements[parseInt(i.toString(), 10)];
|
|
14983
|
+
itemElement.classList.remove(SELECTED, INTERMEDIATE, SELECTEDVALUE);
|
|
14984
|
+
const ratingValue = this.getRatingValue(this.currentValue, i);
|
|
14985
|
+
if (ratingValue === 1) {
|
|
14986
|
+
itemElement.classList.add(SELECTED);
|
|
14987
|
+
}
|
|
14988
|
+
else if (ratingValue > 0) {
|
|
14989
|
+
itemElement.classList.add(INTERMEDIATE);
|
|
14990
|
+
}
|
|
14991
|
+
else if ((this.precision === PrecisionType.Full) && (i + 1 <= this.value) && (!this.enableSingleSelection)) {
|
|
14992
|
+
itemElement.classList.add(SELECTEDVALUE);
|
|
14993
|
+
}
|
|
14994
|
+
this.updateItemContent(ratingValue, i);
|
|
14995
|
+
itemElement.style.setProperty(RATINGVALUE, (ratingValue * 100) + '%');
|
|
14996
|
+
itemElement.classList[((this.value === 0) && (i === 0)) || (this.value === i + 1) || ((ratingValue > 0) && (ratingValue < 1)) ? 'add' : 'remove']('e-rating-focus');
|
|
14997
|
+
}
|
|
14998
|
+
if (this.allowReset) {
|
|
14999
|
+
this.updateResetButton();
|
|
15000
|
+
}
|
|
15001
|
+
attributes(this.ratingItemList, { 'aria-valuenow': this.currentValue.toString() });
|
|
15002
|
+
attributes(this.element, { 'value': this.value.toString() });
|
|
15003
|
+
}
|
|
15004
|
+
updateItemContent(ratingValue, index) {
|
|
15005
|
+
if (!this.fullTemplate && !this.emptyTemplate) {
|
|
15006
|
+
return;
|
|
15007
|
+
}
|
|
15008
|
+
const spanEle = this.itemElements[parseInt(index.toString(), 10)].querySelector('.e-rating-item');
|
|
15009
|
+
if (this.fullTemplate && ratingValue === 1) {
|
|
15010
|
+
if (spanEle.classList.contains(FULLTEMPLATE)) {
|
|
15011
|
+
return;
|
|
15012
|
+
}
|
|
15013
|
+
this.removeItemContent(spanEle);
|
|
15014
|
+
spanEle.classList.add(FULLTEMPLATE);
|
|
15015
|
+
spanEle.append(this.fullTemplateFunction({ ratingValue: ratingValue, index: index }, this, 'ratingFullTemplate', (this.element.id + 'fullTemplate'), this.isStringTemplate)[0]);
|
|
15016
|
+
}
|
|
15017
|
+
else if (this.emptyTemplate) {
|
|
15018
|
+
this.removeItemContent(spanEle);
|
|
15019
|
+
spanEle.classList.add(EMPTYTEMPLATE);
|
|
15020
|
+
spanEle.append(this.emptyTemplateFunction({ ratingValue: ratingValue, index: index }, this, 'ratingFullTemplate', (this.element.id + 'fullTemplate'), this.isStringTemplate)[0]);
|
|
15021
|
+
}
|
|
15022
|
+
else {
|
|
15023
|
+
this.removeItemContent(spanEle);
|
|
15024
|
+
addClass([spanEle], ICONCSS.split(' '));
|
|
15025
|
+
}
|
|
15026
|
+
this.renderReactTemplates();
|
|
15027
|
+
}
|
|
15028
|
+
updateTooltipContent(isChange) {
|
|
15029
|
+
if (this.showTooltip) {
|
|
15030
|
+
let content;
|
|
15031
|
+
if (this.tooltipTemplate) {
|
|
15032
|
+
const templateFunction = this.getTemplateString(this.tooltipTemplate);
|
|
15033
|
+
content = templateFunction({ value: this.currentValue }, this, 'ratingTooltipTemplate', (this.element.id + 'tooltipTemplate'), this.isStringTemplate)[0];
|
|
15034
|
+
}
|
|
15035
|
+
else {
|
|
15036
|
+
content = this.currentValue.toString();
|
|
15037
|
+
}
|
|
15038
|
+
this.tooltipObj.setProperties({ content: content }, isChange);
|
|
15039
|
+
this.renderReactTemplates();
|
|
15040
|
+
}
|
|
15041
|
+
}
|
|
15042
|
+
getTemplateString(template) {
|
|
15043
|
+
let stringContent = '';
|
|
15044
|
+
try {
|
|
15045
|
+
const tempEle = select(template);
|
|
15046
|
+
if (tempEle) {
|
|
15047
|
+
//Return innerHTML incase of jsrenderer script else outerHTML
|
|
15048
|
+
stringContent = tempEle.tagName === 'SCRIPT' ? tempEle.innerHTML : tempEle.outerHTML;
|
|
15049
|
+
}
|
|
15050
|
+
else {
|
|
15051
|
+
stringContent = template;
|
|
15052
|
+
}
|
|
15053
|
+
}
|
|
15054
|
+
catch (e) {
|
|
15055
|
+
stringContent = template;
|
|
15056
|
+
}
|
|
15057
|
+
return compile(stringContent);
|
|
15058
|
+
}
|
|
15059
|
+
displayLabel() {
|
|
15060
|
+
if (this.showLabel) {
|
|
15061
|
+
this.spanLabel = this.createElement('span', { className: LABEL });
|
|
15062
|
+
this.updateLabel();
|
|
15063
|
+
this.updateLabelPosition();
|
|
15064
|
+
}
|
|
15065
|
+
else {
|
|
15066
|
+
if (this.wrapper.contains(this.spanLabel)) {
|
|
15067
|
+
remove(this.spanLabel);
|
|
15068
|
+
this.spanLabel = null;
|
|
15069
|
+
}
|
|
15070
|
+
}
|
|
15071
|
+
}
|
|
15072
|
+
updateLabel() {
|
|
15073
|
+
if (this.showLabel) {
|
|
15074
|
+
if (this.labelTemplate) {
|
|
15075
|
+
if (this.spanLabel.firstChild) {
|
|
15076
|
+
this.spanLabel.removeChild(this.spanLabel.firstChild);
|
|
15077
|
+
}
|
|
15078
|
+
const templateFunction = this.getTemplateString(this.labelTemplate);
|
|
15079
|
+
this.spanLabel.append(templateFunction({ value: this.currentValue }, this, 'ratingLabelTemplate', (this.element.id + 'labelTemplate'), this.isStringTemplate)[0]);
|
|
15080
|
+
}
|
|
15081
|
+
else {
|
|
15082
|
+
this.spanLabel.textContent = this.currentValue + ' / ' + this.itemsCount;
|
|
15083
|
+
}
|
|
15084
|
+
this.renderReactTemplates();
|
|
15085
|
+
}
|
|
15086
|
+
}
|
|
15087
|
+
updateReset() {
|
|
15088
|
+
if (this.allowReset) {
|
|
15089
|
+
this.resetElement = this.createElement('span', { className: RESET });
|
|
15090
|
+
this.updateResetButton();
|
|
15091
|
+
EventHandler.add(this.resetElement, 'click', this.resetClicked, this);
|
|
15092
|
+
this.wrapper.insertBefore(this.resetElement, this.ratingItemList);
|
|
15093
|
+
}
|
|
15094
|
+
else {
|
|
15095
|
+
if (this.wrapper.contains(this.resetElement)) {
|
|
15096
|
+
remove(this.resetElement);
|
|
15097
|
+
this.resetElement = null;
|
|
15098
|
+
}
|
|
15099
|
+
}
|
|
15100
|
+
}
|
|
15101
|
+
updateLabelPosition() {
|
|
15102
|
+
this.clearLabelPosition();
|
|
15103
|
+
this.spanLabel.classList.add('e-label-' + this.labelPosition.toLowerCase());
|
|
15104
|
+
if (this.labelPosition === 'Left' || this.labelPosition === 'Top') {
|
|
15105
|
+
this.wrapper.firstChild.after(this.spanLabel);
|
|
15106
|
+
}
|
|
15107
|
+
else {
|
|
15108
|
+
this.wrapper.appendChild(this.spanLabel);
|
|
15109
|
+
}
|
|
15110
|
+
}
|
|
15111
|
+
clearLabelPosition() {
|
|
15112
|
+
const removeCss = this.spanLabel.classList.value.match(/(e-label-[top|bottom|right|left]+)/g);
|
|
15113
|
+
if (removeCss) {
|
|
15114
|
+
removeClass([this.spanLabel], removeCss);
|
|
15115
|
+
}
|
|
15116
|
+
}
|
|
15117
|
+
wireItemsEvents(itemElement, index) {
|
|
15118
|
+
EventHandler.add(itemElement, 'click', (e) => this.clickHandler(e), this);
|
|
15119
|
+
EventHandler.add(itemElement, 'mousemove', (e) => this.mouseMoveHandler(index, e), this);
|
|
15120
|
+
EventHandler.add(itemElement, 'mouseleave', this.mouseLeaveHandler, this);
|
|
15121
|
+
}
|
|
15122
|
+
clickHandler(e) {
|
|
15123
|
+
this.currentValue = (this.min > 0 && this.currentValue < this.min) ? this.min : this.currentValue;
|
|
15124
|
+
this.triggerChange(e, this.currentValue);
|
|
15125
|
+
this.updateItemValue();
|
|
15126
|
+
this.updateLabel();
|
|
15127
|
+
if (this.allowReset) {
|
|
15128
|
+
this.updateResetButton();
|
|
15129
|
+
}
|
|
15130
|
+
}
|
|
15131
|
+
triggerChange(e, val, isInteracted = true) {
|
|
15132
|
+
val = this.validateValue(val);
|
|
15133
|
+
this.currentValue = val;
|
|
15134
|
+
if (this.currentValue === this.value) {
|
|
15135
|
+
return;
|
|
15136
|
+
}
|
|
15137
|
+
const eventArgs = { event: e, isInteracted: isInteracted, value: val, previousValue: this.value };
|
|
15138
|
+
this.setProperties({ value: val }, true);
|
|
15139
|
+
this.trigger('valueChanged', eventArgs);
|
|
15140
|
+
}
|
|
15141
|
+
mouseMoveHandler(index, e) {
|
|
15142
|
+
let currValue = this.calculateCurrentValue(index, e);
|
|
15143
|
+
currValue = this.validateValue(currValue);
|
|
15144
|
+
const element = this.itemElements[parseInt((index - 1).toString(), 10)];
|
|
15145
|
+
if (currValue === this.currentValue) {
|
|
15146
|
+
this.openRatingTooltip(element, false);
|
|
15147
|
+
return;
|
|
15148
|
+
}
|
|
15149
|
+
this.updateCurrentValue(currValue);
|
|
15150
|
+
this.openRatingTooltip(element, true);
|
|
15151
|
+
const eventArgs = { element: element, event: e, value: currValue };
|
|
15152
|
+
this.trigger('onItemHover', eventArgs);
|
|
15153
|
+
}
|
|
15154
|
+
openRatingTooltip(element, isChange) {
|
|
15155
|
+
if (this.showTooltip) {
|
|
15156
|
+
if (!this.tooltipOpen) {
|
|
15157
|
+
this.updateTooltipContent(false);
|
|
15158
|
+
this.tooltipObj.open(element); //eslint-disable-line
|
|
15159
|
+
this.tooltipOpen = true;
|
|
15160
|
+
}
|
|
15161
|
+
else if (isChange) {
|
|
15162
|
+
this.updateTooltipContent(true);
|
|
15163
|
+
this.tooltipObj.refresh(element);
|
|
15164
|
+
}
|
|
15165
|
+
}
|
|
15166
|
+
}
|
|
15167
|
+
closeRatingTooltip() {
|
|
15168
|
+
if (this.tooltipOpen) {
|
|
15169
|
+
this.tooltipObj.close();
|
|
15170
|
+
this.tooltipOpen = false;
|
|
15171
|
+
}
|
|
15172
|
+
}
|
|
15173
|
+
updateCurrentValue(currValue) {
|
|
15174
|
+
this.currentValue = currValue;
|
|
15175
|
+
this.updateItemValue();
|
|
15176
|
+
this.updateLabel();
|
|
15177
|
+
}
|
|
15178
|
+
mouseLeaveHandler() {
|
|
15179
|
+
this.closeRatingTooltip();
|
|
15180
|
+
this.updateCurrentValue(this.value);
|
|
15181
|
+
}
|
|
15182
|
+
calculateCurrentValue(index, args) {
|
|
15183
|
+
let currentValue = index;
|
|
15184
|
+
if (this.precision !== PrecisionType.Full) {
|
|
15185
|
+
currentValue = args.offsetX / this.itemElements[index - 1].clientWidth;
|
|
15186
|
+
currentValue = (this.enableRtl) ? (1 - currentValue) : currentValue;
|
|
15187
|
+
if (this.precision === PrecisionType.Quarter) {
|
|
15188
|
+
currentValue = currentValue <= 0.25 ? 0.25 : currentValue <= 0.5 ? 0.5 : currentValue < 0.75 ? 0.75 : 1.0;
|
|
15189
|
+
}
|
|
15190
|
+
else if (this.precision === PrecisionType.Half) {
|
|
15191
|
+
currentValue = currentValue <= 0.5 ? 0.5 : 1;
|
|
15192
|
+
}
|
|
15193
|
+
currentValue = currentValue + index - 1;
|
|
15194
|
+
}
|
|
15195
|
+
return currentValue;
|
|
15196
|
+
}
|
|
15197
|
+
/**
|
|
15198
|
+
* Reset’s the value to minimum.
|
|
15199
|
+
*
|
|
15200
|
+
* @returns {void}
|
|
15201
|
+
*/
|
|
15202
|
+
reset() {
|
|
15203
|
+
this.resetClicked(null, false);
|
|
15204
|
+
}
|
|
15205
|
+
resetClicked(e, isInteracted = true) {
|
|
15206
|
+
this.triggerChange(e, this.min, isInteracted);
|
|
15207
|
+
this.updateItemValue();
|
|
15208
|
+
this.updateLabel();
|
|
15209
|
+
this.updateResetButton();
|
|
15210
|
+
}
|
|
15211
|
+
wireKeyboardEvent() {
|
|
15212
|
+
this.keyboardModuleRating = new KeyboardEvents(this.wrapper, {
|
|
15213
|
+
keyAction: this.keyActionHandler.bind(this),
|
|
15214
|
+
keyConfigs: this.keyConfigs,
|
|
15215
|
+
eventName: 'keydown'
|
|
15216
|
+
});
|
|
15217
|
+
}
|
|
15218
|
+
keyActionHandler(e) {
|
|
15219
|
+
if (this.disabled || this.readOnly) {
|
|
15220
|
+
return;
|
|
15221
|
+
}
|
|
15222
|
+
if (e.target.classList.contains(ITEMLIST)) {
|
|
15223
|
+
switch (e.action) {
|
|
15224
|
+
case 'uparrow':
|
|
15225
|
+
this.handleNavigation(e, true);
|
|
15226
|
+
break;
|
|
15227
|
+
case 'downarrow':
|
|
15228
|
+
this.handleNavigation(e, false);
|
|
15229
|
+
break;
|
|
15230
|
+
case 'leftarrow':
|
|
15231
|
+
this.handleNavigation(e, this.enableRtl);
|
|
15232
|
+
break;
|
|
15233
|
+
case 'rightarrow':
|
|
15234
|
+
this.handleNavigation(e, !this.enableRtl);
|
|
15235
|
+
break;
|
|
15236
|
+
}
|
|
15237
|
+
}
|
|
15238
|
+
if (this.allowReset && e.target.classList.contains('e-reset')) {
|
|
15239
|
+
switch (e.action) {
|
|
15240
|
+
case 'space':
|
|
15241
|
+
this.resetClicked(e);
|
|
15242
|
+
break;
|
|
15243
|
+
}
|
|
15244
|
+
}
|
|
15245
|
+
}
|
|
15246
|
+
handleNavigation(e, isIncrease) {
|
|
15247
|
+
if ((!isIncrease && (this.value > this.min)) || (isIncrease && (this.value < this.itemsCount))) {
|
|
15248
|
+
let currentValue = (this.precision === PrecisionType.Full) ? 1 : (this.precision === PrecisionType.Half) ? 0.5 :
|
|
15249
|
+
(this.precision === PrecisionType.Quarter) ? 0.25 : Math.round(0.1 * 10) / 10;
|
|
15250
|
+
currentValue = isIncrease ? this.value + currentValue : this.value - currentValue;
|
|
15251
|
+
this.triggerChange(e, (currentValue));
|
|
15252
|
+
this.updateItemValue();
|
|
15253
|
+
this.updateLabel();
|
|
15254
|
+
if (this.allowReset) {
|
|
15255
|
+
this.updateResetButton();
|
|
15256
|
+
}
|
|
15257
|
+
}
|
|
15258
|
+
}
|
|
15259
|
+
updateContent() {
|
|
15260
|
+
for (let i = 0; i < this.itemsCount; i++) {
|
|
15261
|
+
const itemElement = this.itemElements[parseInt(i.toString(), 10)].firstElementChild;
|
|
15262
|
+
this.renderItemContent(itemElement, this.getRatingValue(this.value, i), i, true);
|
|
15263
|
+
}
|
|
15264
|
+
}
|
|
15265
|
+
/**
|
|
15266
|
+
* To get component name.
|
|
15267
|
+
*
|
|
15268
|
+
* @returns {string} - Module Name
|
|
15269
|
+
* @private
|
|
15270
|
+
*/
|
|
15271
|
+
getModuleName() {
|
|
15272
|
+
return 'rating';
|
|
15273
|
+
}
|
|
15274
|
+
/**
|
|
15275
|
+
* To get the properties to be maintained in the persisted state.
|
|
15276
|
+
*
|
|
15277
|
+
* @returns {string} - Persist data
|
|
15278
|
+
*/
|
|
15279
|
+
getPersistData() {
|
|
15280
|
+
return this.addOnPersist([]);
|
|
15281
|
+
}
|
|
15282
|
+
removeItemElements() {
|
|
15283
|
+
for (let i = 0; i < this.itemElements.length; i++) {
|
|
15284
|
+
remove(this.itemElements[parseInt(i.toString(), 10)]);
|
|
15285
|
+
}
|
|
15286
|
+
this.itemElements = [];
|
|
15287
|
+
}
|
|
15288
|
+
/**
|
|
15289
|
+
* Destroys the Rating instance.
|
|
15290
|
+
*
|
|
15291
|
+
* @returns {void}
|
|
15292
|
+
*/
|
|
15293
|
+
destroy() {
|
|
15294
|
+
super.destroy();
|
|
15295
|
+
// unwires the events and detach the li elements
|
|
15296
|
+
this.removeItemElements();
|
|
15297
|
+
if (this.spanLabel) {
|
|
15298
|
+
remove(this.spanLabel);
|
|
15299
|
+
this.spanLabel = null;
|
|
15300
|
+
}
|
|
15301
|
+
if (this.resetElement) {
|
|
15302
|
+
remove(this.resetElement);
|
|
15303
|
+
this.resetElement = null;
|
|
15304
|
+
}
|
|
15305
|
+
if (this.showTooltip) {
|
|
15306
|
+
this.tooltipObj.destroy();
|
|
15307
|
+
this.tooltipObj = null;
|
|
15308
|
+
}
|
|
15309
|
+
remove(this.ratingItemList);
|
|
15310
|
+
this.ratingItemList = null;
|
|
15311
|
+
this.wrapper.parentNode.insertBefore(this.element, this.wrapper);
|
|
15312
|
+
remove(this.wrapper);
|
|
15313
|
+
this.wrapper = null;
|
|
15314
|
+
this.keyboardModuleRating.destroy();
|
|
15315
|
+
['value', 'aria-label', 'name'].forEach((attr) => {
|
|
15316
|
+
this.element.removeAttribute(attr);
|
|
15317
|
+
});
|
|
15318
|
+
}
|
|
15319
|
+
/**
|
|
15320
|
+
* Called internally if any of the property value changed.
|
|
15321
|
+
*
|
|
15322
|
+
* @param {RatingModel} newProp - Specifies new properties
|
|
15323
|
+
* @param {RatingModel} oldProp - Specifies old properties
|
|
15324
|
+
* @returns {void}
|
|
15325
|
+
* @private
|
|
15326
|
+
*/
|
|
15327
|
+
onPropertyChanged(newProp, oldProp) {
|
|
15328
|
+
for (const prop of Object.keys(newProp)) {
|
|
15329
|
+
switch (prop) {
|
|
15330
|
+
case 'value':
|
|
15331
|
+
this.triggerChange(null, (this.value > this.min) ? this.value : this.min, false);
|
|
15332
|
+
this.updateItemValue();
|
|
15333
|
+
this.updateLabel();
|
|
15334
|
+
break;
|
|
15335
|
+
case 'min':
|
|
15336
|
+
this.updateMinValue();
|
|
15337
|
+
this.updateItemValue();
|
|
15338
|
+
this.updateLabel();
|
|
15339
|
+
break;
|
|
15340
|
+
case 'showLabel':
|
|
15341
|
+
this.displayLabel();
|
|
15342
|
+
break;
|
|
15343
|
+
case 'visible':
|
|
15344
|
+
this.wrapper.classList[!this.visible ? 'add' : 'remove'](HIDDEN);
|
|
15345
|
+
break;
|
|
15346
|
+
case 'disabled':
|
|
15347
|
+
this.updateDisabled();
|
|
15348
|
+
break;
|
|
15349
|
+
case 'readOnly':
|
|
15350
|
+
this.wrapper.classList[this.readOnly ? 'add' : 'remove'](READONLY);
|
|
15351
|
+
break;
|
|
15352
|
+
case 'allowReset':
|
|
15353
|
+
this.updateReset();
|
|
15354
|
+
break;
|
|
15355
|
+
case 'enableRtl':
|
|
15356
|
+
this.wrapper.classList[this.enableRtl ? 'add' : 'remove'](RTL$2);
|
|
15357
|
+
break;
|
|
15358
|
+
case 'cssClass':
|
|
15359
|
+
if (oldProp.cssClass) {
|
|
15360
|
+
removeClass([this.wrapper], oldProp.cssClass.split(' '));
|
|
15361
|
+
}
|
|
15362
|
+
if (newProp.cssClass) {
|
|
15363
|
+
addClass([this.wrapper], newProp.cssClass.split(' '));
|
|
15364
|
+
}
|
|
15365
|
+
break;
|
|
15366
|
+
case 'labelPosition':
|
|
15367
|
+
this.updateLabelPosition();
|
|
15368
|
+
break;
|
|
15369
|
+
case 'showTooltip':
|
|
15370
|
+
this.updateTooltip();
|
|
15371
|
+
break;
|
|
15372
|
+
case 'precision':
|
|
15373
|
+
this.updatePrecision();
|
|
15374
|
+
this.updateLabel();
|
|
15375
|
+
break;
|
|
15376
|
+
case 'enableSingleSelection':
|
|
15377
|
+
this.updateItemValue();
|
|
15378
|
+
break;
|
|
15379
|
+
case 'enableAnimation':
|
|
15380
|
+
this.wrapper.classList[this.enableAnimation ? 'add' : 'remove'](ANIMATION);
|
|
15381
|
+
break;
|
|
15382
|
+
case 'emptyTemplate':
|
|
15383
|
+
case 'fullTemplate':
|
|
15384
|
+
this.updateTemplateFunction();
|
|
15385
|
+
this.updateContent();
|
|
15386
|
+
break;
|
|
15387
|
+
case 'labelTemplate':
|
|
15388
|
+
this.updateLabel();
|
|
15389
|
+
break;
|
|
15390
|
+
case 'itemsCount':
|
|
15391
|
+
this.removeItemElements();
|
|
15392
|
+
this.renderItems();
|
|
15393
|
+
this.updateItemValue();
|
|
15394
|
+
this.updateLabel();
|
|
15395
|
+
break;
|
|
15396
|
+
}
|
|
15397
|
+
}
|
|
15398
|
+
}
|
|
15399
|
+
};
|
|
15400
|
+
__decorate$8([
|
|
15401
|
+
Property(false)
|
|
15402
|
+
], Rating.prototype, "allowReset", void 0);
|
|
15403
|
+
__decorate$8([
|
|
15404
|
+
Property('')
|
|
15405
|
+
], Rating.prototype, "cssClass", void 0);
|
|
15406
|
+
__decorate$8([
|
|
15407
|
+
Property(false)
|
|
15408
|
+
], Rating.prototype, "disabled", void 0);
|
|
15409
|
+
__decorate$8([
|
|
15410
|
+
Property(true)
|
|
15411
|
+
], Rating.prototype, "enableAnimation", void 0);
|
|
15412
|
+
__decorate$8([
|
|
15413
|
+
Property('')
|
|
15414
|
+
], Rating.prototype, "emptyTemplate", void 0);
|
|
15415
|
+
__decorate$8([
|
|
15416
|
+
Property(false)
|
|
15417
|
+
], Rating.prototype, "enableSingleSelection", void 0);
|
|
15418
|
+
__decorate$8([
|
|
15419
|
+
Property('')
|
|
15420
|
+
], Rating.prototype, "fullTemplate", void 0);
|
|
15421
|
+
__decorate$8([
|
|
15422
|
+
Property(5)
|
|
15423
|
+
], Rating.prototype, "itemsCount", void 0);
|
|
15424
|
+
__decorate$8([
|
|
15425
|
+
Property(LabelPosition.Right)
|
|
15426
|
+
], Rating.prototype, "labelPosition", void 0);
|
|
15427
|
+
__decorate$8([
|
|
15428
|
+
Property('')
|
|
15429
|
+
], Rating.prototype, "labelTemplate", void 0);
|
|
15430
|
+
__decorate$8([
|
|
15431
|
+
Property(0.0)
|
|
15432
|
+
], Rating.prototype, "min", void 0);
|
|
15433
|
+
__decorate$8([
|
|
15434
|
+
Property(PrecisionType.Full)
|
|
15435
|
+
], Rating.prototype, "precision", void 0);
|
|
15436
|
+
__decorate$8([
|
|
15437
|
+
Property(false)
|
|
15438
|
+
], Rating.prototype, "readOnly", void 0);
|
|
15439
|
+
__decorate$8([
|
|
15440
|
+
Property(false)
|
|
15441
|
+
], Rating.prototype, "showLabel", void 0);
|
|
15442
|
+
__decorate$8([
|
|
15443
|
+
Property(true)
|
|
15444
|
+
], Rating.prototype, "showTooltip", void 0);
|
|
15445
|
+
__decorate$8([
|
|
15446
|
+
Property('')
|
|
15447
|
+
], Rating.prototype, "tooltipTemplate", void 0);
|
|
15448
|
+
__decorate$8([
|
|
15449
|
+
Property(0.0)
|
|
15450
|
+
], Rating.prototype, "value", void 0);
|
|
15451
|
+
__decorate$8([
|
|
15452
|
+
Property(true)
|
|
15453
|
+
], Rating.prototype, "visible", void 0);
|
|
15454
|
+
__decorate$8([
|
|
15455
|
+
Event()
|
|
15456
|
+
], Rating.prototype, "beforeItemRender", void 0);
|
|
15457
|
+
__decorate$8([
|
|
15458
|
+
Event()
|
|
15459
|
+
], Rating.prototype, "created", void 0);
|
|
15460
|
+
__decorate$8([
|
|
15461
|
+
Event()
|
|
15462
|
+
], Rating.prototype, "onItemHover", void 0);
|
|
15463
|
+
__decorate$8([
|
|
15464
|
+
Event()
|
|
15465
|
+
], Rating.prototype, "valueChanged", void 0);
|
|
15466
|
+
Rating = __decorate$8([
|
|
15467
|
+
NotifyPropertyChanges
|
|
15468
|
+
], Rating);
|
|
15469
|
+
|
|
15470
|
+
/**
|
|
15471
|
+
* Rating modules
|
|
15472
|
+
*/
|
|
15473
|
+
|
|
14653
15474
|
/**
|
|
14654
15475
|
* Signature base modules
|
|
14655
15476
|
*/
|
|
@@ -14658,5 +15479,5 @@ Signature = __decorate$7([
|
|
|
14658
15479
|
* NumericTextBox all modules
|
|
14659
15480
|
*/
|
|
14660
15481
|
|
|
14661
|
-
export { NumericTextBox, regularExpressions, createMask, applyMask, wireEvents, unwireEvents, bindClearEvent, unstrippedValue, strippedValue, maskInputMouseDownHandler, maskInputMouseUpHandler, maskInputFocusHandler, triggerFocus, 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, SignatureBase };
|
|
15482
|
+
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 };
|
|
14662
15483
|
//# sourceMappingURL=ej2-inputs.es2015.js.map
|