@syncfusion/ej2-inputs 25.2.6 → 26.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +3 -2
- package/README.md +13 -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 +1090 -449
- package/dist/es6/ej2-inputs.es2015.js.map +1 -1
- package/dist/es6/ej2-inputs.es5.js +1050 -389
- 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/otp-input.d.ts +4 -0
- package/otp-input.js +4 -0
- package/package.json +10 -10
- package/src/form-validator/form-validator.d.ts +6 -3
- package/src/form-validator/form-validator.js +31 -27
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/input/input.d.ts +2 -2
- package/src/input/input.js +63 -56
- package/src/maskedtextbox/base/mask-base.d.ts +1 -1
- package/src/maskedtextbox/base/mask-base.js +1 -1
- package/src/maskedtextbox/maskedtextbox/maskedtextbox-model.d.ts +2 -2
- package/src/maskedtextbox/maskedtextbox/maskedtextbox.d.ts +1 -2
- package/src/maskedtextbox/maskedtextbox/maskedtextbox.js +6 -7
- package/src/numerictextbox/numerictextbox.d.ts +2 -3
- package/src/numerictextbox/numerictextbox.js +14 -18
- package/src/otp-input/index.d.ts +5 -0
- package/src/otp-input/index.js +4 -0
- package/src/otp-input/otp-input-model.d.ts +142 -0
- package/src/otp-input/otp-input.d.ts +313 -0
- package/src/otp-input/otp-input.js +651 -0
- package/src/rating/rating.d.ts +0 -2
- package/src/rating/rating.js +4 -4
- package/src/slider/slider-model.d.ts +11 -6
- package/src/slider/slider.d.ts +21 -8
- package/src/slider/slider.js +191 -101
- package/src/textarea/textarea-model.d.ts +8 -2
- package/src/textarea/textarea.d.ts +9 -4
- package/src/textarea/textarea.js +17 -21
- package/src/textbox/textbox.d.ts +1 -3
- package/src/textbox/textbox.js +15 -11
- package/src/uploader/uploader.d.ts +1 -3
- package/src/uploader/uploader.js +27 -47
- package/styles/bootstrap-dark.css +1041 -1031
- package/styles/bootstrap-dark.scss +35 -11
- package/styles/bootstrap.css +1040 -1027
- package/styles/bootstrap.scss +35 -11
- package/styles/bootstrap4.css +1097 -1080
- package/styles/bootstrap4.scss +35 -11
- package/styles/bootstrap5-dark.css +1236 -1219
- package/styles/bootstrap5-dark.scss +35 -11
- package/styles/bootstrap5.css +1236 -1219
- package/styles/bootstrap5.scss +35 -11
- package/styles/color-picker/_bds-definition.scss +11 -1
- package/styles/color-picker/_bootstrap-dark-definition.scss +0 -3
- package/styles/color-picker/_bootstrap5-definition.scss +0 -1
- package/styles/color-picker/_bootstrap5.3-definition.scss +132 -0
- package/styles/color-picker/_fabric-dark-definition.scss +0 -3
- package/styles/color-picker/_fluent-definition.scss +0 -1
- package/styles/color-picker/_fluent2-definition.scss +143 -0
- package/styles/color-picker/_fusionnew-definition.scss +0 -1
- package/styles/color-picker/_highcontrast-light-definition.scss +0 -3
- package/styles/color-picker/_layout.scss +69 -34
- package/styles/color-picker/_material-dark-definition.scss +0 -3
- package/styles/color-picker/_material3-definition.scss +0 -1
- package/styles/color-picker/_tailwind-definition.scss +0 -1
- package/styles/color-picker/_theme.scss +13 -2
- package/styles/color-picker/bootstrap-dark.css +54 -20
- package/styles/color-picker/bootstrap.css +54 -20
- package/styles/color-picker/bootstrap4.css +60 -23
- package/styles/color-picker/bootstrap5-dark.css +58 -22
- package/styles/color-picker/bootstrap5.css +58 -22
- package/styles/color-picker/fabric-dark.css +54 -20
- package/styles/color-picker/fabric.css +54 -20
- package/styles/color-picker/fluent-dark.css +54 -20
- package/styles/color-picker/fluent.css +54 -20
- package/styles/color-picker/fluent2.css +2025 -0
- package/styles/color-picker/fluent2.scss +11 -0
- package/styles/color-picker/highcontrast-light.css +54 -20
- package/styles/color-picker/highcontrast.css +54 -20
- package/styles/color-picker/icons/_bootstrap5.3.scss +9 -0
- package/styles/color-picker/icons/_fluent2.scss +9 -0
- package/styles/color-picker/material-dark.css +63 -21
- package/styles/color-picker/material.css +77 -23
- package/styles/color-picker/material3-dark.css +92 -29
- package/styles/color-picker/material3.css +92 -29
- package/styles/color-picker/tailwind-dark.css +54 -21
- package/styles/color-picker/tailwind.css +54 -21
- package/styles/data-form/_bootstrap5.3-definition.scss +41 -0
- package/styles/data-form/_fluent2-definition.scss +41 -0
- package/styles/data-form/_layout.scss +1 -4
- package/styles/data-form/_material3-definition.scss +0 -7
- package/styles/data-form/bootstrap-dark.css +47 -59
- package/styles/data-form/bootstrap.css +47 -59
- package/styles/data-form/bootstrap4.css +47 -59
- package/styles/data-form/bootstrap5-dark.css +47 -59
- package/styles/data-form/bootstrap5.css +47 -59
- package/styles/data-form/fabric-dark.css +47 -59
- package/styles/data-form/fabric.css +47 -59
- package/styles/data-form/fluent-dark.css +47 -59
- package/styles/data-form/fluent.css +47 -59
- package/styles/data-form/fluent2.css +1266 -0
- package/styles/data-form/fluent2.scss +3 -0
- package/styles/data-form/highcontrast-light.css +47 -59
- package/styles/data-form/highcontrast.css +47 -59
- package/styles/data-form/material-dark.css +47 -59
- package/styles/data-form/material.css +47 -59
- package/styles/data-form/material3-dark.css +48 -60
- package/styles/data-form/material3.css +48 -60
- package/styles/data-form/tailwind-dark.css +47 -59
- package/styles/data-form/tailwind.css +47 -59
- package/styles/fabric-dark.css +1015 -988
- package/styles/fabric-dark.scss +35 -11
- package/styles/fabric.css +1015 -988
- package/styles/fabric.scss +35 -11
- package/styles/fluent-dark.css +1081 -1044
- package/styles/fluent-dark.scss +35 -11
- package/styles/fluent.css +1081 -1044
- package/styles/fluent.scss +35 -11
- package/styles/fluent2.css +13375 -0
- package/styles/fluent2.scss +35 -0
- package/styles/highcontrast-light.css +1099 -1179
- package/styles/highcontrast-light.scss +35 -11
- package/styles/highcontrast.css +1096 -1176
- package/styles/highcontrast.scss +35 -11
- package/styles/input/_bds-definition.scss +2 -2
- package/styles/input/_bootstrap5.3-definition.scss +336 -0
- package/styles/input/_fluent2-definition.scss +769 -0
- package/styles/input/_layout.scss +1242 -1939
- package/styles/input/_material-dark-definition.scss +4 -3
- package/styles/input/_material-definition.scss +4 -3
- package/styles/input/_material3-definition.scss +4 -9
- package/styles/input/_theme.scss +929 -1794
- package/styles/input/bootstrap-dark.css +489 -773
- package/styles/input/bootstrap.css +489 -773
- package/styles/input/bootstrap4.css +484 -770
- package/styles/input/bootstrap5-dark.css +488 -787
- package/styles/input/bootstrap5.css +488 -787
- package/styles/input/fabric-dark.css +466 -740
- package/styles/input/fabric.css +466 -740
- package/styles/input/fluent-dark.css +494 -775
- package/styles/input/fluent.css +494 -775
- package/styles/input/fluent2.css +10185 -0
- package/styles/input/fluent2.scss +4 -0
- package/styles/input/highcontrast-light.css +530 -914
- package/styles/input/highcontrast.css +530 -914
- package/styles/input/icons/_bootstrap5.3.scss +17 -0
- package/styles/input/icons/_fluent2.scss +17 -0
- package/styles/input/material-dark.css +1883 -2791
- package/styles/input/material.css +1895 -2791
- package/styles/input/material3-dark.css +1883 -2773
- package/styles/input/material3.css +1883 -2773
- package/styles/input/tailwind-dark.css +464 -749
- package/styles/input/tailwind.css +464 -749
- package/styles/maskedtextbox/_bootstrap5.3-definition.scss +7 -0
- package/styles/maskedtextbox/_fluent2-definition.scss +7 -0
- package/styles/maskedtextbox/_theme.scss +1 -6
- package/styles/maskedtextbox/bootstrap-dark.css +1 -4
- package/styles/maskedtextbox/bootstrap4.css +1 -4
- package/styles/maskedtextbox/bootstrap5-dark.css +1 -4
- package/styles/maskedtextbox/bootstrap5.css +1 -4
- package/styles/maskedtextbox/fabric-dark.css +1 -4
- package/styles/maskedtextbox/fabric.css +1 -4
- package/styles/maskedtextbox/fluent2.css +1244 -0
- package/styles/maskedtextbox/fluent2.scss +4 -0
- package/styles/maskedtextbox/highcontrast-light.css +1 -4
- package/styles/maskedtextbox/highcontrast.css +1 -4
- package/styles/maskedtextbox/material-dark.css +10 -5
- package/styles/maskedtextbox/material.css +24 -7
- package/styles/maskedtextbox/material3-dark.css +25 -8
- package/styles/maskedtextbox/material3.css +25 -8
- package/styles/maskedtextbox/tailwind-dark.css +1 -4
- package/styles/maskedtextbox/tailwind.css +1 -4
- package/styles/material-dark.css +2497 -3126
- package/styles/material-dark.scss +35 -11
- package/styles/material.css +2395 -3052
- package/styles/material.scss +35 -11
- package/styles/material3-dark.css +2656 -3265
- package/styles/material3-dark.scss +35 -11
- package/styles/material3.css +2656 -3265
- package/styles/material3.scss +35 -11
- package/styles/numerictextbox/_bootstrap5.3-definition.scss +3 -0
- package/styles/numerictextbox/_fluent2-definition.scss +3 -0
- package/styles/numerictextbox/bootstrap-dark.css +2 -1
- package/styles/numerictextbox/bootstrap.css +2 -1
- package/styles/numerictextbox/fluent2.css +1261 -0
- package/styles/numerictextbox/fluent2.scss +5 -0
- package/styles/numerictextbox/icons/_bootstrap5.3.scss +11 -0
- package/styles/numerictextbox/icons/_fluent2.scss +11 -0
- package/styles/numerictextbox/material-dark.css +9 -1
- package/styles/numerictextbox/material.css +23 -3
- package/styles/numerictextbox/material3-dark.css +24 -4
- package/styles/numerictextbox/material3.css +24 -4
- package/styles/otp-input/_all.scss +2 -0
- package/styles/otp-input/_bds-definition.scss +58 -0
- package/styles/otp-input/_bootstrap-dark-definition.scss +58 -0
- package/styles/otp-input/_bootstrap-definition.scss +58 -0
- package/styles/otp-input/_bootstrap4-definition.scss +58 -0
- package/styles/otp-input/_bootstrap5-dark-definition.scss +1 -0
- package/styles/otp-input/_bootstrap5-definition.scss +58 -0
- package/styles/otp-input/_bootstrap5.3-definition.scss +58 -0
- package/styles/otp-input/_fabric-dark-definition.scss +58 -0
- package/styles/otp-input/_fabric-definition.scss +58 -0
- package/styles/otp-input/_fluent-dark-definition.scss +1 -0
- package/styles/otp-input/_fluent-definition.scss +58 -0
- package/styles/otp-input/_fluent2-definition.scss +58 -0
- package/styles/otp-input/_fusionnew-definition.scss +58 -0
- package/styles/otp-input/_highcontrast-definition.scss +58 -0
- package/styles/otp-input/_highcontrast-light-definition.scss +58 -0
- package/styles/otp-input/_layout.scss +158 -0
- package/styles/otp-input/_material-dark-definition.scss +58 -0
- package/styles/otp-input/_material-definition.scss +58 -0
- package/styles/otp-input/_material3-dark-definition.scss +1 -0
- package/styles/otp-input/_material3-definition.scss +58 -0
- package/styles/otp-input/_tailwind-dark-definition.scss +1 -0
- package/styles/otp-input/_tailwind-definition.scss +58 -0
- package/styles/otp-input/_theme.scss +67 -0
- package/styles/otp-input/bootstrap-dark.css +225 -0
- package/styles/otp-input/bootstrap-dark.scss +3 -0
- package/styles/otp-input/bootstrap.css +225 -0
- package/styles/otp-input/bootstrap.scss +3 -0
- package/styles/otp-input/bootstrap4.css +225 -0
- package/styles/otp-input/bootstrap4.scss +3 -0
- package/styles/otp-input/bootstrap5-dark.css +225 -0
- package/styles/otp-input/bootstrap5-dark.scss +3 -0
- package/styles/otp-input/bootstrap5.css +225 -0
- package/styles/otp-input/bootstrap5.scss +3 -0
- package/styles/otp-input/fabric-dark.css +225 -0
- package/styles/otp-input/fabric-dark.scss +3 -0
- package/styles/otp-input/fabric.css +225 -0
- package/styles/otp-input/fabric.scss +3 -0
- package/styles/otp-input/fluent-dark.css +225 -0
- package/styles/otp-input/fluent-dark.scss +3 -0
- package/styles/otp-input/fluent.css +225 -0
- package/styles/otp-input/fluent.scss +3 -0
- package/styles/otp-input/fluent2.css +1259 -0
- package/styles/otp-input/fluent2.scss +3 -0
- package/styles/otp-input/highcontrast-light.css +225 -0
- package/styles/otp-input/highcontrast-light.scss +3 -0
- package/styles/otp-input/highcontrast.css +225 -0
- package/styles/otp-input/highcontrast.scss +3 -0
- package/styles/otp-input/material-dark.css +225 -0
- package/styles/otp-input/material-dark.scss +3 -0
- package/styles/otp-input/material.css +225 -0
- package/styles/otp-input/material.scss +3 -0
- package/styles/otp-input/material3-dark.css +280 -0
- package/styles/otp-input/material3-dark.scss +4 -0
- package/styles/otp-input/material3.css +336 -0
- package/styles/otp-input/material3.scss +4 -0
- package/styles/otp-input/tailwind-dark.css +225 -0
- package/styles/otp-input/tailwind-dark.scss +3 -0
- package/styles/otp-input/tailwind.css +225 -0
- package/styles/otp-input/tailwind.scss +3 -0
- package/styles/rating/_bds-definition.scss +2 -2
- package/styles/rating/_bootstrap-dark-definition.scss +2 -2
- package/styles/rating/_bootstrap-definition.scss +2 -2
- package/styles/rating/_bootstrap4-definition.scss +2 -2
- package/styles/rating/_bootstrap5-definition.scss +2 -2
- package/styles/rating/_bootstrap5.3-definition.scss +47 -0
- package/styles/rating/_fabric-dark-definition.scss +2 -2
- package/styles/rating/_fabric-definition.scss +2 -2
- package/styles/rating/_fluent-definition.scss +2 -2
- package/styles/rating/_fluent2-definition.scss +47 -0
- package/styles/rating/_fusionnew-definition.scss +2 -2
- package/styles/rating/_highcontrast-definition.scss +2 -2
- package/styles/rating/_highcontrast-light-definition.scss +2 -2
- package/styles/rating/_layout.scss +22 -46
- package/styles/rating/_material-dark-definition.scss +2 -2
- package/styles/rating/_material-definition.scss +2 -2
- package/styles/rating/_material3-definition.scss +2 -2
- package/styles/rating/_tailwind-definition.scss +2 -2
- package/styles/rating/_theme.scss +1 -1
- package/styles/rating/bootstrap-dark.css +35 -9
- package/styles/rating/bootstrap.css +35 -9
- package/styles/rating/bootstrap4.css +35 -9
- package/styles/rating/bootstrap5-dark.css +35 -9
- package/styles/rating/bootstrap5.css +35 -9
- package/styles/rating/fabric-dark.css +35 -9
- package/styles/rating/fabric.css +35 -9
- package/styles/rating/fluent-dark.css +35 -9
- package/styles/rating/fluent.css +35 -9
- package/styles/rating/fluent2.css +1349 -0
- package/styles/rating/fluent2.scss +4 -0
- package/styles/rating/highcontrast-light.css +35 -9
- package/styles/rating/highcontrast.css +35 -9
- package/styles/rating/material-dark.css +35 -9
- package/styles/rating/material.css +35 -9
- package/styles/rating/material3-dark.css +35 -10
- package/styles/rating/material3.css +35 -10
- package/styles/rating/tailwind-dark.css +34 -9
- package/styles/rating/tailwind.css +34 -9
- package/styles/signature/_bootstrap5.3-definition.scss +3 -0
- package/styles/signature/_fluent2-definition.scss +3 -0
- package/styles/signature/fluent2.css +1043 -0
- package/styles/signature/fluent2.scss +3 -0
- package/styles/signature/material3-dark.css +1 -1
- package/styles/signature/material3.css +1 -1
- package/styles/slider/_bds-definition.scss +1 -0
- package/styles/slider/_bootstrap-dark-definition.scss +1 -0
- package/styles/slider/_bootstrap-definition.scss +1 -0
- package/styles/slider/_bootstrap4-definition.scss +1 -1
- package/styles/slider/_bootstrap5-definition.scss +1 -0
- package/styles/slider/_bootstrap5.3-definition.scss +91 -0
- package/styles/slider/_fluent-definition.scss +2 -0
- package/styles/slider/_fluent2-definition.scss +102 -0
- package/styles/slider/_highcontrast-definition.scss +1 -2
- package/styles/slider/_layout.scss +1623 -1986
- package/styles/slider/_material-dark-definition.scss +2 -2
- package/styles/slider/_material-definition.scss +4 -4
- package/styles/slider/_material3-definition.scss +1 -4
- package/styles/slider/_tailwind-definition.scss +1 -0
- package/styles/slider/_theme.scss +92 -120
- package/styles/slider/bootstrap-dark.css +132 -140
- package/styles/slider/bootstrap.css +132 -140
- package/styles/slider/bootstrap4.css +192 -193
- package/styles/slider/bootstrap5-dark.css +284 -270
- package/styles/slider/bootstrap5.css +284 -270
- package/styles/slider/fabric-dark.css +131 -131
- package/styles/slider/fabric.css +131 -131
- package/styles/slider/fluent-dark.css +170 -155
- package/styles/slider/fluent.css +170 -155
- package/styles/slider/fluent2.css +1642 -0
- package/styles/slider/fluent2.scss +5 -0
- package/styles/slider/highcontrast-light.css +157 -154
- package/styles/slider/highcontrast.css +155 -152
- package/styles/slider/material-dark.css +306 -298
- package/styles/slider/material.css +304 -296
- package/styles/slider/material3-dark.css +577 -535
- package/styles/slider/material3.css +577 -535
- package/styles/slider/tailwind-dark.css +256 -267
- package/styles/slider/tailwind.css +256 -267
- package/styles/tailwind-dark.css +1203 -1201
- package/styles/tailwind-dark.scss +35 -11
- package/styles/tailwind.css +1205 -1203
- package/styles/tailwind.scss +35 -11
- package/styles/textarea/_bootstrap5.3-definition.scss +1 -0
- package/styles/textarea/_fluent2-definition.scss +1 -0
- package/styles/textarea/_layout.scss +1 -1
- package/styles/textarea/bootstrap-dark.css +3 -2
- package/styles/textarea/bootstrap.css +3 -2
- package/styles/textarea/bootstrap4.css +3 -2
- package/styles/textarea/bootstrap5-dark.css +3 -2
- package/styles/textarea/bootstrap5.css +3 -2
- package/styles/textarea/fabric-dark.css +3 -2
- package/styles/textarea/fabric.css +3 -2
- package/styles/textarea/fluent-dark.css +3 -2
- package/styles/textarea/fluent.css +3 -2
- package/styles/textarea/fluent2.css +1247 -0
- package/styles/textarea/fluent2.scss +5 -0
- package/styles/textarea/highcontrast-light.css +3 -2
- package/styles/textarea/highcontrast.css +3 -2
- package/styles/textarea/material-dark.css +12 -3
- package/styles/textarea/material.css +26 -5
- package/styles/textarea/material3-dark.css +27 -6
- package/styles/textarea/material3.css +27 -6
- package/styles/textarea/tailwind-dark.css +3 -2
- package/styles/textarea/tailwind.css +3 -2
- package/styles/textbox/_bootstrap5.3-definition.scss +4 -0
- package/styles/textbox/_fluent2-definition.scss +4 -0
- package/styles/textbox/fluent2.css +1241 -0
- package/styles/textbox/fluent2.scss +4 -0
- package/styles/textbox/material-dark.css +9 -1
- package/styles/textbox/material.css +23 -3
- package/styles/textbox/material3-dark.css +24 -4
- package/styles/textbox/material3.css +24 -4
- package/styles/uploader/_bootstrap5.3-definition.scss +216 -0
- package/styles/uploader/_fluent2-definition.scss +232 -0
- package/styles/uploader/_layout.scss +5 -2
- package/styles/uploader/_material3-definition.scss +0 -24
- package/styles/uploader/_theme.scss +7 -4
- package/styles/uploader/bootstrap-dark.css +47 -12
- package/styles/uploader/bootstrap.css +47 -12
- package/styles/uploader/bootstrap4.css +47 -12
- package/styles/uploader/bootstrap5-dark.css +47 -12
- package/styles/uploader/bootstrap5.css +47 -12
- package/styles/uploader/fabric-dark.css +47 -12
- package/styles/uploader/fabric.css +47 -12
- package/styles/uploader/fluent-dark.css +47 -12
- package/styles/uploader/fluent.css +47 -12
- package/styles/uploader/fluent2.css +1880 -0
- package/styles/uploader/fluent2.scss +6 -0
- package/styles/uploader/highcontrast-light.css +47 -12
- package/styles/uploader/highcontrast.css +47 -12
- package/styles/uploader/icons/_bootstrap5.3.scss +34 -0
- package/styles/uploader/icons/_fluent2.scss +34 -0
- package/styles/uploader/material-dark.css +47 -12
- package/styles/uploader/material.css +47 -12
- package/styles/uploader/material3-dark.css +49 -13
- package/styles/uploader/material3.css +49 -13
- package/styles/uploader/tailwind-dark.css +49 -13
- package/styles/uploader/tailwind.css +49 -13
- package/CHANGELOG.md +0 -1313
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
import { NotifyPropertyChanges, Component, Property, getUniqueID, isNullOrUndefined, addClass, attributes, removeClass, remove, Event } from '@syncfusion/ej2-base';
|
|
21
|
+
var INPUTFIELD = 'e-otp-input-field';
|
|
22
|
+
var RTL = 'e-rtl';
|
|
23
|
+
/**
|
|
24
|
+
* Specifies the type of input for the Otp (One-Time Password) input component.
|
|
25
|
+
*/
|
|
26
|
+
export var OtpInputType;
|
|
27
|
+
(function (OtpInputType) {
|
|
28
|
+
/**
|
|
29
|
+
* Specifies the type of input to be number for the Otp input.
|
|
30
|
+
*/
|
|
31
|
+
OtpInputType["Number"] = "number";
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the type of input to be text for the Otp input.
|
|
34
|
+
*/
|
|
35
|
+
OtpInputType["Text"] = "text";
|
|
36
|
+
/**
|
|
37
|
+
* Specifies the type of input to be password for the Otp input.
|
|
38
|
+
*/
|
|
39
|
+
OtpInputType["Password"] = "password";
|
|
40
|
+
})(OtpInputType || (OtpInputType = {}));
|
|
41
|
+
/**
|
|
42
|
+
* Specifies the style variant for the Otp (One-Time Password) input component.
|
|
43
|
+
*/
|
|
44
|
+
export var OtpInputStyle;
|
|
45
|
+
(function (OtpInputStyle) {
|
|
46
|
+
/**
|
|
47
|
+
* Specifies the style of the Otp input to be outlined.
|
|
48
|
+
*/
|
|
49
|
+
OtpInputStyle["Outlined"] = "outlined";
|
|
50
|
+
/**
|
|
51
|
+
* Specifies the style of the Otp input to be underlined.
|
|
52
|
+
*/
|
|
53
|
+
OtpInputStyle["Underlined"] = "underlined";
|
|
54
|
+
/**
|
|
55
|
+
* Specifies the style of the Otp input to be filled.
|
|
56
|
+
*/
|
|
57
|
+
OtpInputStyle["Filled"] = "filled";
|
|
58
|
+
})(OtpInputStyle || (OtpInputStyle = {}));
|
|
59
|
+
/**
|
|
60
|
+
* Represents the Otp component that allows the user to enter the otp values.
|
|
61
|
+
* ```html
|
|
62
|
+
* <div id='OTPInput'></div>
|
|
63
|
+
* ```
|
|
64
|
+
* ```typescript
|
|
65
|
+
* <script>
|
|
66
|
+
* var OtpinputObj = new OtpInput();
|
|
67
|
+
* OtpinputObj.appendTo('#OTPInput');
|
|
68
|
+
* </script>
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
var OtpInput = /** @class */ (function (_super) {
|
|
72
|
+
__extends(OtpInput, _super);
|
|
73
|
+
function OtpInput(options, element) {
|
|
74
|
+
var _this = _super.call(this, options, element) || this;
|
|
75
|
+
/* Private variables */
|
|
76
|
+
_this.inputs = [];
|
|
77
|
+
_this.previousValue = '';
|
|
78
|
+
_this.separatorElements = [];
|
|
79
|
+
_this.shouldFireFocus = true;
|
|
80
|
+
_this.shouldFireBlur = true;
|
|
81
|
+
_this.isFocusInCalled = false;
|
|
82
|
+
_this.isFocusOutCalled = false;
|
|
83
|
+
return _this;
|
|
84
|
+
}
|
|
85
|
+
OtpInput.prototype.preRender = function () {
|
|
86
|
+
if (!this.element.id) {
|
|
87
|
+
this.element.id = getUniqueID('e-' + this.getModuleName());
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
OtpInput.prototype.render = function () {
|
|
91
|
+
this.initialize();
|
|
92
|
+
};
|
|
93
|
+
OtpInput.prototype.initialize = function () {
|
|
94
|
+
attributes(this.element, { 'role': 'group' });
|
|
95
|
+
this.renderInputs();
|
|
96
|
+
this.renderSeparator(1, this.inputs.length);
|
|
97
|
+
this.addPlaceHolder();
|
|
98
|
+
this.updateCssClass(this.cssClass);
|
|
99
|
+
this.updateVariantClass();
|
|
100
|
+
this.updateAriaLabel(this.ariaLabels);
|
|
101
|
+
this.setElementAttributes(this.htmlAttributes, this.element);
|
|
102
|
+
if (this.enableRtl) {
|
|
103
|
+
this.element.classList.add(RTL);
|
|
104
|
+
}
|
|
105
|
+
this.previousValue = this.value.toString();
|
|
106
|
+
};
|
|
107
|
+
OtpInput.prototype.renderInputs = function () {
|
|
108
|
+
this.hiddenInputEle = this.createElement('input', {
|
|
109
|
+
id: 'otpInput_hidden',
|
|
110
|
+
attrs: {
|
|
111
|
+
name: this.element.id,
|
|
112
|
+
type: 'hidden',
|
|
113
|
+
value: this.type === 'number' ? this.value.toString().replace(/\D/g, '') : this.value.toString(),
|
|
114
|
+
autoComplete: 'off'
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
this.element.appendChild(this.hiddenInputEle);
|
|
118
|
+
for (var i = 0; i < this.length; i++) {
|
|
119
|
+
this.createOtpInput(i);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
OtpInput.prototype.createOtpInput = function (index) {
|
|
123
|
+
var valueContainer = this.getDefaultValue();
|
|
124
|
+
var inputValue = '';
|
|
125
|
+
if (valueContainer) {
|
|
126
|
+
if (this.type === 'number') {
|
|
127
|
+
var valueAtIndex = valueContainer[parseInt(index.toString(), 10)];
|
|
128
|
+
if (!isNaN(Number(valueAtIndex))) {
|
|
129
|
+
inputValue = valueAtIndex;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
inputValue = valueContainer[parseInt(index.toString(), 10)] || '';
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
var inputEle = this.createElement('input', {
|
|
137
|
+
id: this.element.id + "-" + (index + 1),
|
|
138
|
+
className: INPUTFIELD + ' ' + 'e-input',
|
|
139
|
+
attrs: {
|
|
140
|
+
maxlength: '1',
|
|
141
|
+
type: this.type,
|
|
142
|
+
inputmode: (this.type === 'number' ? 'numeric' : 'text')
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
if (this.disabled) {
|
|
146
|
+
inputEle.setAttribute('disabled', 'disabled');
|
|
147
|
+
}
|
|
148
|
+
this.element.appendChild(inputEle);
|
|
149
|
+
this.inputs.push(inputEle);
|
|
150
|
+
if (inputValue) {
|
|
151
|
+
inputEle.value = inputValue;
|
|
152
|
+
}
|
|
153
|
+
this.wireEvents(inputEle, index);
|
|
154
|
+
};
|
|
155
|
+
OtpInput.prototype.renderSeparator = function (index, length) {
|
|
156
|
+
if (this.separator.length > 0) {
|
|
157
|
+
for (var i = index; i < length; i++) {
|
|
158
|
+
var separatorElement = this.createElement('span', {
|
|
159
|
+
className: 'e-otp-separator'
|
|
160
|
+
});
|
|
161
|
+
separatorElement.textContent = this.separator;
|
|
162
|
+
this.separatorElements.push(separatorElement);
|
|
163
|
+
this.element.insertBefore(separatorElement, this.inputs[parseInt(i.toString(), 10)]);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
OtpInput.prototype.updateSeparatorValue = function () {
|
|
168
|
+
if (this.separator === '') {
|
|
169
|
+
for (var i = 0; i < this.separatorElements.length; i++) {
|
|
170
|
+
remove(this.separatorElements[parseInt(i.toString(), 10)]);
|
|
171
|
+
}
|
|
172
|
+
this.separatorElements = [];
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
for (var i = 0; i < this.separatorElements.length; i++) {
|
|
176
|
+
this.separatorElements[parseInt(i.toString(), 10)].textContent = this.separator;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
OtpInput.prototype.addPlaceHolder = function () {
|
|
180
|
+
for (var i = 0; i < this.inputs.length; i++) {
|
|
181
|
+
this.setElementAttributes({ 'placeholder': this.placeholder.length === 1 || this.placeholder.length === 0 ? this.placeholder : this.placeholder.charAt(i) }, this.inputs[parseInt(i.toString(), 10)]);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
OtpInput.prototype.updateInputType = function (inputType) {
|
|
185
|
+
this.inputs.forEach(function (input) {
|
|
186
|
+
input.type = inputType;
|
|
187
|
+
input.setAttribute('inputmode', (inputType === 'number' ? 'numeric' : 'text'));
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
OtpInput.prototype.getDefaultValue = function () {
|
|
191
|
+
var extractedValue = typeof this.value === 'number' ? this.value.toString() : this.value;
|
|
192
|
+
// To remove the white space if present.
|
|
193
|
+
var value = extractedValue.replace(/\s/g, '');
|
|
194
|
+
if (value.length > 0) {
|
|
195
|
+
return value.split('');
|
|
196
|
+
}
|
|
197
|
+
return undefined;
|
|
198
|
+
};
|
|
199
|
+
OtpInput.prototype.handleInputChange = function (index, event) {
|
|
200
|
+
var currentInputElement = this.inputs[parseInt(index.toString(), 10)];
|
|
201
|
+
if (currentInputElement && index < this.length - 1 && currentInputElement.value.length > 0) {
|
|
202
|
+
var nextInputElement = this.inputs[parseInt(index.toString(), 10) + 1];
|
|
203
|
+
this.shouldFireFocus = this.shouldFireBlur = false;
|
|
204
|
+
nextInputElement.focus();
|
|
205
|
+
if (nextInputElement && nextInputElement.value.length > 0) {
|
|
206
|
+
nextInputElement.select();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
var target = event.target;
|
|
210
|
+
if (target.value.length > 1) {
|
|
211
|
+
target.value = target.value.slice(0, 1);
|
|
212
|
+
}
|
|
213
|
+
this.triggerInputEvent(event);
|
|
214
|
+
this.triggerValuechanged(event, true);
|
|
215
|
+
};
|
|
216
|
+
OtpInput.prototype.handleKeyAction = function (index, event) {
|
|
217
|
+
if (event.key.length > 1 && !((index === 0 && event.key === 'Backspace') ||
|
|
218
|
+
(index === this.length - 1 && event.key === 'Delete'))) {
|
|
219
|
+
this.shouldFireFocus = this.shouldFireBlur = false;
|
|
220
|
+
}
|
|
221
|
+
var currentInputElement = this.inputs[parseInt(index.toString(), 10)];
|
|
222
|
+
var previousInputElement = this.inputs[parseInt(index.toString(), 10) - 1];
|
|
223
|
+
var nextInputElement = this.inputs[parseInt(index.toString(), 10) + 1];
|
|
224
|
+
if (event.key === 'Delete') {
|
|
225
|
+
var value = '';
|
|
226
|
+
if (currentInputElement.value.length > 0) {
|
|
227
|
+
value = currentInputElement.value;
|
|
228
|
+
currentInputElement.value = '';
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
if (index !== this.inputs.length - 1) {
|
|
232
|
+
value = nextInputElement.value;
|
|
233
|
+
nextInputElement.value = '';
|
|
234
|
+
nextInputElement.focus();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (value.length > 0) {
|
|
238
|
+
this.triggerInputEvent(event);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else if (event.key === 'Backspace') {
|
|
242
|
+
if (index !== 0 && currentInputElement.value.length === 0) {
|
|
243
|
+
var previousValue = previousInputElement.value;
|
|
244
|
+
previousInputElement.value = '';
|
|
245
|
+
previousInputElement.focus();
|
|
246
|
+
if (previousValue.length > 0) {
|
|
247
|
+
this.triggerInputEvent(event);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
else if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
|
252
|
+
if (event.key === 'ArrowLeft') {
|
|
253
|
+
if (index > 0) {
|
|
254
|
+
previousInputElement.focus();
|
|
255
|
+
previousInputElement.select();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
if (index < this.inputs.length - 1) {
|
|
260
|
+
nextInputElement.focus();
|
|
261
|
+
nextInputElement.select();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
event.preventDefault();
|
|
265
|
+
}
|
|
266
|
+
else if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
if (event.key !== 'Tab' && !event.shiftKey && !event.ctrlKey) {
|
|
271
|
+
if (this.type === 'number' && (/\D/.test(event.key.toLocaleLowerCase()))) {
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
OtpInput.prototype.handleSelection = function (index) {
|
|
278
|
+
var currentInputElement = this.inputs[parseInt(index.toString(), 10)];
|
|
279
|
+
if (currentInputElement.value) {
|
|
280
|
+
currentInputElement.select();
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
OtpInput.prototype.handleFocus = function (index, event) {
|
|
284
|
+
addClass([this.inputs[parseInt(index.toString(), 10)]], 'e-otp-input-focus');
|
|
285
|
+
if (this.shouldFireFocus) {
|
|
286
|
+
var eventArgs = {
|
|
287
|
+
element: this.element,
|
|
288
|
+
event: event,
|
|
289
|
+
isInteracted: this.isFocusInCalled ? false : true,
|
|
290
|
+
value: this.value
|
|
291
|
+
};
|
|
292
|
+
this.trigger('focus', eventArgs);
|
|
293
|
+
}
|
|
294
|
+
this.shouldFireFocus = true;
|
|
295
|
+
};
|
|
296
|
+
OtpInput.prototype.handleBlur = function (index, event) {
|
|
297
|
+
removeClass([this.inputs[parseInt(index.toString(), 10)]], 'e-otp-input-focus');
|
|
298
|
+
if (this.shouldFireBlur) {
|
|
299
|
+
var eventArgs = {
|
|
300
|
+
element: this.element,
|
|
301
|
+
event: event,
|
|
302
|
+
isInteracted: this.isFocusOutCalled ? false : true,
|
|
303
|
+
value: this.value
|
|
304
|
+
};
|
|
305
|
+
this.trigger('blur', eventArgs);
|
|
306
|
+
}
|
|
307
|
+
this.shouldFireBlur = true;
|
|
308
|
+
};
|
|
309
|
+
OtpInput.prototype.handlePaste = function (index, event) {
|
|
310
|
+
var clipboardData = event.clipboardData;
|
|
311
|
+
if (clipboardData) {
|
|
312
|
+
var pastedText = clipboardData.getData('text');
|
|
313
|
+
var pastedValues = pastedText.split('');
|
|
314
|
+
var pastedValueIndex = 0;
|
|
315
|
+
for (var i = index; i < this.inputs.length; i++) {
|
|
316
|
+
if (pastedValues.length > 0 && pastedValues[parseInt(pastedValueIndex.toString(), 10)]) {
|
|
317
|
+
this.inputs[parseInt(i.toString(), 10)].value = pastedValues[parseInt(pastedValueIndex.toString(), 10)];
|
|
318
|
+
pastedValueIndex++;
|
|
319
|
+
this.updateValueProperty();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
this.focusIn();
|
|
323
|
+
this.triggerValuechanged(event, true);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
OtpInput.prototype.triggerInputEvent = function (event) {
|
|
327
|
+
var previousValue = this.value.toString();
|
|
328
|
+
this.updateValueProperty();
|
|
329
|
+
var inputEventArgs = {
|
|
330
|
+
element: this.element,
|
|
331
|
+
event: event,
|
|
332
|
+
previousValue: previousValue,
|
|
333
|
+
value: this.value.toString()
|
|
334
|
+
};
|
|
335
|
+
this.trigger('input', inputEventArgs);
|
|
336
|
+
};
|
|
337
|
+
OtpInput.prototype.triggerValuechanged = function (event, isInteracted) {
|
|
338
|
+
if (this.length === this.value.toString().length) {
|
|
339
|
+
if (this.previousValue !== this.value) {
|
|
340
|
+
var eventArgs = {
|
|
341
|
+
element: this.element,
|
|
342
|
+
event: event,
|
|
343
|
+
isInteracted: isInteracted ? isInteracted : false,
|
|
344
|
+
previousValue: this.previousValue,
|
|
345
|
+
value: this.value
|
|
346
|
+
};
|
|
347
|
+
this.trigger('valueChanged', eventArgs);
|
|
348
|
+
this.previousValue = this.value.toString();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
OtpInput.prototype.wireEvents = function (inputEle, index) {
|
|
353
|
+
inputEle.addEventListener('focus', this.handleFocus.bind(this, index));
|
|
354
|
+
inputEle.addEventListener('blur', this.handleBlur.bind(this, index));
|
|
355
|
+
inputEle.addEventListener('input', this.handleInputChange.bind(this, index));
|
|
356
|
+
inputEle.addEventListener('keydown', this.handleKeyAction.bind(this, index));
|
|
357
|
+
inputEle.addEventListener('click', this.handleSelection.bind(this, index));
|
|
358
|
+
inputEle.addEventListener('paste', this.handlePaste.bind(this, index));
|
|
359
|
+
};
|
|
360
|
+
OtpInput.prototype.unWireEvents = function () {
|
|
361
|
+
for (var i = 0; i < this.inputs.length; i++) {
|
|
362
|
+
var currentInputElement = this.inputs[parseInt(i.toString(), 10)];
|
|
363
|
+
currentInputElement.removeEventListener('focus', this.handleFocus.bind(this, i));
|
|
364
|
+
currentInputElement.removeEventListener('blur', this.handleBlur.bind(this, i));
|
|
365
|
+
currentInputElement.removeEventListener('input', this.handleInputChange.bind(this, i));
|
|
366
|
+
currentInputElement.removeEventListener('keydown', this.handleKeyAction.bind(this, i));
|
|
367
|
+
currentInputElement.removeEventListener('click', this.handleSelection.bind(this, i));
|
|
368
|
+
currentInputElement.removeEventListener('paste', this.handlePaste.bind(this, i));
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
OtpInput.prototype.updateValueProperty = function () {
|
|
372
|
+
var value = '';
|
|
373
|
+
this.inputs.forEach(function (input) {
|
|
374
|
+
value += input.value;
|
|
375
|
+
});
|
|
376
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
377
|
+
this.isProtectedOnChange = true;
|
|
378
|
+
this.value = typeof this.value === 'number' ? parseInt(value, 10) : value;
|
|
379
|
+
this.isProtectedOnChange = prevOnChange;
|
|
380
|
+
this.hiddenInputEle.value = this.value.toString();
|
|
381
|
+
};
|
|
382
|
+
OtpInput.prototype.updateInputValue = function (previousValue) {
|
|
383
|
+
var stringifiedValue = this.value.toString();
|
|
384
|
+
for (var i = 0; i < this.inputs.length; i++) {
|
|
385
|
+
var isValueChanged = previousValue.toString().charAt(i) !== stringifiedValue.charAt(i);
|
|
386
|
+
if (isValueChanged) {
|
|
387
|
+
this.inputs[parseInt(i.toString(), 10)].value = stringifiedValue.charAt(i);
|
|
388
|
+
this.hiddenInputEle.value = stringifiedValue;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
this.focusIn();
|
|
392
|
+
};
|
|
393
|
+
OtpInput.prototype.updateCssClass = function (addCss, removeCss) {
|
|
394
|
+
if (removeCss === void 0) { removeCss = ''; }
|
|
395
|
+
var _a, _b;
|
|
396
|
+
var cssClasses;
|
|
397
|
+
if (removeCss) {
|
|
398
|
+
cssClasses = removeCss.trim().split(' ');
|
|
399
|
+
(_a = this.element.classList).remove.apply(_a, cssClasses);
|
|
400
|
+
}
|
|
401
|
+
if (addCss) {
|
|
402
|
+
cssClasses = addCss.trim().split(' ');
|
|
403
|
+
(_b = this.element.classList).add.apply(_b, cssClasses);
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
OtpInput.prototype.updateVariantClass = function () {
|
|
407
|
+
var variantClass = this.stylingMode.toLocaleLowerCase();
|
|
408
|
+
variantClass = variantClass === 'outlined' ? 'outline' : variantClass;
|
|
409
|
+
if (variantClass === 'underlined' || variantClass === 'filled' || variantClass === 'outline') {
|
|
410
|
+
removeClass([this.element], ['e-underlined', 'e-filled', 'e-outline']);
|
|
411
|
+
addClass([this.element], "e-" + variantClass);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
OtpInput.prototype.updateAriaLabel = function (customAriaLabel) {
|
|
415
|
+
this.inputs.forEach(function (input, index) {
|
|
416
|
+
var defaultLabel = "Enter Otp Character " + (index + 1);
|
|
417
|
+
var ariaLabel = customAriaLabel && customAriaLabel.length > 0
|
|
418
|
+
? customAriaLabel[parseInt(index.toString(), 10)] || defaultLabel
|
|
419
|
+
: defaultLabel;
|
|
420
|
+
input.setAttribute('aria-label', ariaLabel);
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
OtpInput.prototype.updateDisabledState = function () {
|
|
424
|
+
var _this = this;
|
|
425
|
+
this.inputs.forEach(function (input) {
|
|
426
|
+
if (_this.disabled) {
|
|
427
|
+
input.setAttribute('disabled', 'disabled');
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
input.removeAttribute('disabled');
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
OtpInput.prototype.setElementAttributes = function (htmlAttributes, element) {
|
|
435
|
+
if (!isNullOrUndefined(htmlAttributes)) {
|
|
436
|
+
for (var key in htmlAttributes) {
|
|
437
|
+
if (key === 'class') {
|
|
438
|
+
var elementClass = htmlAttributes['class'].replace(/\s+/g, ' ').trim();
|
|
439
|
+
if (elementClass) {
|
|
440
|
+
addClass([element], elementClass.split(' '));
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
else if (key === 'name' && this.element.id === element.id) {
|
|
444
|
+
this.hiddenInputEle.setAttribute(key, htmlAttributes["" + key]);
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
element.setAttribute(key, htmlAttributes["" + key]);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
OtpInput.prototype.handleLengthChange = function (currentValue, previousValue) {
|
|
453
|
+
var isLengthAdded = (currentValue - previousValue) > 0;
|
|
454
|
+
if (isLengthAdded) {
|
|
455
|
+
for (var i = previousValue; i < currentValue; i++) {
|
|
456
|
+
this.createOtpInput(i);
|
|
457
|
+
}
|
|
458
|
+
this.renderSeparator(previousValue, currentValue);
|
|
459
|
+
this.addPlaceHolder();
|
|
460
|
+
this.updateAriaLabel(this.ariaLabels);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
if (currentValue >= 0 && this.inputs.length > 0) {
|
|
464
|
+
for (var i = currentValue; i < this.inputs.length; i++) {
|
|
465
|
+
remove(this.inputs[parseInt(i.toString(), 10)]);
|
|
466
|
+
}
|
|
467
|
+
this.inputs.splice(currentValue);
|
|
468
|
+
if (this.separatorElements.length > 0) {
|
|
469
|
+
// separator should be completely removed when length is 0 or 1;
|
|
470
|
+
var index = currentValue === 0 ? 0 : currentValue - 1;
|
|
471
|
+
for (var i = index; i < this.separatorElements.length; i++) {
|
|
472
|
+
remove(this.separatorElements[parseInt(i.toString(), 10)]);
|
|
473
|
+
}
|
|
474
|
+
this.separatorElements.splice(index);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
/**
|
|
480
|
+
* To get component name.
|
|
481
|
+
*
|
|
482
|
+
* @returns {string} - Module Name
|
|
483
|
+
* @private
|
|
484
|
+
*/
|
|
485
|
+
OtpInput.prototype.getModuleName = function () {
|
|
486
|
+
return 'otpinput';
|
|
487
|
+
};
|
|
488
|
+
/**
|
|
489
|
+
* To get the properties to be maintained in the persisted state.
|
|
490
|
+
*
|
|
491
|
+
* @returns {string} - Persist data
|
|
492
|
+
*/
|
|
493
|
+
OtpInput.prototype.getPersistData = function () {
|
|
494
|
+
return this.addOnPersist([]);
|
|
495
|
+
};
|
|
496
|
+
/**
|
|
497
|
+
* Destroy the Otp input.
|
|
498
|
+
*
|
|
499
|
+
* @returns {void}
|
|
500
|
+
*/
|
|
501
|
+
OtpInput.prototype.destroy = function () {
|
|
502
|
+
_super.prototype.destroy.call(this);
|
|
503
|
+
this.unWireEvents();
|
|
504
|
+
for (var i = 0; i < this.inputs.length; i++) {
|
|
505
|
+
remove(this.inputs[parseInt(i.toString(), 10)]);
|
|
506
|
+
}
|
|
507
|
+
for (var i = 0; i < this.separatorElements.length; i++) {
|
|
508
|
+
remove(this.separatorElements[parseInt(i.toString(), 10)]);
|
|
509
|
+
}
|
|
510
|
+
remove(this.hiddenInputEle);
|
|
511
|
+
removeClass([this.element], ['e-underlined', 'e-filled', 'e-outline', 'e-rtl']);
|
|
512
|
+
if (this.cssClass) {
|
|
513
|
+
removeClass([this.element], this.cssClass.trim().split(' '));
|
|
514
|
+
}
|
|
515
|
+
this.element.removeAttribute('role');
|
|
516
|
+
this.inputs = [];
|
|
517
|
+
this.separatorElements = [];
|
|
518
|
+
this.hiddenInputEle = null;
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* Sets the focus to the Otp input for interaction.
|
|
522
|
+
*
|
|
523
|
+
* @returns {void}
|
|
524
|
+
*/
|
|
525
|
+
OtpInput.prototype.focusIn = function () {
|
|
526
|
+
this.isFocusInCalled = true;
|
|
527
|
+
var focusIndex = 0;
|
|
528
|
+
this.inputs.forEach(function (input, index) {
|
|
529
|
+
if (input.value.length > 0) {
|
|
530
|
+
focusIndex = index;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
this.inputs[parseInt(focusIndex.toString(), 10)].focus();
|
|
534
|
+
this.isFocusInCalled = false;
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* Remove the focus from Otp input, if it is in focus state.
|
|
538
|
+
*
|
|
539
|
+
* @returns {void}
|
|
540
|
+
*/
|
|
541
|
+
OtpInput.prototype.focusOut = function () {
|
|
542
|
+
this.isFocusOutCalled = true;
|
|
543
|
+
this.inputs.forEach(function (input) {
|
|
544
|
+
input.blur();
|
|
545
|
+
});
|
|
546
|
+
this.isFocusOutCalled = false;
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* Called internally if any of the property value changed.
|
|
550
|
+
*
|
|
551
|
+
* @param {OtpInputModel} newProp - Specifies new properties
|
|
552
|
+
* @param {OtpInputModel} oldProp - Specifies old properties
|
|
553
|
+
* @returns {void}
|
|
554
|
+
* @private
|
|
555
|
+
*/
|
|
556
|
+
OtpInput.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
557
|
+
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
558
|
+
var prop = _a[_i];
|
|
559
|
+
switch (prop) {
|
|
560
|
+
case 'value':
|
|
561
|
+
{
|
|
562
|
+
this.updateInputValue(oldProp.value);
|
|
563
|
+
this.triggerValuechanged();
|
|
564
|
+
}
|
|
565
|
+
break;
|
|
566
|
+
case 'placeholder':
|
|
567
|
+
this.addPlaceHolder();
|
|
568
|
+
break;
|
|
569
|
+
case 'disabled':
|
|
570
|
+
this.updateDisabledState();
|
|
571
|
+
break;
|
|
572
|
+
case 'cssClass':
|
|
573
|
+
this.updateCssClass(newProp.cssClass, oldProp.cssClass);
|
|
574
|
+
break;
|
|
575
|
+
case 'separator':
|
|
576
|
+
if (oldProp.separator === '') {
|
|
577
|
+
this.renderSeparator(1, this.inputs.length);
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
this.updateSeparatorValue();
|
|
581
|
+
}
|
|
582
|
+
break;
|
|
583
|
+
case 'type':
|
|
584
|
+
this.updateInputType(newProp.type);
|
|
585
|
+
break;
|
|
586
|
+
case 'stylingMode':
|
|
587
|
+
this.updateVariantClass();
|
|
588
|
+
break;
|
|
589
|
+
case 'ariaLabels':
|
|
590
|
+
this.updateAriaLabel(newProp.ariaLabels);
|
|
591
|
+
break;
|
|
592
|
+
case 'length':
|
|
593
|
+
this.handleLengthChange(newProp.length, oldProp.length);
|
|
594
|
+
break;
|
|
595
|
+
case 'enableRtl':
|
|
596
|
+
this.element.classList[this.enableRtl ? 'add' : 'remove'](RTL);
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
__decorate([
|
|
602
|
+
Property(4)
|
|
603
|
+
], OtpInput.prototype, "length", void 0);
|
|
604
|
+
__decorate([
|
|
605
|
+
Property('')
|
|
606
|
+
], OtpInput.prototype, "value", void 0);
|
|
607
|
+
__decorate([
|
|
608
|
+
Property(OtpInputType.Number)
|
|
609
|
+
], OtpInput.prototype, "type", void 0);
|
|
610
|
+
__decorate([
|
|
611
|
+
Property('')
|
|
612
|
+
], OtpInput.prototype, "separator", void 0);
|
|
613
|
+
__decorate([
|
|
614
|
+
Property('')
|
|
615
|
+
], OtpInput.prototype, "placeholder", void 0);
|
|
616
|
+
__decorate([
|
|
617
|
+
Property(OtpInputStyle.Outlined)
|
|
618
|
+
], OtpInput.prototype, "stylingMode", void 0);
|
|
619
|
+
__decorate([
|
|
620
|
+
Property(false)
|
|
621
|
+
], OtpInput.prototype, "disabled", void 0);
|
|
622
|
+
__decorate([
|
|
623
|
+
Property('')
|
|
624
|
+
], OtpInput.prototype, "cssClass", void 0);
|
|
625
|
+
__decorate([
|
|
626
|
+
Property({})
|
|
627
|
+
], OtpInput.prototype, "htmlAttributes", void 0);
|
|
628
|
+
__decorate([
|
|
629
|
+
Property([])
|
|
630
|
+
], OtpInput.prototype, "ariaLabels", void 0);
|
|
631
|
+
__decorate([
|
|
632
|
+
Event()
|
|
633
|
+
], OtpInput.prototype, "created", void 0);
|
|
634
|
+
__decorate([
|
|
635
|
+
Event()
|
|
636
|
+
], OtpInput.prototype, "valueChanged", void 0);
|
|
637
|
+
__decorate([
|
|
638
|
+
Event()
|
|
639
|
+
], OtpInput.prototype, "focus", void 0);
|
|
640
|
+
__decorate([
|
|
641
|
+
Event()
|
|
642
|
+
], OtpInput.prototype, "blur", void 0);
|
|
643
|
+
__decorate([
|
|
644
|
+
Event()
|
|
645
|
+
], OtpInput.prototype, "input", void 0);
|
|
646
|
+
OtpInput = __decorate([
|
|
647
|
+
NotifyPropertyChanges
|
|
648
|
+
], OtpInput);
|
|
649
|
+
return OtpInput;
|
|
650
|
+
}(Component));
|
|
651
|
+
export { OtpInput };
|
package/src/rating/rating.d.ts
CHANGED
|
@@ -328,9 +328,7 @@ export declare class Rating extends Component<HTMLElement> implements INotifyPro
|
|
|
328
328
|
private emptyTemplateFunction;
|
|
329
329
|
private fullTemplateFunction;
|
|
330
330
|
private tooltipOpen;
|
|
331
|
-
private isReact?;
|
|
332
331
|
private isTouchSelected;
|
|
333
|
-
private isAngular;
|
|
334
332
|
/**
|
|
335
333
|
* Constructor for creating the widget
|
|
336
334
|
*
|
package/src/rating/rating.js
CHANGED
|
@@ -184,10 +184,10 @@ var Rating = /** @class */ (function (_super) {
|
|
|
184
184
|
};
|
|
185
185
|
Rating.prototype.touchMoveHandler = function (e) {
|
|
186
186
|
if (!this.isTouchSelected) {
|
|
187
|
-
this.wrapper.classList.add(
|
|
187
|
+
this.wrapper.classList.add('e-rating-touch');
|
|
188
188
|
this.isTouchSelected = true;
|
|
189
189
|
}
|
|
190
|
-
this.wrapper.classList.add(
|
|
190
|
+
this.wrapper.classList.add('e-touch-select');
|
|
191
191
|
var rect = this.ratingItemList.getBoundingClientRect();
|
|
192
192
|
var x = e.touches[0].clientX - rect.x;
|
|
193
193
|
var currValue = (x / rect.width) * this.itemsCount;
|
|
@@ -218,7 +218,7 @@ var Rating = /** @class */ (function (_super) {
|
|
|
218
218
|
};
|
|
219
219
|
Rating.prototype.touchEndHandler = function () {
|
|
220
220
|
this.closeRatingTooltip();
|
|
221
|
-
this.wrapper.classList.remove(
|
|
221
|
+
this.wrapper.classList.remove('e-touch-select');
|
|
222
222
|
};
|
|
223
223
|
Rating.prototype.updateTemplateFunction = function () {
|
|
224
224
|
this.emptyTemplateFunction = this.emptyTemplate ? this.getTemplateString(this.emptyTemplate) : null;
|
|
@@ -506,7 +506,7 @@ var Rating = /** @class */ (function (_super) {
|
|
|
506
506
|
};
|
|
507
507
|
Rating.prototype.mouseMoveHandler = function (index, e) {
|
|
508
508
|
if (this.isTouchSelected) {
|
|
509
|
-
this.wrapper.classList.remove(
|
|
509
|
+
this.wrapper.classList.remove('e-rating-touch');
|
|
510
510
|
this.isTouchSelected = false;
|
|
511
511
|
}
|
|
512
512
|
var currValue = this.calculateCurrentValue(index, e);
|