@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
|
@@ -534,7 +534,7 @@
|
|
|
534
534
|
TooltipComponent = __decorate([
|
|
535
535
|
core.Component({
|
|
536
536
|
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>",
|
|
537
|
-
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
|
|
537
|
+
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)}"]
|
|
538
538
|
})
|
|
539
539
|
], TooltipComponent);
|
|
540
540
|
return TooltipComponent;
|
|
@@ -11504,9 +11504,8 @@
|
|
|
11504
11504
|
this.translateService = translateService;
|
|
11505
11505
|
this.hasSupportSpeechRecognition = false;
|
|
11506
11506
|
this.isListening = false;
|
|
11507
|
-
this.
|
|
11507
|
+
this.microphoneStatus$ = new rxjs.Subject();
|
|
11508
11508
|
this.TIMEOUT_NO_MESSAGE = 3000;
|
|
11509
|
-
this.verifyMicrophoneState();
|
|
11510
11509
|
this.setRecognition();
|
|
11511
11510
|
}
|
|
11512
11511
|
SpeechRecognitionService.prototype.listen = function () {
|
|
@@ -11515,82 +11514,73 @@
|
|
|
11515
11514
|
if (this.isListening) {
|
|
11516
11515
|
speechSubject.error('Already listening');
|
|
11517
11516
|
}
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
var
|
|
11530
|
-
|
|
11531
|
-
|
|
11517
|
+
this.hasMicrophoneAccess.then(function (hasAccess) {
|
|
11518
|
+
if (!hasAccess) {
|
|
11519
|
+
_this.toastService.show({ severity: 'error', text: _this.translateService.instant('platform.angular_components.no_microphone_permission') });
|
|
11520
|
+
speechSubject.error('Microphone access is disabled');
|
|
11521
|
+
return;
|
|
11522
|
+
}
|
|
11523
|
+
_this.microphoneStatus$.next('active');
|
|
11524
|
+
_this.isListening = true;
|
|
11525
|
+
_this.recognition.continuous = true;
|
|
11526
|
+
_this.recognition.interimResults = true;
|
|
11527
|
+
_this.recognition.maxAlternatives = 1;
|
|
11528
|
+
var silenceTimer;
|
|
11529
|
+
var restartSilenceTimer = function () {
|
|
11530
|
+
if (silenceTimer !== undefined) {
|
|
11531
|
+
clearTimeout(silenceTimer);
|
|
11532
11532
|
}
|
|
11533
|
-
|
|
11533
|
+
silenceTimer = setTimeout(function () {
|
|
11534
11534
|
_this.recognition.stop();
|
|
11535
11535
|
}, _this.TIMEOUT_NO_MESSAGE);
|
|
11536
11536
|
};
|
|
11537
|
-
var
|
|
11538
|
-
var
|
|
11539
|
-
|
|
11537
|
+
var fullTranscript = '';
|
|
11538
|
+
var interimTranscript = '';
|
|
11539
|
+
_this.recognition.onresult = function (event) {
|
|
11540
11540
|
_this.ngZone.run(function () {
|
|
11541
|
-
|
|
11541
|
+
restartSilenceTimer();
|
|
11542
11542
|
var interimTranscript = '';
|
|
11543
11543
|
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
11544
11544
|
var transcript = event.results[i][0].transcript;
|
|
11545
11545
|
if (event.results[i].isFinal) {
|
|
11546
|
-
|
|
11546
|
+
fullTranscript += transcript + '\n';
|
|
11547
11547
|
}
|
|
11548
11548
|
else {
|
|
11549
11549
|
interimTranscript += transcript;
|
|
11550
11550
|
}
|
|
11551
11551
|
}
|
|
11552
11552
|
interimTranscript = interimTranscript;
|
|
11553
|
-
speechSubject.next({ text:
|
|
11553
|
+
speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
|
|
11554
11554
|
});
|
|
11555
11555
|
};
|
|
11556
|
-
|
|
11556
|
+
_this.recognition.onerror = function () {
|
|
11557
11557
|
_this.ngZone.run(function () {
|
|
11558
|
-
if (
|
|
11559
|
-
clearTimeout(
|
|
11558
|
+
if (silenceTimer !== undefined) {
|
|
11559
|
+
clearTimeout(silenceTimer);
|
|
11560
11560
|
}
|
|
11561
11561
|
_this.isListening = false;
|
|
11562
11562
|
speechSubject.error('Speech recognition error');
|
|
11563
|
+
_this.microphoneStatus$.next('inactive');
|
|
11563
11564
|
});
|
|
11564
11565
|
};
|
|
11565
|
-
|
|
11566
|
+
_this.recognition.onend = function () {
|
|
11566
11567
|
_this.ngZone.run(function () {
|
|
11567
|
-
if (
|
|
11568
|
-
clearTimeout(
|
|
11568
|
+
if (silenceTimer !== undefined) {
|
|
11569
|
+
clearTimeout(silenceTimer);
|
|
11569
11570
|
}
|
|
11570
|
-
speechSubject.next({ text:
|
|
11571
|
+
speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
|
|
11571
11572
|
_this.isListening = false;
|
|
11572
11573
|
speechSubject.complete();
|
|
11574
|
+
_this.microphoneStatus$.next('inactive');
|
|
11573
11575
|
});
|
|
11574
11576
|
};
|
|
11575
|
-
|
|
11576
|
-
}
|
|
11577
|
+
_this.recognition.start();
|
|
11578
|
+
});
|
|
11577
11579
|
return speechSubject;
|
|
11578
11580
|
};
|
|
11579
11581
|
SpeechRecognitionService.prototype.stop = function () {
|
|
11580
11582
|
this.recognition.stop();
|
|
11581
11583
|
};
|
|
11582
|
-
SpeechRecognitionService.prototype.verifyMicrophoneState = function () {
|
|
11583
|
-
var _this = this;
|
|
11584
|
-
navigator.permissions.query({ name: 'microphone' }).then(function (result) {
|
|
11585
|
-
var microphoneResultState = result.state;
|
|
11586
|
-
_this.hasMicrophoneAccess = microphoneResultState === 'granted';
|
|
11587
|
-
result.onchange = function () {
|
|
11588
|
-
_this.ngZone.run(function () {
|
|
11589
|
-
_this.hasMicrophoneAccess = result.state === 'granted';
|
|
11590
|
-
});
|
|
11591
|
-
};
|
|
11592
|
-
});
|
|
11593
|
-
};
|
|
11594
11584
|
SpeechRecognitionService.prototype.setRecognition = function () {
|
|
11595
11585
|
var _this = this;
|
|
11596
11586
|
var _a;
|
|
@@ -11606,6 +11596,48 @@
|
|
|
11606
11596
|
this.recognition.maxAlternatives = 1;
|
|
11607
11597
|
this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
|
|
11608
11598
|
};
|
|
11599
|
+
Object.defineProperty(SpeechRecognitionService.prototype, "hasMicrophoneAccess", {
|
|
11600
|
+
get: function () {
|
|
11601
|
+
var _this = this;
|
|
11602
|
+
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
11603
|
+
var permission;
|
|
11604
|
+
var _this = this;
|
|
11605
|
+
return __generator(this, function (_a) {
|
|
11606
|
+
switch (_a.label) {
|
|
11607
|
+
case 0: return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
|
|
11608
|
+
case 1:
|
|
11609
|
+
permission = _a.sent();
|
|
11610
|
+
if (permission.state === 'denied') {
|
|
11611
|
+
resolve(false);
|
|
11612
|
+
}
|
|
11613
|
+
else if (permission.state === 'granted') {
|
|
11614
|
+
resolve(true);
|
|
11615
|
+
}
|
|
11616
|
+
else if (permission.state === 'prompt') {
|
|
11617
|
+
try {
|
|
11618
|
+
navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {
|
|
11619
|
+
stream.getTracks().forEach(function (t) { return t.stop(); });
|
|
11620
|
+
}).catch(function () {
|
|
11621
|
+
resolve(false);
|
|
11622
|
+
});
|
|
11623
|
+
permission.onchange = function () {
|
|
11624
|
+
_this.ngZone.run(function () {
|
|
11625
|
+
resolve(permission.state === 'granted' ? true : false);
|
|
11626
|
+
});
|
|
11627
|
+
};
|
|
11628
|
+
}
|
|
11629
|
+
catch (error) {
|
|
11630
|
+
resolve(false);
|
|
11631
|
+
}
|
|
11632
|
+
}
|
|
11633
|
+
return [2 /*return*/];
|
|
11634
|
+
}
|
|
11635
|
+
});
|
|
11636
|
+
}); });
|
|
11637
|
+
},
|
|
11638
|
+
enumerable: true,
|
|
11639
|
+
configurable: true
|
|
11640
|
+
});
|
|
11609
11641
|
SpeechRecognitionService.ctorParameters = function () { return [
|
|
11610
11642
|
{ type: LocaleService },
|
|
11611
11643
|
{ type: core.NgZone },
|
|
@@ -13623,21 +13655,6 @@
|
|
|
13623
13655
|
enumerable: true,
|
|
13624
13656
|
configurable: true
|
|
13625
13657
|
});
|
|
13626
|
-
Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
|
|
13627
|
-
get: function () {
|
|
13628
|
-
return this._placeholder;
|
|
13629
|
-
},
|
|
13630
|
-
set: function (value) {
|
|
13631
|
-
if (value) {
|
|
13632
|
-
this._placeholder = value;
|
|
13633
|
-
}
|
|
13634
|
-
else {
|
|
13635
|
-
this._placeholder = '';
|
|
13636
|
-
}
|
|
13637
|
-
},
|
|
13638
|
-
enumerable: true,
|
|
13639
|
-
configurable: true
|
|
13640
|
-
});
|
|
13641
13658
|
Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
|
|
13642
13659
|
get: function () {
|
|
13643
13660
|
return this._inputStyle;
|
|
@@ -13702,7 +13719,7 @@
|
|
|
13702
13719
|
], TextAreaComponent.prototype, "maxLength", void 0);
|
|
13703
13720
|
__decorate([
|
|
13704
13721
|
core.Input()
|
|
13705
|
-
], TextAreaComponent.prototype, "placeholder",
|
|
13722
|
+
], TextAreaComponent.prototype, "placeholder", void 0);
|
|
13706
13723
|
__decorate([
|
|
13707
13724
|
core.Input()
|
|
13708
13725
|
], TextAreaComponent.prototype, "inputStyle", null);
|
|
@@ -13712,7 +13729,7 @@
|
|
|
13712
13729
|
TextAreaComponent = TextAreaComponent_1 = __decorate([
|
|
13713
13730
|
core.Component({
|
|
13714
13731
|
selector: 's-textarea',
|
|
13715
|
-
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",
|
|
13732
|
+
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",
|
|
13716
13733
|
providers: [
|
|
13717
13734
|
{
|
|
13718
13735
|
provide: forms.NG_VALUE_ACCESSOR,
|
|
@@ -13822,7 +13839,7 @@
|
|
|
13822
13839
|
this.speechRecognitionPlaceholder = '';
|
|
13823
13840
|
this._recognizedText = '';
|
|
13824
13841
|
this.originalTextAreaElementText = '';
|
|
13825
|
-
this.
|
|
13842
|
+
this.isDoneTextToSpeech = false;
|
|
13826
13843
|
this.onDestroy$ = new rxjs.Subject();
|
|
13827
13844
|
this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
|
|
13828
13845
|
this.keydownEventListener = function (event) {
|
|
@@ -13831,7 +13848,7 @@
|
|
|
13831
13848
|
}
|
|
13832
13849
|
};
|
|
13833
13850
|
this.disabled = false;
|
|
13834
|
-
this.
|
|
13851
|
+
this.isListeningUserVoice = false;
|
|
13835
13852
|
this.voiceSpeed = 1;
|
|
13836
13853
|
this.isDisabledMicrophone = false;
|
|
13837
13854
|
this.canRenderMicrophone = true;
|
|
@@ -13843,7 +13860,9 @@
|
|
|
13843
13860
|
this.isPlayingTextToSpeech = false;
|
|
13844
13861
|
this.recognizedText = new core.EventEmitter();
|
|
13845
13862
|
}
|
|
13863
|
+
SpeechRecognitionComponent_1 = SpeechRecognitionComponent;
|
|
13846
13864
|
SpeechRecognitionComponent.prototype.ngOnInit = function () {
|
|
13865
|
+
var _this = this;
|
|
13847
13866
|
if (!this.hasSpeechRecognitionBrowserApi) {
|
|
13848
13867
|
return;
|
|
13849
13868
|
}
|
|
@@ -13852,18 +13871,26 @@
|
|
|
13852
13871
|
}
|
|
13853
13872
|
this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
|
|
13854
13873
|
this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
|
|
13874
|
+
this.speechRecognitionService.microphoneStatus$.pipe(operators.takeUntil(this.onDestroy$)).subscribe(function (status) {
|
|
13875
|
+
if (status === 'active') {
|
|
13876
|
+
_this.onCloseToolbar();
|
|
13877
|
+
}
|
|
13878
|
+
});
|
|
13855
13879
|
};
|
|
13856
13880
|
SpeechRecognitionComponent.prototype.onListen = function () {
|
|
13857
13881
|
var _this = this;
|
|
13858
13882
|
if (this.isDisabledMicrophone || this.isListening) {
|
|
13859
13883
|
return;
|
|
13860
13884
|
}
|
|
13885
|
+
// if (this.isPlayingTextToSpeech) {
|
|
13886
|
+
// this.onCloseToolbar();
|
|
13887
|
+
// }
|
|
13861
13888
|
this.disabled = true;
|
|
13862
13889
|
this.canRenderMicrophone = false;
|
|
13863
13890
|
this.canRenderListeningText = true;
|
|
13864
13891
|
this.originalTextAreaElementText = this.textAreaElement.value;
|
|
13865
13892
|
this.textAreaElement.value = '';
|
|
13866
|
-
this.
|
|
13893
|
+
this.isListeningUserVoice = true;
|
|
13867
13894
|
this.speechRecognitionService.listen()
|
|
13868
13895
|
.pipe(operators.takeUntil(this.onDestroy$))
|
|
13869
13896
|
.subscribe(function (_a) {
|
|
@@ -13875,10 +13902,10 @@
|
|
|
13875
13902
|
_this.canRenderAprove = true;
|
|
13876
13903
|
_this.canRenderDiscard = true;
|
|
13877
13904
|
_this.canRenderListeningText = false;
|
|
13878
|
-
_this.
|
|
13905
|
+
_this.isListeningUserVoice = false;
|
|
13879
13906
|
}
|
|
13880
13907
|
}, function () {
|
|
13881
|
-
_this.
|
|
13908
|
+
_this.isListeningUserVoice = false;
|
|
13882
13909
|
_this.canRenderMicrophone = true;
|
|
13883
13910
|
_this.isDisabledMicrophone = false;
|
|
13884
13911
|
_this.canRenderListeningText = false;
|
|
@@ -13897,15 +13924,15 @@
|
|
|
13897
13924
|
}
|
|
13898
13925
|
this.canRenderTextToSpeechToolbar = true;
|
|
13899
13926
|
this.canRenderTextToSpeech = false;
|
|
13900
|
-
|
|
13927
|
+
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = true;
|
|
13901
13928
|
this.speak();
|
|
13902
13929
|
};
|
|
13903
13930
|
SpeechRecognitionComponent.prototype.onCloseToolbar = function () {
|
|
13904
13931
|
this.canRenderTextToSpeechToolbar = false;
|
|
13905
13932
|
this.canRenderTextToSpeech = true;
|
|
13906
|
-
this.
|
|
13907
|
-
this.textToSpeechService.cancel();
|
|
13933
|
+
this.stopTextToSpeech();
|
|
13908
13934
|
this.voiceSpeed = 1;
|
|
13935
|
+
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
|
|
13909
13936
|
};
|
|
13910
13937
|
SpeechRecognitionComponent.prototype.onDiscard = function () {
|
|
13911
13938
|
this.canRenderAprove = false;
|
|
@@ -13916,7 +13943,8 @@
|
|
|
13916
13943
|
this._recognizedText = '';
|
|
13917
13944
|
this.setTextAreaValue(this.originalTextAreaElementText);
|
|
13918
13945
|
this.disabled = false;
|
|
13919
|
-
this.
|
|
13946
|
+
this.stopTextToSpeech();
|
|
13947
|
+
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
|
|
13920
13948
|
};
|
|
13921
13949
|
SpeechRecognitionComponent.prototype.onAprove = function () {
|
|
13922
13950
|
this.canRenderAprove = false;
|
|
@@ -13946,7 +13974,7 @@
|
|
|
13946
13974
|
this.textToSpeechService.pause();
|
|
13947
13975
|
}
|
|
13948
13976
|
else {
|
|
13949
|
-
if (this.
|
|
13977
|
+
if (this.isDoneTextToSpeech) {
|
|
13950
13978
|
this.speak();
|
|
13951
13979
|
}
|
|
13952
13980
|
else {
|
|
@@ -13956,7 +13984,6 @@
|
|
|
13956
13984
|
this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
|
|
13957
13985
|
};
|
|
13958
13986
|
SpeechRecognitionComponent.prototype.restartTextToSpeech = function () {
|
|
13959
|
-
this.isPlayingTextToSpeech = true;
|
|
13960
13987
|
this.textToSpeechService.cancel();
|
|
13961
13988
|
this.speak();
|
|
13962
13989
|
};
|
|
@@ -13987,7 +14014,7 @@
|
|
|
13987
14014
|
Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
|
|
13988
14015
|
get: function () {
|
|
13989
14016
|
var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
|
|
13990
|
-
return !this.
|
|
14017
|
+
return !this.textToSpeech || !hasTextToSpeechVoice || this.isListening || SpeechRecognitionComponent_1.TOOLBAR_ACTIVE;
|
|
13991
14018
|
},
|
|
13992
14019
|
enumerable: true,
|
|
13993
14020
|
configurable: true
|
|
@@ -13995,14 +14022,28 @@
|
|
|
13995
14022
|
SpeechRecognitionComponent.prototype.setTextAreaValue = function (value) {
|
|
13996
14023
|
this.textAreaElement.value = value;
|
|
13997
14024
|
};
|
|
14025
|
+
SpeechRecognitionComponent.prototype.stopTextToSpeech = function () {
|
|
14026
|
+
this.isPlayingTextToSpeech = false;
|
|
14027
|
+
this.textToSpeechService.cancel();
|
|
14028
|
+
};
|
|
13998
14029
|
SpeechRecognitionComponent.prototype.speak = function () {
|
|
13999
14030
|
var _this = this;
|
|
14000
|
-
this.
|
|
14001
|
-
this.
|
|
14031
|
+
this.isDoneTextToSpeech = false;
|
|
14032
|
+
this.isPlayingTextToSpeech = true;
|
|
14033
|
+
this.textToSpeechService.speak(this.textToSpeech, this.voiceSpeed).then(function () {
|
|
14002
14034
|
_this.isPlayingTextToSpeech = false;
|
|
14003
|
-
_this.
|
|
14035
|
+
_this.isDoneTextToSpeech = true;
|
|
14004
14036
|
});
|
|
14005
14037
|
};
|
|
14038
|
+
Object.defineProperty(SpeechRecognitionComponent.prototype, "textToSpeech", {
|
|
14039
|
+
get: function () {
|
|
14040
|
+
return this.textAreaElement.value;
|
|
14041
|
+
},
|
|
14042
|
+
enumerable: true,
|
|
14043
|
+
configurable: true
|
|
14044
|
+
});
|
|
14045
|
+
var SpeechRecognitionComponent_1;
|
|
14046
|
+
SpeechRecognitionComponent.TOOLBAR_ACTIVE = false;
|
|
14006
14047
|
SpeechRecognitionComponent.ctorParameters = function () { return [
|
|
14007
14048
|
{ type: SpeechRecognitionService },
|
|
14008
14049
|
{ type: TextToSpeechService },
|
|
@@ -14020,11 +14061,11 @@
|
|
|
14020
14061
|
__decorate([
|
|
14021
14062
|
core.Output()
|
|
14022
14063
|
], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
|
|
14023
|
-
SpeechRecognitionComponent = __decorate([
|
|
14064
|
+
SpeechRecognitionComponent = SpeechRecognitionComponent_1 = __decorate([
|
|
14024
14065
|
core.Component({
|
|
14025
14066
|
selector: 's-speech-recognition',
|
|
14026
|
-
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=\"
|
|
14027
|
-
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-
|
|
14067
|
+
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",
|
|
14068
|
+
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}"]
|
|
14028
14069
|
})
|
|
14029
14070
|
], SpeechRecognitionComponent);
|
|
14030
14071
|
return SpeechRecognitionComponent;
|