@seniorsistemas/angular-components 17.26.9-bugfix-sds-309-85a29221 → 17.26.9-bugfix-sds-305-deb2a383
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 +82 -122
- 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/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/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 +57 -82
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +84 -124
- 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, ɵɵinject, HostBinding, ChangeDetectorRef, ViewChildren, InjectionToken,
|
|
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, Pipe, ɵɵinject, 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';
|
|
@@ -1940,7 +1940,7 @@ var BignumberInputDirective = /** @class */ (function (_super) {
|
|
|
1940
1940
|
var BignumberInputDirective_1;
|
|
1941
1941
|
BignumberInputDirective.ctorParameters = function () { return [
|
|
1942
1942
|
{ type: Injector },
|
|
1943
|
-
{ type: LocaleService }
|
|
1943
|
+
{ type: LocaleService, decorators: [{ type: Inject, args: [LocaleService,] }] }
|
|
1944
1944
|
]; };
|
|
1945
1945
|
__decorate([
|
|
1946
1946
|
Input()
|
|
@@ -1986,7 +1986,8 @@ var BignumberInputDirective = /** @class */ (function (_super) {
|
|
|
1986
1986
|
multi: true,
|
|
1987
1987
|
},
|
|
1988
1988
|
],
|
|
1989
|
-
})
|
|
1989
|
+
}),
|
|
1990
|
+
__param(1, Inject(LocaleService))
|
|
1990
1991
|
], BignumberInputDirective);
|
|
1991
1992
|
return BignumberInputDirective;
|
|
1992
1993
|
}(CurrencyMaskDirective));
|
|
@@ -11359,8 +11360,9 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11359
11360
|
this.translateService = translateService;
|
|
11360
11361
|
this.hasSupportSpeechRecognition = false;
|
|
11361
11362
|
this.isListening = false;
|
|
11362
|
-
this.
|
|
11363
|
+
this.hasMicrophoneAccess = false;
|
|
11363
11364
|
this.TIMEOUT_NO_MESSAGE = 3000;
|
|
11365
|
+
this.verifyMicrophoneState();
|
|
11364
11366
|
this.setRecognition();
|
|
11365
11367
|
}
|
|
11366
11368
|
SpeechRecognitionService.prototype.listen = function () {
|
|
@@ -11369,73 +11371,82 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11369
11371
|
if (this.isListening) {
|
|
11370
11372
|
speechSubject.error('Already listening');
|
|
11371
11373
|
}
|
|
11372
|
-
this.hasMicrophoneAccess
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
var
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
clearTimeout(silenceTimer);
|
|
11374
|
+
else if (!this.hasMicrophoneAccess) {
|
|
11375
|
+
this.isListening = false;
|
|
11376
|
+
this.toastService.show({ severity: 'error', text: this.translateService.instant('platform.angular_components.no_microphone_permission') });
|
|
11377
|
+
speechSubject.error('Microphone access is disabled');
|
|
11378
|
+
}
|
|
11379
|
+
else {
|
|
11380
|
+
this.isListening = true;
|
|
11381
|
+
this.recognition.continuous = true;
|
|
11382
|
+
this.recognition.interimResults = true;
|
|
11383
|
+
this.recognition.maxAlternatives = 1;
|
|
11384
|
+
var silenceTimer_1;
|
|
11385
|
+
var restartSilenceTimer_1 = function () {
|
|
11386
|
+
if (silenceTimer_1 !== undefined) {
|
|
11387
|
+
clearTimeout(silenceTimer_1);
|
|
11387
11388
|
}
|
|
11388
|
-
|
|
11389
|
+
silenceTimer_1 = setTimeout(function () {
|
|
11389
11390
|
_this.recognition.stop();
|
|
11390
11391
|
}, _this.TIMEOUT_NO_MESSAGE);
|
|
11391
11392
|
};
|
|
11392
|
-
var
|
|
11393
|
-
var
|
|
11394
|
-
|
|
11393
|
+
var fullTranscript_1 = '';
|
|
11394
|
+
var interimTranscript_1 = '';
|
|
11395
|
+
this.recognition.onresult = function (event) {
|
|
11395
11396
|
_this.ngZone.run(function () {
|
|
11396
|
-
|
|
11397
|
+
restartSilenceTimer_1();
|
|
11397
11398
|
var interimTranscript = '';
|
|
11398
11399
|
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
11399
11400
|
var transcript = event.results[i][0].transcript;
|
|
11400
11401
|
if (event.results[i].isFinal) {
|
|
11401
|
-
|
|
11402
|
+
fullTranscript_1 += transcript + '\n';
|
|
11402
11403
|
}
|
|
11403
11404
|
else {
|
|
11404
11405
|
interimTranscript += transcript;
|
|
11405
11406
|
}
|
|
11406
11407
|
}
|
|
11407
11408
|
interimTranscript = interimTranscript;
|
|
11408
|
-
speechSubject.next({ text:
|
|
11409
|
+
speechSubject.next({ text: fullTranscript_1 + interimTranscript, isFinal: false });
|
|
11409
11410
|
});
|
|
11410
11411
|
};
|
|
11411
|
-
|
|
11412
|
+
this.recognition.onerror = function () {
|
|
11412
11413
|
_this.ngZone.run(function () {
|
|
11413
|
-
if (
|
|
11414
|
-
clearTimeout(
|
|
11414
|
+
if (silenceTimer_1 !== undefined) {
|
|
11415
|
+
clearTimeout(silenceTimer_1);
|
|
11415
11416
|
}
|
|
11416
11417
|
_this.isListening = false;
|
|
11417
11418
|
speechSubject.error('Speech recognition error');
|
|
11418
|
-
_this.microphoneStatus$.next('inactive');
|
|
11419
11419
|
});
|
|
11420
11420
|
};
|
|
11421
|
-
|
|
11421
|
+
this.recognition.onend = function () {
|
|
11422
11422
|
_this.ngZone.run(function () {
|
|
11423
|
-
if (
|
|
11424
|
-
clearTimeout(
|
|
11423
|
+
if (silenceTimer_1 !== undefined) {
|
|
11424
|
+
clearTimeout(silenceTimer_1);
|
|
11425
11425
|
}
|
|
11426
|
-
speechSubject.next({ text:
|
|
11426
|
+
speechSubject.next({ text: fullTranscript_1 + interimTranscript_1, isFinal: true });
|
|
11427
11427
|
_this.isListening = false;
|
|
11428
11428
|
speechSubject.complete();
|
|
11429
|
-
_this.microphoneStatus$.next('inactive');
|
|
11430
11429
|
});
|
|
11431
11430
|
};
|
|
11432
|
-
|
|
11433
|
-
}
|
|
11431
|
+
this.recognition.start();
|
|
11432
|
+
}
|
|
11434
11433
|
return speechSubject;
|
|
11435
11434
|
};
|
|
11436
11435
|
SpeechRecognitionService.prototype.stop = function () {
|
|
11437
11436
|
this.recognition.stop();
|
|
11438
11437
|
};
|
|
11438
|
+
SpeechRecognitionService.prototype.verifyMicrophoneState = function () {
|
|
11439
|
+
var _this = this;
|
|
11440
|
+
navigator.permissions.query({ name: 'microphone' }).then(function (result) {
|
|
11441
|
+
var microphoneResultState = result.state;
|
|
11442
|
+
_this.hasMicrophoneAccess = microphoneResultState === 'granted';
|
|
11443
|
+
result.onchange = function () {
|
|
11444
|
+
_this.ngZone.run(function () {
|
|
11445
|
+
_this.hasMicrophoneAccess = result.state === 'granted';
|
|
11446
|
+
});
|
|
11447
|
+
};
|
|
11448
|
+
});
|
|
11449
|
+
};
|
|
11439
11450
|
SpeechRecognitionService.prototype.setRecognition = function () {
|
|
11440
11451
|
var _this = this;
|
|
11441
11452
|
var _a;
|
|
@@ -11451,48 +11462,6 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11451
11462
|
this.recognition.maxAlternatives = 1;
|
|
11452
11463
|
this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
|
|
11453
11464
|
};
|
|
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
11465
|
SpeechRecognitionService.ctorParameters = function () { return [
|
|
11497
11466
|
{ type: LocaleService },
|
|
11498
11467
|
{ type: NgZone },
|
|
@@ -13510,6 +13479,21 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13510
13479
|
enumerable: true,
|
|
13511
13480
|
configurable: true
|
|
13512
13481
|
});
|
|
13482
|
+
Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
|
|
13483
|
+
get: function () {
|
|
13484
|
+
return this._placeholder;
|
|
13485
|
+
},
|
|
13486
|
+
set: function (value) {
|
|
13487
|
+
if (value) {
|
|
13488
|
+
this._placeholder = value;
|
|
13489
|
+
}
|
|
13490
|
+
else {
|
|
13491
|
+
this._placeholder = '';
|
|
13492
|
+
}
|
|
13493
|
+
},
|
|
13494
|
+
enumerable: true,
|
|
13495
|
+
configurable: true
|
|
13496
|
+
});
|
|
13513
13497
|
Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
|
|
13514
13498
|
get: function () {
|
|
13515
13499
|
return this._inputStyle;
|
|
@@ -13574,7 +13558,7 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13574
13558
|
], TextAreaComponent.prototype, "maxLength", void 0);
|
|
13575
13559
|
__decorate([
|
|
13576
13560
|
Input()
|
|
13577
|
-
], TextAreaComponent.prototype, "placeholder",
|
|
13561
|
+
], TextAreaComponent.prototype, "placeholder", null);
|
|
13578
13562
|
__decorate([
|
|
13579
13563
|
Input()
|
|
13580
13564
|
], TextAreaComponent.prototype, "inputStyle", null);
|
|
@@ -13584,7 +13568,7 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13584
13568
|
TextAreaComponent = TextAreaComponent_1 = __decorate([
|
|
13585
13569
|
Component({
|
|
13586
13570
|
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
|
|
13571
|
+
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
13572
|
providers: [
|
|
13589
13573
|
{
|
|
13590
13574
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -13694,7 +13678,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13694
13678
|
this.speechRecognitionPlaceholder = '';
|
|
13695
13679
|
this._recognizedText = '';
|
|
13696
13680
|
this.originalTextAreaElementText = '';
|
|
13697
|
-
this.
|
|
13681
|
+
this.isDoneSpeaking = false;
|
|
13698
13682
|
this.onDestroy$ = new Subject();
|
|
13699
13683
|
this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
|
|
13700
13684
|
this.keydownEventListener = function (event) {
|
|
@@ -13703,7 +13687,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13703
13687
|
}
|
|
13704
13688
|
};
|
|
13705
13689
|
this.disabled = false;
|
|
13706
|
-
this.
|
|
13690
|
+
this.isSpeaking = false;
|
|
13707
13691
|
this.voiceSpeed = 1;
|
|
13708
13692
|
this.isDisabledMicrophone = false;
|
|
13709
13693
|
this.canRenderMicrophone = true;
|
|
@@ -13715,9 +13699,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13715
13699
|
this.isPlayingTextToSpeech = false;
|
|
13716
13700
|
this.recognizedText = new EventEmitter();
|
|
13717
13701
|
}
|
|
13718
|
-
SpeechRecognitionComponent_1 = SpeechRecognitionComponent;
|
|
13719
13702
|
SpeechRecognitionComponent.prototype.ngOnInit = function () {
|
|
13720
|
-
var _this = this;
|
|
13721
13703
|
if (!this.hasSpeechRecognitionBrowserApi) {
|
|
13722
13704
|
return;
|
|
13723
13705
|
}
|
|
@@ -13726,26 +13708,18 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13726
13708
|
}
|
|
13727
13709
|
this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
|
|
13728
13710
|
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
13711
|
};
|
|
13735
13712
|
SpeechRecognitionComponent.prototype.onListen = function () {
|
|
13736
13713
|
var _this = this;
|
|
13737
13714
|
if (this.isDisabledMicrophone || this.isListening) {
|
|
13738
13715
|
return;
|
|
13739
13716
|
}
|
|
13740
|
-
// if (this.isPlayingTextToSpeech) {
|
|
13741
|
-
// this.onCloseToolbar();
|
|
13742
|
-
// }
|
|
13743
13717
|
this.disabled = true;
|
|
13744
13718
|
this.canRenderMicrophone = false;
|
|
13745
13719
|
this.canRenderListeningText = true;
|
|
13746
13720
|
this.originalTextAreaElementText = this.textAreaElement.value;
|
|
13747
13721
|
this.textAreaElement.value = '';
|
|
13748
|
-
this.
|
|
13722
|
+
this.isSpeaking = true;
|
|
13749
13723
|
this.speechRecognitionService.listen()
|
|
13750
13724
|
.pipe(takeUntil(this.onDestroy$))
|
|
13751
13725
|
.subscribe(function (_a) {
|
|
@@ -13757,10 +13731,10 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13757
13731
|
_this.canRenderAprove = true;
|
|
13758
13732
|
_this.canRenderDiscard = true;
|
|
13759
13733
|
_this.canRenderListeningText = false;
|
|
13760
|
-
_this.
|
|
13734
|
+
_this.isSpeaking = false;
|
|
13761
13735
|
}
|
|
13762
13736
|
}, function () {
|
|
13763
|
-
_this.
|
|
13737
|
+
_this.isSpeaking = false;
|
|
13764
13738
|
_this.canRenderMicrophone = true;
|
|
13765
13739
|
_this.isDisabledMicrophone = false;
|
|
13766
13740
|
_this.canRenderListeningText = false;
|
|
@@ -13779,15 +13753,15 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13779
13753
|
}
|
|
13780
13754
|
this.canRenderTextToSpeechToolbar = true;
|
|
13781
13755
|
this.canRenderTextToSpeech = false;
|
|
13782
|
-
|
|
13756
|
+
this.isPlayingTextToSpeech = true;
|
|
13783
13757
|
this.speak();
|
|
13784
13758
|
};
|
|
13785
13759
|
SpeechRecognitionComponent.prototype.onCloseToolbar = function () {
|
|
13786
13760
|
this.canRenderTextToSpeechToolbar = false;
|
|
13787
13761
|
this.canRenderTextToSpeech = true;
|
|
13788
|
-
this.
|
|
13762
|
+
this.isPlayingTextToSpeech = false;
|
|
13763
|
+
this.textToSpeechService.cancel();
|
|
13789
13764
|
this.voiceSpeed = 1;
|
|
13790
|
-
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
|
|
13791
13765
|
};
|
|
13792
13766
|
SpeechRecognitionComponent.prototype.onDiscard = function () {
|
|
13793
13767
|
this.canRenderAprove = false;
|
|
@@ -13798,8 +13772,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13798
13772
|
this._recognizedText = '';
|
|
13799
13773
|
this.setTextAreaValue(this.originalTextAreaElementText);
|
|
13800
13774
|
this.disabled = false;
|
|
13801
|
-
this.
|
|
13802
|
-
SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
|
|
13775
|
+
this.textToSpeechService.cancel();
|
|
13803
13776
|
};
|
|
13804
13777
|
SpeechRecognitionComponent.prototype.onAprove = function () {
|
|
13805
13778
|
this.canRenderAprove = false;
|
|
@@ -13829,7 +13802,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13829
13802
|
this.textToSpeechService.pause();
|
|
13830
13803
|
}
|
|
13831
13804
|
else {
|
|
13832
|
-
if (this.
|
|
13805
|
+
if (this.isDoneSpeaking) {
|
|
13833
13806
|
this.speak();
|
|
13834
13807
|
}
|
|
13835
13808
|
else {
|
|
@@ -13839,6 +13812,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13839
13812
|
this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
|
|
13840
13813
|
};
|
|
13841
13814
|
SpeechRecognitionComponent.prototype.restartTextToSpeech = function () {
|
|
13815
|
+
this.isPlayingTextToSpeech = true;
|
|
13842
13816
|
this.textToSpeechService.cancel();
|
|
13843
13817
|
this.speak();
|
|
13844
13818
|
};
|
|
@@ -13869,7 +13843,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13869
13843
|
Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
|
|
13870
13844
|
get: function () {
|
|
13871
13845
|
var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
|
|
13872
|
-
return !this.
|
|
13846
|
+
return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
|
|
13873
13847
|
},
|
|
13874
13848
|
enumerable: true,
|
|
13875
13849
|
configurable: true
|
|
@@ -13877,28 +13851,14 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13877
13851
|
SpeechRecognitionComponent.prototype.setTextAreaValue = function (value) {
|
|
13878
13852
|
this.textAreaElement.value = value;
|
|
13879
13853
|
};
|
|
13880
|
-
SpeechRecognitionComponent.prototype.stopTextToSpeech = function () {
|
|
13881
|
-
this.isPlayingTextToSpeech = false;
|
|
13882
|
-
this.textToSpeechService.cancel();
|
|
13883
|
-
};
|
|
13884
13854
|
SpeechRecognitionComponent.prototype.speak = function () {
|
|
13885
13855
|
var _this = this;
|
|
13886
|
-
this.
|
|
13887
|
-
this.
|
|
13888
|
-
this.textToSpeechService.speak(this.textToSpeech, this.voiceSpeed).then(function () {
|
|
13856
|
+
this.isDoneSpeaking = false;
|
|
13857
|
+
this.textToSpeechService.speak(this._recognizedText, this.voiceSpeed).then(function () {
|
|
13889
13858
|
_this.isPlayingTextToSpeech = false;
|
|
13890
|
-
_this.
|
|
13859
|
+
_this.isDoneSpeaking = true;
|
|
13891
13860
|
});
|
|
13892
13861
|
};
|
|
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
13862
|
SpeechRecognitionComponent.ctorParameters = function () { return [
|
|
13903
13863
|
{ type: SpeechRecognitionService },
|
|
13904
13864
|
{ type: TextToSpeechService },
|
|
@@ -13916,11 +13876,11 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13916
13876
|
__decorate([
|
|
13917
13877
|
Output()
|
|
13918
13878
|
], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
|
|
13919
|
-
SpeechRecognitionComponent =
|
|
13879
|
+
SpeechRecognitionComponent = __decorate([
|
|
13920
13880
|
Component({
|
|
13921
13881
|
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
|
|
13882
|
+
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",
|
|
13883
|
+
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
13884
|
})
|
|
13925
13885
|
], SpeechRecognitionComponent);
|
|
13926
13886
|
return SpeechRecognitionComponent;
|