@seniorsistemas/angular-components 17.25.11 → 17.26.0

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 (46) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +582 -62
  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/dynamic-form/configurations/fields/text-area-field.d.ts +2 -0
  6. package/components/index.d.ts +1 -0
  7. package/components/speech-recognition/speech-recognition/speech-recognition.component.d.ts +50 -0
  8. package/components/speech-recognition/speech-recognition.module.d.ts +2 -0
  9. package/components/speech-recognition/speech-recognition.service.d.ts +18 -0
  10. package/components/speech-recognition/text-to-speech.service.d.ts +22 -0
  11. package/components/text-area/index.d.ts +2 -0
  12. package/components/text-area/text-area/text-area.component.d.ts +24 -0
  13. package/components/text-area/text-area.module.d.ts +2 -0
  14. package/esm2015/components/dynamic-form/components/fields/text-area/text-area-field.component.js +2 -2
  15. package/esm2015/components/dynamic-form/configurations/fields/text-area-field.js +3 -1
  16. package/esm2015/components/dynamic-form/dynamic-form.module.js +3 -1
  17. package/esm2015/components/index.js +2 -1
  18. package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +202 -0
  19. package/esm2015/components/speech-recognition/speech-recognition.module.js +19 -0
  20. package/esm2015/components/speech-recognition/speech-recognition.service.js +102 -0
  21. package/esm2015/components/speech-recognition/text-to-speech.service.js +75 -0
  22. package/esm2015/components/text-area/index.js +3 -0
  23. package/esm2015/components/text-area/text-area/text-area.component.js +87 -0
  24. package/esm2015/components/text-area/text-area.module.js +24 -0
  25. package/esm2015/locale/fallback.js +6 -2
  26. package/esm2015/seniorsistemas-angular-components.js +65 -61
  27. package/esm5/components/dynamic-form/components/fields/text-area/text-area-field.component.js +2 -2
  28. package/esm5/components/dynamic-form/configurations/fields/text-area-field.js +3 -1
  29. package/esm5/components/dynamic-form/dynamic-form.module.js +3 -1
  30. package/esm5/components/index.js +2 -1
  31. package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +216 -0
  32. package/esm5/components/speech-recognition/speech-recognition.module.js +22 -0
  33. package/esm5/components/speech-recognition/speech-recognition.service.js +104 -0
  34. package/esm5/components/speech-recognition/text-to-speech.service.js +83 -0
  35. package/esm5/components/text-area/index.js +3 -0
  36. package/esm5/components/text-area/text-area/text-area.component.js +94 -0
  37. package/esm5/components/text-area/text-area.module.js +27 -0
  38. package/esm5/locale/fallback.js +6 -2
  39. package/esm5/seniorsistemas-angular-components.js +65 -61
  40. package/fesm2015/seniorsistemas-angular-components.js +481 -4
  41. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  42. package/fesm5/seniorsistemas-angular-components.js +518 -4
  43. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  44. package/package.json +1 -1
  45. package/seniorsistemas-angular-components.d.ts +64 -60
  46. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -7169,12 +7169,14 @@
7169
7169
  var TextAreaField = /** @class */ (function (_super) {
7170
7170
  __extends(TextAreaField, _super);
7171
7171
  function TextAreaField(config) {
7172
+ var _a;
7172
7173
  var _this = _super.call(this, config) || this;
7173
7174
  _this.cols = config.cols;
7174
7175
  _this.rows = config.rows;
7175
7176
  _this.keyFilter = config.keyFilter;
7176
7177
  _this.style = config.style;
7177
7178
  _this.readonly = config.readonly;
7179
+ _this.speechRecognition = (_a = config.speechRecognition) !== null && _a !== void 0 ? _a : false;
7178
7180
  return _this;
7179
7181
  }
7180
7182
  return TextAreaField;
@@ -11519,7 +11521,7 @@
11519
11521
  ], TextAreaFieldComponent.prototype, "inputRef", void 0);
11520
11522
  TextAreaFieldComponent = __decorate([
11521
11523
  core.Component({
11522
- template: "<s-field-label *ngIf=\"inputRef\" [field]=\"field\"\n [fieldContainerRef]=\"inputRef?.nativeElement\"></s-field-label>\n\n<textarea #inputRef\n [id]=\"(field.id || field.name)\"\n *ngIf=\"!field.keyFilter\"\n pInputTextarea\n [rows]=\"field.rows\"\n [cols]=\"field.cols\"\n [formControl]=\"formControl\"\n style=\"resize: vertical;\"\n [ngStyle]=\"field.style\"\n [readonly]=\"field.readonly ? field.readonly() : false\"\n></textarea>\n<textarea #inputRef\n [id]=\"(field.id || field.name)\"\n *ngIf=\"field.keyFilter\"\n pInputTextarea\n [rows]=\"field.rows\"\n [cols]=\"field.cols\"\n [formControl]=\"formControl\"\n style=\"resize: vertical;\"\n [pKeyFilter]=\"field.keyFilter\"\n [ngStyle]=\"field.style\"\n [readonly]=\"field.readonly ? field.readonly() : false\"\n></textarea>\n"
11524
+ template: "<s-field-label *ngIf=\"textArea\" [field]=\"field\"\n [fieldContainerRef]=\"textArea.textAreaElement?.nativeElement\"></s-field-label>\n\n<s-textarea\n #textArea\n [inputId]=\"(field.id || field.name)\"\n [rows]=\"field.rows\"\n [formControl]=\"formControl\"\n style=\"resize: vertical;\"\n [inputStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n [keyFilter]=\"field.keyFilter\"\n [speechRecognition]=\"field.speechRecognition\">\n</s-textarea>\n"
11523
11525
  })
11524
11526
  ], TextAreaFieldComponent);
11525
11527
  return TextAreaFieldComponent;
@@ -13383,6 +13385,513 @@
13383
13385
  return TextFieldModule;
13384
13386
  }());
13385
13387
 
13388
+ var TextAreaComponent = /** @class */ (function () {
13389
+ function TextAreaComponent() {
13390
+ this.onChange = function () { };
13391
+ this.onTouched = function () { };
13392
+ this.disabled = false;
13393
+ this.value = '';
13394
+ this.inputId = "textarea-" + Math.random();
13395
+ this.rows = 5;
13396
+ this.speechRecognition = false;
13397
+ this.readOnly = false;
13398
+ this.renderTextArea = false;
13399
+ }
13400
+ TextAreaComponent_1 = TextAreaComponent;
13401
+ Object.defineProperty(TextAreaComponent.prototype, "textAreaElement", {
13402
+ get: function () {
13403
+ return this._textAreaElement;
13404
+ },
13405
+ set: function (value) {
13406
+ var _this = this;
13407
+ this._textAreaElement = value;
13408
+ setTimeout(function () {
13409
+ _this.renderTextArea = true;
13410
+ });
13411
+ },
13412
+ enumerable: true,
13413
+ configurable: true
13414
+ });
13415
+ TextAreaComponent.prototype.writeValue = function (obj) {
13416
+ this.value = obj;
13417
+ };
13418
+ TextAreaComponent.prototype.registerOnChange = function (fn) {
13419
+ this.onChange = fn;
13420
+ };
13421
+ TextAreaComponent.prototype.registerOnTouched = function (fn) {
13422
+ this.onTouched = fn;
13423
+ };
13424
+ TextAreaComponent.prototype.setDisabledState = function (isDisabled) {
13425
+ this.disabled = isDisabled;
13426
+ };
13427
+ TextAreaComponent.prototype.setValue = function (value) {
13428
+ if (this.disabled) {
13429
+ return;
13430
+ }
13431
+ this.value = value;
13432
+ this.writeValue(this.value);
13433
+ this.onChange(this.value);
13434
+ this.onTouched(this.value);
13435
+ };
13436
+ TextAreaComponent.prototype.handleRecognizedText = function (recognizedText) {
13437
+ this.setValue(recognizedText);
13438
+ };
13439
+ var TextAreaComponent_1;
13440
+ __decorate([
13441
+ core.ViewChild('textArea', { read: core.ElementRef })
13442
+ ], TextAreaComponent.prototype, "textAreaElement", null);
13443
+ __decorate([
13444
+ core.Input()
13445
+ ], TextAreaComponent.prototype, "inputId", void 0);
13446
+ __decorate([
13447
+ core.Input()
13448
+ ], TextAreaComponent.prototype, "rows", void 0);
13449
+ __decorate([
13450
+ core.Input()
13451
+ ], TextAreaComponent.prototype, "speechRecognition", void 0);
13452
+ __decorate([
13453
+ core.Input()
13454
+ ], TextAreaComponent.prototype, "keyFilter", void 0);
13455
+ __decorate([
13456
+ core.Input()
13457
+ ], TextAreaComponent.prototype, "inputStyle", void 0);
13458
+ __decorate([
13459
+ core.Input()
13460
+ ], TextAreaComponent.prototype, "readOnly", void 0);
13461
+ TextAreaComponent = TextAreaComponent_1 = __decorate([
13462
+ core.Component({
13463
+ selector: 's-textarea',
13464
+ 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 (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 (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<s-speech-recognition\n *ngIf=\"speechRecognition && renderTextArea\"\n [textAreaElement]=\"textAreaElement.nativeElement\"\n (recognizedText)=\"handleRecognizedText($event)\">\n</s-speech-recognition>\n",
13465
+ providers: [
13466
+ {
13467
+ provide: forms.NG_VALUE_ACCESSOR,
13468
+ useExisting: core.forwardRef(function () { return TextAreaComponent_1; }),
13469
+ multi: true,
13470
+ },
13471
+ ],
13472
+ styles: [".textarea{border-radius:3px;border:1px solid #c1c1cc;background:#fff;width:100%;max-width:100%;min-height:4em;min-width:10em;outline:0;padding:8px;display:block}.textarea:disabled{opacity:.5}"]
13473
+ })
13474
+ ], TextAreaComponent);
13475
+ return TextAreaComponent;
13476
+ }());
13477
+
13478
+ var SpeechRecognitionService = /** @class */ (function () {
13479
+ function SpeechRecognitionService(localeService, ngZone) {
13480
+ this.localeService = localeService;
13481
+ this.ngZone = ngZone;
13482
+ this.isListening = false;
13483
+ this.TIMEOUT_NO_MESSAGE = 3000;
13484
+ this.setRecognition();
13485
+ }
13486
+ SpeechRecognitionService.prototype.listen = function () {
13487
+ var _this = this;
13488
+ if (this.isListening) {
13489
+ return;
13490
+ }
13491
+ var speechSubject = new rxjs.Subject();
13492
+ this.isListening = true;
13493
+ this.recognition.continuous = true;
13494
+ this.recognition.interimResults = true;
13495
+ this.recognition.maxAlternatives = 1;
13496
+ var silenceTimer;
13497
+ var restartSilenceTimer = function () {
13498
+ if (silenceTimer !== undefined) {
13499
+ clearTimeout(silenceTimer);
13500
+ }
13501
+ silenceTimer = setTimeout(function () {
13502
+ _this.recognition.stop();
13503
+ }, _this.TIMEOUT_NO_MESSAGE);
13504
+ };
13505
+ var fullTranscript = '';
13506
+ var interimTranscript = '';
13507
+ this.recognition.onresult = function (event) {
13508
+ _this.ngZone.run(function () {
13509
+ restartSilenceTimer();
13510
+ var interimTranscript = '';
13511
+ for (var i = event.resultIndex; i < event.results.length; ++i) {
13512
+ var transcript = event.results[i][0].transcript;
13513
+ if (event.results[i].isFinal) {
13514
+ fullTranscript += transcript + '\n';
13515
+ }
13516
+ else {
13517
+ interimTranscript += transcript;
13518
+ }
13519
+ }
13520
+ interimTranscript = interimTranscript;
13521
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
13522
+ });
13523
+ };
13524
+ this.recognition.onerror = function () {
13525
+ _this.ngZone.run(function () {
13526
+ if (silenceTimer !== undefined) {
13527
+ clearTimeout(silenceTimer);
13528
+ }
13529
+ _this.isListening = false;
13530
+ speechSubject.next({
13531
+ isFinal: true,
13532
+ text: ''
13533
+ });
13534
+ });
13535
+ };
13536
+ this.recognition.onend = function () {
13537
+ _this.ngZone.run(function () {
13538
+ if (silenceTimer !== undefined) {
13539
+ clearTimeout(silenceTimer);
13540
+ }
13541
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
13542
+ _this.isListening = false;
13543
+ speechSubject.complete();
13544
+ });
13545
+ };
13546
+ this.recognition.start();
13547
+ return speechSubject;
13548
+ };
13549
+ SpeechRecognitionService.prototype.stop = function () {
13550
+ this.recognition.stop();
13551
+ };
13552
+ SpeechRecognitionService.prototype.setRecognition = function () {
13553
+ var SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
13554
+ if (!SpeechRecognitionConstructor) {
13555
+ throw new Error('Speech recognition is not supported in this browser.');
13556
+ }
13557
+ this.recognition = new SpeechRecognitionConstructor();
13558
+ this.recognition.lang = this.localeService.getLocaleOptions().locale || 'pt-BR';
13559
+ this.recognition.interimResults = false;
13560
+ this.recognition.maxAlternatives = 1;
13561
+ };
13562
+ SpeechRecognitionService.ctorParameters = function () { return [
13563
+ { type: LocaleService },
13564
+ { type: core.NgZone }
13565
+ ]; };
13566
+ SpeechRecognitionService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function SpeechRecognitionService_Factory() { return new SpeechRecognitionService(core["ɵɵinject"](LocaleService), core["ɵɵinject"](core.NgZone)); }, token: SpeechRecognitionService, providedIn: "root" });
13567
+ SpeechRecognitionService = __decorate([
13568
+ core.Injectable({
13569
+ providedIn: 'root'
13570
+ })
13571
+ ], SpeechRecognitionService);
13572
+ return SpeechRecognitionService;
13573
+ }());
13574
+
13575
+ var TextToSpeechService = /** @class */ (function () {
13576
+ function TextToSpeechService(locale, ngZone) {
13577
+ this.locale = locale;
13578
+ this.ngZone = ngZone;
13579
+ this.utterance = new SpeechSynthesisUtterance();
13580
+ this.voices = [];
13581
+ this.setVoices();
13582
+ }
13583
+ TextToSpeechService.prototype.setVoices = function () {
13584
+ var _this = this;
13585
+ var _voices = speechSynthesis.getVoices();
13586
+ if (!_voices.length) {
13587
+ speechSynthesis.onvoiceschanged = function () {
13588
+ _this.ngZone.run(function () {
13589
+ _voices = speechSynthesis.getVoices();
13590
+ var currentLang = _this.locale.getLocaleOptions().locale || 'pt-BR';
13591
+ _this.voices = _voices.filter(function (voice) { return voice.lang === currentLang; });
13592
+ _this.activeVoice = _this.voices[0];
13593
+ });
13594
+ };
13595
+ }
13596
+ };
13597
+ /**
13598
+ * Updates the active voice
13599
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SpeechSynthesisVoice/voiceURI)
13600
+ * @param voiceUri
13601
+ */
13602
+ TextToSpeechService.prototype.updateVoice = function (voiceUri) {
13603
+ this.activeVoice = this.voices.find(function (voice) { return voice.voiceURI === voiceUri; });
13604
+ };
13605
+ TextToSpeechService.prototype.speak = function (text, speed) {
13606
+ var _this = this;
13607
+ if (speed === void 0) { speed = 1; }
13608
+ if (!this.activeVoice) {
13609
+ return;
13610
+ }
13611
+ return new Promise(function (resolve) {
13612
+ _this.utterance.text = text;
13613
+ _this.utterance.voice = _this.activeVoice;
13614
+ _this.utterance.rate = speed;
13615
+ speechSynthesis.speak(_this.utterance);
13616
+ _this.utterance.onend = function () {
13617
+ _this.ngZone.run(function () {
13618
+ resolve(true);
13619
+ });
13620
+ };
13621
+ });
13622
+ };
13623
+ TextToSpeechService.prototype.pause = function () {
13624
+ speechSynthesis.pause();
13625
+ };
13626
+ TextToSpeechService.prototype.resume = function () {
13627
+ speechSynthesis.resume();
13628
+ };
13629
+ TextToSpeechService.prototype.cancel = function () {
13630
+ speechSynthesis.cancel();
13631
+ };
13632
+ Object.defineProperty(TextToSpeechService.prototype, "hasVoice", {
13633
+ get: function () {
13634
+ return !!this.activeVoice;
13635
+ },
13636
+ enumerable: true,
13637
+ configurable: true
13638
+ });
13639
+ TextToSpeechService.ctorParameters = function () { return [
13640
+ { type: LocaleService },
13641
+ { type: core.NgZone }
13642
+ ]; };
13643
+ TextToSpeechService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function TextToSpeechService_Factory() { return new TextToSpeechService(core["ɵɵinject"](LocaleService), core["ɵɵinject"](core.NgZone)); }, token: TextToSpeechService, providedIn: "root" });
13644
+ TextToSpeechService = __decorate([
13645
+ core.Injectable({
13646
+ providedIn: 'root'
13647
+ })
13648
+ ], TextToSpeechService);
13649
+ return TextToSpeechService;
13650
+ }());
13651
+
13652
+ var SpeechRecognitionComponent = /** @class */ (function () {
13653
+ function SpeechRecognitionComponent(speechRecognitionService, textToSpeechService, translateService) {
13654
+ var _this = this;
13655
+ this.speechRecognitionService = speechRecognitionService;
13656
+ this.textToSpeechService = textToSpeechService;
13657
+ this.translateService = translateService;
13658
+ this._recognizedText = '';
13659
+ this.originalTextAreaElementText = '';
13660
+ this.isDoneSpeaking = false;
13661
+ this.onDestroy$ = new rxjs.Subject();
13662
+ this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
13663
+ this.SPEECH_RECOGNITION_MARGIN_OFFSET = 13;
13664
+ this.keydownEventListener = function (event) {
13665
+ if (_this.disabled) {
13666
+ event.preventDefault();
13667
+ }
13668
+ };
13669
+ this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER = new MutationObserver(function () {
13670
+ _this.SPEECH_CONTAINER_WIDTH_CALLBACK();
13671
+ });
13672
+ this.SPEECH_CONTAINER_WIDTH_CALLBACK = function () {
13673
+ _this.setSpeechContainerWidth();
13674
+ };
13675
+ this.speechRecognitionContainerWidth = 0;
13676
+ this.disabled = false;
13677
+ this.isSpeaking = false;
13678
+ this.voiceSpeed = 1;
13679
+ this.isDisabledMicrophone = false;
13680
+ this.canRenderMicrophone = true;
13681
+ this.canRenderTextToSpeech = true;
13682
+ this.canRenderListeningText = false;
13683
+ this.canRenderDiscard = false;
13684
+ this.canRenderAprove = false;
13685
+ this.canRenderTextToSpeechToolbar = false;
13686
+ this.isPlayingTextToSpeech = false;
13687
+ this.recognizedText = new core.EventEmitter();
13688
+ }
13689
+ SpeechRecognitionComponent.prototype.ngOnInit = function () {
13690
+ if (!this.textAreaElement) {
13691
+ throw new Error('textAreaElement is required');
13692
+ }
13693
+ this.textAreaElement.placeholder = this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
13694
+ this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
13695
+ var config = { attributes: true, childList: true, subtree: true };
13696
+ this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER.observe(this.textAreaElement, config);
13697
+ window.addEventListener('resize', this.SPEECH_CONTAINER_WIDTH_CALLBACK);
13698
+ };
13699
+ SpeechRecognitionComponent.prototype.ngAfterViewInit = function () {
13700
+ var _this = this;
13701
+ setTimeout(function () {
13702
+ _this.setSpeechContainerWidth();
13703
+ });
13704
+ };
13705
+ SpeechRecognitionComponent.prototype.onListen = function () {
13706
+ var _this = this;
13707
+ if (this.isDisabledMicrophone || this.isListening) {
13708
+ return;
13709
+ }
13710
+ this.disabled = true;
13711
+ this.canRenderMicrophone = false;
13712
+ this.canRenderListeningText = true;
13713
+ if (this.textAreaElement.value && !this.originalTextAreaElementText) {
13714
+ this.originalTextAreaElementText = this.textAreaElement.value;
13715
+ }
13716
+ this.textAreaElement.value = '';
13717
+ this.isSpeaking = true;
13718
+ this.speechRecognitionService.listen()
13719
+ .pipe(operators.takeUntil(this.onDestroy$))
13720
+ .subscribe(function (_a) {
13721
+ var text = _a.text, isFinal = _a.isFinal;
13722
+ _this._recognizedText = text;
13723
+ _this.setTextAreaValue(text);
13724
+ setTimeout(function () {
13725
+ _this.textAreaElement.scrollTop = _this.textAreaElement.scrollHeight;
13726
+ }, 120);
13727
+ if (isFinal) {
13728
+ _this.canRenderAprove = true;
13729
+ _this.canRenderDiscard = true;
13730
+ _this.canRenderListeningText = false;
13731
+ _this.isSpeaking = false;
13732
+ }
13733
+ });
13734
+ };
13735
+ SpeechRecognitionComponent.prototype.onOpenToolbar = function () {
13736
+ if (this.isDisabledTextToSpeech) {
13737
+ return;
13738
+ }
13739
+ this.canRenderTextToSpeechToolbar = true;
13740
+ this.canRenderTextToSpeech = false;
13741
+ this.isPlayingTextToSpeech = true;
13742
+ this.speak();
13743
+ };
13744
+ SpeechRecognitionComponent.prototype.onCloseToolbar = function () {
13745
+ this.canRenderTextToSpeechToolbar = false;
13746
+ this.canRenderTextToSpeech = true;
13747
+ this.isPlayingTextToSpeech = false;
13748
+ this.textToSpeechService.cancel();
13749
+ this.voiceSpeed = 1;
13750
+ };
13751
+ SpeechRecognitionComponent.prototype.onDiscard = function () {
13752
+ this.canRenderAprove = false;
13753
+ this.canRenderDiscard = false;
13754
+ this.canRenderMicrophone = true;
13755
+ this.canRenderTextToSpeechToolbar = false;
13756
+ this.canRenderTextToSpeech = true;
13757
+ this._recognizedText = '';
13758
+ this.setTextAreaValue(this.originalTextAreaElementText);
13759
+ this.disabled = false;
13760
+ this.textToSpeechService.cancel();
13761
+ };
13762
+ SpeechRecognitionComponent.prototype.onAprove = function () {
13763
+ this.canRenderAprove = false;
13764
+ this.canRenderDiscard = false;
13765
+ this.canRenderMicrophone = true;
13766
+ this.canRenderTextToSpeechToolbar = false;
13767
+ this.canRenderTextToSpeech = true;
13768
+ this.originalTextAreaElementText = this._recognizedText;
13769
+ this.recognizedText.emit(this._recognizedText);
13770
+ this._recognizedText = '';
13771
+ this.disabled = false;
13772
+ this.textToSpeechService.cancel();
13773
+ };
13774
+ SpeechRecognitionComponent.prototype.ngOnDestroy = function () {
13775
+ this.onDestroy$.next();
13776
+ this.onDestroy$.complete();
13777
+ this.textAreaElement.removeEventListener('keydown', this.keydownEventListener);
13778
+ window.removeEventListener('resize', this.SPEECH_CONTAINER_WIDTH_CALLBACK);
13779
+ this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER.disconnect();
13780
+ };
13781
+ SpeechRecognitionComponent.prototype.toggleTextToSpeech = function () {
13782
+ if (this.isPlayingTextToSpeech) {
13783
+ this.textToSpeechService.pause();
13784
+ }
13785
+ else {
13786
+ if (this.isDoneSpeaking) {
13787
+ this.speak();
13788
+ }
13789
+ else {
13790
+ this.textToSpeechService.resume();
13791
+ }
13792
+ }
13793
+ this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
13794
+ };
13795
+ SpeechRecognitionComponent.prototype.restartTextToSpeech = function () {
13796
+ this.isPlayingTextToSpeech = true;
13797
+ this.textToSpeechService.cancel();
13798
+ this.speak();
13799
+ };
13800
+ SpeechRecognitionComponent.prototype.updateVoiceSpeed = function () {
13801
+ var voiceSpeedIndex = this.VOICE_SPEEDS.indexOf(this.voiceSpeed);
13802
+ var nextVoiceSpeedIndex = this.VOICE_SPEEDS[voiceSpeedIndex + 1] ? voiceSpeedIndex + 1 : 0;
13803
+ this.voiceSpeed = this.VOICE_SPEEDS[nextVoiceSpeedIndex];
13804
+ this.textToSpeechService.cancel();
13805
+ this.speak();
13806
+ };
13807
+ SpeechRecognitionComponent.prototype.stopListening = function () {
13808
+ this.speechRecognitionService.stop();
13809
+ };
13810
+ Object.defineProperty(SpeechRecognitionComponent.prototype, "isListening", {
13811
+ get: function () {
13812
+ return this.speechRecognitionService.isListening;
13813
+ },
13814
+ enumerable: true,
13815
+ configurable: true
13816
+ });
13817
+ Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
13818
+ get: function () {
13819
+ var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
13820
+ return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
13821
+ },
13822
+ enumerable: true,
13823
+ configurable: true
13824
+ });
13825
+ SpeechRecognitionComponent.prototype.setTextAreaValue = function (value) {
13826
+ this.textAreaElement.value = value;
13827
+ };
13828
+ SpeechRecognitionComponent.prototype.speak = function () {
13829
+ var _this = this;
13830
+ this.isDoneSpeaking = false;
13831
+ this.textToSpeechService.speak(this._recognizedText, this.voiceSpeed).then(function () {
13832
+ _this.isPlayingTextToSpeech = false;
13833
+ _this.isDoneSpeaking = true;
13834
+ });
13835
+ };
13836
+ SpeechRecognitionComponent.prototype.setSpeechContainerWidth = function () {
13837
+ this.speechRecognitionContainerWidth = this.textAreaElement.getBoundingClientRect().width - this.SPEECH_RECOGNITION_MARGIN_OFFSET;
13838
+ };
13839
+ SpeechRecognitionComponent.ctorParameters = function () { return [
13840
+ { type: SpeechRecognitionService },
13841
+ { type: TextToSpeechService },
13842
+ { type: core$1.TranslateService }
13843
+ ]; };
13844
+ __decorate([
13845
+ core.Input()
13846
+ ], SpeechRecognitionComponent.prototype, "textAreaElement", void 0);
13847
+ __decorate([
13848
+ core.Output()
13849
+ ], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
13850
+ SpeechRecognitionComponent = __decorate([
13851
+ core.Component({
13852
+ selector: 's-speech-recognition',
13853
+ template: "<section class=\"speech-recognition\" [style.width.px]=\"speechRecognitionContainerWidth\" *ngIf=\"speechRecognitionContainerWidth\">\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",
13854
+ styles: [".speech-recognition{display:-ms-flexbox;display:flex;gap:10px;-ms-flex-pack:justify;justify-content:space-between}.speech-recognition-buttons{display:-ms-flexbox;display:flex;gap:10px;position:relative;bottom:15px}.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}"]
13855
+ })
13856
+ ], SpeechRecognitionComponent);
13857
+ return SpeechRecognitionComponent;
13858
+ }());
13859
+
13860
+ var SpeechRecognitionModule = /** @class */ (function () {
13861
+ function SpeechRecognitionModule() {
13862
+ }
13863
+ SpeechRecognitionModule = __decorate([
13864
+ core.NgModule({
13865
+ declarations: [SpeechRecognitionComponent],
13866
+ imports: [
13867
+ common.CommonModule,
13868
+ core$1.TranslateModule
13869
+ ],
13870
+ exports: [SpeechRecognitionComponent]
13871
+ })
13872
+ ], SpeechRecognitionModule);
13873
+ return SpeechRecognitionModule;
13874
+ }());
13875
+
13876
+ var TextAreaModule = /** @class */ (function () {
13877
+ function TextAreaModule() {
13878
+ }
13879
+ TextAreaModule = __decorate([
13880
+ core.NgModule({
13881
+ declarations: [TextAreaComponent],
13882
+ imports: [
13883
+ common.CommonModule,
13884
+ forms.FormsModule,
13885
+ forms.ReactiveFormsModule,
13886
+ SpeechRecognitionModule,
13887
+ keyfilter.KeyFilterModule
13888
+ ],
13889
+ exports: [TextAreaComponent]
13890
+ })
13891
+ ], TextAreaModule);
13892
+ return TextAreaModule;
13893
+ }());
13894
+
13386
13895
  var DynamicFormModule = /** @class */ (function () {
13387
13896
  function DynamicFormModule() {
13388
13897
  }
@@ -13441,6 +13950,7 @@
13441
13950
  ProfilePictureModule,
13442
13951
  EditorFieldModule,
13443
13952
  FieldLabelModule,
13953
+ TextAreaModule
13444
13954
  ],
13445
13955
  declarations: [
13446
13956
  AutocompleteFieldComponent,
@@ -22636,7 +23146,11 @@
22636
23146
  "platform.angular_components.add_all": "Adicionar todos",
22637
23147
  "platform.angular_components.remove_all": "Remover todos",
22638
23148
  "platform.angular_components.country_name_gb": "Reino Unido",
22639
- "platform.angular_components.insight_footer": "Conteúdo gerado por inteligência artificial. Sujeito a imprecisões."
23149
+ "platform.angular_components.insight_footer": "Conteúdo gerado por inteligência artificial. Sujeito a imprecisões.",
23150
+ "platform.angular_components.text_area_speech_recognition_placeholder": "Preencha o campo, com pelo menos, uma frase",
23151
+ "platform.angular_components.text_area_before_speech": "Grave ou ouça o texto clicando nos Ícones",
23152
+ "platform.angular_components.text_area_while_speech": "Clique novamente no Ícone para finalizar",
23153
+ "platform.angular_components.text_area_end_speech": "Gravação finalizada"
22640
23154
  };
22641
23155
 
22642
23156
  exports.AccordionComponent = AccordionComponent;
@@ -22819,9 +23333,11 @@
22819
23333
  exports.TaxCalculationLanguageConfigs = TaxCalculationLanguageConfigs;
22820
23334
  exports.TemplateDirective = TemplateDirective;
22821
23335
  exports.TemplateModule = TemplateModule;
23336
+ exports.TextAreaComponent = TextAreaComponent;
22822
23337
  exports.TextAreaField = TextAreaField;
22823
23338
  exports.TextAreaIAComponent = TextAreaIAComponent;
22824
23339
  exports.TextAreaIAModule = TextAreaIAModule;
23340
+ exports.TextAreaModule = TextAreaModule;
22825
23341
  exports.TextField = TextField;
22826
23342
  exports.ThumbnailComponent = ThumbnailComponent;
22827
23343
  exports.ThumbnailModule = ThumbnailModule;
@@ -22881,69 +23397,73 @@
22881
23397
  exports.ɵbv = ProfilePictureFieldComponent;
22882
23398
  exports.ɵbw = EditorFieldModule;
22883
23399
  exports.ɵbx = EditorFieldComponent;
22884
- exports.ɵby = AutocompleteFieldComponent;
22885
- exports.ɵbz = BooleanFieldComponent;
23400
+ exports.ɵby = SpeechRecognitionModule;
23401
+ exports.ɵbz = SpeechRecognitionComponent;
22886
23402
  exports.ɵc = InfoSignComponent;
22887
- exports.ɵca = BooleanSwitchFieldComponent;
22888
- exports.ɵcb = CalendarFieldComponent;
22889
- exports.ɵcc = ChipsFieldComponent;
22890
- exports.ɵcd = CountryPhonePickerFieldComponent;
22891
- exports.ɵce = DynamicFieldComponent;
22892
- exports.ɵcf = DynamicFormDirective;
22893
- exports.ɵcg = FieldsetComponent;
22894
- exports.ɵch = FileUploadComponent$1;
22895
- exports.ɵci = LookupFieldComponent;
22896
- exports.ɵcj = RadioButtonComponent;
22897
- exports.ɵck = RowComponent;
22898
- exports.ɵcl = SectionComponent;
22899
- exports.ɵcm = SelectFieldComponent;
22900
- exports.ɵcn = SliderFieldComponent;
22901
- exports.ɵco = TextAreaFieldComponent;
22902
- exports.ɵcp = TextAreaIAFieldComponent;
22903
- exports.ɵcq = IAssistService;
22904
- exports.ɵcr = ButtonFieldComponent;
22905
- exports.ɵct = DecimalField;
22906
- exports.ɵcu = SideTableComponent;
22907
- exports.ɵcv = InfiniteScrollModule;
22908
- exports.ɵcw = InfiniteScrollDirective;
22909
- exports.ɵcx = IAInsightSidebarComponent;
22910
- exports.ɵcy = IAInsightCardComponent;
22911
- exports.ɵcz = IAInsightCardLoaderComponent;
23403
+ exports.ɵca = SpeechRecognitionService;
23404
+ exports.ɵcb = TextToSpeechService;
23405
+ exports.ɵcc = AutocompleteFieldComponent;
23406
+ exports.ɵcd = BooleanFieldComponent;
23407
+ exports.ɵce = BooleanSwitchFieldComponent;
23408
+ exports.ɵcf = CalendarFieldComponent;
23409
+ exports.ɵcg = ChipsFieldComponent;
23410
+ exports.ɵch = CountryPhonePickerFieldComponent;
23411
+ exports.ɵci = DynamicFieldComponent;
23412
+ exports.ɵcj = DynamicFormDirective;
23413
+ exports.ɵck = FieldsetComponent;
23414
+ exports.ɵcl = FileUploadComponent$1;
23415
+ exports.ɵcm = LookupFieldComponent;
23416
+ exports.ɵcn = RadioButtonComponent;
23417
+ exports.ɵco = RowComponent;
23418
+ exports.ɵcp = SectionComponent;
23419
+ exports.ɵcq = SelectFieldComponent;
23420
+ exports.ɵcr = SliderFieldComponent;
23421
+ exports.ɵcs = TextAreaFieldComponent;
23422
+ exports.ɵct = TextAreaIAFieldComponent;
23423
+ exports.ɵcu = IAssistService;
23424
+ exports.ɵcv = ButtonFieldComponent;
23425
+ exports.ɵcx = DecimalField;
23426
+ exports.ɵcy = SideTableComponent;
23427
+ exports.ɵcz = InfiniteScrollModule;
22912
23428
  exports.ɵd = TieredMenuEventService;
22913
- exports.ɵda = GridMenuItemComponent;
22914
- exports.ɵdb = InlineEditItemComponent;
22915
- exports.ɵdc = InlineEditCalendarComponent;
22916
- exports.ɵdd = InlineEditLookupComponent;
22917
- exports.ɵde = InlineEditNumberComponent;
22918
- exports.ɵdf = InlineEditTextComponent;
22919
- exports.ɵdg = InlineEditTextAreaComponent;
22920
- exports.ɵdh = InlineEditTextAreaIAComponent;
22921
- exports.ɵdi = KanbanEventService;
22922
- exports.ɵdj = KanbanItemComponent;
22923
- exports.ɵdk = KanbanColumnComponent;
22924
- exports.ɵdl = KanbanItemDraggingComponent;
22925
- exports.ɵdm = NumberLocaleOptions;
22926
- exports.ɵdn = BorderButtonModule;
22927
- exports.ɵdo = BorderButtonComponent;
22928
- exports.ɵdp = ProgressBarDeterminateComponent;
22929
- exports.ɵdq = ProgressBarIndeterminateComponent;
22930
- exports.ɵdr = SelectButtonItemComponent;
22931
- exports.ɵds = SlidePanelService;
22932
- exports.ɵdt = ThumbnailItemComponent;
22933
- exports.ɵdu = ThumbnailItemVideoComponent;
22934
- exports.ɵdv = ThumbnailItemImageComponent;
22935
- exports.ɵdw = TimelineItemModule;
22936
- exports.ɵdx = TimelineIconItemComponent;
22937
- exports.ɵdy = HorizontalTimelineModule;
22938
- exports.ɵdz = HorizontalTimelineComponent;
23429
+ exports.ɵda = InfiniteScrollDirective;
23430
+ exports.ɵdb = IAInsightSidebarComponent;
23431
+ exports.ɵdc = IAInsightCardComponent;
23432
+ exports.ɵdd = IAInsightCardLoaderComponent;
23433
+ exports.ɵde = GridMenuItemComponent;
23434
+ exports.ɵdf = InlineEditItemComponent;
23435
+ exports.ɵdg = InlineEditCalendarComponent;
23436
+ exports.ɵdh = InlineEditLookupComponent;
23437
+ exports.ɵdi = InlineEditNumberComponent;
23438
+ exports.ɵdj = InlineEditTextComponent;
23439
+ exports.ɵdk = InlineEditTextAreaComponent;
23440
+ exports.ɵdl = InlineEditTextAreaIAComponent;
23441
+ exports.ɵdm = KanbanEventService;
23442
+ exports.ɵdn = KanbanItemComponent;
23443
+ exports.ɵdo = KanbanColumnComponent;
23444
+ exports.ɵdp = KanbanItemDraggingComponent;
23445
+ exports.ɵdq = NumberLocaleOptions;
23446
+ exports.ɵdr = BorderButtonModule;
23447
+ exports.ɵds = BorderButtonComponent;
23448
+ exports.ɵdt = ProgressBarDeterminateComponent;
23449
+ exports.ɵdu = ProgressBarIndeterminateComponent;
23450
+ exports.ɵdv = SelectButtonItemComponent;
23451
+ exports.ɵdw = SlidePanelService;
23452
+ exports.ɵdx = ThumbnailItemComponent;
23453
+ exports.ɵdy = ThumbnailItemVideoComponent;
23454
+ exports.ɵdz = ThumbnailItemImageComponent;
22939
23455
  exports.ɵe = TieredMenuService;
22940
- exports.ɵea = VerticalTimelineModule;
22941
- exports.ɵeb = VerticalTimelineComponent;
22942
- exports.ɵec = RangeLineComponent;
22943
- exports.ɵed = CollapseOptionComponent;
22944
- exports.ɵee = CollapsedItemsComponent;
22945
- exports.ɵef = VerticalItemsComponent;
22946
- exports.ɵeg = ChipItemComponent;
23456
+ exports.ɵea = TimelineItemModule;
23457
+ exports.ɵeb = TimelineIconItemComponent;
23458
+ exports.ɵec = HorizontalTimelineModule;
23459
+ exports.ɵed = HorizontalTimelineComponent;
23460
+ exports.ɵee = VerticalTimelineModule;
23461
+ exports.ɵef = VerticalTimelineComponent;
23462
+ exports.ɵeg = RangeLineComponent;
23463
+ exports.ɵeh = CollapseOptionComponent;
23464
+ exports.ɵei = CollapsedItemsComponent;
23465
+ exports.ɵej = VerticalItemsComponent;
23466
+ exports.ɵek = ChipItemComponent;
22947
23467
  exports.ɵf = TieredMenuGlobalService;
22948
23468
  exports.ɵg = TieredMenuComponent;
22949
23469
  exports.ɵh = TieredMenuNestedComponent;