@syncfusion/ej2-inputs 28.2.11 → 29.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/README.md +26 -2
- package/aceconfig.js +17 -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 +652 -25
- package/dist/es6/ej2-inputs.es2015.js.map +1 -1
- package/dist/es6/ej2-inputs.es5.js +681 -25
- 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 +18 -26
- package/speech-to-text.d.ts +4 -0
- package/speech-to-text.js +4 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/rating/rating.js +3 -0
- package/src/slider/slider.d.ts +0 -2
- package/src/slider/slider.js +14 -19
- package/src/speech-to-text/index.d.ts +5 -0
- package/src/speech-to-text/index.js +4 -0
- package/src/speech-to-text/speech-to-text-model.d.ts +270 -0
- package/src/speech-to-text/speech-to-text.d.ts +487 -0
- package/src/speech-to-text/speech-to-text.js +660 -0
- package/src/uploader/uploader.js +7 -5
- package/styles/bds-lite.css +81 -0
- package/styles/bds-lite.scss +3 -0
- package/styles/bds.css +111 -0
- package/styles/bds.scss +4 -0
- package/styles/bootstrap-dark-lite.css +98 -17
- package/styles/bootstrap-dark-lite.scss +3 -0
- package/styles/bootstrap-dark.css +128 -17
- package/styles/bootstrap-dark.scss +4 -0
- package/styles/bootstrap-lite.css +81 -0
- package/styles/bootstrap-lite.scss +3 -0
- package/styles/bootstrap.css +111 -0
- package/styles/bootstrap.scss +4 -0
- package/styles/bootstrap4-lite.css +102 -25
- package/styles/bootstrap4-lite.scss +3 -0
- package/styles/bootstrap4.css +132 -25
- package/styles/bootstrap4.scss +4 -0
- package/styles/bootstrap5-dark-lite.css +151 -73
- package/styles/bootstrap5-dark-lite.scss +3 -0
- package/styles/bootstrap5-dark.css +192 -83
- package/styles/bootstrap5-dark.scss +4 -0
- package/styles/bootstrap5-lite.css +106 -28
- package/styles/bootstrap5-lite.scss +3 -0
- package/styles/bootstrap5.3-lite.css +78 -0
- package/styles/bootstrap5.3-lite.scss +3 -0
- package/styles/bootstrap5.3.css +109 -0
- package/styles/bootstrap5.3.scss +4 -0
- package/styles/bootstrap5.css +137 -28
- package/styles/bootstrap5.scss +4 -0
- package/styles/color-picker/_theme.scss +4 -2
- package/styles/color-picker/bootstrap4.css +4 -4
- package/styles/color-picker/bootstrap5-dark.css +12 -12
- package/styles/color-picker/bootstrap5.css +7 -7
- package/styles/data-form/_bootstrap-dark-definition.scss +4 -2
- package/styles/data-form/_bootstrap4-definition.scss +4 -2
- package/styles/data-form/_fabric-dark-definition.scss +4 -2
- package/styles/data-form/_material-dark-definition.scss +4 -2
- package/styles/data-form/_material-definition.scss +4 -2
- package/styles/data-form/bootstrap-dark.css +6 -6
- package/styles/data-form/bootstrap4.css +6 -6
- package/styles/data-form/bootstrap5-dark.css +6 -6
- package/styles/data-form/bootstrap5.css +4 -4
- package/styles/data-form/fabric-dark.css +6 -6
- package/styles/data-form/material-dark.css +6 -6
- package/styles/data-form/material.css +6 -6
- package/styles/fabric-dark-lite.css +104 -22
- package/styles/fabric-dark-lite.scss +3 -0
- package/styles/fabric-dark.css +135 -22
- package/styles/fabric-dark.scss +4 -0
- package/styles/fabric-lite.css +100 -18
- package/styles/fabric-lite.scss +3 -0
- package/styles/fabric.css +131 -18
- package/styles/fabric.scss +4 -0
- package/styles/fluent-dark-lite.css +96 -14
- package/styles/fluent-dark-lite.scss +3 -0
- package/styles/fluent-dark.css +127 -14
- package/styles/fluent-dark.scss +4 -0
- package/styles/fluent-lite.css +96 -14
- package/styles/fluent-lite.scss +3 -0
- package/styles/fluent.css +127 -14
- package/styles/fluent.scss +4 -0
- package/styles/fluent2-lite.css +82 -0
- package/styles/fluent2-lite.scss +3 -0
- package/styles/fluent2.css +115 -2
- package/styles/fluent2.scss +4 -0
- package/styles/highcontrast-light-lite.css +81 -0
- package/styles/highcontrast-light-lite.scss +3 -0
- package/styles/highcontrast-light.css +111 -0
- package/styles/highcontrast-light.scss +4 -0
- package/styles/highcontrast-lite.css +81 -0
- package/styles/highcontrast-lite.scss +3 -0
- package/styles/highcontrast.css +111 -0
- package/styles/highcontrast.scss +4 -0
- package/styles/input/_bootstrap4-definition.scss +8 -6
- package/styles/input/_layout.scss +8 -1
- package/styles/input/_theme.scss +5 -1
- package/styles/input/bootstrap4.css +9 -9
- package/styles/input/bootstrap5-dark.css +25 -25
- package/styles/input/bootstrap5.css +7 -7
- package/styles/input/fabric-dark.css +6 -6
- package/styles/input/tailwind-dark.css +2 -2
- package/styles/input/tailwind3.css +2 -2
- package/styles/maskedtextbox/bootstrap5-dark.css +1 -1
- package/styles/material-dark-lite.css +89 -6
- package/styles/material-dark-lite.scss +3 -0
- package/styles/material-dark.css +121 -6
- package/styles/material-dark.scss +4 -0
- package/styles/material-lite.css +89 -6
- package/styles/material-lite.scss +3 -0
- package/styles/material.css +121 -6
- package/styles/material.scss +4 -0
- package/styles/material3-dark-lite.css +81 -0
- package/styles/material3-dark-lite.scss +3 -0
- package/styles/material3-dark.css +111 -0
- package/styles/material3-dark.scss +4 -0
- package/styles/material3-lite.css +81 -0
- package/styles/material3-lite.scss +3 -0
- package/styles/material3.css +111 -0
- package/styles/material3.scss +4 -0
- package/styles/otp-input/bootstrap5-dark.css +3 -3
- package/styles/rating/bootstrap-dark.css +11 -11
- package/styles/rating/bootstrap5-dark.css +5 -5
- package/styles/rating/bootstrap5.css +5 -5
- package/styles/rating/fabric-dark.css +5 -5
- package/styles/rating/fabric.css +12 -12
- package/styles/rating/fluent-dark.css +11 -11
- package/styles/rating/fluent.css +11 -11
- package/styles/rating/tailwind-dark.css +5 -5
- package/styles/rating/tailwind.css +5 -5
- package/styles/signature/bootstrap5-dark.css +1 -1
- package/styles/slider/_bootstrap4-definition.scss +4 -2
- package/styles/slider/_fluent2-definition.scss +2 -2
- package/styles/slider/_fusionnew-definition.scss +3 -0
- package/styles/slider/_layout.scss +4 -2
- package/styles/slider/bootstrap4.css +6 -6
- package/styles/slider/bootstrap5-dark.css +5 -5
- package/styles/slider/bootstrap5.css +5 -5
- package/styles/slider/fabric-dark.css +5 -5
- package/styles/slider/fabric.css +6 -6
- package/styles/slider/fluent-dark.css +3 -3
- package/styles/slider/fluent.css +3 -3
- package/styles/slider/fluent2.css +2 -2
- package/styles/smart-textarea/tailwind-dark.css +1 -1
- package/styles/speech-to-text/_all.scss +2 -0
- package/styles/speech-to-text/_bds-definition.scss +25 -0
- package/styles/speech-to-text/_bigger.scss +45 -0
- package/styles/speech-to-text/_bootstrap-dark-definition.scss +24 -0
- package/styles/speech-to-text/_bootstrap-definition.scss +24 -0
- package/styles/speech-to-text/_bootstrap4-definition.scss +24 -0
- package/styles/speech-to-text/_bootstrap5-dark-definition.scss +1 -0
- package/styles/speech-to-text/_bootstrap5-definition.scss +24 -0
- package/styles/speech-to-text/_bootstrap5.3-definition.scss +24 -0
- package/styles/speech-to-text/_fabric-dark-definition.scss +24 -0
- package/styles/speech-to-text/_fabric-definition.scss +24 -0
- package/styles/speech-to-text/_fluent-dark-definition.scss +1 -0
- package/styles/speech-to-text/_fluent-definition.scss +24 -0
- package/styles/speech-to-text/_fluent2-definition.scss +25 -0
- package/styles/speech-to-text/_fusionnew-definition.scss +24 -0
- package/styles/speech-to-text/_highcontrast-definition.scss +24 -0
- package/styles/speech-to-text/_highcontrast-light-definition.scss +24 -0
- package/styles/speech-to-text/_layout.scss +59 -0
- package/styles/speech-to-text/_material-dark-definition.scss +24 -0
- package/styles/speech-to-text/_material-definition.scss +24 -0
- package/styles/speech-to-text/_material3-dark-definition.scss +1 -0
- package/styles/speech-to-text/_material3-definition.scss +24 -0
- package/styles/speech-to-text/_tailwind-dark-definition.scss +1 -0
- package/styles/speech-to-text/_tailwind-definition.scss +25 -0
- package/styles/speech-to-text/_tailwind3-definition.scss +25 -0
- package/styles/speech-to-text/_theme.scss +30 -0
- package/styles/speech-to-text/bds.css +173 -0
- package/styles/speech-to-text/bds.scss +7 -0
- package/styles/speech-to-text/bootstrap-dark.css +110 -0
- package/styles/speech-to-text/bootstrap-dark.scss +7 -0
- package/styles/speech-to-text/bootstrap.css +110 -0
- package/styles/speech-to-text/bootstrap.scss +7 -0
- package/styles/speech-to-text/bootstrap4.css +106 -0
- package/styles/speech-to-text/bootstrap4.scss +7 -0
- package/styles/speech-to-text/bootstrap5-dark.css +108 -0
- package/styles/speech-to-text/bootstrap5-dark.scss +7 -0
- package/styles/speech-to-text/bootstrap5.3.css +112 -0
- package/styles/speech-to-text/bootstrap5.3.scss +7 -0
- package/styles/speech-to-text/bootstrap5.css +108 -0
- package/styles/speech-to-text/bootstrap5.scss +7 -0
- package/styles/speech-to-text/fabric-dark.css +112 -0
- package/styles/speech-to-text/fabric-dark.scss +7 -0
- package/styles/speech-to-text/fabric.css +112 -0
- package/styles/speech-to-text/fabric.scss +7 -0
- package/styles/speech-to-text/fluent-dark.css +112 -0
- package/styles/speech-to-text/fluent-dark.scss +7 -0
- package/styles/speech-to-text/fluent.css +112 -0
- package/styles/speech-to-text/fluent.scss +7 -0
- package/styles/speech-to-text/fluent2.css +118 -0
- package/styles/speech-to-text/fluent2.scss +7 -0
- package/styles/speech-to-text/highcontrast-light.css +110 -0
- package/styles/speech-to-text/highcontrast-light.scss +7 -0
- package/styles/speech-to-text/highcontrast.css +110 -0
- package/styles/speech-to-text/highcontrast.scss +7 -0
- package/styles/speech-to-text/icons/_bds.scss +8 -0
- package/styles/speech-to-text/icons/_bootstrap-dark.scss +8 -0
- package/styles/speech-to-text/icons/_bootstrap.scss +8 -0
- package/styles/speech-to-text/icons/_bootstrap4.scss +8 -0
- package/styles/speech-to-text/icons/_bootstrap5-dark.scss +1 -0
- package/styles/speech-to-text/icons/_bootstrap5.3.scss +8 -0
- package/styles/speech-to-text/icons/_bootstrap5.scss +8 -0
- package/styles/speech-to-text/icons/_fabric-dark.scss +8 -0
- package/styles/speech-to-text/icons/_fabric.scss +8 -0
- package/styles/speech-to-text/icons/_fluent-dark.scss +1 -0
- package/styles/speech-to-text/icons/_fluent.scss +8 -0
- package/styles/speech-to-text/icons/_fluent2.scss +8 -0
- package/styles/speech-to-text/icons/_fusionnew.scss +8 -0
- package/styles/speech-to-text/icons/_highcontrast-light.scss +8 -0
- package/styles/speech-to-text/icons/_highcontrast.scss +8 -0
- package/styles/speech-to-text/icons/_material-dark.scss +8 -0
- package/styles/speech-to-text/icons/_material.scss +8 -0
- package/styles/speech-to-text/icons/_material3-dark.scss +1 -0
- package/styles/speech-to-text/icons/_material3.scss +8 -0
- package/styles/speech-to-text/icons/_tailwind-dark.scss +1 -0
- package/styles/speech-to-text/icons/_tailwind.scss +8 -0
- package/styles/speech-to-text/icons/_tailwind3.scss +8 -0
- package/styles/speech-to-text/material-dark.css +114 -0
- package/styles/speech-to-text/material-dark.scss +7 -0
- package/styles/speech-to-text/material.css +114 -0
- package/styles/speech-to-text/material.scss +7 -0
- package/styles/speech-to-text/material3-dark.css +112 -0
- package/styles/speech-to-text/material3-dark.scss +8 -0
- package/styles/speech-to-text/material3.css +114 -0
- package/styles/speech-to-text/material3.scss +8 -0
- package/styles/speech-to-text/tailwind-dark.css +110 -0
- package/styles/speech-to-text/tailwind-dark.scss +7 -0
- package/styles/speech-to-text/tailwind.css +110 -0
- package/styles/speech-to-text/tailwind.scss +7 -0
- package/styles/speech-to-text/tailwind3.css +114 -0
- package/styles/speech-to-text/tailwind3.scss +7 -0
- package/styles/tailwind-dark-lite.css +93 -12
- package/styles/tailwind-dark-lite.scss +3 -0
- package/styles/tailwind-dark.css +126 -15
- package/styles/tailwind-dark.scss +4 -0
- package/styles/tailwind-lite.css +86 -5
- package/styles/tailwind-lite.scss +3 -0
- package/styles/tailwind.css +116 -5
- package/styles/tailwind.scss +4 -0
- package/styles/tailwind3-lite.css +83 -2
- package/styles/tailwind3-lite.scss +3 -0
- package/styles/tailwind3.css +113 -2
- package/styles/tailwind3.scss +4 -0
- package/styles/uploader/bootstrap5-dark.css +25 -25
- package/styles/uploader/tailwind-dark.css +7 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isNullOrUndefined, createElement, addClass, attributes, removeClass, formatUnit, remove, detach, classList, closest, getValue, setValue, L10n, getUniqueID, Internationalization, EventHandler, Browser, merge, getNumericObject, Property, Event, NotifyPropertyChanges, Component, extend, ChildProperty, setStyleAttribute, SanitizeHtmlHelper, initializeCSPTemplate, Collection, Complex, onIntlChange, select, selectAll, Base, KeyboardEvents, Ajax, append, Animation, compile, rippleEffect, getInstance } from '@syncfusion/ej2-base';
|
|
2
2
|
import { Tooltip, getZindexPartial, createSpinner, showSpinner, hideSpinner, isCollide, Popup } from '@syncfusion/ej2-popups';
|
|
3
3
|
import { SplitButton, Deferred, getModel } from '@syncfusion/ej2-splitbuttons';
|
|
4
|
+
import { Button } from '@syncfusion/ej2-buttons';
|
|
4
5
|
|
|
5
6
|
/* eslint-disable valid-jsdoc, jsdoc/require-jsdoc, jsdoc/require-returns, jsdoc/require-param */
|
|
6
7
|
var CLASSNAMES = {
|
|
@@ -4300,6 +4301,7 @@ var TooltipData = /** @__PURE__ @class */ (function (_super) {
|
|
|
4300
4301
|
}(ChildProperty));
|
|
4301
4302
|
var bootstrapTooltipOffset = 6;
|
|
4302
4303
|
var bootstrap4TooltipOffset = 3;
|
|
4304
|
+
var tolerance = 1e-10;
|
|
4303
4305
|
var classNames = {
|
|
4304
4306
|
root: 'e-slider',
|
|
4305
4307
|
rtl: 'e-rtl',
|
|
@@ -4462,15 +4464,6 @@ var Slider = /** @__PURE__ @class */ (function (_super) {
|
|
|
4462
4464
|
var decimals = precision || 0;
|
|
4463
4465
|
return Number(value.toFixed(decimals));
|
|
4464
4466
|
};
|
|
4465
|
-
Slider.prototype.fractionalToInteger = function (value) {
|
|
4466
|
-
value = (this.numberOfDecimals(value) === 0) ? Number(value).toFixed(this.noOfDecimals) : value;
|
|
4467
|
-
var tens = 1;
|
|
4468
|
-
for (var i = 0; i < this.noOfDecimals; i++) {
|
|
4469
|
-
tens *= 10;
|
|
4470
|
-
}
|
|
4471
|
-
value = Number((value * tens).toFixed(0));
|
|
4472
|
-
return value;
|
|
4473
|
-
};
|
|
4474
4467
|
/**
|
|
4475
4468
|
* To Initialize the control rendering
|
|
4476
4469
|
*
|
|
@@ -5274,7 +5267,6 @@ var Slider = /** @__PURE__ @class */ (function (_super) {
|
|
|
5274
5267
|
};
|
|
5275
5268
|
Slider.prototype.renderScale = function () {
|
|
5276
5269
|
var orien = this.orientation === 'Vertical' ? 'v' : 'h';
|
|
5277
|
-
this.noOfDecimals = this.numberOfDecimals(this.step);
|
|
5278
5270
|
this.ul = this.createElement('ul', {
|
|
5279
5271
|
className: classNames.scale + ' ' + 'e-' + orien + '-scale ' + classNames.tick + '-' + this.ticks.placement.toLowerCase(),
|
|
5280
5272
|
attrs: { role: 'presentation', 'aria-hidden': 'true' }
|
|
@@ -5295,9 +5287,9 @@ var Slider = /** @__PURE__ @class */ (function (_super) {
|
|
|
5295
5287
|
else if (smallStep <= 0) {
|
|
5296
5288
|
smallStep = parseFloat(formatUnit(this.step));
|
|
5297
5289
|
}
|
|
5298
|
-
var min =
|
|
5299
|
-
var max =
|
|
5300
|
-
var steps =
|
|
5290
|
+
var min = parseFloat(formatUnit(this.min));
|
|
5291
|
+
var max = parseFloat(formatUnit(this.max));
|
|
5292
|
+
var steps = parseFloat(formatUnit(smallStep));
|
|
5301
5293
|
var bigNum = !isNullOrUndefined(this.customValues) && this.customValues.length > 0 && this.customValues.length - 1;
|
|
5302
5294
|
var customStep = this.customTickCounter(bigNum);
|
|
5303
5295
|
var count = !isNullOrUndefined(this.customValues) && this.customValues.length > 0 ?
|
|
@@ -5341,20 +5333,24 @@ var Slider = /** @__PURE__ @class */ (function (_super) {
|
|
|
5341
5333
|
if (this.numberOfDecimals(this.max) === 0 && this.numberOfDecimals(this.min) === 0 &&
|
|
5342
5334
|
this.numberOfDecimals(this.step) === 0) {
|
|
5343
5335
|
if (orien === 'h') {
|
|
5344
|
-
|
|
5336
|
+
var reminder = (start - parseFloat(this.min.toString())) % this.ticks.largeStep;
|
|
5337
|
+
islargeTick = (Math.abs(reminder) < tolerance || Math.abs(this.ticks.largeStep - reminder) < tolerance);
|
|
5345
5338
|
}
|
|
5346
5339
|
else {
|
|
5347
|
-
|
|
5340
|
+
var reminder = Math.abs(start - parseFloat(this.max.toString())) % this.ticks.largeStep;
|
|
5341
|
+
islargeTick = (Math.abs(reminder) < tolerance || Math.abs(this.ticks.largeStep - reminder) < tolerance);
|
|
5348
5342
|
}
|
|
5349
5343
|
}
|
|
5350
5344
|
else {
|
|
5351
|
-
var largestep = this.
|
|
5352
|
-
var startValue =
|
|
5345
|
+
var largestep = this.ticks.largeStep;
|
|
5346
|
+
var startValue = start;
|
|
5353
5347
|
if (orien === 'h') {
|
|
5354
|
-
|
|
5348
|
+
var reminder = ((startValue - min) % largestep);
|
|
5349
|
+
islargeTick = Math.abs(reminder) < tolerance || Math.abs(largestep - reminder) < tolerance;
|
|
5355
5350
|
}
|
|
5356
5351
|
else {
|
|
5357
|
-
|
|
5352
|
+
var reminder = Math.abs(startValue - parseFloat(max.toString())) % largestep;
|
|
5353
|
+
islargeTick = Math.abs(reminder) < tolerance || Math.abs(largestep - reminder) < tolerance;
|
|
5358
5354
|
}
|
|
5359
5355
|
}
|
|
5360
5356
|
}
|
|
@@ -11246,11 +11242,13 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
|
|
|
11246
11242
|
};
|
|
11247
11243
|
Uploader.prototype.getFilesInArray = function (files) {
|
|
11248
11244
|
var uploadFiles = [];
|
|
11249
|
-
if (files
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
|
|
11245
|
+
if (files) {
|
|
11246
|
+
if (files instanceof Array) {
|
|
11247
|
+
uploadFiles = files;
|
|
11248
|
+
}
|
|
11249
|
+
else {
|
|
11250
|
+
uploadFiles.push(files);
|
|
11251
|
+
}
|
|
11254
11252
|
}
|
|
11255
11253
|
return uploadFiles;
|
|
11256
11254
|
};
|
|
@@ -17205,6 +17203,9 @@ var Rating = /** @__PURE__ @class */ (function (_super) {
|
|
|
17205
17203
|
};
|
|
17206
17204
|
Rating.prototype.updateResetButton = function () {
|
|
17207
17205
|
if (this.allowReset) {
|
|
17206
|
+
if (this.resetElement) {
|
|
17207
|
+
this.resetElement.blur();
|
|
17208
|
+
}
|
|
17208
17209
|
var isDisabled = (this.value <= this.min) || this.disabled;
|
|
17209
17210
|
this.resetElement.classList[isDisabled ? 'add' : 'remove'](DISABLED$2);
|
|
17210
17211
|
attributes(this.resetElement, { 'tabindex': (isDisabled ? '-1' : '0'), 'aria-hidden': isDisabled.toString() });
|
|
@@ -18600,5 +18601,660 @@ var OtpInput = /** @__PURE__ @class */ (function (_super) {
|
|
|
18600
18601
|
return OtpInput;
|
|
18601
18602
|
}(Component));
|
|
18602
18603
|
|
|
18603
|
-
|
|
18604
|
+
var __extends$d = (undefined && undefined.__extends) || (function () {
|
|
18605
|
+
var extendStatics = function (d, b) {
|
|
18606
|
+
extendStatics = Object.setPrototypeOf ||
|
|
18607
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18608
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
18609
|
+
return extendStatics(d, b);
|
|
18610
|
+
};
|
|
18611
|
+
return function (d, b) {
|
|
18612
|
+
extendStatics(d, b);
|
|
18613
|
+
function __() { this.constructor = d; }
|
|
18614
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18615
|
+
};
|
|
18616
|
+
})();
|
|
18617
|
+
var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
18618
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18619
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
18620
|
+
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;
|
|
18621
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18622
|
+
};
|
|
18623
|
+
/**
|
|
18624
|
+
* Configuration settings for the toggle button used in the SpeechToText component.
|
|
18625
|
+
*/
|
|
18626
|
+
var ButtonSettings = /** @__PURE__ @class */ (function (_super) {
|
|
18627
|
+
__extends$d(ButtonSettings, _super);
|
|
18628
|
+
function ButtonSettings() {
|
|
18629
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
18630
|
+
}
|
|
18631
|
+
__decorate$c([
|
|
18632
|
+
Property('')
|
|
18633
|
+
], ButtonSettings.prototype, "content", void 0);
|
|
18634
|
+
__decorate$c([
|
|
18635
|
+
Property('')
|
|
18636
|
+
], ButtonSettings.prototype, "stopContent", void 0);
|
|
18637
|
+
__decorate$c([
|
|
18638
|
+
Property('')
|
|
18639
|
+
], ButtonSettings.prototype, "iconCss", void 0);
|
|
18640
|
+
__decorate$c([
|
|
18641
|
+
Property('')
|
|
18642
|
+
], ButtonSettings.prototype, "stopIconCss", void 0);
|
|
18643
|
+
__decorate$c([
|
|
18644
|
+
Property('Left')
|
|
18645
|
+
], ButtonSettings.prototype, "iconPosition", void 0);
|
|
18646
|
+
__decorate$c([
|
|
18647
|
+
Property(false)
|
|
18648
|
+
], ButtonSettings.prototype, "isPrimary", void 0);
|
|
18649
|
+
return ButtonSettings;
|
|
18650
|
+
}(ChildProperty));
|
|
18651
|
+
/**
|
|
18652
|
+
* Configuration settings for tooltips in the SpeechToText component.
|
|
18653
|
+
* This allows customization of the tooltip content and its positioning.
|
|
18654
|
+
*/
|
|
18655
|
+
var TooltipSettings = /** @__PURE__ @class */ (function (_super) {
|
|
18656
|
+
__extends$d(TooltipSettings, _super);
|
|
18657
|
+
function TooltipSettings() {
|
|
18658
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
18659
|
+
}
|
|
18660
|
+
__decorate$c([
|
|
18661
|
+
Property('Start listening')
|
|
18662
|
+
], TooltipSettings.prototype, "content", void 0);
|
|
18663
|
+
__decorate$c([
|
|
18664
|
+
Property('Stop listening')
|
|
18665
|
+
], TooltipSettings.prototype, "stopContent", void 0);
|
|
18666
|
+
__decorate$c([
|
|
18667
|
+
Property('TopCenter')
|
|
18668
|
+
], TooltipSettings.prototype, "position", void 0);
|
|
18669
|
+
return TooltipSettings;
|
|
18670
|
+
}(ChildProperty));
|
|
18671
|
+
/**
|
|
18672
|
+
* Enum representing the operational states of the SpeechToText component.
|
|
18673
|
+
*/
|
|
18674
|
+
var SpeechToTextState;
|
|
18675
|
+
(function (SpeechToTextState) {
|
|
18676
|
+
/**
|
|
18677
|
+
* Specifies the state where the SpeechToText component is inactive and not processing spoken input.
|
|
18678
|
+
*/
|
|
18679
|
+
SpeechToTextState["Inactive"] = "Inactive";
|
|
18680
|
+
/**
|
|
18681
|
+
* Specifies the state where the SpeechToText component is actively listening to spoken input.
|
|
18682
|
+
*/
|
|
18683
|
+
SpeechToTextState["Listening"] = "Listening";
|
|
18684
|
+
/**
|
|
18685
|
+
* Specifies the state where the SpeechToText component has stopped processing spoken input.
|
|
18686
|
+
*/
|
|
18687
|
+
SpeechToTextState["Stopped"] = "Stopped";
|
|
18688
|
+
})(SpeechToTextState || (SpeechToTextState = {}));
|
|
18689
|
+
//#endregion
|
|
18690
|
+
var SpeechToText = /** @__PURE__ @class */ (function (_super) {
|
|
18691
|
+
__extends$d(SpeechToText, _super);
|
|
18692
|
+
//#endregion
|
|
18693
|
+
//#region Inherited methods
|
|
18694
|
+
/**
|
|
18695
|
+
* Constructor for creating the component
|
|
18696
|
+
*
|
|
18697
|
+
* @param {SpeechToTextModel} options - Specifies the SpeechToTextModel model.
|
|
18698
|
+
* @param {string | HTMLElement} element - Specifies the element to render as component.
|
|
18699
|
+
* @private
|
|
18700
|
+
*/
|
|
18701
|
+
function SpeechToText(options, element) {
|
|
18702
|
+
var _this = _super.call(this, options, element) || this;
|
|
18703
|
+
_this.fullTranscript = '';
|
|
18704
|
+
_this.isClicked = false;
|
|
18705
|
+
_this.isUserInteracted = false;
|
|
18706
|
+
_this.hasStarted = false;
|
|
18707
|
+
return _this;
|
|
18708
|
+
}
|
|
18709
|
+
/**
|
|
18710
|
+
* Initialize the event handler
|
|
18711
|
+
*
|
|
18712
|
+
* @private
|
|
18713
|
+
* @returns {void}
|
|
18714
|
+
*/
|
|
18715
|
+
SpeechToText.prototype.preRender = function () {
|
|
18716
|
+
if (!this.element.id) {
|
|
18717
|
+
this.element.id = getUniqueID('e-' + this.getModuleName());
|
|
18718
|
+
}
|
|
18719
|
+
};
|
|
18720
|
+
SpeechToText.prototype.getDirective = function () {
|
|
18721
|
+
return 'EJS-SPEECHTOTEXT';
|
|
18722
|
+
};
|
|
18723
|
+
/**
|
|
18724
|
+
* To get component name.
|
|
18725
|
+
*
|
|
18726
|
+
* @returns {string} - It returns the current module name.
|
|
18727
|
+
* @private
|
|
18728
|
+
*/
|
|
18729
|
+
SpeechToText.prototype.getModuleName = function () {
|
|
18730
|
+
return 'speech-to-text';
|
|
18731
|
+
};
|
|
18732
|
+
/**
|
|
18733
|
+
* Get the properties to be maintained in the persisted state.
|
|
18734
|
+
*
|
|
18735
|
+
* @private
|
|
18736
|
+
* @returns {string} - It returns the persisted data.
|
|
18737
|
+
*/
|
|
18738
|
+
SpeechToText.prototype.getPersistData = function () {
|
|
18739
|
+
return this.addOnPersist([]);
|
|
18740
|
+
};
|
|
18741
|
+
SpeechToText.prototype.render = function () {
|
|
18742
|
+
this.renderSpeechToText();
|
|
18743
|
+
this.initializeSpeechRecognition();
|
|
18744
|
+
if (!isNullOrUndefined(this.listeningState)) {
|
|
18745
|
+
this.handleStateChange();
|
|
18746
|
+
}
|
|
18747
|
+
this.wireEvents();
|
|
18748
|
+
};
|
|
18749
|
+
//#endregion
|
|
18750
|
+
//#region Private Methods
|
|
18751
|
+
SpeechToText.prototype.initializeLocale = function () {
|
|
18752
|
+
this.l10n = new L10n(this.getModuleName(), {
|
|
18753
|
+
abortedError: 'Speech recognition was aborted.',
|
|
18754
|
+
audioCaptureError: 'No microphone detected. Ensure your microphone is connected.',
|
|
18755
|
+
defaultError: 'An unknown error occurred.',
|
|
18756
|
+
networkError: 'Network error occurred. Check your internet connection.',
|
|
18757
|
+
noSpeechError: 'No speech detected. Please speak into the microphone.',
|
|
18758
|
+
notAllowedError: 'Microphone access denied. Allow microphone permissions.',
|
|
18759
|
+
serviceNotAllowedError: 'Speech recognition service is not allowed in this context.',
|
|
18760
|
+
unsupportedBrowserError: 'The browser does not support the SpeechRecognition API.',
|
|
18761
|
+
startAriaLabel: 'Press to start speaking and transcribe your words',
|
|
18762
|
+
stopAriaLabel: 'Press to stop speaking and end transcription',
|
|
18763
|
+
startTooltipText: 'Start listening',
|
|
18764
|
+
stopTooltipText: 'Stop listening'
|
|
18765
|
+
}, this.locale);
|
|
18766
|
+
};
|
|
18767
|
+
SpeechToText.prototype.renderSpeechToText = function () {
|
|
18768
|
+
this.initializeLocale();
|
|
18769
|
+
var iconCss = !isNullOrUndefined(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
|
|
18770
|
+
this.buttonInst = new Button({
|
|
18771
|
+
iconCss: iconCss,
|
|
18772
|
+
isPrimary: this.buttonSettings.isPrimary,
|
|
18773
|
+
cssClass: this.updateButtonCssClass(),
|
|
18774
|
+
disabled: this.disabled,
|
|
18775
|
+
content: this.buttonSettings.content,
|
|
18776
|
+
iconPosition: this.buttonSettings.iconPosition,
|
|
18777
|
+
enableRtl: this.enableRtl
|
|
18778
|
+
});
|
|
18779
|
+
this.buttonInst.appendTo(this.element);
|
|
18780
|
+
this.updateTooltip();
|
|
18781
|
+
this.updateCssClass(this.cssClass, '');
|
|
18782
|
+
this.updateAriaLabel();
|
|
18783
|
+
if (!isNullOrUndefined(this.htmlAttributes)) {
|
|
18784
|
+
this.addHtmlAttributes(this.htmlAttributes);
|
|
18785
|
+
}
|
|
18786
|
+
};
|
|
18787
|
+
SpeechToText.prototype.updateAriaLabel = function () {
|
|
18788
|
+
var ariaLabel;
|
|
18789
|
+
if (this.htmlAttributes && this.htmlAttributes['aria-label']) {
|
|
18790
|
+
ariaLabel = this.htmlAttributes['aria-label'];
|
|
18791
|
+
}
|
|
18792
|
+
else {
|
|
18793
|
+
ariaLabel = this.micOn ? this.l10n.getConstant('stopAriaLabel') : this.l10n.getConstant('startAriaLabel');
|
|
18794
|
+
}
|
|
18795
|
+
this.element.setAttribute('aria-label', ariaLabel);
|
|
18796
|
+
};
|
|
18797
|
+
SpeechToText.prototype.updateCssClass = function (newClass, oldClass) {
|
|
18798
|
+
if (oldClass) {
|
|
18799
|
+
removeClass([this.element], oldClass.trim().split(' '));
|
|
18800
|
+
}
|
|
18801
|
+
if (newClass) {
|
|
18802
|
+
addClass([this.element], newClass.trim().split(' '));
|
|
18803
|
+
}
|
|
18804
|
+
};
|
|
18805
|
+
SpeechToText.prototype.updateButtonCssClass = function () {
|
|
18806
|
+
var content = this.isClicked ? this.buttonSettings.stopContent : this.buttonSettings.content;
|
|
18807
|
+
var cssClass;
|
|
18808
|
+
if (content === '') {
|
|
18809
|
+
cssClass = 'e-round';
|
|
18810
|
+
}
|
|
18811
|
+
if (this.micOn) {
|
|
18812
|
+
cssClass += ' e-listening-state';
|
|
18813
|
+
}
|
|
18814
|
+
return cssClass;
|
|
18815
|
+
};
|
|
18816
|
+
SpeechToText.prototype.updateTooltip = function () {
|
|
18817
|
+
if (this.showTooltip) {
|
|
18818
|
+
if (this.tooltipSettings) {
|
|
18819
|
+
if (this.tooltipSettings.content === 'Start listening') {
|
|
18820
|
+
this.tooltipSettings.content = this.l10n.getConstant('startTooltipText');
|
|
18821
|
+
}
|
|
18822
|
+
if (this.tooltipSettings.stopContent === 'Stop listening') {
|
|
18823
|
+
this.tooltipSettings.stopContent = this.l10n.getConstant('stopTooltipText');
|
|
18824
|
+
}
|
|
18825
|
+
}
|
|
18826
|
+
this.tooltipInst = new Tooltip({
|
|
18827
|
+
content: this.hasStarted ? this.tooltipSettings.stopContent : this.tooltipSettings.content,
|
|
18828
|
+
position: this.tooltipSettings.position,
|
|
18829
|
+
windowCollision: true,
|
|
18830
|
+
cssClass: this.cssClass ? ('e-speech-to-text-tooltip ' + this.cssClass) : 'e-speech-to-text-tooltip',
|
|
18831
|
+
opensOn: 'Hover',
|
|
18832
|
+
enableRtl: this.enableRtl
|
|
18833
|
+
});
|
|
18834
|
+
this.tooltipInst.appendTo(this.element);
|
|
18835
|
+
}
|
|
18836
|
+
else {
|
|
18837
|
+
if (!isNullOrUndefined(this.tooltipInst)) {
|
|
18838
|
+
this.tooltipInst.destroy();
|
|
18839
|
+
this.tooltipInst = null;
|
|
18840
|
+
}
|
|
18841
|
+
}
|
|
18842
|
+
};
|
|
18843
|
+
SpeechToText.prototype.handleStateChange = function () {
|
|
18844
|
+
if (this.disabled) {
|
|
18845
|
+
return;
|
|
18846
|
+
}
|
|
18847
|
+
if (this.listeningState === SpeechToTextState.Listening) {
|
|
18848
|
+
this.micOn = true;
|
|
18849
|
+
this.startSpeechRecognition();
|
|
18850
|
+
}
|
|
18851
|
+
else if (this.listeningState === SpeechToTextState.Inactive || this.listeningState === SpeechToTextState.Stopped) {
|
|
18852
|
+
if (this.micOn) {
|
|
18853
|
+
this.micOn = false;
|
|
18854
|
+
this.stopSpeechRecognition();
|
|
18855
|
+
}
|
|
18856
|
+
else {
|
|
18857
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
18858
|
+
this.isProtectedOnChange = true;
|
|
18859
|
+
this.listeningState = SpeechToTextState.Inactive;
|
|
18860
|
+
this.isProtectedOnChange = prevOnChange;
|
|
18861
|
+
}
|
|
18862
|
+
}
|
|
18863
|
+
};
|
|
18864
|
+
SpeechToText.prototype.addHtmlAttributes = function (attrs) {
|
|
18865
|
+
if (attrs) {
|
|
18866
|
+
for (var attr in attrs) {
|
|
18867
|
+
if (Object.prototype.hasOwnProperty.call(attrs, attr)) {
|
|
18868
|
+
this.element.setAttribute(attr, attrs[attr]);
|
|
18869
|
+
}
|
|
18870
|
+
}
|
|
18871
|
+
}
|
|
18872
|
+
};
|
|
18873
|
+
SpeechToText.prototype.removeHtmlAttributes = function (attrs) {
|
|
18874
|
+
if (attrs) {
|
|
18875
|
+
for (var attr in attrs) {
|
|
18876
|
+
if (Object.prototype.hasOwnProperty.call(attrs, attr)) {
|
|
18877
|
+
this.element.removeAttribute(attr);
|
|
18878
|
+
}
|
|
18879
|
+
}
|
|
18880
|
+
}
|
|
18881
|
+
};
|
|
18882
|
+
SpeechToText.prototype.wireEvents = function () {
|
|
18883
|
+
EventHandler.add(this.element, 'click', this.handleButtonClick, this);
|
|
18884
|
+
};
|
|
18885
|
+
SpeechToText.prototype.unWireEvents = function () {
|
|
18886
|
+
EventHandler.remove(this.element, 'click', this.handleButtonClick);
|
|
18887
|
+
};
|
|
18888
|
+
SpeechToText.prototype.handleButtonClick = function (event) {
|
|
18889
|
+
this.isUserInteracted = true;
|
|
18890
|
+
this.micOn = !this.micOn;
|
|
18891
|
+
if (this.micOn) {
|
|
18892
|
+
this.startSpeechRecognition(event);
|
|
18893
|
+
}
|
|
18894
|
+
else {
|
|
18895
|
+
this.stopSpeechRecognition(event);
|
|
18896
|
+
}
|
|
18897
|
+
};
|
|
18898
|
+
SpeechToText.prototype.triggerUnSupportedError = function () {
|
|
18899
|
+
var eventArgs = {
|
|
18900
|
+
error: 'unsupported-browser',
|
|
18901
|
+
errorMessage: this.l10n.getConstant('unsupportedBrowserError')
|
|
18902
|
+
};
|
|
18903
|
+
this.trigger('onError', eventArgs);
|
|
18904
|
+
};
|
|
18905
|
+
SpeechToText.prototype.initializeSpeechRecognition = function () {
|
|
18906
|
+
var _this = this;
|
|
18907
|
+
var windowInst = window;
|
|
18908
|
+
var SpeechRecognition = windowInst.SpeechRecognition || windowInst.webkitSpeechRecognition;
|
|
18909
|
+
if (!SpeechRecognition) {
|
|
18910
|
+
this.triggerUnSupportedError();
|
|
18911
|
+
return;
|
|
18912
|
+
}
|
|
18913
|
+
this.recognition = new SpeechRecognition();
|
|
18914
|
+
this.recognition.continuous = true;
|
|
18915
|
+
this.recognition.lang = this.lang;
|
|
18916
|
+
this.recognition.interimResults = this.allowInterimResults;
|
|
18917
|
+
this.recognition.onstart = function (event) {
|
|
18918
|
+
var prevOnChange = _this.isProtectedOnChange;
|
|
18919
|
+
_this.isProtectedOnChange = true;
|
|
18920
|
+
_this.transcript = _this.fullTranscript = '';
|
|
18921
|
+
_this.isProtectedOnChange = prevOnChange;
|
|
18922
|
+
var eventArgs = {
|
|
18923
|
+
cancel: false,
|
|
18924
|
+
listeningState: SpeechToTextState.Listening,
|
|
18925
|
+
event: event,
|
|
18926
|
+
isInteracted: _this.isUserInteracted
|
|
18927
|
+
};
|
|
18928
|
+
_this.trigger('onStart', eventArgs, function () {
|
|
18929
|
+
if (!eventArgs.cancel) {
|
|
18930
|
+
_this.handleStartRecognition();
|
|
18931
|
+
}
|
|
18932
|
+
else {
|
|
18933
|
+
_this.recognition.abort();
|
|
18934
|
+
_this.micOn = false;
|
|
18935
|
+
}
|
|
18936
|
+
});
|
|
18937
|
+
};
|
|
18938
|
+
this.recognition.onend = function (event) {
|
|
18939
|
+
if (_this.hasStarted) {
|
|
18940
|
+
_this.micOn = false;
|
|
18941
|
+
_this.handleStopRecognition(event);
|
|
18942
|
+
}
|
|
18943
|
+
};
|
|
18944
|
+
this.recognition.onerror = function (event) {
|
|
18945
|
+
var errorMessage = '';
|
|
18946
|
+
switch (event.error) {
|
|
18947
|
+
case 'not-allowed':
|
|
18948
|
+
errorMessage = _this.l10n.getConstant('notAllowedError');
|
|
18949
|
+
break;
|
|
18950
|
+
case 'audio-capture':
|
|
18951
|
+
errorMessage = _this.l10n.getConstant('audioCaptureError');
|
|
18952
|
+
break;
|
|
18953
|
+
case 'network':
|
|
18954
|
+
errorMessage = _this.l10n.getConstant('networkError');
|
|
18955
|
+
break;
|
|
18956
|
+
case 'no-speech':
|
|
18957
|
+
errorMessage = _this.l10n.getConstant('noSpeechError');
|
|
18958
|
+
break;
|
|
18959
|
+
case 'aborted':
|
|
18960
|
+
errorMessage = _this.l10n.getConstant('abortedError');
|
|
18961
|
+
break;
|
|
18962
|
+
case 'service-not-allowed':
|
|
18963
|
+
errorMessage = _this.l10n.getConstant('serviceNotAllowedError');
|
|
18964
|
+
break;
|
|
18965
|
+
default:
|
|
18966
|
+
errorMessage = _this.l10n.getConstant('defaultError');
|
|
18967
|
+
}
|
|
18968
|
+
var eventArgs = {
|
|
18969
|
+
event: event,
|
|
18970
|
+
error: event.error,
|
|
18971
|
+
errorMessage: errorMessage
|
|
18972
|
+
};
|
|
18973
|
+
_this.trigger('onError', eventArgs);
|
|
18974
|
+
_this.isUserInteracted = false;
|
|
18975
|
+
};
|
|
18976
|
+
this.recognition.onresult = function (event) {
|
|
18977
|
+
var result = event.results[event.resultIndex];
|
|
18978
|
+
var interimTranscript = '';
|
|
18979
|
+
var prevOnChange = _this.isProtectedOnChange;
|
|
18980
|
+
_this.isProtectedOnChange = true;
|
|
18981
|
+
if (result.isFinal) {
|
|
18982
|
+
_this.fullTranscript += result[0].transcript;
|
|
18983
|
+
_this.transcript = _this.fullTranscript;
|
|
18984
|
+
}
|
|
18985
|
+
else {
|
|
18986
|
+
interimTranscript += result[0].transcript;
|
|
18987
|
+
_this.transcript = _this.fullTranscript + interimTranscript;
|
|
18988
|
+
}
|
|
18989
|
+
var eventArgs = {
|
|
18990
|
+
event: event,
|
|
18991
|
+
transcript: _this.transcript,
|
|
18992
|
+
isInterimResult: !result.isFinal
|
|
18993
|
+
};
|
|
18994
|
+
_this.trigger('transcriptChanged', eventArgs, function () {
|
|
18995
|
+
if (eventArgs.transcript !== _this.transcript) {
|
|
18996
|
+
var prevOnChange_1 = _this.isProtectedOnChange;
|
|
18997
|
+
_this.isProtectedOnChange = true;
|
|
18998
|
+
_this.transcript = _this.fullTranscript = eventArgs.transcript;
|
|
18999
|
+
_this.isProtectedOnChange = prevOnChange_1;
|
|
19000
|
+
}
|
|
19001
|
+
});
|
|
19002
|
+
_this.isProtectedOnChange = prevOnChange;
|
|
19003
|
+
};
|
|
19004
|
+
};
|
|
19005
|
+
SpeechToText.prototype.handleStartRecognition = function () {
|
|
19006
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
19007
|
+
this.isProtectedOnChange = true;
|
|
19008
|
+
this.hasStarted = true;
|
|
19009
|
+
this.listeningState = SpeechToTextState.Listening;
|
|
19010
|
+
if (!isNullOrUndefined(this.tooltipInst)) {
|
|
19011
|
+
this.tooltipInst.content = this.tooltipSettings.stopContent;
|
|
19012
|
+
}
|
|
19013
|
+
this.updateAriaLabel();
|
|
19014
|
+
this.isClicked = true;
|
|
19015
|
+
this.buttonInst.cssClass = this.updateButtonCssClass();
|
|
19016
|
+
this.buttonInst.content = this.buttonSettings.stopContent;
|
|
19017
|
+
var iconCss = !isNullOrUndefined(this.buttonSettings.stopIconCss) && this.buttonSettings.stopIconCss !== '' ? this.buttonSettings.stopIconCss : 'e-icons e-listen-stop';
|
|
19018
|
+
this.buttonInst.iconCss = iconCss;
|
|
19019
|
+
this.isProtectedOnChange = prevOnChange;
|
|
19020
|
+
};
|
|
19021
|
+
SpeechToText.prototype.triggerUnSupportedStart = function (event) {
|
|
19022
|
+
var _this = this;
|
|
19023
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
19024
|
+
this.isProtectedOnChange = true;
|
|
19025
|
+
this.transcript = '';
|
|
19026
|
+
this.isProtectedOnChange = prevOnChange;
|
|
19027
|
+
var eventArgs = {
|
|
19028
|
+
cancel: false,
|
|
19029
|
+
listeningState: SpeechToTextState.Listening,
|
|
19030
|
+
event: event,
|
|
19031
|
+
isInteracted: this.isUserInteracted
|
|
19032
|
+
};
|
|
19033
|
+
this.trigger('onStart', eventArgs, function () {
|
|
19034
|
+
if (!eventArgs.cancel) {
|
|
19035
|
+
_this.handleStartRecognition();
|
|
19036
|
+
}
|
|
19037
|
+
});
|
|
19038
|
+
};
|
|
19039
|
+
SpeechToText.prototype.startSpeechRecognition = function (event) {
|
|
19040
|
+
if (this.hasStarted) {
|
|
19041
|
+
return;
|
|
19042
|
+
}
|
|
19043
|
+
if (this.recognition) {
|
|
19044
|
+
this.recognition.start();
|
|
19045
|
+
}
|
|
19046
|
+
else {
|
|
19047
|
+
this.triggerUnSupportedStart(event);
|
|
19048
|
+
}
|
|
19049
|
+
};
|
|
19050
|
+
SpeechToText.prototype.stopSpeechRecognition = function (event) {
|
|
19051
|
+
if (this.recognition) {
|
|
19052
|
+
this.recognition.stop();
|
|
19053
|
+
}
|
|
19054
|
+
else {
|
|
19055
|
+
this.handleStopRecognition(event);
|
|
19056
|
+
}
|
|
19057
|
+
};
|
|
19058
|
+
SpeechToText.prototype.handleStopRecognition = function (event) {
|
|
19059
|
+
if (!this.hasStarted) {
|
|
19060
|
+
return;
|
|
19061
|
+
} // Ensure onStop is only processed if needed
|
|
19062
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
19063
|
+
this.isProtectedOnChange = true;
|
|
19064
|
+
this.listeningState = SpeechToTextState.Stopped;
|
|
19065
|
+
if (!isNullOrUndefined(this.tooltipInst)) {
|
|
19066
|
+
this.tooltipInst.content = this.tooltipSettings.content;
|
|
19067
|
+
}
|
|
19068
|
+
this.updateAriaLabel();
|
|
19069
|
+
this.isClicked = false;
|
|
19070
|
+
this.buttonInst.cssClass = this.updateButtonCssClass();
|
|
19071
|
+
this.buttonInst.content = this.buttonSettings.content;
|
|
19072
|
+
var eventArgs = {
|
|
19073
|
+
listeningState: SpeechToTextState.Stopped,
|
|
19074
|
+
event: event,
|
|
19075
|
+
isInteracted: this.isUserInteracted
|
|
19076
|
+
};
|
|
19077
|
+
this.trigger('onStop', eventArgs);
|
|
19078
|
+
this.listeningState = SpeechToTextState.Inactive;
|
|
19079
|
+
var iconCss = !isNullOrUndefined(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
|
|
19080
|
+
this.buttonInst.iconCss = iconCss;
|
|
19081
|
+
this.hasStarted = false;
|
|
19082
|
+
this.isProtectedOnChange = prevOnChange;
|
|
19083
|
+
};
|
|
19084
|
+
SpeechToText.prototype.buttonSettingsChanges = function (oldModel, newModel) {
|
|
19085
|
+
if (oldModel.content !== newModel.content || oldModel.stopContent !== newModel.stopContent) {
|
|
19086
|
+
this.buttonInst.content = this.hasStarted ? this.buttonSettings.stopContent : this.buttonSettings.content;
|
|
19087
|
+
this.buttonInst.cssClass = this.updateButtonCssClass();
|
|
19088
|
+
}
|
|
19089
|
+
if (oldModel.iconCss !== newModel.iconCss || oldModel.stopIconCss !== newModel.stopIconCss) {
|
|
19090
|
+
var iconCss = !isNullOrUndefined(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
|
|
19091
|
+
var stopIconCss = !isNullOrUndefined(this.buttonSettings.stopIconCss) && this.buttonSettings.stopIconCss !== '' ? this.buttonSettings.stopIconCss : 'e-icons e-listen-stop';
|
|
19092
|
+
this.buttonInst.iconCss = this.hasStarted ? stopIconCss : iconCss;
|
|
19093
|
+
}
|
|
19094
|
+
if (oldModel.iconPosition !== newModel.iconPosition) {
|
|
19095
|
+
this.buttonInst.iconPosition = this.buttonSettings.iconPosition;
|
|
19096
|
+
}
|
|
19097
|
+
if (oldModel.isPrimary !== newModel.isPrimary) {
|
|
19098
|
+
this.buttonInst.isPrimary = this.buttonSettings.isPrimary;
|
|
19099
|
+
}
|
|
19100
|
+
};
|
|
19101
|
+
SpeechToText.prototype.destroyAndNullify = function (obj) {
|
|
19102
|
+
if (obj) {
|
|
19103
|
+
obj.destroy();
|
|
19104
|
+
obj = null;
|
|
19105
|
+
}
|
|
19106
|
+
};
|
|
19107
|
+
//#endregion
|
|
19108
|
+
//#region Public Methods
|
|
19109
|
+
/**
|
|
19110
|
+
* Destroy the SpeechToText.
|
|
19111
|
+
*
|
|
19112
|
+
* @returns {void}
|
|
19113
|
+
*/
|
|
19114
|
+
SpeechToText.prototype.destroy = function () {
|
|
19115
|
+
_super.prototype.destroy.call(this);
|
|
19116
|
+
this.unWireEvents();
|
|
19117
|
+
this.destroyAndNullify(this.buttonInst);
|
|
19118
|
+
this.destroyAndNullify(this.tooltipInst);
|
|
19119
|
+
this.recognition = null;
|
|
19120
|
+
this.micOn = null;
|
|
19121
|
+
this.htmlAttributes = this.tooltipSettings = this.buttonSettings = null;
|
|
19122
|
+
this.element.classList.remove('e-rtl');
|
|
19123
|
+
};
|
|
19124
|
+
/**
|
|
19125
|
+
* Begins the audio capture process by listening to the user's microphone input.
|
|
19126
|
+
* This method initiates the speech-to-text process and continuously updates the `transcript` property with interim and final recognition results.
|
|
19127
|
+
*
|
|
19128
|
+
* @returns {void} No return value.
|
|
19129
|
+
*/
|
|
19130
|
+
SpeechToText.prototype.startListening = function () {
|
|
19131
|
+
if (!this.disabled && !this.isClicked) {
|
|
19132
|
+
this.isUserInteracted = false;
|
|
19133
|
+
this.micOn = true;
|
|
19134
|
+
this.startSpeechRecognition();
|
|
19135
|
+
}
|
|
19136
|
+
};
|
|
19137
|
+
/**
|
|
19138
|
+
* Stops the audio capture process and finalizes the speech recognition.
|
|
19139
|
+
* This method ends the ongoing speech-to-text operation and completes the recognition process, storing the final transcription.
|
|
19140
|
+
* It is typically called to stop listening when the user is finished speaking.
|
|
19141
|
+
*
|
|
19142
|
+
* @returns {void} No return value.
|
|
19143
|
+
*/
|
|
19144
|
+
SpeechToText.prototype.stopListening = function () {
|
|
19145
|
+
if (!this.disabled && this.isClicked) {
|
|
19146
|
+
this.isUserInteracted = false;
|
|
19147
|
+
this.micOn = false;
|
|
19148
|
+
this.stopSpeechRecognition();
|
|
19149
|
+
}
|
|
19150
|
+
};
|
|
19151
|
+
/**
|
|
19152
|
+
* Called if any of the property value is changed.
|
|
19153
|
+
*
|
|
19154
|
+
* @param {SpeechToTextModel} newProp - Specifies new properties
|
|
19155
|
+
* @param {SpeechToTextModel} oldProp - Specifies old properties
|
|
19156
|
+
* @returns {void}
|
|
19157
|
+
* @private
|
|
19158
|
+
*/
|
|
19159
|
+
SpeechToText.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
19160
|
+
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
19161
|
+
var prop = _a[_i];
|
|
19162
|
+
switch (prop) {
|
|
19163
|
+
case 'lang':
|
|
19164
|
+
if (this.recognition) {
|
|
19165
|
+
this.recognition.lang = this.lang;
|
|
19166
|
+
}
|
|
19167
|
+
break;
|
|
19168
|
+
case 'allowInterimResults':
|
|
19169
|
+
if (this.recognition) {
|
|
19170
|
+
this.recognition.interimResults = this.allowInterimResults;
|
|
19171
|
+
}
|
|
19172
|
+
break;
|
|
19173
|
+
case 'buttonSettings':
|
|
19174
|
+
this.buttonSettingsChanges(oldProp.buttonSettings, newProp.buttonSettings);
|
|
19175
|
+
break;
|
|
19176
|
+
case 'cssClass':
|
|
19177
|
+
this.updateCssClass(newProp.cssClass, oldProp.cssClass);
|
|
19178
|
+
break;
|
|
19179
|
+
case 'disabled':
|
|
19180
|
+
this.buttonInst.disabled = this.disabled;
|
|
19181
|
+
this.handleStateChange();
|
|
19182
|
+
break;
|
|
19183
|
+
case 'htmlAttributes':
|
|
19184
|
+
this.removeHtmlAttributes(oldProp.htmlAttributes);
|
|
19185
|
+
this.addHtmlAttributes(newProp.htmlAttributes);
|
|
19186
|
+
break;
|
|
19187
|
+
case 'listeningState':
|
|
19188
|
+
this.handleStateChange();
|
|
19189
|
+
break;
|
|
19190
|
+
case 'tooltipSettings':
|
|
19191
|
+
case 'showTooltip':
|
|
19192
|
+
this.updateTooltip();
|
|
19193
|
+
break;
|
|
19194
|
+
case 'transcript':
|
|
19195
|
+
this.transcript = this.fullTranscript = newProp.transcript;
|
|
19196
|
+
break;
|
|
19197
|
+
case 'enableRtl':
|
|
19198
|
+
this.buttonInst.enableRtl = this.tooltipInst.enableRtl = this.enableRtl;
|
|
19199
|
+
break;
|
|
19200
|
+
case 'locale':
|
|
19201
|
+
this.l10n.setLocale(this.locale);
|
|
19202
|
+
this.updateAriaLabel();
|
|
19203
|
+
this.updateTooltip();
|
|
19204
|
+
break;
|
|
19205
|
+
}
|
|
19206
|
+
}
|
|
19207
|
+
};
|
|
19208
|
+
__decorate$c([
|
|
19209
|
+
Property('')
|
|
19210
|
+
], SpeechToText.prototype, "transcript", void 0);
|
|
19211
|
+
__decorate$c([
|
|
19212
|
+
Property('')
|
|
19213
|
+
], SpeechToText.prototype, "lang", void 0);
|
|
19214
|
+
__decorate$c([
|
|
19215
|
+
Property(true)
|
|
19216
|
+
], SpeechToText.prototype, "allowInterimResults", void 0);
|
|
19217
|
+
__decorate$c([
|
|
19218
|
+
Property(true)
|
|
19219
|
+
], SpeechToText.prototype, "showTooltip", void 0);
|
|
19220
|
+
__decorate$c([
|
|
19221
|
+
Property('Inactive')
|
|
19222
|
+
], SpeechToText.prototype, "listeningState", void 0);
|
|
19223
|
+
__decorate$c([
|
|
19224
|
+
Complex({}, ButtonSettings)
|
|
19225
|
+
], SpeechToText.prototype, "buttonSettings", void 0);
|
|
19226
|
+
__decorate$c([
|
|
19227
|
+
Complex({}, TooltipSettings)
|
|
19228
|
+
], SpeechToText.prototype, "tooltipSettings", void 0);
|
|
19229
|
+
__decorate$c([
|
|
19230
|
+
Property(false)
|
|
19231
|
+
], SpeechToText.prototype, "disabled", void 0);
|
|
19232
|
+
__decorate$c([
|
|
19233
|
+
Property('')
|
|
19234
|
+
], SpeechToText.prototype, "cssClass", void 0);
|
|
19235
|
+
__decorate$c([
|
|
19236
|
+
Property({})
|
|
19237
|
+
], SpeechToText.prototype, "htmlAttributes", void 0);
|
|
19238
|
+
__decorate$c([
|
|
19239
|
+
Event()
|
|
19240
|
+
], SpeechToText.prototype, "created", void 0);
|
|
19241
|
+
__decorate$c([
|
|
19242
|
+
Event()
|
|
19243
|
+
], SpeechToText.prototype, "onStart", void 0);
|
|
19244
|
+
__decorate$c([
|
|
19245
|
+
Event()
|
|
19246
|
+
], SpeechToText.prototype, "onStop", void 0);
|
|
19247
|
+
__decorate$c([
|
|
19248
|
+
Event()
|
|
19249
|
+
], SpeechToText.prototype, "onError", void 0);
|
|
19250
|
+
__decorate$c([
|
|
19251
|
+
Event()
|
|
19252
|
+
], SpeechToText.prototype, "transcriptChanged", void 0);
|
|
19253
|
+
SpeechToText = __decorate$c([
|
|
19254
|
+
NotifyPropertyChanges
|
|
19255
|
+
], SpeechToText);
|
|
19256
|
+
return SpeechToText;
|
|
19257
|
+
}(Component));
|
|
19258
|
+
|
|
19259
|
+
export { AsyncSettings, ButtonSettings, ButtonsProps, ChatMessageRole, ColorPicker, ColorRangeData, ErrorOption, FilesProp, FormValidator, Input, LabelPosition, LimitData, MaskUndo, MaskedTextBox, NumericTextBox, OtpInput, OtpInputStyle, OtpInputType, PrecisionType, Rating, Signature, SignatureBase, Slider, SmartTextArea, SpeechToText, SpeechToTextState, TEXTBOX_FOCUS, TextArea, TextBox, TextTransform, TicksData, TooltipData, TooltipSettings, Uploader, applyMask, bindClearEvent, containerAttributes, createMask, escapeRegExp, getMaskedVal, getVal, maskInput, maskInputBlurHandler, maskInputDropHandler, maskInputFocusHandler, maskInputMouseDownHandler, maskInputMouseUpHandler, mobileRemoveFunction, regex, regularExpressions, setElementValue, setMaskValue, strippedValue, triggerFocus, unstrippedValue, unwireEvents, wireEvents };
|
|
18604
19260
|
//# sourceMappingURL=ej2-inputs.es5.js.map
|