@seniorsistemas/angular-components 17.26.9-bugfix-sds-309-85a29221 → 17.26.9-bugfix-sds-305-32cf1ca4
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/bundles/seniorsistemas-angular-components.umd.js +86 -123
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/speech-recognition/speech-recognition/speech-recognition.component.d.ts +2 -5
- package/components/speech-recognition/speech-recognition.service.d.ts +2 -3
- package/components/text-area/text-area/text-area.component.d.ts +3 -1
- package/esm2015/components/bignumber-input/bignumber-input.directive.js +6 -5
- package/esm2015/components/locale/locale.service.js +8 -2
- package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +20 -38
- package/esm2015/components/speech-recognition/speech-recognition.service.js +22 -41
- package/esm2015/components/speech-recognition/text-to-speech.service.js +1 -1
- package/esm2015/components/text-area/text-area/text-area.component.js +14 -3
- package/esm5/components/bignumber-input/bignumber-input.directive.js +6 -5
- package/esm5/components/locale/locale.service.js +8 -2
- package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +19 -43
- package/esm5/components/speech-recognition/speech-recognition.service.js +46 -78
- package/esm5/components/speech-recognition/text-to-speech.service.js +1 -1
- package/esm5/components/text-area/text-area/text-area.component.js +18 -3
- package/fesm2015/seniorsistemas-angular-components.js +61 -83
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +88 -125
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __decorate, __assign, __extends, __read, __spread, __awaiter, __generator,
|
|
2
|
-
import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, Pipe,
|
|
1
|
+
import { __decorate, __assign, __extends, __read, __param, __spread, __awaiter, __generator, __values, __rest } from 'tslib';
|
|
2
|
+
import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, ɵɵinject, Pipe, Inject, HostBinding, ChangeDetectorRef, ViewChildren, InjectionToken, PLATFORM_ID, KeyValueDiffers, ViewEncapsulation, INJECTOR, NgZone, ContentChild, Optional } from '@angular/core';
|
|
3
3
|
import { trigger, transition, style as style$7, animate, state, group, query, animateChild } from '@angular/animations';
|
|
4
4
|
import { Subject, of, from, ReplaySubject, throwError, fromEvent, forkJoin, pipe } from 'rxjs';
|
|
5
5
|
import { takeUntil, tap, map, switchMap, catchError, first, filter, take, delay, debounceTime, repeat, finalize } from 'rxjs/operators';
|
|
@@ -1275,8 +1275,11 @@ var LocaleService = /** @class */ (function () {
|
|
|
1275
1275
|
{ type: HttpClient },
|
|
1276
1276
|
{ type: CookieService }
|
|
1277
1277
|
]; };
|
|
1278
|
+
LocaleService.ɵprov = ɵɵdefineInjectable({ factory: function LocaleService_Factory() { return new LocaleService(ɵɵinject(HttpClient), ɵɵinject(CookieService)); }, token: LocaleService, providedIn: "root" });
|
|
1278
1279
|
LocaleService = __decorate([
|
|
1279
|
-
Injectable(
|
|
1280
|
+
Injectable({
|
|
1281
|
+
providedIn: "root"
|
|
1282
|
+
})
|
|
1280
1283
|
], LocaleService);
|
|
1281
1284
|
return LocaleService;
|
|
1282
1285
|
}());
|
|
@@ -1940,7 +1943,7 @@ var BignumberInputDirective = /** @class */ (function (_super) {
|
|
|
1940
1943
|
var BignumberInputDirective_1;
|
|
1941
1944
|
BignumberInputDirective.ctorParameters = function () { return [
|
|
1942
1945
|
{ type: Injector },
|
|
1943
|
-
{ type: LocaleService }
|
|
1946
|
+
{ type: LocaleService, decorators: [{ type: Inject, args: [LocaleService,] }] }
|
|
1944
1947
|
]; };
|
|
1945
1948
|
__decorate([
|
|
1946
1949
|
Input()
|
|
@@ -1986,7 +1989,8 @@ var BignumberInputDirective = /** @class */ (function (_super) {
|
|
|
1986
1989
|
multi: true,
|
|
1987
1990
|
},
|
|
1988
1991
|
],
|
|
1989
|
-
})
|
|
1992
|
+
}),
|
|
1993
|
+
__param(1, Inject(LocaleService))
|
|
1990
1994
|
], BignumberInputDirective);
|
|
1991
1995
|
return BignumberInputDirective;
|
|
1992
1996
|
}(CurrencyMaskDirective));
|
|
@@ -11359,8 +11363,9 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11359
11363
|
this.translateService = translateService;
|
|
11360
11364
|
this.hasSupportSpeechRecognition = false;
|
|
11361
11365
|
this.isListening = false;
|
|
11362
|
-
this.
|
|
11366
|
+
this.hasMicrophoneAccess = false;
|
|
11363
11367
|
this.TIMEOUT_NO_MESSAGE = 3000;
|
|
11368
|
+
this.verifyMicrophoneState();
|
|
11364
11369
|
this.setRecognition();
|
|
11365
11370
|
}
|
|
11366
11371
|
SpeechRecognitionService.prototype.listen = function () {
|
|
@@ -11369,73 +11374,82 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11369
11374
|
if (this.isListening) {
|
|
11370
11375
|
speechSubject.error('Already listening');
|
|
11371
11376
|
}
|
|
11372
|
-
this.hasMicrophoneAccess
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
var
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
clearTimeout(silenceTimer);
|
|
11377
|
+
else if (!this.hasMicrophoneAccess) {
|
|
11378
|
+
this.isListening = false;
|
|
11379
|
+
this.toastService.show({ severity: 'error', text: this.translateService.instant('platform.angular_components.no_microphone_permission') });
|
|
11380
|
+
speechSubject.error('Microphone access is disabled');
|
|
11381
|
+
}
|
|
11382
|
+
else {
|
|
11383
|
+
this.isListening = true;
|
|
11384
|
+
this.recognition.continuous = true;
|
|
11385
|
+
this.recognition.interimResults = true;
|
|
11386
|
+
this.recognition.maxAlternatives = 1;
|
|
11387
|
+
var silenceTimer_1;
|
|
11388
|
+
var restartSilenceTimer_1 = function () {
|
|
11389
|
+
if (silenceTimer_1 !== undefined) {
|
|
11390
|
+
clearTimeout(silenceTimer_1);
|
|
11387
11391
|
}
|
|
11388
|
-
|
|
11392
|
+
silenceTimer_1 = setTimeout(function () {
|
|
11389
11393
|
_this.recognition.stop();
|
|
11390
11394
|
}, _this.TIMEOUT_NO_MESSAGE);
|
|
11391
11395
|
};
|
|
11392
|
-
var
|
|
11393
|
-
var
|
|
11394
|
-
|
|
11396
|
+
var fullTranscript_1 = '';
|
|
11397
|
+
var interimTranscript_1 = '';
|
|
11398
|
+
this.recognition.onresult = function (event) {
|
|
11395
11399
|
_this.ngZone.run(function () {
|
|
11396
|
-
|
|
11400
|
+
restartSilenceTimer_1();
|
|
11397
11401
|
var interimTranscript = '';
|
|
11398
11402
|
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
11399
11403
|
var transcript = event.results[i][0].transcript;
|
|
11400
11404
|
if (event.results[i].isFinal) {
|
|
11401
|
-
|
|
11405
|
+
fullTranscript_1 += transcript + '\n';
|
|
11402
11406
|
}
|
|
11403
11407
|
else {
|
|
11404
11408
|
interimTranscript += transcript;
|
|
11405
11409
|
}
|
|
11406
11410
|
}
|
|
11407
11411
|
interimTranscript = interimTranscript;
|
|
11408
|
-
speechSubject.next({ text:
|
|
11412
|
+
speechSubject.next({ text: fullTranscript_1 + interimTranscript, isFinal: false });
|
|
11409
11413
|
});
|
|
11410
11414
|
};
|
|
11411
|
-
|
|
11415
|
+
this.recognition.onerror = function () {
|
|
11412
11416
|
_this.ngZone.run(function () {
|
|
11413
|
-
if (
|
|
11414
|
-
clearTimeout(
|
|
11417
|
+
if (silenceTimer_1 !== undefined) {
|
|
11418
|
+
clearTimeout(silenceTimer_1);
|
|
11415
11419
|
}
|
|
11416
11420
|
_this.isListening = false;
|
|
11417
11421
|
speechSubject.error('Speech recognition error');
|
|
11418
|
-
_this.microphoneStatus$.next('inactive');
|
|
11419
11422
|
});
|
|
11420
11423
|
};
|
|
11421
|
-
|
|
11424
|
+
this.recognition.onend = function () {
|
|
11422
11425
|
_this.ngZone.run(function () {
|
|
11423
|
-
if (
|
|
11424
|
-
clearTimeout(
|
|
11426
|
+
if (silenceTimer_1 !== undefined) {
|
|
11427
|
+
clearTimeout(silenceTimer_1);
|
|
11425
11428
|
}
|
|
11426
|
-
speechSubject.next({ text:
|
|
11429
|
+
speechSubject.next({ text: fullTranscript_1 + interimTranscript_1, isFinal: true });
|
|
11427
11430
|
_this.isListening = false;
|
|
11428
11431
|
speechSubject.complete();
|
|
11429
|
-
_this.microphoneStatus$.next('inactive');
|
|
11430
11432
|
});
|
|
11431
11433
|
};
|
|
11432
|
-
|
|
11433
|
-
}
|
|
11434
|
+
this.recognition.start();
|
|
11435
|
+
}
|
|
11434
11436
|
return speechSubject;
|
|
11435
11437
|
};
|
|
11436
11438
|
SpeechRecognitionService.prototype.stop = function () {
|
|
11437
11439
|
this.recognition.stop();
|
|
11438
11440
|
};
|
|
11441
|
+
SpeechRecognitionService.prototype.verifyMicrophoneState = function () {
|
|
11442
|
+
var _this = this;
|
|
11443
|
+
navigator.permissions.query({ name: 'microphone' }).then(function (result) {
|
|
11444
|
+
var microphoneResultState = result.state;
|
|
11445
|
+
_this.hasMicrophoneAccess = microphoneResultState === 'granted';
|
|
11446
|
+
result.onchange = function () {
|
|
11447
|
+
_this.ngZone.run(function () {
|
|
11448
|
+
_this.hasMicrophoneAccess = result.state === 'granted';
|
|
11449
|
+
});
|
|
11450
|
+
};
|
|
11451
|
+
});
|
|
11452
|
+
};
|
|
11439
11453
|
SpeechRecognitionService.prototype.setRecognition = function () {
|
|
11440
11454
|
var _this = this;
|
|
11441
11455
|
var _a;
|
|
@@ -11451,48 +11465,6 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11451
11465
|
this.recognition.maxAlternatives = 1;
|
|
11452
11466
|
this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
|
|
11453
11467
|
};
|
|
11454
|
-
Object.defineProperty(SpeechRecognitionService.prototype, "hasMicrophoneAccess", {
|
|
11455
|
-
get: function () {
|
|
11456
|
-
var _this = this;
|
|
11457
|
-
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
11458
|
-
var permission;
|
|
11459
|
-
var _this = this;
|
|
11460
|
-
return __generator(this, function (_a) {
|
|
11461
|
-
switch (_a.label) {
|
|
11462
|
-
case 0: return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
|
|
11463
|
-
case 1:
|
|
11464
|
-
permission = _a.sent();
|
|
11465
|
-
if (permission.state === 'denied') {
|
|
11466
|
-
resolve(false);
|
|
11467
|
-
}
|
|
11468
|
-
else if (permission.state === 'granted') {
|
|
11469
|
-
resolve(true);
|
|
11470
|
-
}
|
|
11471
|
-
else if (permission.state === 'prompt') {
|
|
11472
|
-
try {
|
|
11473
|
-
navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {
|
|
11474
|
-
stream.getTracks().forEach(function (t) { return t.stop(); });
|
|
11475
|
-
}).catch(function () {
|
|
11476
|
-
resolve(false);
|
|
11477
|
-
});
|
|
11478
|
-
permission.onchange = function () {
|
|
11479
|
-
_this.ngZone.run(function () {
|
|
11480
|
-
resolve(permission.state === 'granted' ? true : false);
|
|
11481
|
-
});
|
|
11482
|
-
};
|
|
11483
|
-
}
|
|
11484
|
-
catch (error) {
|
|
11485
|
-
resolve(false);
|
|
11486
|
-
}
|
|
11487
|
-
}
|
|
11488
|
-
return [2 /*return*/];
|
|
11489
|
-
}
|
|
11490
|
-
});
|
|
11491
|
-
}); });
|
|
11492
|
-
},
|
|
11493
|
-
enumerable: true,
|
|
11494
|
-
configurable: true
|
|
11495
|
-
});
|
|
11496
11468
|
SpeechRecognitionService.ctorParameters = function () { return [
|
|
11497
11469
|
{ type: LocaleService },
|
|
11498
11470
|
{ type: NgZone },
|
|
@@ -13510,6 +13482,21 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13510
13482
|
enumerable: true,
|
|
13511
13483
|
configurable: true
|
|
13512
13484
|
});
|
|
13485
|
+
Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
|
|
13486
|
+
get: function () {
|
|
13487
|
+
return this._placeholder;
|
|
13488
|
+
},
|
|
13489
|
+
set: function (value) {
|
|
13490
|
+
if (value) {
|
|
13491
|
+
this._placeholder = value;
|
|
13492
|
+
}
|
|
13493
|
+
else {
|
|
13494
|
+
this._placeholder = '';
|
|
13495
|
+
}
|
|
13496
|
+
},
|
|
13497
|
+
enumerable: true,
|
|
13498
|
+
configurable: true
|
|
13499
|
+
});
|
|
13513
13500
|
Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
|
|
13514
13501
|
get: function () {
|
|
13515
13502
|
return this._inputStyle;
|
|
@@ -13574,7 +13561,7 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13574
13561
|
], TextAreaComponent.prototype, "maxLength", void 0);
|
|
13575
13562
|
__decorate([
|
|
13576
13563
|
Input()
|
|
13577
|
-
], TextAreaComponent.prototype, "placeholder",
|
|
13564
|
+
], TextAreaComponent.prototype, "placeholder", null);
|
|
13578
13565
|
__decorate([
|
|
13579
13566
|
Input()
|
|
13580
13567
|
], TextAreaComponent.prototype, "inputStyle", null);
|
|
@@ -13584,7 +13571,7 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13584
13571
|
TextAreaComponent = TextAreaComponent_1 = __decorate([
|
|
13585
13572
|
Component({
|
|
13586
13573
|
selector: 's-textarea',
|
|
13587
|
-
template: "<textarea\n *ngIf=\"keyFilter\"\n #textArea\n class=\"textarea\"\n [pKeyFilter]=\"keyFilter\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder
|
|
13574
|
+
template: "<textarea\n *ngIf=\"keyFilter\"\n #textArea\n class=\"textarea\"\n [pKeyFilter]=\"keyFilter\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder\"\n [maxlength]=\"maxLength\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<textarea\n *ngIf=\"!keyFilter\"\n #textArea\n class=\"textarea\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder\"\n [maxlength]=\"maxLength\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<s-speech-recognition\n *ngIf=\"speechRecognition && renderTextArea\"\n [textAreaElement]=\"textAreaElement.nativeElement\"\n [keepContext]=\"keepContext\"\n [speechRecognitionPlaceholder]=\"speechRecognitionPlaceholder\"\n (recognizedText)=\"handleRecognizedText($event)\">\n</s-speech-recognition>\n",
|
|
13588
13575
|
providers: [
|
|
13589
13576
|
{
|
|
13590
13577
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -13694,7 +13681,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13694
13681
|
this.speechRecognitionPlaceholder = '';
|
|
13695
13682
|
this._recognizedText = '';
|
|
13696
13683
|
this.originalTextAreaElementText = '';
|
|
13697
|
-
this.
|
|
13684
|
+
this.isDoneSpeaking = false;
|
|
13698
13685
|
this.onDestroy$ = new Subject();
|
|
13699
13686
|
this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
|
|
13700
13687
|
this.keydownEventListener = function (event) {
|
|
@@ -13703,7 +13690,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13703
13690
|
}
|
|
13704
13691
|
};
|
|
13705
13692
|
this.disabled = false;
|
|
13706
|
-
this.
|
|
13693
|
+
this.isSpeaking = false;
|
|
13707
13694
|
this.voiceSpeed = 1;
|
|
13708
13695
|
this.isDisabledMicrophone = false;
|
|
13709
13696
|
this.canRenderMicrophone = true;
|
|
@@ -13715,9 +13702,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13715
13702
|
this.isPlayingTextToSpeech = false;
|
|
13716
13703
|
this.recognizedText = new EventEmitter();
|
|
13717
13704
|
}
|
|
13718
|
-
SpeechRecognitionComponent_1 = SpeechRecognitionComponent;
|
|
13719
13705
|
SpeechRecognitionComponent.prototype.ngOnInit = function () {
|
|
13720
|
-
var _this = this;
|
|
13721
13706
|
if (!this.hasSpeechRecognitionBrowserApi) {
|
|
13722
13707
|
return;
|
|
13723
13708
|
}
|
|
@@ -13726,26 +13711,18 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13726
13711
|
}
|
|
13727
13712
|
this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
|
|
13728
13713
|
this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
|
|
13729
|
-
this.speechRecognitionService.microphoneStatus$.pipe(takeUntil(this.onDestroy$)).subscribe(function (status) {
|
|
13730
|
-
if (status === 'active') {
|
|
13731
|
-
_this.onCloseToolbar();
|
|
13732
|
-
}
|
|
13733
|
-
});
|
|
13734
13714
|
};
|
|
13735
13715
|
SpeechRecognitionComponent.prototype.onListen = function () {
|
|
13736
13716
|
var _this = this;
|
|
13737
13717
|
if (this.isDisabledMicrophone || this.isListening) {
|
|
13738
13718
|
return;
|
|
13739
13719
|
}
|
|
13740
|
-
// if (this.isPlayingTextToSpeech) {
|
|
13741
|
-
// this.onCloseToolbar();
|
|
13742
|
-
// }
|
|
13743
13720
|
this.disabled = true;
|
|
13744
13721
|
this.canRenderMicrophone = false;
|
|
13745
13722
|
this.canRenderListeningText = true;
|
|
13746
13723
|
this.originalTextAreaElementText = this.textAreaElement.value;
|
|
13747
13724
|
this.textAreaElement.value = '';
|
|
13748
|
-
this.
|
|
13725
|
+
this.isSpeaking = true;
|
|
13749
13726
|
this.speechRecognitionService.listen()
|
|
13750
13727
|
.pipe(takeUntil(this.onDestroy$))
|
|
13751
13728
|
.subscribe(function (_a) {
|
|
@@ -13757,10 +13734,10 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13757
13734
|
_this.canRenderAprove = true;
|
|
13758
13735
|
_this.canRenderDiscard = true;
|
|
13759
13736
|
_this.canRenderListeningText = false;
|
|
13760
|
-
_this.
|
|
13737
|
+
_this.isSpeaking = false;
|
|
13761
13738
|
}
|
|
13762
13739
|
}, function () {
|
|
13763
|
-
_this.
|
|
13740
|
+
_this.isSpeaking = false;
|
|
13764
13741
|
_this.canRenderMicrophone = true;
|
|
13765
13742
|
_this.isDisabledMicrophone = false;
|
|
13766
13743
|
_this.canRenderListeningText = false;
|
|
@@ -13779,15 +13756,15 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13779
13756
|
}
|
|
13780
13757
|
this.canRenderTextToSpeechToolbar = true;
|
|
13781
13758
|
this.canRenderTextToSpeech = false;
|
|
13782
|
-
|
|
13759
|
+
this.isPlayingTextToSpeech = true;
|
|
13783
13760
|
this.speak();
|
|
13784
13761
|
};
|
|
13785
13762
|
SpeechRecognitionComponent.prototype.onCloseToolbar = function () {
|
|
13786
13763
|
this.canRenderTextToSpeechToolbar = false;
|
|
13787
13764
|
this.canRenderTextToSpeech = true;
|
|
13788
|
-
this.
|
|
13765
|
+
this.isPlayingTextToSpeech = false;
|
|
13766
|
+
this.textToSpeechService.cancel();
|
|
13789
13767
|
this.voiceSpeed = 1;
|
|
13790
|
-
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
|
|
13791
13768
|
};
|
|
13792
13769
|
SpeechRecognitionComponent.prototype.onDiscard = function () {
|
|
13793
13770
|
this.canRenderAprove = false;
|
|
@@ -13798,8 +13775,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13798
13775
|
this._recognizedText = '';
|
|
13799
13776
|
this.setTextAreaValue(this.originalTextAreaElementText);
|
|
13800
13777
|
this.disabled = false;
|
|
13801
|
-
this.
|
|
13802
|
-
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
|
|
13778
|
+
this.textToSpeechService.cancel();
|
|
13803
13779
|
};
|
|
13804
13780
|
SpeechRecognitionComponent.prototype.onAprove = function () {
|
|
13805
13781
|
this.canRenderAprove = false;
|
|
@@ -13829,7 +13805,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13829
13805
|
this.textToSpeechService.pause();
|
|
13830
13806
|
}
|
|
13831
13807
|
else {
|
|
13832
|
-
if (this.
|
|
13808
|
+
if (this.isDoneSpeaking) {
|
|
13833
13809
|
this.speak();
|
|
13834
13810
|
}
|
|
13835
13811
|
else {
|
|
@@ -13839,6 +13815,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13839
13815
|
this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
|
|
13840
13816
|
};
|
|
13841
13817
|
SpeechRecognitionComponent.prototype.restartTextToSpeech = function () {
|
|
13818
|
+
this.isPlayingTextToSpeech = true;
|
|
13842
13819
|
this.textToSpeechService.cancel();
|
|
13843
13820
|
this.speak();
|
|
13844
13821
|
};
|
|
@@ -13869,7 +13846,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13869
13846
|
Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
|
|
13870
13847
|
get: function () {
|
|
13871
13848
|
var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
|
|
13872
|
-
return !this.
|
|
13849
|
+
return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
|
|
13873
13850
|
},
|
|
13874
13851
|
enumerable: true,
|
|
13875
13852
|
configurable: true
|
|
@@ -13877,28 +13854,14 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13877
13854
|
SpeechRecognitionComponent.prototype.setTextAreaValue = function (value) {
|
|
13878
13855
|
this.textAreaElement.value = value;
|
|
13879
13856
|
};
|
|
13880
|
-
SpeechRecognitionComponent.prototype.stopTextToSpeech = function () {
|
|
13881
|
-
this.isPlayingTextToSpeech = false;
|
|
13882
|
-
this.textToSpeechService.cancel();
|
|
13883
|
-
};
|
|
13884
13857
|
SpeechRecognitionComponent.prototype.speak = function () {
|
|
13885
13858
|
var _this = this;
|
|
13886
|
-
this.
|
|
13887
|
-
this.
|
|
13888
|
-
this.textToSpeechService.speak(this.textToSpeech, this.voiceSpeed).then(function () {
|
|
13859
|
+
this.isDoneSpeaking = false;
|
|
13860
|
+
this.textToSpeechService.speak(this._recognizedText, this.voiceSpeed).then(function () {
|
|
13889
13861
|
_this.isPlayingTextToSpeech = false;
|
|
13890
|
-
_this.
|
|
13862
|
+
_this.isDoneSpeaking = true;
|
|
13891
13863
|
});
|
|
13892
13864
|
};
|
|
13893
|
-
Object.defineProperty(SpeechRecognitionComponent.prototype, "textToSpeech", {
|
|
13894
|
-
get: function () {
|
|
13895
|
-
return this.textAreaElement.value;
|
|
13896
|
-
},
|
|
13897
|
-
enumerable: true,
|
|
13898
|
-
configurable: true
|
|
13899
|
-
});
|
|
13900
|
-
var SpeechRecognitionComponent_1;
|
|
13901
|
-
SpeechRecognitionComponent.TOOLBAR_ACTIVE = false;
|
|
13902
13865
|
SpeechRecognitionComponent.ctorParameters = function () { return [
|
|
13903
13866
|
{ type: SpeechRecognitionService },
|
|
13904
13867
|
{ type: TextToSpeechService },
|
|
@@ -13916,11 +13879,11 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13916
13879
|
__decorate([
|
|
13917
13880
|
Output()
|
|
13918
13881
|
], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
|
|
13919
|
-
SpeechRecognitionComponent =
|
|
13882
|
+
SpeechRecognitionComponent = __decorate([
|
|
13920
13883
|
Component({
|
|
13921
13884
|
selector: 's-speech-recognition',
|
|
13922
|
-
template: "<section class=\"speech-recognition\" *ngIf=\"hasSpeechRecognitionBrowserApi\">\n <div class=\"speech-recognition-text\">\n <ng-container *ngIf=\"canRenderMicrophone\">\n {{ 'platform.angular_components.text_area_before_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"
|
|
13923
|
-
styles: [".speech-recognition{display:-ms-flexbox;display:flex;gap:10px;-ms-flex-pack:justify;justify-content:space-between;width:100%}.speech-recognition-buttons{display:-ms-flexbox;display:flex;gap:10px;position:relative;bottom:15px;margin-right:16px}.speech-recognition-item{display:-ms-inline-flexbox;display:inline-flex;height:25px;padding:4px 12px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;gap:8px;border-radius:15px;cursor:pointer;transition:background .1s ease-in}.speech-recognition-item i,.speech-recognition-item span{color:#fff}.speech-recognition-item-disabled{cursor:default!important}.speech-recognition-item-disabled *{opacity:.5}.speech-recognition-item-microphone{background:#428bca}.speech-recognition-item-microphone:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-regular{background:#7892a1}.speech-recognition-item-regular:not(.speech-recognition-item-disabled):hover{background:#697882}.speech-recognition-item-aprove{background:#0c9348}.speech-recognition-item-aprove:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-discard{background:#c13018}.speech-recognition-item-discard:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-toolbar{background:#7892a1;display:-ms-flexbox;display:flex;border-radius:15px;-ms-flex-align:center;align-items:center;color:#fff
|
|
13885
|
+
template: "<section class=\"speech-recognition\" *ngIf=\"hasSpeechRecognitionBrowserApi\">\n <div class=\"speech-recognition-text\">\n <ng-container *ngIf=\"canRenderMicrophone\">\n {{ 'platform.angular_components.text_area_before_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"isSpeaking\">\n {{ 'platform.angular_components.text_area_while_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"canRenderAprove && canRenderDiscard\">\n {{ 'platform.angular_components.text_area_end_speech' | translate }}\n </ng-container>\n </div>\n <div class=\"speech-recognition-buttons\">\n <span\n *ngIf=\"canRenderListeningText\"\n (click)=\"stopListening()\"\n class=\"speech-recognition-item speech-recognition-item-regular\">\n <i class=\"far fa-ellipsis-h\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderMicrophone\"\n (click)=\"onListen()\"\n class=\"speech-recognition-item speech-recognition-item-microphone\"\n [class.speech-recognition-item-disabled]=\"isDisabledMicrophone || isListening || disabled\">\n <i class=\"fas fa-microphone\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderAprove\"\n (click)=\"onAprove()\"\n class=\"speech-recognition-item speech-recognition-item-aprove\">\n <i class=\"fas fa-check\"></i>\n </span>\n\n <span *ngIf=\"canRenderDiscard\"\n (click)=\"onDiscard()\"\n class=\"speech-recognition-item speech-recognition-item-discard\">\n <i class=\"fas fa-times\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeech\"\n (click)=\"onOpenToolbar()\"\n class=\"speech-recognition-item speech-recognition-item-regular\"\n [class.speech-recognition-item-disabled]=\"isDisabledTextToSpeech\">\n <i class=\"fas fa-volume-down\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeechToolbar\"\n class=\"speech-recognition-item-toolbar\">\n <i class=\"fas\" [class.fa-pause]=\"isPlayingTextToSpeech\" [class.fa-play]=\"!isPlayingTextToSpeech\"\n (click)=\"toggleTextToSpeech()\"></i>\n <i class=\"fas fa-backward\" (click)=\"restartTextToSpeech()\"></i>\n <span (click)=\"updateVoiceSpeed()\">\n {{ voiceSpeed }}x\n </span>\n <i class=\"fas fa-times\" (click)=\"onCloseToolbar()\"></i>\n </span>\n </div>\n</section>\n",
|
|
13886
|
+
styles: [".speech-recognition{display:-ms-flexbox;display:flex;gap:10px;-ms-flex-pack:justify;justify-content:space-between;width:100%}.speech-recognition-buttons{display:-ms-flexbox;display:flex;gap:10px;position:relative;bottom:15px;margin-right:16px}.speech-recognition-item{display:-ms-inline-flexbox;display:inline-flex;height:25px;padding:4px 12px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;gap:8px;border-radius:15px;cursor:pointer;transition:background .1s ease-in}.speech-recognition-item i,.speech-recognition-item span{color:#fff}.speech-recognition-item-disabled{cursor:default!important}.speech-recognition-item-disabled *{opacity:.5}.speech-recognition-item-microphone{background:#428bca}.speech-recognition-item-microphone:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-regular{background:#7892a1}.speech-recognition-item-regular:not(.speech-recognition-item-disabled):hover{background:#697882}.speech-recognition-item-aprove{background:#0c9348}.speech-recognition-item-aprove:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-discard{background:#c13018}.speech-recognition-item-discard:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-toolbar{background:#7892a1;display:-ms-flexbox;display:flex;border-radius:15px;-ms-flex-align:center;align-items:center;color:#fff}.speech-recognition-item-toolbar i,.speech-recognition-item-toolbar span{cursor:pointer}.speech-recognition-item-toolbar i:not(:first-child),.speech-recognition-item-toolbar i:not(:last-child){padding:6px}.speech-recognition-item-toolbar i:first-child{padding-left:10px}.speech-recognition-item-toolbar i:last-child{padding-right:10px}.speech-recognition-item-toolbar span{height:25px}.speech-recognition-text{color:#212533;font-size:12px;font-style:normal;font-weight:400;word-break:break-word}"]
|
|
13924
13887
|
})
|
|
13925
13888
|
], SpeechRecognitionComponent);
|
|
13926
13889
|
return SpeechRecognitionComponent;
|