@seniorsistemas/angular-components 17.26.9-bugfix-sds-307-c6084396 → 17.26.9-bugfix-sds-309-85a29221
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 +121 -80
- 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 +5 -2
- package/components/speech-recognition/speech-recognition.service.d.ts +3 -2
- package/components/text-area/text-area/text-area.component.d.ts +1 -3
- package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +38 -20
- package/esm2015/components/speech-recognition/speech-recognition.service.js +41 -22
- package/esm2015/components/speech-recognition/text-to-speech.service.js +1 -1
- package/esm2015/components/text-area/text-area/text-area.component.js +3 -14
- package/esm2015/components/tooltip/tooltip.component.js +1 -1
- package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +43 -19
- package/esm5/components/speech-recognition/speech-recognition.service.js +78 -46
- package/esm5/components/speech-recognition/text-to-speech.service.js +1 -1
- package/esm5/components/text-area/text-area/text-area.component.js +3 -18
- package/esm5/components/tooltip/tooltip.component.js +1 -1
- package/fesm2015/seniorsistemas-angular-components.js +79 -53
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +121 -80
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -389,7 +389,7 @@ var TooltipComponent = /** @class */ (function () {
|
|
|
389
389
|
TooltipComponent = __decorate([
|
|
390
390
|
Component({
|
|
391
391
|
template: "<div\n id=\"tooltip\"\n class=\"tooltip\"\n [ngClass]=\"['tooltip--' + position]\"\n [class.tooltip--visible]=\"visible\"\n [ngStyle]=\"{\n 'left': left + 'px',\n 'top': top + 'px'\n }\">\n <ng-template\n *ngIf=\"escape;\n then escapeTemplate;\n else noEscapeTemplate\">\n </ng-template> \n</div>\n\n<ng-template #noEscapeTemplate>\n <span\n class=\"tooltip__content\"\n [innerHTML]=\"tooltip\">\n </span>\n</ng-template>\n\n<ng-template #escapeTemplate>\n <span class=\"tooltip__content\">\n {{ tooltip }}\n </span>\n</ng-template>",
|
|
392
|
-
styles: [".tooltip{background-color:#000;border-radius:2px;color:#fff;font-family:\"Open Sans\",sans-serif;font-size:14px;font-weight:400;line-height:21px;opacity:0;padding:8px;transform:translateX(-50%);text-align:center;max-width:220px;word-wrap:break-word;z-index:99999
|
|
392
|
+
styles: [".tooltip{background-color:#000;border-radius:2px;color:#fff;font-family:\"Open Sans\",sans-serif;font-size:14px;font-weight:400;line-height:21px;opacity:0;padding:8px;position:fixed;transform:translateX(-50%);text-align:center;max-width:220px;word-wrap:break-word;z-index:99999}.tooltip--visible{opacity:1;transition:opacity .3s}.tooltip::before{content:\"\";height:0;position:absolute;width:0}.tooltip--bottom{margin-top:5px;transform:translateX(-50%)}.tooltip--bottom::before{border:5px solid transparent;border-bottom:5px solid #000;left:calc(50% - 5px);top:-10px}.tooltip--top{margin-bottom:5px;transform:translate(-50%,-100%)}.tooltip--top::before{border:5px solid transparent;border-top:5px solid #000;left:calc(50% - 5px);bottom:-10px}.tooltip--left{margin-right:28px;transform:translate(calc(-100% - 7px),-50%)}.tooltip--left::before{border:5px solid transparent;border-left:5px solid #000;right:-10px;bottom:calc(50% - 5px)}.tooltip--right{margin-left:7px;transform:translateY(-50%)}.tooltip--right::before{border:5px solid transparent;border-right:5px solid #000;left:-10px;bottom:calc(50% - 5px)}"]
|
|
393
393
|
})
|
|
394
394
|
], TooltipComponent);
|
|
395
395
|
return TooltipComponent;
|
|
@@ -11359,9 +11359,8 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11359
11359
|
this.translateService = translateService;
|
|
11360
11360
|
this.hasSupportSpeechRecognition = false;
|
|
11361
11361
|
this.isListening = false;
|
|
11362
|
-
this.
|
|
11362
|
+
this.microphoneStatus$ = new Subject();
|
|
11363
11363
|
this.TIMEOUT_NO_MESSAGE = 3000;
|
|
11364
|
-
this.verifyMicrophoneState();
|
|
11365
11364
|
this.setRecognition();
|
|
11366
11365
|
}
|
|
11367
11366
|
SpeechRecognitionService.prototype.listen = function () {
|
|
@@ -11370,82 +11369,73 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11370
11369
|
if (this.isListening) {
|
|
11371
11370
|
speechSubject.error('Already listening');
|
|
11372
11371
|
}
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
var
|
|
11385
|
-
|
|
11386
|
-
|
|
11372
|
+
this.hasMicrophoneAccess.then(function (hasAccess) {
|
|
11373
|
+
if (!hasAccess) {
|
|
11374
|
+
_this.toastService.show({ severity: 'error', text: _this.translateService.instant('platform.angular_components.no_microphone_permission') });
|
|
11375
|
+
speechSubject.error('Microphone access is disabled');
|
|
11376
|
+
return;
|
|
11377
|
+
}
|
|
11378
|
+
_this.microphoneStatus$.next('active');
|
|
11379
|
+
_this.isListening = true;
|
|
11380
|
+
_this.recognition.continuous = true;
|
|
11381
|
+
_this.recognition.interimResults = true;
|
|
11382
|
+
_this.recognition.maxAlternatives = 1;
|
|
11383
|
+
var silenceTimer;
|
|
11384
|
+
var restartSilenceTimer = function () {
|
|
11385
|
+
if (silenceTimer !== undefined) {
|
|
11386
|
+
clearTimeout(silenceTimer);
|
|
11387
11387
|
}
|
|
11388
|
-
|
|
11388
|
+
silenceTimer = setTimeout(function () {
|
|
11389
11389
|
_this.recognition.stop();
|
|
11390
11390
|
}, _this.TIMEOUT_NO_MESSAGE);
|
|
11391
11391
|
};
|
|
11392
|
-
var
|
|
11393
|
-
var
|
|
11394
|
-
|
|
11392
|
+
var fullTranscript = '';
|
|
11393
|
+
var interimTranscript = '';
|
|
11394
|
+
_this.recognition.onresult = function (event) {
|
|
11395
11395
|
_this.ngZone.run(function () {
|
|
11396
|
-
|
|
11396
|
+
restartSilenceTimer();
|
|
11397
11397
|
var interimTranscript = '';
|
|
11398
11398
|
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
11399
11399
|
var transcript = event.results[i][0].transcript;
|
|
11400
11400
|
if (event.results[i].isFinal) {
|
|
11401
|
-
|
|
11401
|
+
fullTranscript += transcript + '\n';
|
|
11402
11402
|
}
|
|
11403
11403
|
else {
|
|
11404
11404
|
interimTranscript += transcript;
|
|
11405
11405
|
}
|
|
11406
11406
|
}
|
|
11407
11407
|
interimTranscript = interimTranscript;
|
|
11408
|
-
speechSubject.next({ text:
|
|
11408
|
+
speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
|
|
11409
11409
|
});
|
|
11410
11410
|
};
|
|
11411
|
-
|
|
11411
|
+
_this.recognition.onerror = function () {
|
|
11412
11412
|
_this.ngZone.run(function () {
|
|
11413
|
-
if (
|
|
11414
|
-
clearTimeout(
|
|
11413
|
+
if (silenceTimer !== undefined) {
|
|
11414
|
+
clearTimeout(silenceTimer);
|
|
11415
11415
|
}
|
|
11416
11416
|
_this.isListening = false;
|
|
11417
11417
|
speechSubject.error('Speech recognition error');
|
|
11418
|
+
_this.microphoneStatus$.next('inactive');
|
|
11418
11419
|
});
|
|
11419
11420
|
};
|
|
11420
|
-
|
|
11421
|
+
_this.recognition.onend = function () {
|
|
11421
11422
|
_this.ngZone.run(function () {
|
|
11422
|
-
if (
|
|
11423
|
-
clearTimeout(
|
|
11423
|
+
if (silenceTimer !== undefined) {
|
|
11424
|
+
clearTimeout(silenceTimer);
|
|
11424
11425
|
}
|
|
11425
|
-
speechSubject.next({ text:
|
|
11426
|
+
speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
|
|
11426
11427
|
_this.isListening = false;
|
|
11427
11428
|
speechSubject.complete();
|
|
11429
|
+
_this.microphoneStatus$.next('inactive');
|
|
11428
11430
|
});
|
|
11429
11431
|
};
|
|
11430
|
-
|
|
11431
|
-
}
|
|
11432
|
+
_this.recognition.start();
|
|
11433
|
+
});
|
|
11432
11434
|
return speechSubject;
|
|
11433
11435
|
};
|
|
11434
11436
|
SpeechRecognitionService.prototype.stop = function () {
|
|
11435
11437
|
this.recognition.stop();
|
|
11436
11438
|
};
|
|
11437
|
-
SpeechRecognitionService.prototype.verifyMicrophoneState = function () {
|
|
11438
|
-
var _this = this;
|
|
11439
|
-
navigator.permissions.query({ name: 'microphone' }).then(function (result) {
|
|
11440
|
-
var microphoneResultState = result.state;
|
|
11441
|
-
_this.hasMicrophoneAccess = microphoneResultState === 'granted';
|
|
11442
|
-
result.onchange = function () {
|
|
11443
|
-
_this.ngZone.run(function () {
|
|
11444
|
-
_this.hasMicrophoneAccess = result.state === 'granted';
|
|
11445
|
-
});
|
|
11446
|
-
};
|
|
11447
|
-
});
|
|
11448
|
-
};
|
|
11449
11439
|
SpeechRecognitionService.prototype.setRecognition = function () {
|
|
11450
11440
|
var _this = this;
|
|
11451
11441
|
var _a;
|
|
@@ -11461,6 +11451,48 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11461
11451
|
this.recognition.maxAlternatives = 1;
|
|
11462
11452
|
this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
|
|
11463
11453
|
};
|
|
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
|
+
});
|
|
11464
11496
|
SpeechRecognitionService.ctorParameters = function () { return [
|
|
11465
11497
|
{ type: LocaleService },
|
|
11466
11498
|
{ type: NgZone },
|
|
@@ -13478,21 +13510,6 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13478
13510
|
enumerable: true,
|
|
13479
13511
|
configurable: true
|
|
13480
13512
|
});
|
|
13481
|
-
Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
|
|
13482
|
-
get: function () {
|
|
13483
|
-
return this._placeholder;
|
|
13484
|
-
},
|
|
13485
|
-
set: function (value) {
|
|
13486
|
-
if (value) {
|
|
13487
|
-
this._placeholder = value;
|
|
13488
|
-
}
|
|
13489
|
-
else {
|
|
13490
|
-
this._placeholder = '';
|
|
13491
|
-
}
|
|
13492
|
-
},
|
|
13493
|
-
enumerable: true,
|
|
13494
|
-
configurable: true
|
|
13495
|
-
});
|
|
13496
13513
|
Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
|
|
13497
13514
|
get: function () {
|
|
13498
13515
|
return this._inputStyle;
|
|
@@ -13557,7 +13574,7 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13557
13574
|
], TextAreaComponent.prototype, "maxLength", void 0);
|
|
13558
13575
|
__decorate([
|
|
13559
13576
|
Input()
|
|
13560
|
-
], TextAreaComponent.prototype, "placeholder",
|
|
13577
|
+
], TextAreaComponent.prototype, "placeholder", void 0);
|
|
13561
13578
|
__decorate([
|
|
13562
13579
|
Input()
|
|
13563
13580
|
], TextAreaComponent.prototype, "inputStyle", null);
|
|
@@ -13567,7 +13584,7 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13567
13584
|
TextAreaComponent = TextAreaComponent_1 = __decorate([
|
|
13568
13585
|
Component({
|
|
13569
13586
|
selector: 's-textarea',
|
|
13570
|
-
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",
|
|
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 ? 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 ? 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",
|
|
13571
13588
|
providers: [
|
|
13572
13589
|
{
|
|
13573
13590
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -13677,7 +13694,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13677
13694
|
this.speechRecognitionPlaceholder = '';
|
|
13678
13695
|
this._recognizedText = '';
|
|
13679
13696
|
this.originalTextAreaElementText = '';
|
|
13680
|
-
this.
|
|
13697
|
+
this.isDoneTextToSpeech = false;
|
|
13681
13698
|
this.onDestroy$ = new Subject();
|
|
13682
13699
|
this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
|
|
13683
13700
|
this.keydownEventListener = function (event) {
|
|
@@ -13686,7 +13703,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13686
13703
|
}
|
|
13687
13704
|
};
|
|
13688
13705
|
this.disabled = false;
|
|
13689
|
-
this.
|
|
13706
|
+
this.isListeningUserVoice = false;
|
|
13690
13707
|
this.voiceSpeed = 1;
|
|
13691
13708
|
this.isDisabledMicrophone = false;
|
|
13692
13709
|
this.canRenderMicrophone = true;
|
|
@@ -13698,7 +13715,9 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13698
13715
|
this.isPlayingTextToSpeech = false;
|
|
13699
13716
|
this.recognizedText = new EventEmitter();
|
|
13700
13717
|
}
|
|
13718
|
+
SpeechRecognitionComponent_1 = SpeechRecognitionComponent;
|
|
13701
13719
|
SpeechRecognitionComponent.prototype.ngOnInit = function () {
|
|
13720
|
+
var _this = this;
|
|
13702
13721
|
if (!this.hasSpeechRecognitionBrowserApi) {
|
|
13703
13722
|
return;
|
|
13704
13723
|
}
|
|
@@ -13707,18 +13726,26 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13707
13726
|
}
|
|
13708
13727
|
this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
|
|
13709
13728
|
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
|
+
});
|
|
13710
13734
|
};
|
|
13711
13735
|
SpeechRecognitionComponent.prototype.onListen = function () {
|
|
13712
13736
|
var _this = this;
|
|
13713
13737
|
if (this.isDisabledMicrophone || this.isListening) {
|
|
13714
13738
|
return;
|
|
13715
13739
|
}
|
|
13740
|
+
// if (this.isPlayingTextToSpeech) {
|
|
13741
|
+
// this.onCloseToolbar();
|
|
13742
|
+
// }
|
|
13716
13743
|
this.disabled = true;
|
|
13717
13744
|
this.canRenderMicrophone = false;
|
|
13718
13745
|
this.canRenderListeningText = true;
|
|
13719
13746
|
this.originalTextAreaElementText = this.textAreaElement.value;
|
|
13720
13747
|
this.textAreaElement.value = '';
|
|
13721
|
-
this.
|
|
13748
|
+
this.isListeningUserVoice = true;
|
|
13722
13749
|
this.speechRecognitionService.listen()
|
|
13723
13750
|
.pipe(takeUntil(this.onDestroy$))
|
|
13724
13751
|
.subscribe(function (_a) {
|
|
@@ -13730,10 +13757,10 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13730
13757
|
_this.canRenderAprove = true;
|
|
13731
13758
|
_this.canRenderDiscard = true;
|
|
13732
13759
|
_this.canRenderListeningText = false;
|
|
13733
|
-
_this.
|
|
13760
|
+
_this.isListeningUserVoice = false;
|
|
13734
13761
|
}
|
|
13735
13762
|
}, function () {
|
|
13736
|
-
_this.
|
|
13763
|
+
_this.isListeningUserVoice = false;
|
|
13737
13764
|
_this.canRenderMicrophone = true;
|
|
13738
13765
|
_this.isDisabledMicrophone = false;
|
|
13739
13766
|
_this.canRenderListeningText = false;
|
|
@@ -13752,15 +13779,15 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13752
13779
|
}
|
|
13753
13780
|
this.canRenderTextToSpeechToolbar = true;
|
|
13754
13781
|
this.canRenderTextToSpeech = false;
|
|
13755
|
-
|
|
13782
|
+
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = true;
|
|
13756
13783
|
this.speak();
|
|
13757
13784
|
};
|
|
13758
13785
|
SpeechRecognitionComponent.prototype.onCloseToolbar = function () {
|
|
13759
13786
|
this.canRenderTextToSpeechToolbar = false;
|
|
13760
13787
|
this.canRenderTextToSpeech = true;
|
|
13761
|
-
this.
|
|
13762
|
-
this.textToSpeechService.cancel();
|
|
13788
|
+
this.stopTextToSpeech();
|
|
13763
13789
|
this.voiceSpeed = 1;
|
|
13790
|
+
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
|
|
13764
13791
|
};
|
|
13765
13792
|
SpeechRecognitionComponent.prototype.onDiscard = function () {
|
|
13766
13793
|
this.canRenderAprove = false;
|
|
@@ -13771,7 +13798,8 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13771
13798
|
this._recognizedText = '';
|
|
13772
13799
|
this.setTextAreaValue(this.originalTextAreaElementText);
|
|
13773
13800
|
this.disabled = false;
|
|
13774
|
-
this.
|
|
13801
|
+
this.stopTextToSpeech();
|
|
13802
|
+
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
|
|
13775
13803
|
};
|
|
13776
13804
|
SpeechRecognitionComponent.prototype.onAprove = function () {
|
|
13777
13805
|
this.canRenderAprove = false;
|
|
@@ -13801,7 +13829,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13801
13829
|
this.textToSpeechService.pause();
|
|
13802
13830
|
}
|
|
13803
13831
|
else {
|
|
13804
|
-
if (this.
|
|
13832
|
+
if (this.isDoneTextToSpeech) {
|
|
13805
13833
|
this.speak();
|
|
13806
13834
|
}
|
|
13807
13835
|
else {
|
|
@@ -13811,7 +13839,6 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13811
13839
|
this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
|
|
13812
13840
|
};
|
|
13813
13841
|
SpeechRecognitionComponent.prototype.restartTextToSpeech = function () {
|
|
13814
|
-
this.isPlayingTextToSpeech = true;
|
|
13815
13842
|
this.textToSpeechService.cancel();
|
|
13816
13843
|
this.speak();
|
|
13817
13844
|
};
|
|
@@ -13842,7 +13869,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13842
13869
|
Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
|
|
13843
13870
|
get: function () {
|
|
13844
13871
|
var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
|
|
13845
|
-
return !this.
|
|
13872
|
+
return !this.textToSpeech || !hasTextToSpeechVoice || this.isListening || SpeechRecognitionComponent_1.TOOLBAR_ACTIVE;
|
|
13846
13873
|
},
|
|
13847
13874
|
enumerable: true,
|
|
13848
13875
|
configurable: true
|
|
@@ -13850,14 +13877,28 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13850
13877
|
SpeechRecognitionComponent.prototype.setTextAreaValue = function (value) {
|
|
13851
13878
|
this.textAreaElement.value = value;
|
|
13852
13879
|
};
|
|
13880
|
+
SpeechRecognitionComponent.prototype.stopTextToSpeech = function () {
|
|
13881
|
+
this.isPlayingTextToSpeech = false;
|
|
13882
|
+
this.textToSpeechService.cancel();
|
|
13883
|
+
};
|
|
13853
13884
|
SpeechRecognitionComponent.prototype.speak = function () {
|
|
13854
13885
|
var _this = this;
|
|
13855
|
-
this.
|
|
13856
|
-
this.
|
|
13886
|
+
this.isDoneTextToSpeech = false;
|
|
13887
|
+
this.isPlayingTextToSpeech = true;
|
|
13888
|
+
this.textToSpeechService.speak(this.textToSpeech, this.voiceSpeed).then(function () {
|
|
13857
13889
|
_this.isPlayingTextToSpeech = false;
|
|
13858
|
-
_this.
|
|
13890
|
+
_this.isDoneTextToSpeech = true;
|
|
13859
13891
|
});
|
|
13860
13892
|
};
|
|
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;
|
|
13861
13902
|
SpeechRecognitionComponent.ctorParameters = function () { return [
|
|
13862
13903
|
{ type: SpeechRecognitionService },
|
|
13863
13904
|
{ type: TextToSpeechService },
|
|
@@ -13875,11 +13916,11 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13875
13916
|
__decorate([
|
|
13876
13917
|
Output()
|
|
13877
13918
|
], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
|
|
13878
|
-
SpeechRecognitionComponent = __decorate([
|
|
13919
|
+
SpeechRecognitionComponent = SpeechRecognitionComponent_1 = __decorate([
|
|
13879
13920
|
Component({
|
|
13880
13921
|
selector: 's-speech-recognition',
|
|
13881
|
-
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=\"
|
|
13882
|
-
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-
|
|
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=\"isListeningUserVoice\">\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",
|
|
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;height:25px}.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-text{color:#212533;font-size:12px;font-style:normal;font-weight:400;word-break:break-word}"]
|
|
13883
13924
|
})
|
|
13884
13925
|
], SpeechRecognitionComponent);
|
|
13885
13926
|
return SpeechRecognitionComponent;
|