@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, Component, getValue, setValue, L10n, getUniqueID, Internationalization, EventHandler, Browser, merge, getNumericObject, Property, Event, NotifyPropertyChanges, extend, ChildProperty, setStyleAttribute, SanitizeHtmlHelper, initializeCSPTemplate, Collection, Complex, Base, onIntlChange, select, selectAll, 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
|
const CLASSNAMES = {
|
|
@@ -4203,6 +4204,7 @@ __decorate$2([
|
|
|
4203
4204
|
], TooltipData.prototype, "format", void 0);
|
|
4204
4205
|
const bootstrapTooltipOffset = 6;
|
|
4205
4206
|
const bootstrap4TooltipOffset = 3;
|
|
4207
|
+
const tolerance = 1e-10;
|
|
4206
4208
|
const classNames = {
|
|
4207
4209
|
root: 'e-slider',
|
|
4208
4210
|
rtl: 'e-rtl',
|
|
@@ -4363,15 +4365,6 @@ let Slider = class Slider extends Component {
|
|
|
4363
4365
|
const decimals = precision || 0;
|
|
4364
4366
|
return Number(value.toFixed(decimals));
|
|
4365
4367
|
}
|
|
4366
|
-
fractionalToInteger(value) {
|
|
4367
|
-
value = (this.numberOfDecimals(value) === 0) ? Number(value).toFixed(this.noOfDecimals) : value;
|
|
4368
|
-
let tens = 1;
|
|
4369
|
-
for (let i = 0; i < this.noOfDecimals; i++) {
|
|
4370
|
-
tens *= 10;
|
|
4371
|
-
}
|
|
4372
|
-
value = Number((value * tens).toFixed(0));
|
|
4373
|
-
return value;
|
|
4374
|
-
}
|
|
4375
4368
|
/**
|
|
4376
4369
|
* To Initialize the control rendering
|
|
4377
4370
|
*
|
|
@@ -5170,7 +5163,6 @@ let Slider = class Slider extends Component {
|
|
|
5170
5163
|
}
|
|
5171
5164
|
renderScale() {
|
|
5172
5165
|
const orien = this.orientation === 'Vertical' ? 'v' : 'h';
|
|
5173
|
-
this.noOfDecimals = this.numberOfDecimals(this.step);
|
|
5174
5166
|
this.ul = this.createElement('ul', {
|
|
5175
5167
|
className: classNames.scale + ' ' + 'e-' + orien + '-scale ' + classNames.tick + '-' + this.ticks.placement.toLowerCase(),
|
|
5176
5168
|
attrs: { role: 'presentation', 'aria-hidden': 'true' }
|
|
@@ -5191,9 +5183,9 @@ let Slider = class Slider extends Component {
|
|
|
5191
5183
|
else if (smallStep <= 0) {
|
|
5192
5184
|
smallStep = parseFloat(formatUnit(this.step));
|
|
5193
5185
|
}
|
|
5194
|
-
const min =
|
|
5195
|
-
const max =
|
|
5196
|
-
const steps =
|
|
5186
|
+
const min = parseFloat(formatUnit(this.min));
|
|
5187
|
+
const max = parseFloat(formatUnit(this.max));
|
|
5188
|
+
const steps = parseFloat(formatUnit(smallStep));
|
|
5197
5189
|
const bigNum = !isNullOrUndefined(this.customValues) && this.customValues.length > 0 && this.customValues.length - 1;
|
|
5198
5190
|
const customStep = this.customTickCounter(bigNum);
|
|
5199
5191
|
const count = !isNullOrUndefined(this.customValues) && this.customValues.length > 0 ?
|
|
@@ -5237,20 +5229,24 @@ let Slider = class Slider extends Component {
|
|
|
5237
5229
|
if (this.numberOfDecimals(this.max) === 0 && this.numberOfDecimals(this.min) === 0 &&
|
|
5238
5230
|
this.numberOfDecimals(this.step) === 0) {
|
|
5239
5231
|
if (orien === 'h') {
|
|
5240
|
-
|
|
5232
|
+
const reminder = (start - parseFloat(this.min.toString())) % this.ticks.largeStep;
|
|
5233
|
+
islargeTick = (Math.abs(reminder) < tolerance || Math.abs(this.ticks.largeStep - reminder) < tolerance);
|
|
5241
5234
|
}
|
|
5242
5235
|
else {
|
|
5243
|
-
|
|
5236
|
+
const reminder = Math.abs(start - parseFloat(this.max.toString())) % this.ticks.largeStep;
|
|
5237
|
+
islargeTick = (Math.abs(reminder) < tolerance || Math.abs(this.ticks.largeStep - reminder) < tolerance);
|
|
5244
5238
|
}
|
|
5245
5239
|
}
|
|
5246
5240
|
else {
|
|
5247
|
-
const largestep = this.
|
|
5248
|
-
const startValue =
|
|
5241
|
+
const largestep = this.ticks.largeStep;
|
|
5242
|
+
const startValue = start;
|
|
5249
5243
|
if (orien === 'h') {
|
|
5250
|
-
|
|
5244
|
+
const reminder = ((startValue - min) % largestep);
|
|
5245
|
+
islargeTick = Math.abs(reminder) < tolerance || Math.abs(largestep - reminder) < tolerance;
|
|
5251
5246
|
}
|
|
5252
5247
|
else {
|
|
5253
|
-
|
|
5248
|
+
const reminder = Math.abs(startValue - parseFloat(max.toString())) % largestep;
|
|
5249
|
+
islargeTick = Math.abs(reminder) < tolerance || Math.abs(largestep - reminder) < tolerance;
|
|
5254
5250
|
}
|
|
5255
5251
|
}
|
|
5256
5252
|
}
|
|
@@ -11028,11 +11024,13 @@ let Uploader = class Uploader extends Component {
|
|
|
11028
11024
|
}
|
|
11029
11025
|
getFilesInArray(files) {
|
|
11030
11026
|
let uploadFiles = [];
|
|
11031
|
-
if (files
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11027
|
+
if (files) {
|
|
11028
|
+
if (files instanceof Array) {
|
|
11029
|
+
uploadFiles = files;
|
|
11030
|
+
}
|
|
11031
|
+
else {
|
|
11032
|
+
uploadFiles.push(files);
|
|
11033
|
+
}
|
|
11036
11034
|
}
|
|
11037
11035
|
return uploadFiles;
|
|
11038
11036
|
}
|
|
@@ -16768,6 +16766,9 @@ let Rating = class Rating extends Component {
|
|
|
16768
16766
|
}
|
|
16769
16767
|
updateResetButton() {
|
|
16770
16768
|
if (this.allowReset) {
|
|
16769
|
+
if (this.resetElement) {
|
|
16770
|
+
this.resetElement.blur();
|
|
16771
|
+
}
|
|
16771
16772
|
const isDisabled = (this.value <= this.min) || this.disabled;
|
|
16772
16773
|
this.resetElement.classList[isDisabled ? 'add' : 'remove'](DISABLED$2);
|
|
16773
16774
|
attributes(this.resetElement, { 'tabindex': (isDisabled ? '-1' : '0'), 'aria-hidden': isDisabled.toString() });
|
|
@@ -18130,5 +18131,631 @@ OtpInput = __decorate$b([
|
|
|
18130
18131
|
NotifyPropertyChanges
|
|
18131
18132
|
], OtpInput);
|
|
18132
18133
|
|
|
18133
|
-
|
|
18134
|
+
var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
18135
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18136
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
18137
|
+
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;
|
|
18138
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18139
|
+
};
|
|
18140
|
+
/**
|
|
18141
|
+
* Configuration settings for the toggle button used in the SpeechToText component.
|
|
18142
|
+
*/
|
|
18143
|
+
class ButtonSettings extends ChildProperty {
|
|
18144
|
+
}
|
|
18145
|
+
__decorate$c([
|
|
18146
|
+
Property('')
|
|
18147
|
+
], ButtonSettings.prototype, "content", void 0);
|
|
18148
|
+
__decorate$c([
|
|
18149
|
+
Property('')
|
|
18150
|
+
], ButtonSettings.prototype, "stopContent", void 0);
|
|
18151
|
+
__decorate$c([
|
|
18152
|
+
Property('')
|
|
18153
|
+
], ButtonSettings.prototype, "iconCss", void 0);
|
|
18154
|
+
__decorate$c([
|
|
18155
|
+
Property('')
|
|
18156
|
+
], ButtonSettings.prototype, "stopIconCss", void 0);
|
|
18157
|
+
__decorate$c([
|
|
18158
|
+
Property('Left')
|
|
18159
|
+
], ButtonSettings.prototype, "iconPosition", void 0);
|
|
18160
|
+
__decorate$c([
|
|
18161
|
+
Property(false)
|
|
18162
|
+
], ButtonSettings.prototype, "isPrimary", void 0);
|
|
18163
|
+
/**
|
|
18164
|
+
* Configuration settings for tooltips in the SpeechToText component.
|
|
18165
|
+
* This allows customization of the tooltip content and its positioning.
|
|
18166
|
+
*/
|
|
18167
|
+
class TooltipSettings extends ChildProperty {
|
|
18168
|
+
}
|
|
18169
|
+
__decorate$c([
|
|
18170
|
+
Property('Start listening')
|
|
18171
|
+
], TooltipSettings.prototype, "content", void 0);
|
|
18172
|
+
__decorate$c([
|
|
18173
|
+
Property('Stop listening')
|
|
18174
|
+
], TooltipSettings.prototype, "stopContent", void 0);
|
|
18175
|
+
__decorate$c([
|
|
18176
|
+
Property('TopCenter')
|
|
18177
|
+
], TooltipSettings.prototype, "position", void 0);
|
|
18178
|
+
/**
|
|
18179
|
+
* Enum representing the operational states of the SpeechToText component.
|
|
18180
|
+
*/
|
|
18181
|
+
var SpeechToTextState;
|
|
18182
|
+
(function (SpeechToTextState) {
|
|
18183
|
+
/**
|
|
18184
|
+
* Specifies the state where the SpeechToText component is inactive and not processing spoken input.
|
|
18185
|
+
*/
|
|
18186
|
+
SpeechToTextState["Inactive"] = "Inactive";
|
|
18187
|
+
/**
|
|
18188
|
+
* Specifies the state where the SpeechToText component is actively listening to spoken input.
|
|
18189
|
+
*/
|
|
18190
|
+
SpeechToTextState["Listening"] = "Listening";
|
|
18191
|
+
/**
|
|
18192
|
+
* Specifies the state where the SpeechToText component has stopped processing spoken input.
|
|
18193
|
+
*/
|
|
18194
|
+
SpeechToTextState["Stopped"] = "Stopped";
|
|
18195
|
+
})(SpeechToTextState || (SpeechToTextState = {}));
|
|
18196
|
+
//#endregion
|
|
18197
|
+
let SpeechToText = class SpeechToText extends Component {
|
|
18198
|
+
//#endregion
|
|
18199
|
+
//#region Inherited methods
|
|
18200
|
+
/**
|
|
18201
|
+
* Constructor for creating the component
|
|
18202
|
+
*
|
|
18203
|
+
* @param {SpeechToTextModel} options - Specifies the SpeechToTextModel model.
|
|
18204
|
+
* @param {string | HTMLElement} element - Specifies the element to render as component.
|
|
18205
|
+
* @private
|
|
18206
|
+
*/
|
|
18207
|
+
constructor(options, element) {
|
|
18208
|
+
super(options, element);
|
|
18209
|
+
this.fullTranscript = '';
|
|
18210
|
+
this.isClicked = false;
|
|
18211
|
+
this.isUserInteracted = false;
|
|
18212
|
+
this.hasStarted = false;
|
|
18213
|
+
}
|
|
18214
|
+
/**
|
|
18215
|
+
* Initialize the event handler
|
|
18216
|
+
*
|
|
18217
|
+
* @private
|
|
18218
|
+
* @returns {void}
|
|
18219
|
+
*/
|
|
18220
|
+
preRender() {
|
|
18221
|
+
if (!this.element.id) {
|
|
18222
|
+
this.element.id = getUniqueID('e-' + this.getModuleName());
|
|
18223
|
+
}
|
|
18224
|
+
}
|
|
18225
|
+
getDirective() {
|
|
18226
|
+
return 'EJS-SPEECHTOTEXT';
|
|
18227
|
+
}
|
|
18228
|
+
/**
|
|
18229
|
+
* To get component name.
|
|
18230
|
+
*
|
|
18231
|
+
* @returns {string} - It returns the current module name.
|
|
18232
|
+
* @private
|
|
18233
|
+
*/
|
|
18234
|
+
getModuleName() {
|
|
18235
|
+
return 'speech-to-text';
|
|
18236
|
+
}
|
|
18237
|
+
/**
|
|
18238
|
+
* Get the properties to be maintained in the persisted state.
|
|
18239
|
+
*
|
|
18240
|
+
* @private
|
|
18241
|
+
* @returns {string} - It returns the persisted data.
|
|
18242
|
+
*/
|
|
18243
|
+
getPersistData() {
|
|
18244
|
+
return this.addOnPersist([]);
|
|
18245
|
+
}
|
|
18246
|
+
render() {
|
|
18247
|
+
this.renderSpeechToText();
|
|
18248
|
+
this.initializeSpeechRecognition();
|
|
18249
|
+
if (!isNullOrUndefined(this.listeningState)) {
|
|
18250
|
+
this.handleStateChange();
|
|
18251
|
+
}
|
|
18252
|
+
this.wireEvents();
|
|
18253
|
+
}
|
|
18254
|
+
//#endregion
|
|
18255
|
+
//#region Private Methods
|
|
18256
|
+
initializeLocale() {
|
|
18257
|
+
this.l10n = new L10n(this.getModuleName(), {
|
|
18258
|
+
abortedError: 'Speech recognition was aborted.',
|
|
18259
|
+
audioCaptureError: 'No microphone detected. Ensure your microphone is connected.',
|
|
18260
|
+
defaultError: 'An unknown error occurred.',
|
|
18261
|
+
networkError: 'Network error occurred. Check your internet connection.',
|
|
18262
|
+
noSpeechError: 'No speech detected. Please speak into the microphone.',
|
|
18263
|
+
notAllowedError: 'Microphone access denied. Allow microphone permissions.',
|
|
18264
|
+
serviceNotAllowedError: 'Speech recognition service is not allowed in this context.',
|
|
18265
|
+
unsupportedBrowserError: 'The browser does not support the SpeechRecognition API.',
|
|
18266
|
+
startAriaLabel: 'Press to start speaking and transcribe your words',
|
|
18267
|
+
stopAriaLabel: 'Press to stop speaking and end transcription',
|
|
18268
|
+
startTooltipText: 'Start listening',
|
|
18269
|
+
stopTooltipText: 'Stop listening'
|
|
18270
|
+
}, this.locale);
|
|
18271
|
+
}
|
|
18272
|
+
renderSpeechToText() {
|
|
18273
|
+
this.initializeLocale();
|
|
18274
|
+
const iconCss = !isNullOrUndefined(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
|
|
18275
|
+
this.buttonInst = new Button({
|
|
18276
|
+
iconCss: iconCss,
|
|
18277
|
+
isPrimary: this.buttonSettings.isPrimary,
|
|
18278
|
+
cssClass: this.updateButtonCssClass(),
|
|
18279
|
+
disabled: this.disabled,
|
|
18280
|
+
content: this.buttonSettings.content,
|
|
18281
|
+
iconPosition: this.buttonSettings.iconPosition,
|
|
18282
|
+
enableRtl: this.enableRtl
|
|
18283
|
+
});
|
|
18284
|
+
this.buttonInst.appendTo(this.element);
|
|
18285
|
+
this.updateTooltip();
|
|
18286
|
+
this.updateCssClass(this.cssClass, '');
|
|
18287
|
+
this.updateAriaLabel();
|
|
18288
|
+
if (!isNullOrUndefined(this.htmlAttributes)) {
|
|
18289
|
+
this.addHtmlAttributes(this.htmlAttributes);
|
|
18290
|
+
}
|
|
18291
|
+
}
|
|
18292
|
+
updateAriaLabel() {
|
|
18293
|
+
let ariaLabel;
|
|
18294
|
+
if (this.htmlAttributes && this.htmlAttributes['aria-label']) {
|
|
18295
|
+
ariaLabel = this.htmlAttributes['aria-label'];
|
|
18296
|
+
}
|
|
18297
|
+
else {
|
|
18298
|
+
ariaLabel = this.micOn ? this.l10n.getConstant('stopAriaLabel') : this.l10n.getConstant('startAriaLabel');
|
|
18299
|
+
}
|
|
18300
|
+
this.element.setAttribute('aria-label', ariaLabel);
|
|
18301
|
+
}
|
|
18302
|
+
updateCssClass(newClass, oldClass) {
|
|
18303
|
+
if (oldClass) {
|
|
18304
|
+
removeClass([this.element], oldClass.trim().split(' '));
|
|
18305
|
+
}
|
|
18306
|
+
if (newClass) {
|
|
18307
|
+
addClass([this.element], newClass.trim().split(' '));
|
|
18308
|
+
}
|
|
18309
|
+
}
|
|
18310
|
+
updateButtonCssClass() {
|
|
18311
|
+
const content = this.isClicked ? this.buttonSettings.stopContent : this.buttonSettings.content;
|
|
18312
|
+
let cssClass;
|
|
18313
|
+
if (content === '') {
|
|
18314
|
+
cssClass = 'e-round';
|
|
18315
|
+
}
|
|
18316
|
+
if (this.micOn) {
|
|
18317
|
+
cssClass += ' e-listening-state';
|
|
18318
|
+
}
|
|
18319
|
+
return cssClass;
|
|
18320
|
+
}
|
|
18321
|
+
updateTooltip() {
|
|
18322
|
+
if (this.showTooltip) {
|
|
18323
|
+
if (this.tooltipSettings) {
|
|
18324
|
+
if (this.tooltipSettings.content === 'Start listening') {
|
|
18325
|
+
this.tooltipSettings.content = this.l10n.getConstant('startTooltipText');
|
|
18326
|
+
}
|
|
18327
|
+
if (this.tooltipSettings.stopContent === 'Stop listening') {
|
|
18328
|
+
this.tooltipSettings.stopContent = this.l10n.getConstant('stopTooltipText');
|
|
18329
|
+
}
|
|
18330
|
+
}
|
|
18331
|
+
this.tooltipInst = new Tooltip({
|
|
18332
|
+
content: this.hasStarted ? this.tooltipSettings.stopContent : this.tooltipSettings.content,
|
|
18333
|
+
position: this.tooltipSettings.position,
|
|
18334
|
+
windowCollision: true,
|
|
18335
|
+
cssClass: this.cssClass ? ('e-speech-to-text-tooltip ' + this.cssClass) : 'e-speech-to-text-tooltip',
|
|
18336
|
+
opensOn: 'Hover',
|
|
18337
|
+
enableRtl: this.enableRtl
|
|
18338
|
+
});
|
|
18339
|
+
this.tooltipInst.appendTo(this.element);
|
|
18340
|
+
}
|
|
18341
|
+
else {
|
|
18342
|
+
if (!isNullOrUndefined(this.tooltipInst)) {
|
|
18343
|
+
this.tooltipInst.destroy();
|
|
18344
|
+
this.tooltipInst = null;
|
|
18345
|
+
}
|
|
18346
|
+
}
|
|
18347
|
+
}
|
|
18348
|
+
handleStateChange() {
|
|
18349
|
+
if (this.disabled) {
|
|
18350
|
+
return;
|
|
18351
|
+
}
|
|
18352
|
+
if (this.listeningState === SpeechToTextState.Listening) {
|
|
18353
|
+
this.micOn = true;
|
|
18354
|
+
this.startSpeechRecognition();
|
|
18355
|
+
}
|
|
18356
|
+
else if (this.listeningState === SpeechToTextState.Inactive || this.listeningState === SpeechToTextState.Stopped) {
|
|
18357
|
+
if (this.micOn) {
|
|
18358
|
+
this.micOn = false;
|
|
18359
|
+
this.stopSpeechRecognition();
|
|
18360
|
+
}
|
|
18361
|
+
else {
|
|
18362
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
18363
|
+
this.isProtectedOnChange = true;
|
|
18364
|
+
this.listeningState = SpeechToTextState.Inactive;
|
|
18365
|
+
this.isProtectedOnChange = prevOnChange;
|
|
18366
|
+
}
|
|
18367
|
+
}
|
|
18368
|
+
}
|
|
18369
|
+
addHtmlAttributes(attrs) {
|
|
18370
|
+
if (attrs) {
|
|
18371
|
+
for (const attr in attrs) {
|
|
18372
|
+
if (Object.prototype.hasOwnProperty.call(attrs, attr)) {
|
|
18373
|
+
this.element.setAttribute(attr, attrs[attr]);
|
|
18374
|
+
}
|
|
18375
|
+
}
|
|
18376
|
+
}
|
|
18377
|
+
}
|
|
18378
|
+
removeHtmlAttributes(attrs) {
|
|
18379
|
+
if (attrs) {
|
|
18380
|
+
for (const attr in attrs) {
|
|
18381
|
+
if (Object.prototype.hasOwnProperty.call(attrs, attr)) {
|
|
18382
|
+
this.element.removeAttribute(attr);
|
|
18383
|
+
}
|
|
18384
|
+
}
|
|
18385
|
+
}
|
|
18386
|
+
}
|
|
18387
|
+
wireEvents() {
|
|
18388
|
+
EventHandler.add(this.element, 'click', this.handleButtonClick, this);
|
|
18389
|
+
}
|
|
18390
|
+
unWireEvents() {
|
|
18391
|
+
EventHandler.remove(this.element, 'click', this.handleButtonClick);
|
|
18392
|
+
}
|
|
18393
|
+
handleButtonClick(event) {
|
|
18394
|
+
this.isUserInteracted = true;
|
|
18395
|
+
this.micOn = !this.micOn;
|
|
18396
|
+
if (this.micOn) {
|
|
18397
|
+
this.startSpeechRecognition(event);
|
|
18398
|
+
}
|
|
18399
|
+
else {
|
|
18400
|
+
this.stopSpeechRecognition(event);
|
|
18401
|
+
}
|
|
18402
|
+
}
|
|
18403
|
+
triggerUnSupportedError() {
|
|
18404
|
+
const eventArgs = {
|
|
18405
|
+
error: 'unsupported-browser',
|
|
18406
|
+
errorMessage: this.l10n.getConstant('unsupportedBrowserError')
|
|
18407
|
+
};
|
|
18408
|
+
this.trigger('onError', eventArgs);
|
|
18409
|
+
}
|
|
18410
|
+
initializeSpeechRecognition() {
|
|
18411
|
+
const windowInst = window;
|
|
18412
|
+
const SpeechRecognition = windowInst.SpeechRecognition || windowInst.webkitSpeechRecognition;
|
|
18413
|
+
if (!SpeechRecognition) {
|
|
18414
|
+
this.triggerUnSupportedError();
|
|
18415
|
+
return;
|
|
18416
|
+
}
|
|
18417
|
+
this.recognition = new SpeechRecognition();
|
|
18418
|
+
this.recognition.continuous = true;
|
|
18419
|
+
this.recognition.lang = this.lang;
|
|
18420
|
+
this.recognition.interimResults = this.allowInterimResults;
|
|
18421
|
+
this.recognition.onstart = (event) => {
|
|
18422
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
18423
|
+
this.isProtectedOnChange = true;
|
|
18424
|
+
this.transcript = this.fullTranscript = '';
|
|
18425
|
+
this.isProtectedOnChange = prevOnChange;
|
|
18426
|
+
const eventArgs = {
|
|
18427
|
+
cancel: false,
|
|
18428
|
+
listeningState: SpeechToTextState.Listening,
|
|
18429
|
+
event: event,
|
|
18430
|
+
isInteracted: this.isUserInteracted
|
|
18431
|
+
};
|
|
18432
|
+
this.trigger('onStart', eventArgs, () => {
|
|
18433
|
+
if (!eventArgs.cancel) {
|
|
18434
|
+
this.handleStartRecognition();
|
|
18435
|
+
}
|
|
18436
|
+
else {
|
|
18437
|
+
this.recognition.abort();
|
|
18438
|
+
this.micOn = false;
|
|
18439
|
+
}
|
|
18440
|
+
});
|
|
18441
|
+
};
|
|
18442
|
+
this.recognition.onend = (event) => {
|
|
18443
|
+
if (this.hasStarted) {
|
|
18444
|
+
this.micOn = false;
|
|
18445
|
+
this.handleStopRecognition(event);
|
|
18446
|
+
}
|
|
18447
|
+
};
|
|
18448
|
+
this.recognition.onerror = (event) => {
|
|
18449
|
+
let errorMessage = '';
|
|
18450
|
+
switch (event.error) {
|
|
18451
|
+
case 'not-allowed':
|
|
18452
|
+
errorMessage = this.l10n.getConstant('notAllowedError');
|
|
18453
|
+
break;
|
|
18454
|
+
case 'audio-capture':
|
|
18455
|
+
errorMessage = this.l10n.getConstant('audioCaptureError');
|
|
18456
|
+
break;
|
|
18457
|
+
case 'network':
|
|
18458
|
+
errorMessage = this.l10n.getConstant('networkError');
|
|
18459
|
+
break;
|
|
18460
|
+
case 'no-speech':
|
|
18461
|
+
errorMessage = this.l10n.getConstant('noSpeechError');
|
|
18462
|
+
break;
|
|
18463
|
+
case 'aborted':
|
|
18464
|
+
errorMessage = this.l10n.getConstant('abortedError');
|
|
18465
|
+
break;
|
|
18466
|
+
case 'service-not-allowed':
|
|
18467
|
+
errorMessage = this.l10n.getConstant('serviceNotAllowedError');
|
|
18468
|
+
break;
|
|
18469
|
+
default:
|
|
18470
|
+
errorMessage = this.l10n.getConstant('defaultError');
|
|
18471
|
+
}
|
|
18472
|
+
const eventArgs = {
|
|
18473
|
+
event: event,
|
|
18474
|
+
error: event.error,
|
|
18475
|
+
errorMessage: errorMessage
|
|
18476
|
+
};
|
|
18477
|
+
this.trigger('onError', eventArgs);
|
|
18478
|
+
this.isUserInteracted = false;
|
|
18479
|
+
};
|
|
18480
|
+
this.recognition.onresult = (event) => {
|
|
18481
|
+
const result = event.results[event.resultIndex];
|
|
18482
|
+
let interimTranscript = '';
|
|
18483
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
18484
|
+
this.isProtectedOnChange = true;
|
|
18485
|
+
if (result.isFinal) {
|
|
18486
|
+
this.fullTranscript += result[0].transcript;
|
|
18487
|
+
this.transcript = this.fullTranscript;
|
|
18488
|
+
}
|
|
18489
|
+
else {
|
|
18490
|
+
interimTranscript += result[0].transcript;
|
|
18491
|
+
this.transcript = this.fullTranscript + interimTranscript;
|
|
18492
|
+
}
|
|
18493
|
+
const eventArgs = {
|
|
18494
|
+
event: event,
|
|
18495
|
+
transcript: this.transcript,
|
|
18496
|
+
isInterimResult: !result.isFinal
|
|
18497
|
+
};
|
|
18498
|
+
this.trigger('transcriptChanged', eventArgs, () => {
|
|
18499
|
+
if (eventArgs.transcript !== this.transcript) {
|
|
18500
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
18501
|
+
this.isProtectedOnChange = true;
|
|
18502
|
+
this.transcript = this.fullTranscript = eventArgs.transcript;
|
|
18503
|
+
this.isProtectedOnChange = prevOnChange;
|
|
18504
|
+
}
|
|
18505
|
+
});
|
|
18506
|
+
this.isProtectedOnChange = prevOnChange;
|
|
18507
|
+
};
|
|
18508
|
+
}
|
|
18509
|
+
handleStartRecognition() {
|
|
18510
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
18511
|
+
this.isProtectedOnChange = true;
|
|
18512
|
+
this.hasStarted = true;
|
|
18513
|
+
this.listeningState = SpeechToTextState.Listening;
|
|
18514
|
+
if (!isNullOrUndefined(this.tooltipInst)) {
|
|
18515
|
+
this.tooltipInst.content = this.tooltipSettings.stopContent;
|
|
18516
|
+
}
|
|
18517
|
+
this.updateAriaLabel();
|
|
18518
|
+
this.isClicked = true;
|
|
18519
|
+
this.buttonInst.cssClass = this.updateButtonCssClass();
|
|
18520
|
+
this.buttonInst.content = this.buttonSettings.stopContent;
|
|
18521
|
+
const iconCss = !isNullOrUndefined(this.buttonSettings.stopIconCss) && this.buttonSettings.stopIconCss !== '' ? this.buttonSettings.stopIconCss : 'e-icons e-listen-stop';
|
|
18522
|
+
this.buttonInst.iconCss = iconCss;
|
|
18523
|
+
this.isProtectedOnChange = prevOnChange;
|
|
18524
|
+
}
|
|
18525
|
+
triggerUnSupportedStart(event) {
|
|
18526
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
18527
|
+
this.isProtectedOnChange = true;
|
|
18528
|
+
this.transcript = '';
|
|
18529
|
+
this.isProtectedOnChange = prevOnChange;
|
|
18530
|
+
const eventArgs = {
|
|
18531
|
+
cancel: false,
|
|
18532
|
+
listeningState: SpeechToTextState.Listening,
|
|
18533
|
+
event: event,
|
|
18534
|
+
isInteracted: this.isUserInteracted
|
|
18535
|
+
};
|
|
18536
|
+
this.trigger('onStart', eventArgs, () => {
|
|
18537
|
+
if (!eventArgs.cancel) {
|
|
18538
|
+
this.handleStartRecognition();
|
|
18539
|
+
}
|
|
18540
|
+
});
|
|
18541
|
+
}
|
|
18542
|
+
startSpeechRecognition(event) {
|
|
18543
|
+
if (this.hasStarted) {
|
|
18544
|
+
return;
|
|
18545
|
+
}
|
|
18546
|
+
if (this.recognition) {
|
|
18547
|
+
this.recognition.start();
|
|
18548
|
+
}
|
|
18549
|
+
else {
|
|
18550
|
+
this.triggerUnSupportedStart(event);
|
|
18551
|
+
}
|
|
18552
|
+
}
|
|
18553
|
+
stopSpeechRecognition(event) {
|
|
18554
|
+
if (this.recognition) {
|
|
18555
|
+
this.recognition.stop();
|
|
18556
|
+
}
|
|
18557
|
+
else {
|
|
18558
|
+
this.handleStopRecognition(event);
|
|
18559
|
+
}
|
|
18560
|
+
}
|
|
18561
|
+
handleStopRecognition(event) {
|
|
18562
|
+
if (!this.hasStarted) {
|
|
18563
|
+
return;
|
|
18564
|
+
} // Ensure onStop is only processed if needed
|
|
18565
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
18566
|
+
this.isProtectedOnChange = true;
|
|
18567
|
+
this.listeningState = SpeechToTextState.Stopped;
|
|
18568
|
+
if (!isNullOrUndefined(this.tooltipInst)) {
|
|
18569
|
+
this.tooltipInst.content = this.tooltipSettings.content;
|
|
18570
|
+
}
|
|
18571
|
+
this.updateAriaLabel();
|
|
18572
|
+
this.isClicked = false;
|
|
18573
|
+
this.buttonInst.cssClass = this.updateButtonCssClass();
|
|
18574
|
+
this.buttonInst.content = this.buttonSettings.content;
|
|
18575
|
+
const eventArgs = {
|
|
18576
|
+
listeningState: SpeechToTextState.Stopped,
|
|
18577
|
+
event: event,
|
|
18578
|
+
isInteracted: this.isUserInteracted
|
|
18579
|
+
};
|
|
18580
|
+
this.trigger('onStop', eventArgs);
|
|
18581
|
+
this.listeningState = SpeechToTextState.Inactive;
|
|
18582
|
+
const iconCss = !isNullOrUndefined(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
|
|
18583
|
+
this.buttonInst.iconCss = iconCss;
|
|
18584
|
+
this.hasStarted = false;
|
|
18585
|
+
this.isProtectedOnChange = prevOnChange;
|
|
18586
|
+
}
|
|
18587
|
+
buttonSettingsChanges(oldModel, newModel) {
|
|
18588
|
+
if (oldModel.content !== newModel.content || oldModel.stopContent !== newModel.stopContent) {
|
|
18589
|
+
this.buttonInst.content = this.hasStarted ? this.buttonSettings.stopContent : this.buttonSettings.content;
|
|
18590
|
+
this.buttonInst.cssClass = this.updateButtonCssClass();
|
|
18591
|
+
}
|
|
18592
|
+
if (oldModel.iconCss !== newModel.iconCss || oldModel.stopIconCss !== newModel.stopIconCss) {
|
|
18593
|
+
const iconCss = !isNullOrUndefined(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
|
|
18594
|
+
const stopIconCss = !isNullOrUndefined(this.buttonSettings.stopIconCss) && this.buttonSettings.stopIconCss !== '' ? this.buttonSettings.stopIconCss : 'e-icons e-listen-stop';
|
|
18595
|
+
this.buttonInst.iconCss = this.hasStarted ? stopIconCss : iconCss;
|
|
18596
|
+
}
|
|
18597
|
+
if (oldModel.iconPosition !== newModel.iconPosition) {
|
|
18598
|
+
this.buttonInst.iconPosition = this.buttonSettings.iconPosition;
|
|
18599
|
+
}
|
|
18600
|
+
if (oldModel.isPrimary !== newModel.isPrimary) {
|
|
18601
|
+
this.buttonInst.isPrimary = this.buttonSettings.isPrimary;
|
|
18602
|
+
}
|
|
18603
|
+
}
|
|
18604
|
+
destroyAndNullify(obj) {
|
|
18605
|
+
if (obj) {
|
|
18606
|
+
obj.destroy();
|
|
18607
|
+
obj = null;
|
|
18608
|
+
}
|
|
18609
|
+
}
|
|
18610
|
+
//#endregion
|
|
18611
|
+
//#region Public Methods
|
|
18612
|
+
/**
|
|
18613
|
+
* Destroy the SpeechToText.
|
|
18614
|
+
*
|
|
18615
|
+
* @returns {void}
|
|
18616
|
+
*/
|
|
18617
|
+
destroy() {
|
|
18618
|
+
super.destroy();
|
|
18619
|
+
this.unWireEvents();
|
|
18620
|
+
this.destroyAndNullify(this.buttonInst);
|
|
18621
|
+
this.destroyAndNullify(this.tooltipInst);
|
|
18622
|
+
this.recognition = null;
|
|
18623
|
+
this.micOn = null;
|
|
18624
|
+
this.htmlAttributes = this.tooltipSettings = this.buttonSettings = null;
|
|
18625
|
+
this.element.classList.remove('e-rtl');
|
|
18626
|
+
}
|
|
18627
|
+
/**
|
|
18628
|
+
* Begins the audio capture process by listening to the user's microphone input.
|
|
18629
|
+
* This method initiates the speech-to-text process and continuously updates the `transcript` property with interim and final recognition results.
|
|
18630
|
+
*
|
|
18631
|
+
* @returns {void} No return value.
|
|
18632
|
+
*/
|
|
18633
|
+
startListening() {
|
|
18634
|
+
if (!this.disabled && !this.isClicked) {
|
|
18635
|
+
this.isUserInteracted = false;
|
|
18636
|
+
this.micOn = true;
|
|
18637
|
+
this.startSpeechRecognition();
|
|
18638
|
+
}
|
|
18639
|
+
}
|
|
18640
|
+
/**
|
|
18641
|
+
* Stops the audio capture process and finalizes the speech recognition.
|
|
18642
|
+
* This method ends the ongoing speech-to-text operation and completes the recognition process, storing the final transcription.
|
|
18643
|
+
* It is typically called to stop listening when the user is finished speaking.
|
|
18644
|
+
*
|
|
18645
|
+
* @returns {void} No return value.
|
|
18646
|
+
*/
|
|
18647
|
+
stopListening() {
|
|
18648
|
+
if (!this.disabled && this.isClicked) {
|
|
18649
|
+
this.isUserInteracted = false;
|
|
18650
|
+
this.micOn = false;
|
|
18651
|
+
this.stopSpeechRecognition();
|
|
18652
|
+
}
|
|
18653
|
+
}
|
|
18654
|
+
/**
|
|
18655
|
+
* Called if any of the property value is changed.
|
|
18656
|
+
*
|
|
18657
|
+
* @param {SpeechToTextModel} newProp - Specifies new properties
|
|
18658
|
+
* @param {SpeechToTextModel} oldProp - Specifies old properties
|
|
18659
|
+
* @returns {void}
|
|
18660
|
+
* @private
|
|
18661
|
+
*/
|
|
18662
|
+
onPropertyChanged(newProp, oldProp) {
|
|
18663
|
+
for (const prop of Object.keys(newProp)) {
|
|
18664
|
+
switch (prop) {
|
|
18665
|
+
case 'lang':
|
|
18666
|
+
if (this.recognition) {
|
|
18667
|
+
this.recognition.lang = this.lang;
|
|
18668
|
+
}
|
|
18669
|
+
break;
|
|
18670
|
+
case 'allowInterimResults':
|
|
18671
|
+
if (this.recognition) {
|
|
18672
|
+
this.recognition.interimResults = this.allowInterimResults;
|
|
18673
|
+
}
|
|
18674
|
+
break;
|
|
18675
|
+
case 'buttonSettings':
|
|
18676
|
+
this.buttonSettingsChanges(oldProp.buttonSettings, newProp.buttonSettings);
|
|
18677
|
+
break;
|
|
18678
|
+
case 'cssClass':
|
|
18679
|
+
this.updateCssClass(newProp.cssClass, oldProp.cssClass);
|
|
18680
|
+
break;
|
|
18681
|
+
case 'disabled':
|
|
18682
|
+
this.buttonInst.disabled = this.disabled;
|
|
18683
|
+
this.handleStateChange();
|
|
18684
|
+
break;
|
|
18685
|
+
case 'htmlAttributes':
|
|
18686
|
+
this.removeHtmlAttributes(oldProp.htmlAttributes);
|
|
18687
|
+
this.addHtmlAttributes(newProp.htmlAttributes);
|
|
18688
|
+
break;
|
|
18689
|
+
case 'listeningState':
|
|
18690
|
+
this.handleStateChange();
|
|
18691
|
+
break;
|
|
18692
|
+
case 'tooltipSettings':
|
|
18693
|
+
case 'showTooltip':
|
|
18694
|
+
this.updateTooltip();
|
|
18695
|
+
break;
|
|
18696
|
+
case 'transcript':
|
|
18697
|
+
this.transcript = this.fullTranscript = newProp.transcript;
|
|
18698
|
+
break;
|
|
18699
|
+
case 'enableRtl':
|
|
18700
|
+
this.buttonInst.enableRtl = this.tooltipInst.enableRtl = this.enableRtl;
|
|
18701
|
+
break;
|
|
18702
|
+
case 'locale':
|
|
18703
|
+
this.l10n.setLocale(this.locale);
|
|
18704
|
+
this.updateAriaLabel();
|
|
18705
|
+
this.updateTooltip();
|
|
18706
|
+
break;
|
|
18707
|
+
}
|
|
18708
|
+
}
|
|
18709
|
+
}
|
|
18710
|
+
};
|
|
18711
|
+
__decorate$c([
|
|
18712
|
+
Property('')
|
|
18713
|
+
], SpeechToText.prototype, "transcript", void 0);
|
|
18714
|
+
__decorate$c([
|
|
18715
|
+
Property('')
|
|
18716
|
+
], SpeechToText.prototype, "lang", void 0);
|
|
18717
|
+
__decorate$c([
|
|
18718
|
+
Property(true)
|
|
18719
|
+
], SpeechToText.prototype, "allowInterimResults", void 0);
|
|
18720
|
+
__decorate$c([
|
|
18721
|
+
Property(true)
|
|
18722
|
+
], SpeechToText.prototype, "showTooltip", void 0);
|
|
18723
|
+
__decorate$c([
|
|
18724
|
+
Property('Inactive')
|
|
18725
|
+
], SpeechToText.prototype, "listeningState", void 0);
|
|
18726
|
+
__decorate$c([
|
|
18727
|
+
Complex({}, ButtonSettings)
|
|
18728
|
+
], SpeechToText.prototype, "buttonSettings", void 0);
|
|
18729
|
+
__decorate$c([
|
|
18730
|
+
Complex({}, TooltipSettings)
|
|
18731
|
+
], SpeechToText.prototype, "tooltipSettings", void 0);
|
|
18732
|
+
__decorate$c([
|
|
18733
|
+
Property(false)
|
|
18734
|
+
], SpeechToText.prototype, "disabled", void 0);
|
|
18735
|
+
__decorate$c([
|
|
18736
|
+
Property('')
|
|
18737
|
+
], SpeechToText.prototype, "cssClass", void 0);
|
|
18738
|
+
__decorate$c([
|
|
18739
|
+
Property({})
|
|
18740
|
+
], SpeechToText.prototype, "htmlAttributes", void 0);
|
|
18741
|
+
__decorate$c([
|
|
18742
|
+
Event()
|
|
18743
|
+
], SpeechToText.prototype, "created", void 0);
|
|
18744
|
+
__decorate$c([
|
|
18745
|
+
Event()
|
|
18746
|
+
], SpeechToText.prototype, "onStart", void 0);
|
|
18747
|
+
__decorate$c([
|
|
18748
|
+
Event()
|
|
18749
|
+
], SpeechToText.prototype, "onStop", void 0);
|
|
18750
|
+
__decorate$c([
|
|
18751
|
+
Event()
|
|
18752
|
+
], SpeechToText.prototype, "onError", void 0);
|
|
18753
|
+
__decorate$c([
|
|
18754
|
+
Event()
|
|
18755
|
+
], SpeechToText.prototype, "transcriptChanged", void 0);
|
|
18756
|
+
SpeechToText = __decorate$c([
|
|
18757
|
+
NotifyPropertyChanges
|
|
18758
|
+
], SpeechToText);
|
|
18759
|
+
|
|
18760
|
+
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 };
|
|
18134
18761
|
//# sourceMappingURL=ej2-inputs.es2015.js.map
|