@syncfusion/ej2-inputs 21.2.9 → 22.1.34
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 +1 -0
- package/CHANGELOG.md +22 -0
- 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 +142 -109
- package/dist/es6/ej2-inputs.es2015.js.map +1 -1
- package/dist/es6/ej2-inputs.es5.js +144 -112
- 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 +9 -9
- package/src/color-picker/color-picker.d.ts +1 -0
- package/src/color-picker/color-picker.js +3 -14
- package/src/form-validator/form-validator.js +21 -3
- package/src/input/input.js +16 -10
- package/src/numerictextbox/numerictextbox.js +6 -2
- package/src/rating/rating-model.d.ts +31 -27
- package/src/rating/rating.d.ts +8 -4
- package/src/rating/rating.js +26 -19
- package/src/slider/slider.d.ts +31 -65
- package/src/slider/slider.js +69 -50
- package/src/textbox/textbox.js +3 -5
- package/src/uploader/uploader-model.d.ts +2 -1
- package/src/uploader/uploader.d.ts +2 -1
- package/src/uploader/uploader.js +2 -10
- package/styles/bootstrap-dark.css +22 -3
- package/styles/bootstrap.css +22 -3
- package/styles/bootstrap4.css +22 -4
- package/styles/bootstrap5-dark.css +22 -3
- package/styles/bootstrap5.css +22 -3
- package/styles/color-picker/_layout.scss +49 -5
- package/styles/color-picker/_material3-dark-definition.scss +1 -0
- package/styles/color-picker/_material3-definition.scss +141 -0
- package/styles/color-picker/_theme.scss +6 -1
- package/styles/color-picker/fluent-dark.css +1 -0
- package/styles/color-picker/fluent.css +1 -0
- package/styles/color-picker/icons/_material3-dark.scss +1 -0
- package/styles/color-picker/material3-dark.css +880 -0
- package/styles/color-picker/material3-dark.scss +12 -0
- package/styles/color-picker/material3.css +936 -0
- package/styles/color-picker/material3.scss +12 -0
- package/styles/fabric-dark.css +22 -3
- package/styles/fabric.css +22 -3
- package/styles/fluent-dark.css +23 -3
- package/styles/fluent.css +23 -3
- package/styles/highcontrast-light.css +22 -3
- package/styles/highcontrast.css +22 -3
- package/styles/input/_layout.scss +268 -107
- package/styles/input/_material3-dark-definition.scss +1 -0
- package/styles/input/_material3-definition.scss +548 -0
- package/styles/input/_theme.scss +3 -2
- package/styles/input/bootstrap-dark.css +14 -1
- package/styles/input/bootstrap.css +14 -1
- package/styles/input/bootstrap4.css +14 -1
- package/styles/input/bootstrap5-dark.css +14 -1
- package/styles/input/bootstrap5.css +14 -1
- package/styles/input/fabric-dark.css +14 -1
- package/styles/input/fabric.css +14 -1
- package/styles/input/fluent-dark.css +14 -1
- package/styles/input/fluent.css +14 -1
- package/styles/input/highcontrast-light.css +14 -1
- package/styles/input/highcontrast.css +14 -1
- package/styles/input/icons/_material3-dark.scss +1 -0
- package/styles/input/material-dark.css +92 -64
- package/styles/input/material.css +92 -64
- package/styles/input/material3-dark.css +12357 -0
- package/styles/input/material3-dark.scss +5 -0
- package/styles/input/material3.css +12413 -0
- package/styles/input/material3.scss +5 -0
- package/styles/input/tailwind-dark.css +14 -1
- package/styles/input/tailwind.css +14 -1
- package/styles/maskedtextbox/_material3-dark-definition.scss +1 -0
- package/styles/maskedtextbox/_material3-definition.scss +4 -0
- package/styles/maskedtextbox/material3-dark.css +104 -0
- package/styles/maskedtextbox/material3-dark.scss +5 -0
- package/styles/maskedtextbox/material3.css +160 -0
- package/styles/maskedtextbox/material3.scss +5 -0
- package/styles/material-dark.css +102 -66
- package/styles/material.css +102 -66
- package/styles/material3-dark.css +15119 -0
- package/styles/material3-dark.scss +11 -0
- package/styles/material3.css +15175 -0
- package/styles/material3.scss +11 -0
- package/styles/numerictextbox/_material3-dark-definition.scss +1 -0
- package/styles/numerictextbox/_material3-definition.scss +4 -0
- package/styles/numerictextbox/icons/_material3-dark.scss +1 -0
- package/styles/numerictextbox/material3-dark.css +118 -0
- package/styles/numerictextbox/material3-dark.scss +6 -0
- package/styles/numerictextbox/material3.css +174 -0
- package/styles/numerictextbox/material3.scss +6 -0
- package/styles/rating/_bootstrap-dark-definition.scss +4 -3
- package/styles/rating/_bootstrap-definition.scss +4 -3
- package/styles/rating/_bootstrap4-definition.scss +4 -3
- package/styles/rating/_bootstrap5-definition.scss +4 -0
- package/styles/rating/_fabric-dark-definition.scss +4 -3
- package/styles/rating/_fabric-definition.scss +4 -3
- package/styles/rating/_fluent-definition.scss +4 -0
- package/styles/rating/_fusionnew-definition.scss +4 -3
- package/styles/rating/_highcontrast-definition.scss +4 -3
- package/styles/rating/_highcontrast-light-definition.scss +4 -3
- package/styles/rating/_layout.scss +2 -0
- package/styles/rating/_material-dark-definition.scss +4 -3
- package/styles/rating/_material-definition.scss +4 -3
- package/styles/rating/_material3-dark-definition.scss +1 -0
- package/styles/rating/_material3-definition.scss +47 -0
- package/styles/rating/_tailwind-definition.scss +4 -0
- package/styles/rating/_theme.scss +36 -14
- package/styles/rating/bootstrap-dark.css +8 -2
- package/styles/rating/bootstrap.css +8 -2
- package/styles/rating/bootstrap4.css +8 -3
- package/styles/rating/bootstrap5-dark.css +8 -2
- package/styles/rating/bootstrap5.css +8 -2
- package/styles/rating/fabric-dark.css +8 -2
- package/styles/rating/fabric.css +8 -2
- package/styles/rating/fluent-dark.css +8 -2
- package/styles/rating/fluent.css +8 -2
- package/styles/rating/highcontrast-light.css +8 -2
- package/styles/rating/highcontrast.css +8 -2
- package/styles/rating/material-dark.css +8 -2
- package/styles/rating/material.css +8 -2
- package/styles/rating/material3-dark.css +340 -0
- package/styles/rating/material3-dark.scss +5 -0
- package/styles/rating/material3.css +396 -0
- package/styles/rating/material3.scss +5 -0
- package/styles/rating/tailwind-dark.css +8 -2
- package/styles/rating/tailwind.css +8 -2
- package/styles/signature/_material3-dark-definition.scss +1 -0
- package/styles/signature/_material3-definition.scss +3 -0
- package/styles/signature/material3-dark.css +65 -0
- package/styles/signature/material3-dark.scss +4 -0
- package/styles/signature/material3.css +121 -0
- package/styles/signature/material3.scss +4 -0
- package/styles/slider/_layout.scss +60 -15
- package/styles/slider/_material3-dark-definition.scss +1 -0
- package/styles/slider/_material3-definition.scss +97 -0
- package/styles/slider/_theme.scss +11 -2
- package/styles/slider/material-dark.css +2 -0
- package/styles/slider/material.css +2 -0
- package/styles/slider/material3-dark.css +765 -0
- package/styles/slider/material3-dark.scss +6 -0
- package/styles/slider/material3.css +821 -0
- package/styles/slider/material3.scss +6 -0
- package/styles/tailwind-dark.css +22 -3
- package/styles/tailwind.css +22 -3
- package/styles/textbox/_bootstrap-dark-definition.scss +3 -0
- package/styles/textbox/_bootstrap-definition.scss +3 -0
- package/styles/textbox/_bootstrap4-definition.scss +3 -0
- package/styles/textbox/_bootstrap5-definition.scss +3 -0
- package/styles/textbox/_fabric-dark-definition.scss +3 -0
- package/styles/textbox/_fabric-definition.scss +3 -0
- package/styles/textbox/_fluent-definition.scss +3 -0
- package/styles/textbox/_fusionnew-definition.scss +3 -0
- package/styles/textbox/_highcontrast-definition.scss +3 -0
- package/styles/textbox/_highcontrast-light-definition.scss +3 -0
- package/styles/textbox/_layout.scss +27 -0
- package/styles/textbox/_material-dark-definition.scss +3 -0
- package/styles/textbox/_material-definition.scss +3 -0
- package/styles/textbox/_material3-dark-definition.scss +1 -0
- package/styles/textbox/_material3-definition.scss +4 -0
- package/styles/textbox/_tailwind-definition.scss +3 -0
- package/styles/textbox/material3-dark.css +72 -0
- package/styles/textbox/material3-dark.scss +5 -0
- package/styles/textbox/material3.css +128 -0
- package/styles/textbox/material3.scss +5 -0
- package/styles/uploader/_material3-dark-definition.scss +1 -0
- package/styles/uploader/_material3-definition.scss +215 -0
- package/styles/uploader/icons/_material3-dark.scss +1 -0
- package/styles/uploader/material3-dark.css +861 -0
- package/styles/uploader/material3-dark.scss +7 -0
- package/styles/uploader/material3.css +917 -0
- package/styles/uploader/material3.scss +7 -0
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version :
|
|
3
|
+
* version : 22.1.34
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-inputs@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-inputs@
|
|
3
|
+
"_id": "@syncfusion/ej2-inputs@18.74.0",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-x9jghchba/Xily/58EMO4f9+dcFmmX4AufdAPHex+2tEM2GyPU2bCu+Ol0yGQ/bNA65VtXo0pYUeQr/Wh8oh6w==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-inputs",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"/@syncfusion/ej2-schedule",
|
|
40
40
|
"/@syncfusion/ej2-vue-inputs"
|
|
41
41
|
],
|
|
42
|
-
"_resolved": "https://nexus.syncfusion.com/repository/ej2-
|
|
43
|
-
"_shasum": "
|
|
42
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-inputs/-/ej2-inputs-18.74.0.tgz",
|
|
43
|
+
"_shasum": "dff7895481b1426f52f2297c62534349625f6d84",
|
|
44
44
|
"_spec": "@syncfusion/ej2-inputs@*",
|
|
45
45
|
"_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
|
|
46
46
|
"author": {
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
},
|
|
49
49
|
"bundleDependencies": false,
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@syncfusion/ej2-base": "~
|
|
52
|
-
"@syncfusion/ej2-buttons": "~
|
|
53
|
-
"@syncfusion/ej2-popups": "~
|
|
54
|
-
"@syncfusion/ej2-splitbuttons": "~
|
|
51
|
+
"@syncfusion/ej2-base": "~22.1.34",
|
|
52
|
+
"@syncfusion/ej2-buttons": "~22.1.34",
|
|
53
|
+
"@syncfusion/ej2-popups": "~22.1.34",
|
|
54
|
+
"@syncfusion/ej2-splitbuttons": "~22.1.34"
|
|
55
55
|
},
|
|
56
56
|
"deprecated": false,
|
|
57
57
|
"description": "A package of Essential JS 2 input components such as Textbox, Color-picker, Masked-textbox, Numeric-textbox, Slider, Upload, and Form-validator that is used to get input from the users.",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/inputs"
|
|
120
120
|
},
|
|
121
121
|
"typings": "index.d.ts",
|
|
122
|
-
"version": "
|
|
122
|
+
"version": "22.1.34",
|
|
123
123
|
"sideEffects": false,
|
|
124
124
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
125
125
|
}
|
|
@@ -1186,23 +1186,12 @@ var ColorPicker = /** @class */ (function (_super) {
|
|
|
1186
1186
|
};
|
|
1187
1187
|
ColorPicker.prototype.paletteKeyDown = function (e) {
|
|
1188
1188
|
var target = e.target;
|
|
1189
|
+
if (!target.classList.contains(PALETTES)) {
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1189
1192
|
var selectedEle;
|
|
1190
1193
|
var idx;
|
|
1191
1194
|
var tiles = [].slice.call(selectAll('.' + TILE, target));
|
|
1192
|
-
if ((target.classList.contains('e-palette') || target.classList.contains('e-tile')) && (e.keyCode === 9 && !e.shiftKey)) {
|
|
1193
|
-
if (this.modeSwitcher || this.showButtons) {
|
|
1194
|
-
this.getPopupEle().querySelector('.e-btn').focus();
|
|
1195
|
-
e.preventDefault();
|
|
1196
|
-
e.stopPropagation();
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
else if ((target.classList.contains('e-palette') || target.classList.contains('e-tile')) && (e.keyCode === 9 && e.shiftKey)) {
|
|
1200
|
-
if (this.splitBtn) {
|
|
1201
|
-
this.splitBtn.element.focus();
|
|
1202
|
-
e.preventDefault();
|
|
1203
|
-
e.stopPropagation();
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
1195
|
var prevSelectedEle = (tiles.filter(function (tile) { return tile.classList.contains('e-selected'); })).pop();
|
|
1207
1196
|
switch (!e.altKey && e.keyCode) {
|
|
1208
1197
|
case 39:
|
|
@@ -20,7 +20,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
20
20
|
import { selectAll, select, createElement, Base, detach } from '@syncfusion/ej2-base';
|
|
21
21
|
import { extend, isNullOrUndefined, EventHandler } from '@syncfusion/ej2-base';
|
|
22
22
|
import { Property, NotifyPropertyChanges, Event, onIntlChange } from '@syncfusion/ej2-base';
|
|
23
|
-
import { L10n } from '@syncfusion/ej2-base';
|
|
23
|
+
import { Internationalization, L10n } from '@syncfusion/ej2-base';
|
|
24
24
|
/**
|
|
25
25
|
* global declarations
|
|
26
26
|
*/
|
|
@@ -668,7 +668,17 @@ var FormValidator = /** @class */ (function (_super) {
|
|
|
668
668
|
this.customPlacement.call(this, this.inputElement, errorElement);
|
|
669
669
|
}
|
|
670
670
|
else {
|
|
671
|
-
|
|
671
|
+
var inputParent = this.inputElement.parentElement;
|
|
672
|
+
var grandParent = inputParent.parentElement;
|
|
673
|
+
if (inputParent.classList.contains('e-control-wrapper') || inputParent.classList.contains('e-wrapper')) {
|
|
674
|
+
grandParent.insertBefore(errorElement, inputParent.nextSibling);
|
|
675
|
+
}
|
|
676
|
+
else if (grandParent.classList.contains('e-control-wrapper') || grandParent.classList.contains('e-wrapper')) {
|
|
677
|
+
grandParent.parentElement.insertBefore(errorElement, grandParent.nextSibling);
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
inputParent.insertBefore(errorElement, this.inputElement.nextSibling);
|
|
681
|
+
}
|
|
672
682
|
}
|
|
673
683
|
errorElement.style.display = 'block';
|
|
674
684
|
this.getErrorElement(name);
|
|
@@ -763,7 +773,15 @@ var FormValidator = /** @class */ (function (_super) {
|
|
|
763
773
|
return !isNaN(Number(option.value)) && Number(option.value) >= param[0] && Number(option.value) <= param[1];
|
|
764
774
|
},
|
|
765
775
|
date: function (option) {
|
|
766
|
-
|
|
776
|
+
if (!isNullOrUndefined(option.param) && (typeof (option.param) === 'string' && option.param !== '')) {
|
|
777
|
+
var globalize = new Internationalization;
|
|
778
|
+
var dateOptions = { format: option.param.toString(), type: 'dateTime', skeleton: 'yMd' };
|
|
779
|
+
var dateValue = globalize.parseDate(option.value, dateOptions);
|
|
780
|
+
return (!isNullOrUndefined(dateValue) && dateValue instanceof Date && !isNaN(+dateValue));
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
return !isNaN(new Date(option.value).getTime());
|
|
784
|
+
}
|
|
767
785
|
},
|
|
768
786
|
max: function (option) {
|
|
769
787
|
if (!isNaN(Number(option.value))) {
|
package/src/input/input.js
CHANGED
|
@@ -55,14 +55,14 @@ export var Input;
|
|
|
55
55
|
}
|
|
56
56
|
bindInitialEvent(args);
|
|
57
57
|
if (!isNullOrUndefined(args.properties) && !isNullOrUndefined(args.properties.showClearButton) &&
|
|
58
|
-
args.properties.showClearButton
|
|
58
|
+
args.properties.showClearButton) {
|
|
59
59
|
setClearButton(args.properties.showClearButton, args.element, inputObject, true, makeElement);
|
|
60
60
|
inputObject.clearButton.setAttribute('role', 'button');
|
|
61
61
|
if (inputObject.container.classList.contains(CLASSNAMES.FLOATINPUT)) {
|
|
62
62
|
addClass([inputObject.container], CLASSNAMES.INPUTGROUP);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
if (!isNullOrUndefined(args.buttons)
|
|
65
|
+
if (!isNullOrUndefined(args.buttons)) {
|
|
66
66
|
for (var i = 0; i < args.buttons.length; i++) {
|
|
67
67
|
inputObject.buttons.push(appendSpan(args.buttons[i], inputObject.container, makeElement));
|
|
68
68
|
}
|
|
@@ -86,9 +86,11 @@ export var Input;
|
|
|
86
86
|
|| parent.classList.contains('e-filled')) {
|
|
87
87
|
parent.classList.add('e-input-focus');
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
if (args.floatLabelType === 'Auto') {
|
|
90
|
+
setTimeout(function () {
|
|
91
|
+
Input.calculateWidth(args.element, parent);
|
|
92
|
+
}, 80);
|
|
93
|
+
}
|
|
92
94
|
});
|
|
93
95
|
args.element.addEventListener('blur', function () {
|
|
94
96
|
var parent = getParentNode(this);
|
|
@@ -96,9 +98,11 @@ export var Input;
|
|
|
96
98
|
|| parent.classList.contains('e-filled')) {
|
|
97
99
|
parent.classList.remove('e-input-focus');
|
|
98
100
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
if (args.floatLabelType === 'Auto' && args.element.value === '') {
|
|
102
|
+
setTimeout(function () {
|
|
103
|
+
Input.calculateWidth(args.element, parent);
|
|
104
|
+
}, 80);
|
|
105
|
+
}
|
|
102
106
|
});
|
|
103
107
|
args.element.addEventListener('input', function () {
|
|
104
108
|
checkInputValue(floatType, args.element);
|
|
@@ -304,7 +308,7 @@ export var Input;
|
|
|
304
308
|
}
|
|
305
309
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
306
310
|
function wireClearBtnEvents(element, button, container) {
|
|
307
|
-
if (
|
|
311
|
+
if (isBindClearAction === undefined || isBindClearAction) {
|
|
308
312
|
button.addEventListener('click', function (event) {
|
|
309
313
|
if (!(element.classList.contains(CLASSNAMES.DISABLE) || element.readOnly)) {
|
|
310
314
|
event.preventDefault();
|
|
@@ -385,7 +389,9 @@ export var Input;
|
|
|
385
389
|
*/
|
|
386
390
|
function setValue(value, element, floatLabelType, clearButton) {
|
|
387
391
|
element.value = value;
|
|
388
|
-
|
|
392
|
+
if (floatLabelType === 'Auto' && value === '') {
|
|
393
|
+
calculateWidth(element, element.parentElement);
|
|
394
|
+
}
|
|
389
395
|
if ((!isNullOrUndefined(floatLabelType)) && floatLabelType === 'Auto') {
|
|
390
396
|
validateLabel(element, floatLabelType);
|
|
391
397
|
}
|
|
@@ -1071,8 +1071,12 @@ var NumericTextBox = /** @class */ (function (_super) {
|
|
|
1071
1071
|
event.stopPropagation();
|
|
1072
1072
|
clearInterval(this.timeOut);
|
|
1073
1073
|
this.isCalled = false;
|
|
1074
|
-
|
|
1075
|
-
|
|
1074
|
+
if (this.spinUp) {
|
|
1075
|
+
EventHandler.remove(this.spinUp, 'mouseleave', this.mouseUpClick);
|
|
1076
|
+
}
|
|
1077
|
+
if (this.spinDown) {
|
|
1078
|
+
EventHandler.remove(this.spinDown, 'mouseleave', this.mouseUpClick);
|
|
1079
|
+
}
|
|
1076
1080
|
};
|
|
1077
1081
|
/**
|
|
1078
1082
|
* Increments the NumericTextBox value with the specified step value.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addClass, Event, attributes, BaseEventArgs, compile, Component, EmitType, EventHandler, getUniqueID, INotifyPropertyChanged, select, Browser } from '@syncfusion/ej2-base';import { isNullOrUndefined, KeyboardEventArgs, KeyboardEvents, MouseEventArgs, NotifyPropertyChanges, Property, remove, removeClass } from '@syncfusion/ej2-base';import { Tooltip } from '@syncfusion/ej2-popups';
|
|
1
|
+
import { addClass, Event, attributes, BaseEventArgs, compile, Component, EmitType, EventHandler, getUniqueID, INotifyPropertyChanged, select, Browser, append } from '@syncfusion/ej2-base';import { isNullOrUndefined, KeyboardEventArgs, KeyboardEvents, MouseEventArgs, NotifyPropertyChanges, Property, remove, removeClass, initializeCSPTemplate } from '@syncfusion/ej2-base';import { Tooltip } from '@syncfusion/ej2-popups';
|
|
2
2
|
import {LabelPosition,PrecisionType,RatingItemEventArgs,RatingHoverEventArgs,RatingChangedEventArgs} from "./rating";
|
|
3
3
|
import {ComponentModel} from '@syncfusion/ej2-base';
|
|
4
4
|
|
|
@@ -10,9 +10,9 @@ export interface RatingModel extends ComponentModel{
|
|
|
10
10
|
/**
|
|
11
11
|
* Defines whether to show or hide the reset button in a rating component.
|
|
12
12
|
* When set to "true", the reset button will be visible to the user, and they will be able to click it to reset the rating value to its default value.
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
14
|
* {% codeBlock src='rating/allowReset/index.md' %}{% endcodeBlock %}
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
16
|
* @default false
|
|
17
17
|
*/
|
|
18
18
|
allowReset?: boolean;
|
|
@@ -38,8 +38,9 @@ export interface RatingModel extends ComponentModel{
|
|
|
38
38
|
* Defines the template that defines the appearance of each un-rated item in a rating component.
|
|
39
39
|
*
|
|
40
40
|
* @default ''
|
|
41
|
+
* @aspType string
|
|
41
42
|
*/
|
|
42
|
-
emptyTemplate?: string;
|
|
43
|
+
emptyTemplate?: string | Function;
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* Defines whether to add animation (to provide visual feedback to the user) when an item in a rating component is hovered.
|
|
@@ -60,12 +61,13 @@ export interface RatingModel extends ComponentModel{
|
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* Defines the template that defines the appearance of each rated item in a rating component.
|
|
63
|
-
*
|
|
64
|
+
*
|
|
64
65
|
* {% codeBlock src='rating/fullTemplate/index.md' %}{% endcodeBlock %}
|
|
65
|
-
*
|
|
66
|
+
*
|
|
66
67
|
* @default ''
|
|
68
|
+
* @aspType string
|
|
67
69
|
*/
|
|
68
|
-
fullTemplate?: string;
|
|
70
|
+
fullTemplate?: string | Function;
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
73
|
* Defines the specific number of items (symbols) in rating component.
|
|
@@ -84,9 +86,9 @@ export interface RatingModel extends ComponentModel{
|
|
|
84
86
|
* * Bottom
|
|
85
87
|
* * Left
|
|
86
88
|
* * Right
|
|
87
|
-
*
|
|
89
|
+
*
|
|
88
90
|
* {% codeBlock src='rating/labelPosition/index.md' %}{% endcodeBlock %}
|
|
89
|
-
*
|
|
91
|
+
*
|
|
90
92
|
* @isenumeration true
|
|
91
93
|
* @default LabelPosition.Right
|
|
92
94
|
* @asptype LabelPosition
|
|
@@ -95,12 +97,13 @@ export interface RatingModel extends ComponentModel{
|
|
|
95
97
|
|
|
96
98
|
/**
|
|
97
99
|
* Defines the template that used as label over default label of the rating. The current value of rating passed as context to build the content.
|
|
98
|
-
*
|
|
100
|
+
*
|
|
99
101
|
* {% codeBlock src='rating/labelTemplate/index.md' %}{% endcodeBlock %}
|
|
100
|
-
*
|
|
102
|
+
*
|
|
101
103
|
* @default ''
|
|
104
|
+
* @aspType string
|
|
102
105
|
*/
|
|
103
|
-
labelTemplate?: string;
|
|
106
|
+
labelTemplate?: string | Function;
|
|
104
107
|
|
|
105
108
|
/**
|
|
106
109
|
* Defines the value that specifies minimum rating that a user can select.
|
|
@@ -120,9 +123,9 @@ export interface RatingModel extends ComponentModel{
|
|
|
120
123
|
* * Half
|
|
121
124
|
* * Quarter
|
|
122
125
|
* * Exact
|
|
123
|
-
*
|
|
126
|
+
*
|
|
124
127
|
* {% codeBlock src='rating/precision/index.md' %}{% endcodeBlock %}
|
|
125
|
-
*
|
|
128
|
+
*
|
|
126
129
|
* @isenumeration true
|
|
127
130
|
* @default PrecisionType.Full
|
|
128
131
|
* @asptype PrecisionType
|
|
@@ -140,9 +143,9 @@ export interface RatingModel extends ComponentModel{
|
|
|
140
143
|
/**
|
|
141
144
|
* Defines a value that specifies whether to display a label that shows the current value of a rating.
|
|
142
145
|
* When set to "true", a label will be displayed that shows the current value of the rating; otherwise false.
|
|
143
|
-
*
|
|
146
|
+
*
|
|
144
147
|
* {% codeBlock src='rating/showLabel/index.md' %}{% endcodeBlock %}
|
|
145
|
-
*
|
|
148
|
+
*
|
|
146
149
|
* @default false
|
|
147
150
|
*/
|
|
148
151
|
showLabel?: boolean;
|
|
@@ -158,21 +161,22 @@ export interface RatingModel extends ComponentModel{
|
|
|
158
161
|
/**
|
|
159
162
|
* Defines the template that used as tooltip content over default tooltip content of the rating.
|
|
160
163
|
* The current value of rating passed as context to build the content.
|
|
161
|
-
*
|
|
164
|
+
*
|
|
162
165
|
* {% codeBlock src='rating/tooltipTemplate/index.md' %}{% endcodeBlock %}
|
|
163
|
-
*
|
|
166
|
+
*
|
|
164
167
|
* @default ''
|
|
168
|
+
* @aspType string
|
|
165
169
|
*/
|
|
166
|
-
tooltipTemplate?: string;
|
|
170
|
+
tooltipTemplate?: string | Function;
|
|
167
171
|
|
|
168
172
|
/**
|
|
169
173
|
* Defines the current rating value which used to display and update the rating selected by the user.
|
|
170
174
|
* Based on "PrecisionType", users can select ratings with varying levels of precision.
|
|
171
175
|
* The "value" is a decimal value that ranges from the minimum value to the items count,
|
|
172
176
|
* as specified by the "min" and "itemsCount" properties of the rating.
|
|
173
|
-
*
|
|
177
|
+
*
|
|
174
178
|
* {% codeBlock src='rating/value/index.md' %}{% endcodeBlock %}
|
|
175
|
-
*
|
|
179
|
+
*
|
|
176
180
|
* @default 0.0
|
|
177
181
|
* @aspType double
|
|
178
182
|
*/
|
|
@@ -188,9 +192,9 @@ export interface RatingModel extends ComponentModel{
|
|
|
188
192
|
|
|
189
193
|
/**
|
|
190
194
|
* Event callback that is raised before rendering each item.
|
|
191
|
-
*
|
|
195
|
+
*
|
|
192
196
|
* {% codeBlock src='rating/beforeItemRenderEvent/index.md' %}{% endcodeBlock %}
|
|
193
|
-
*
|
|
197
|
+
*
|
|
194
198
|
* @event beforeItemRender
|
|
195
199
|
*/
|
|
196
200
|
beforeItemRender?: EmitType<RatingItemEventArgs>;
|
|
@@ -204,18 +208,18 @@ export interface RatingModel extends ComponentModel{
|
|
|
204
208
|
|
|
205
209
|
/**
|
|
206
210
|
* Event callback that is raised when a user hovers over an item.
|
|
207
|
-
*
|
|
211
|
+
*
|
|
208
212
|
* {% codeBlock src='rating/onItemHoverEvent/index.md' %}{% endcodeBlock %}
|
|
209
|
-
*
|
|
213
|
+
*
|
|
210
214
|
* @event onItemHover
|
|
211
215
|
*/
|
|
212
216
|
onItemHover?: EmitType<RatingHoverEventArgs>;
|
|
213
217
|
|
|
214
218
|
/**
|
|
215
219
|
* Event callback that is raised when the value is changed.
|
|
216
|
-
*
|
|
220
|
+
*
|
|
217
221
|
* {% codeBlock src='rating/valueChangedEvent/index.md' %}{% endcodeBlock %}
|
|
218
|
-
*
|
|
222
|
+
*
|
|
219
223
|
* @event valueChanged
|
|
220
224
|
*/
|
|
221
225
|
valueChanged?: EmitType<RatingChangedEventArgs>;
|
package/src/rating/rating.d.ts
CHANGED
|
@@ -137,8 +137,9 @@ export declare class Rating extends Component<HTMLElement> implements INotifyPro
|
|
|
137
137
|
* Defines the template that defines the appearance of each un-rated item in a rating component.
|
|
138
138
|
*
|
|
139
139
|
* @default ''
|
|
140
|
+
* @aspType string
|
|
140
141
|
*/
|
|
141
|
-
emptyTemplate: string;
|
|
142
|
+
emptyTemplate: string | Function;
|
|
142
143
|
/**
|
|
143
144
|
* Defines whether to add animation (to provide visual feedback to the user) when an item in a rating component is hovered.
|
|
144
145
|
* When set to "true", an animation will be added when the user hovers their cursor over an item in the rating component.
|
|
@@ -160,8 +161,9 @@ export declare class Rating extends Component<HTMLElement> implements INotifyPro
|
|
|
160
161
|
* {% codeBlock src='rating/fullTemplate/index.md' %}{% endcodeBlock %}
|
|
161
162
|
*
|
|
162
163
|
* @default ''
|
|
164
|
+
* @aspType string
|
|
163
165
|
*/
|
|
164
|
-
fullTemplate: string;
|
|
166
|
+
fullTemplate: string | Function;
|
|
165
167
|
/**
|
|
166
168
|
* Defines the specific number of items (symbols) in rating component.
|
|
167
169
|
* The rating component typically consists of a number of items, such as stars or other symbols, that represent the rating value.
|
|
@@ -192,8 +194,9 @@ export declare class Rating extends Component<HTMLElement> implements INotifyPro
|
|
|
192
194
|
* {% codeBlock src='rating/labelTemplate/index.md' %}{% endcodeBlock %}
|
|
193
195
|
*
|
|
194
196
|
* @default ''
|
|
197
|
+
* @aspType string
|
|
195
198
|
*/
|
|
196
|
-
labelTemplate: string;
|
|
199
|
+
labelTemplate: string | Function;
|
|
197
200
|
/**
|
|
198
201
|
* Defines the value that specifies minimum rating that a user can select.
|
|
199
202
|
* The value is set to 0, which means that the minimum possible rating is 0.
|
|
@@ -249,8 +252,9 @@ export declare class Rating extends Component<HTMLElement> implements INotifyPro
|
|
|
249
252
|
* {% codeBlock src='rating/tooltipTemplate/index.md' %}{% endcodeBlock %}
|
|
250
253
|
*
|
|
251
254
|
* @default ''
|
|
255
|
+
* @aspType string
|
|
252
256
|
*/
|
|
253
|
-
tooltipTemplate: string;
|
|
257
|
+
tooltipTemplate: string | Function;
|
|
254
258
|
/**
|
|
255
259
|
* Defines the current rating value which used to display and update the rating selected by the user.
|
|
256
260
|
* Based on "PrecisionType", users can select ratings with varying levels of precision.
|
package/src/rating/rating.js
CHANGED
|
@@ -17,8 +17,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
17
17
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
19
|
};
|
|
20
|
-
import { addClass, Event, attributes, compile, Component, EventHandler, getUniqueID, select, Browser } from '@syncfusion/ej2-base';
|
|
21
|
-
import { isNullOrUndefined, KeyboardEvents, NotifyPropertyChanges, Property, remove, removeClass } from '@syncfusion/ej2-base';
|
|
20
|
+
import { addClass, Event, attributes, compile, Component, EventHandler, getUniqueID, select, Browser, append } from '@syncfusion/ej2-base';
|
|
21
|
+
import { isNullOrUndefined, KeyboardEvents, NotifyPropertyChanges, Property, remove, removeClass, initializeCSPTemplate } from '@syncfusion/ej2-base';
|
|
22
22
|
import { Tooltip } from '@syncfusion/ej2-popups';
|
|
23
23
|
var ICONCSS = 'e-rating-icon e-icons e-star-filled';
|
|
24
24
|
var ITEMLIST = 'e-rating-item-list';
|
|
@@ -196,8 +196,8 @@ var Rating = /** @class */ (function (_super) {
|
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
198
|
var previousValue = this.currentValue;
|
|
199
|
-
this.updateCurrentValue(currValue);
|
|
200
199
|
this.triggerChange(e, currValue);
|
|
200
|
+
this.updateCurrentValue(currValue);
|
|
201
201
|
if (this.showTooltip) {
|
|
202
202
|
if (element) {
|
|
203
203
|
if (Math.ceil(currValue) !== Math.ceil(previousValue)) {
|
|
@@ -241,11 +241,11 @@ var Rating = /** @class */ (function (_super) {
|
|
|
241
241
|
}
|
|
242
242
|
if (this.fullTemplate && val === 1) {
|
|
243
243
|
spanEle.classList.add(FULLTEMPLATE);
|
|
244
|
-
|
|
244
|
+
append(this.fullTemplateFunction({ index: index, ratingValue: val }, this, 'ratingFullTemplate', (this.element.id + 'fullTemplate'), this.isStringTemplate), spanEle);
|
|
245
245
|
}
|
|
246
246
|
else if (this.emptyTemplate) {
|
|
247
247
|
spanEle.classList.add(EMPTYTEMPLATE);
|
|
248
|
-
|
|
248
|
+
append(this.emptyTemplateFunction({ index: index, ratingValue: val }, this, 'ratingEmptyTemplate', (this.element.id + 'emptyTemplate'), this.isStringTemplate), spanEle);
|
|
249
249
|
}
|
|
250
250
|
else {
|
|
251
251
|
addClass([spanEle], ICONCSS.split(' '));
|
|
@@ -255,7 +255,7 @@ var Rating = /** @class */ (function (_super) {
|
|
|
255
255
|
spanEle.classList.remove(FULLTEMPLATE, EMPTYTEMPLATE);
|
|
256
256
|
removeClass([spanEle], ICONCSS.split(' '));
|
|
257
257
|
if (spanEle.firstChild) {
|
|
258
|
-
spanEle.
|
|
258
|
+
spanEle.innerHTML = '';
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
Rating.prototype.updateTooltip = function () {
|
|
@@ -340,7 +340,7 @@ var Rating = /** @class */ (function (_super) {
|
|
|
340
340
|
}
|
|
341
341
|
this.removeItemContent(spanEle);
|
|
342
342
|
spanEle.classList.add(FULLTEMPLATE);
|
|
343
|
-
|
|
343
|
+
append(this.fullTemplateFunction({ ratingValue: ratingValue, index: index }, this, 'ratingFullTemplate', (this.element.id + 'fullTemplate' + index), this.isStringTemplate), spanEle);
|
|
344
344
|
}
|
|
345
345
|
else if (this.emptyTemplate) {
|
|
346
346
|
if (!this.isReact && spanEle.classList.contains(EMPTYTEMPLATE)) {
|
|
@@ -348,7 +348,7 @@ var Rating = /** @class */ (function (_super) {
|
|
|
348
348
|
}
|
|
349
349
|
this.removeItemContent(spanEle);
|
|
350
350
|
spanEle.classList.add(EMPTYTEMPLATE);
|
|
351
|
-
|
|
351
|
+
append(this.emptyTemplateFunction({ ratingValue: ratingValue, index: index }, this, 'ratingEmptyTemplate', (this.element.id + 'emptyTemplate' + index), this.isStringTemplate), spanEle);
|
|
352
352
|
}
|
|
353
353
|
else {
|
|
354
354
|
this.removeItemContent(spanEle);
|
|
@@ -360,25 +360,32 @@ var Rating = /** @class */ (function (_super) {
|
|
|
360
360
|
if (this.isReact) {
|
|
361
361
|
this.clearTemplate(['ratingTooltipTemplate']);
|
|
362
362
|
}
|
|
363
|
-
var
|
|
363
|
+
var content_1;
|
|
364
364
|
if (this.tooltipTemplate) {
|
|
365
|
+
content_1 = this.createElement('span', { className: 'e-rating-tooltip-content' });
|
|
365
366
|
var templateFunction = this.getTemplateString(this.tooltipTemplate);
|
|
366
|
-
|
|
367
|
+
append(templateFunction({ value: this.currentValue }, this, 'ratingTooltipTemplate', (this.element.id + 'tooltipTemplate'), this.isStringTemplate), content_1);
|
|
368
|
+
this.tooltipObj.setProperties({ content: content_1 }, isChange);
|
|
367
369
|
}
|
|
368
370
|
else {
|
|
369
|
-
|
|
371
|
+
content_1 = this.currentValue.toString();
|
|
372
|
+
this.tooltipObj.setProperties({ content: initializeCSPTemplate(function () { return content_1; }) }, isChange);
|
|
370
373
|
}
|
|
371
|
-
this.tooltipObj.setProperties({ content: content }, isChange);
|
|
372
374
|
this.renderReactTemplates();
|
|
373
375
|
}
|
|
374
376
|
};
|
|
375
377
|
Rating.prototype.getTemplateString = function (template) {
|
|
376
378
|
var stringContent = '';
|
|
377
379
|
try {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
if (typeof template !== 'function') {
|
|
381
|
+
var tempEle = select(template);
|
|
382
|
+
if (tempEle) {
|
|
383
|
+
//Return innerHTML incase of jsrenderer script else outerHTML
|
|
384
|
+
stringContent = tempEle.tagName === 'SCRIPT' ? tempEle.innerHTML : tempEle.outerHTML;
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
stringContent = template;
|
|
388
|
+
}
|
|
382
389
|
}
|
|
383
390
|
else {
|
|
384
391
|
stringContent = template;
|
|
@@ -409,10 +416,10 @@ var Rating = /** @class */ (function (_super) {
|
|
|
409
416
|
this.clearTemplate(['ratingLabelTemplate']);
|
|
410
417
|
}
|
|
411
418
|
if (this.spanLabel.firstChild) {
|
|
412
|
-
this.spanLabel.
|
|
419
|
+
this.spanLabel.innerHTML = '';
|
|
413
420
|
}
|
|
414
421
|
var templateFunction = this.getTemplateString(this.labelTemplate);
|
|
415
|
-
|
|
422
|
+
append(templateFunction({ value: this.currentValue }, this, 'ratingLabelTemplate', (this.element.id + 'labelTemplate'), this.isStringTemplate), this.spanLabel);
|
|
416
423
|
this.renderReactTemplates();
|
|
417
424
|
}
|
|
418
425
|
else {
|
|
@@ -500,7 +507,7 @@ var Rating = /** @class */ (function (_super) {
|
|
|
500
507
|
if (this.showTooltip) {
|
|
501
508
|
if (!this.tooltipOpen) {
|
|
502
509
|
this.updateTooltipContent(false);
|
|
503
|
-
this.tooltipObj.open(element);
|
|
510
|
+
this.tooltipObj.open(element);
|
|
504
511
|
this.tooltipOpen = true;
|
|
505
512
|
}
|
|
506
513
|
else if (isChange) {
|