@seniorsistemas/angular-components 17.26.9-bugfix-sds-309-1338ba18 → 17.26.9-bugfix-sds-309-f709bce3

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.
Files changed (21) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +47 -34
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/speech-recognition/speech-recognition/speech-recognition.component.d.ts +5 -2
  6. package/components/speech-recognition/speech-recognition.service.d.ts +2 -0
  7. package/components/text-area/text-area/text-area.component.d.ts +1 -3
  8. package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +37 -19
  9. package/esm2015/components/speech-recognition/speech-recognition.service.js +5 -1
  10. package/esm2015/components/speech-recognition/text-to-speech.service.js +1 -1
  11. package/esm2015/components/text-area/text-area/text-area.component.js +3 -14
  12. package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +42 -18
  13. package/esm5/components/speech-recognition/speech-recognition.service.js +5 -1
  14. package/esm5/components/speech-recognition/text-to-speech.service.js +1 -1
  15. package/esm5/components/text-area/text-area/text-area.component.js +3 -18
  16. package/fesm2015/seniorsistemas-angular-components.js +42 -31
  17. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  18. package/fesm5/seniorsistemas-angular-components.js +47 -34
  19. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  20. package/package.json +1 -1
  21. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -11504,6 +11504,7 @@
11504
11504
  this.translateService = translateService;
11505
11505
  this.hasSupportSpeechRecognition = false;
11506
11506
  this.isListening = false;
11507
+ this.microphoneStatus$ = new rxjs.Subject();
11507
11508
  this.TIMEOUT_NO_MESSAGE = 3000;
11508
11509
  this.setRecognition();
11509
11510
  }
@@ -11519,6 +11520,7 @@
11519
11520
  speechSubject.error('Microphone access is disabled');
11520
11521
  return;
11521
11522
  }
11523
+ _this.microphoneStatus$.next('active');
11522
11524
  _this.isListening = true;
11523
11525
  _this.recognition.continuous = true;
11524
11526
  _this.recognition.interimResults = true;
@@ -11558,6 +11560,7 @@
11558
11560
  }
11559
11561
  _this.isListening = false;
11560
11562
  speechSubject.error('Speech recognition error');
11563
+ _this.microphoneStatus$.next('inactive');
11561
11564
  });
11562
11565
  };
11563
11566
  _this.recognition.onend = function () {
@@ -11568,6 +11571,7 @@
11568
11571
  speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
11569
11572
  _this.isListening = false;
11570
11573
  speechSubject.complete();
11574
+ _this.microphoneStatus$.next('inactive');
11571
11575
  });
11572
11576
  };
11573
11577
  _this.recognition.start();
@@ -13651,21 +13655,6 @@
13651
13655
  enumerable: true,
13652
13656
  configurable: true
13653
13657
  });
13654
- Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
13655
- get: function () {
13656
- return this._placeholder;
13657
- },
13658
- set: function (value) {
13659
- if (value) {
13660
- this._placeholder = value;
13661
- }
13662
- else {
13663
- this._placeholder = '';
13664
- }
13665
- },
13666
- enumerable: true,
13667
- configurable: true
13668
- });
13669
13658
  Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
13670
13659
  get: function () {
13671
13660
  return this._inputStyle;
@@ -13730,7 +13719,7 @@
13730
13719
  ], TextAreaComponent.prototype, "maxLength", void 0);
13731
13720
  __decorate([
13732
13721
  core.Input()
13733
- ], TextAreaComponent.prototype, "placeholder", null);
13722
+ ], TextAreaComponent.prototype, "placeholder", void 0);
13734
13723
  __decorate([
13735
13724
  core.Input()
13736
13725
  ], TextAreaComponent.prototype, "inputStyle", null);
@@ -13740,7 +13729,7 @@
13740
13729
  TextAreaComponent = TextAreaComponent_1 = __decorate([
13741
13730
  core.Component({
13742
13731
  selector: 's-textarea',
13743
- 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",
13744
13733
  providers: [
13745
13734
  {
13746
13735
  provide: forms.NG_VALUE_ACCESSOR,
@@ -13850,7 +13839,7 @@
13850
13839
  this.speechRecognitionPlaceholder = '';
13851
13840
  this._recognizedText = '';
13852
13841
  this.originalTextAreaElementText = '';
13853
- this.isDoneSpeaking = false;
13842
+ this.isDoneTextToSpeech = false;
13854
13843
  this.onDestroy$ = new rxjs.Subject();
13855
13844
  this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
13856
13845
  this.keydownEventListener = function (event) {
@@ -13859,7 +13848,7 @@
13859
13848
  }
13860
13849
  };
13861
13850
  this.disabled = false;
13862
- this.isSpeaking = false;
13851
+ this.isListeningUserVoice = false;
13863
13852
  this.voiceSpeed = 1;
13864
13853
  this.isDisabledMicrophone = false;
13865
13854
  this.canRenderMicrophone = true;
@@ -13871,7 +13860,9 @@
13871
13860
  this.isPlayingTextToSpeech = false;
13872
13861
  this.recognizedText = new core.EventEmitter();
13873
13862
  }
13863
+ SpeechRecognitionComponent_1 = SpeechRecognitionComponent;
13874
13864
  SpeechRecognitionComponent.prototype.ngOnInit = function () {
13865
+ var _this = this;
13875
13866
  if (!this.hasSpeechRecognitionBrowserApi) {
13876
13867
  return;
13877
13868
  }
@@ -13880,18 +13871,26 @@
13880
13871
  }
13881
13872
  this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
13882
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
+ });
13883
13879
  };
13884
13880
  SpeechRecognitionComponent.prototype.onListen = function () {
13885
13881
  var _this = this;
13886
13882
  if (this.isDisabledMicrophone || this.isListening) {
13887
13883
  return;
13888
13884
  }
13885
+ // if (this.isPlayingTextToSpeech) {
13886
+ // this.onCloseToolbar();
13887
+ // }
13889
13888
  this.disabled = true;
13890
13889
  this.canRenderMicrophone = false;
13891
13890
  this.canRenderListeningText = true;
13892
13891
  this.originalTextAreaElementText = this.textAreaElement.value;
13893
13892
  this.textAreaElement.value = '';
13894
- this.isSpeaking = true;
13893
+ this.isListeningUserVoice = true;
13895
13894
  this.speechRecognitionService.listen()
13896
13895
  .pipe(operators.takeUntil(this.onDestroy$))
13897
13896
  .subscribe(function (_a) {
@@ -13903,10 +13902,10 @@
13903
13902
  _this.canRenderAprove = true;
13904
13903
  _this.canRenderDiscard = true;
13905
13904
  _this.canRenderListeningText = false;
13906
- _this.isSpeaking = false;
13905
+ _this.isListeningUserVoice = false;
13907
13906
  }
13908
13907
  }, function () {
13909
- _this.isSpeaking = false;
13908
+ _this.isListeningUserVoice = false;
13910
13909
  _this.canRenderMicrophone = true;
13911
13910
  _this.isDisabledMicrophone = false;
13912
13911
  _this.canRenderListeningText = false;
@@ -13925,15 +13924,15 @@
13925
13924
  }
13926
13925
  this.canRenderTextToSpeechToolbar = true;
13927
13926
  this.canRenderTextToSpeech = false;
13928
- this.isPlayingTextToSpeech = true;
13927
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = true;
13929
13928
  this.speak();
13930
13929
  };
13931
13930
  SpeechRecognitionComponent.prototype.onCloseToolbar = function () {
13932
13931
  this.canRenderTextToSpeechToolbar = false;
13933
13932
  this.canRenderTextToSpeech = true;
13934
- this.isPlayingTextToSpeech = false;
13935
- this.textToSpeechService.cancel();
13933
+ this.stopTextToSpeech();
13936
13934
  this.voiceSpeed = 1;
13935
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
13937
13936
  };
13938
13937
  SpeechRecognitionComponent.prototype.onDiscard = function () {
13939
13938
  this.canRenderAprove = false;
@@ -13944,7 +13943,8 @@
13944
13943
  this._recognizedText = '';
13945
13944
  this.setTextAreaValue(this.originalTextAreaElementText);
13946
13945
  this.disabled = false;
13947
- this.textToSpeechService.cancel();
13946
+ this.stopTextToSpeech();
13947
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
13948
13948
  };
13949
13949
  SpeechRecognitionComponent.prototype.onAprove = function () {
13950
13950
  this.canRenderAprove = false;
@@ -13974,7 +13974,7 @@
13974
13974
  this.textToSpeechService.pause();
13975
13975
  }
13976
13976
  else {
13977
- if (this.isDoneSpeaking) {
13977
+ if (this.isDoneTextToSpeech) {
13978
13978
  this.speak();
13979
13979
  }
13980
13980
  else {
@@ -13984,7 +13984,6 @@
13984
13984
  this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
13985
13985
  };
13986
13986
  SpeechRecognitionComponent.prototype.restartTextToSpeech = function () {
13987
- this.isPlayingTextToSpeech = true;
13988
13987
  this.textToSpeechService.cancel();
13989
13988
  this.speak();
13990
13989
  };
@@ -14015,7 +14014,7 @@
14015
14014
  Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
14016
14015
  get: function () {
14017
14016
  var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
14018
- return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
14017
+ return !this.textToSpeech || !hasTextToSpeechVoice || this.isListening || SpeechRecognitionComponent_1.TOOLBAR_ACTIVE;
14019
14018
  },
14020
14019
  enumerable: true,
14021
14020
  configurable: true
@@ -14023,14 +14022,28 @@
14023
14022
  SpeechRecognitionComponent.prototype.setTextAreaValue = function (value) {
14024
14023
  this.textAreaElement.value = value;
14025
14024
  };
14025
+ SpeechRecognitionComponent.prototype.stopTextToSpeech = function () {
14026
+ this.isPlayingTextToSpeech = false;
14027
+ this.textToSpeechService.cancel();
14028
+ };
14026
14029
  SpeechRecognitionComponent.prototype.speak = function () {
14027
14030
  var _this = this;
14028
- this.isDoneSpeaking = false;
14029
- this.textToSpeechService.speak(this._recognizedText, this.voiceSpeed).then(function () {
14031
+ this.isDoneTextToSpeech = false;
14032
+ this.isPlayingTextToSpeech = true;
14033
+ this.textToSpeechService.speak(this.textToSpeech, this.voiceSpeed).then(function () {
14030
14034
  _this.isPlayingTextToSpeech = false;
14031
- _this.isDoneSpeaking = true;
14035
+ _this.isDoneTextToSpeech = true;
14032
14036
  });
14033
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;
14034
14047
  SpeechRecognitionComponent.ctorParameters = function () { return [
14035
14048
  { type: SpeechRecognitionService },
14036
14049
  { type: TextToSpeechService },
@@ -14048,10 +14061,10 @@
14048
14061
  __decorate([
14049
14062
  core.Output()
14050
14063
  ], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
14051
- SpeechRecognitionComponent = __decorate([
14064
+ SpeechRecognitionComponent = SpeechRecognitionComponent_1 = __decorate([
14052
14065
  core.Component({
14053
14066
  selector: 's-speech-recognition',
14054
- 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",
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",
14055
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}.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}"]
14056
14069
  })
14057
14070
  ], SpeechRecognitionComponent);