@seniorsistemas/angular-components 17.26.5 → 17.26.7

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 (62) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +278 -170
  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/bignumber-input/{number-input.directive.d.ts → bignumber-input.directive.d.ts} +3 -1
  6. package/components/bignumber-input/index.d.ts +2 -2
  7. package/components/card/card.component.d.ts +5 -2
  8. package/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.d.ts +7 -6
  9. package/components/dynamic-form/configurations/fields/text-area-ia-field.d.ts +4 -6
  10. package/components/number-input/number-input.directive.d.ts +11 -9
  11. package/components/speech-recognition/speech-recognition/speech-recognition.component.d.ts +3 -8
  12. package/components/speech-recognition/speech-recognition.service.d.ts +1 -0
  13. package/components/speech-recognition/text-to-speech.service.d.ts +1 -0
  14. package/components/text-area/text-area/text-area.component.d.ts +9 -2
  15. package/components/text-area-ia/text-area-ia.component.d.ts +4 -1
  16. package/esm2015/components/bignumber-input/bignumber-input.directive.js +150 -0
  17. package/esm2015/components/bignumber-input/bignumber-input.module.js +15 -0
  18. package/esm2015/components/bignumber-input/index.js +3 -3
  19. package/esm2015/components/card/card.component.js +22 -7
  20. package/esm2015/components/dynamic-form/components/fields/bignumber/bignumber-field.module.js +2 -2
  21. package/esm2015/components/dynamic-form/components/fields/text-area/text-area-field.component.js +2 -2
  22. package/esm2015/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +15 -13
  23. package/esm2015/components/dynamic-form/configurations/fields/text-area-ia-field.js +7 -2
  24. package/esm2015/components/dynamic-form/dynamic-form.module.js +2 -2
  25. package/esm2015/components/inline-edit/inline-edit.module.js +2 -2
  26. package/esm2015/components/number-input/number-input.directive.js +41 -21
  27. package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +9 -25
  28. package/esm2015/components/speech-recognition/speech-recognition.service.js +8 -3
  29. package/esm2015/components/speech-recognition/text-to-speech.service.js +13 -4
  30. package/esm2015/components/text-area/text-area/text-area.component.js +33 -5
  31. package/esm2015/components/text-area-ia/text-area-ia.component.js +13 -5
  32. package/esm2015/components/text-area-ia/text-area-ia.module.js +3 -3
  33. package/esm2015/locale/fallback.js +4 -4
  34. package/esm5/components/bignumber-input/bignumber-input.directive.js +155 -0
  35. package/esm5/components/bignumber-input/bignumber-input.module.js +18 -0
  36. package/esm5/components/bignumber-input/index.js +3 -3
  37. package/esm5/components/card/card.component.js +26 -7
  38. package/esm5/components/dynamic-form/components/fields/bignumber/bignumber-field.module.js +2 -2
  39. package/esm5/components/dynamic-form/components/fields/text-area/text-area-field.component.js +2 -2
  40. package/esm5/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +15 -13
  41. package/esm5/components/dynamic-form/configurations/fields/text-area-ia-field.js +8 -3
  42. package/esm5/components/dynamic-form/dynamic-form.module.js +2 -2
  43. package/esm5/components/inline-edit/inline-edit.module.js +2 -2
  44. package/esm5/components/number-input/number-input.directive.js +42 -22
  45. package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +13 -26
  46. package/esm5/components/speech-recognition/speech-recognition.service.js +9 -3
  47. package/esm5/components/speech-recognition/text-to-speech.service.js +13 -4
  48. package/esm5/components/text-area/text-area/text-area.component.js +42 -6
  49. package/esm5/components/text-area-ia/text-area-ia.component.js +13 -5
  50. package/esm5/components/text-area-ia/text-area-ia.module.js +3 -3
  51. package/esm5/locale/fallback.js +4 -4
  52. package/fesm2015/seniorsistemas-angular-components.js +260 -168
  53. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  54. package/fesm5/seniorsistemas-angular-components.js +280 -172
  55. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  56. package/package.json +1 -1
  57. package/seniorsistemas-angular-components.metadata.json +1 -1
  58. package/esm2015/components/bignumber-input/number-input.directive.js +0 -132
  59. package/esm2015/components/bignumber-input/number-input.module.js +0 -15
  60. package/esm5/components/bignumber-input/number-input.directive.js +0 -137
  61. package/esm5/components/bignumber-input/number-input.module.js +0 -18
  62. /package/components/bignumber-input/{number-input.module.d.ts → bignumber-input.module.d.ts} +0 -0
@@ -1435,6 +1435,7 @@
1435
1435
  _this.scale = 0;
1436
1436
  _this.alignTo = ng2CurrencyMask.AlignmentOptions.LEFT;
1437
1437
  _this.allowNegative = true;
1438
+ _this.pasteRejected = new core.EventEmitter();
1438
1439
  _this.onLocaleService();
1439
1440
  return _this;
1440
1441
  }
@@ -1457,6 +1458,17 @@
1457
1458
  this.updateVariables();
1458
1459
  }
1459
1460
  };
1461
+ BignumberInputDirective.prototype.onPaste = function (event) {
1462
+ var _a, _b;
1463
+ var pastedText = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
1464
+ var numericText = pastedText.replace(new RegExp("\\" + this.thousandsSeparator, "g"), "").replace(this.decimalSeparator, ".");
1465
+ var _c = __read(numericText.split("."), 2), intPart = _c[0], _d = _c[1], decimalPart = _d === void 0 ? "" : _d;
1466
+ var totalDigits = intPart.replace(/\D/g, "").length + decimalPart.slice(0, this.scale).length;
1467
+ if (totalDigits > this.precision) {
1468
+ event.preventDefault();
1469
+ this.pasteRejected.emit(pastedText);
1470
+ }
1471
+ };
1460
1472
  BignumberInputDirective.prototype.onKeypress = function (event) {
1461
1473
  var code = event.code;
1462
1474
  if (code === "Minus" || code === "NumpadSubtract") {
@@ -1538,6 +1550,12 @@
1538
1550
  __decorate([
1539
1551
  core.HostBinding("attr.maxLength")
1540
1552
  ], BignumberInputDirective.prototype, "maxLength", void 0);
1553
+ __decorate([
1554
+ core.Output()
1555
+ ], BignumberInputDirective.prototype, "pasteRejected", void 0);
1556
+ __decorate([
1557
+ core.HostListener("paste", ["$event"])
1558
+ ], BignumberInputDirective.prototype, "onPaste", null);
1541
1559
  __decorate([
1542
1560
  core.HostListener("keypress", ["$event"])
1543
1561
  ], BignumberInputDirective.prototype, "onKeypress", null);
@@ -3315,13 +3333,24 @@
3315
3333
  var CardComponent = /** @class */ (function () {
3316
3334
  function CardComponent() {
3317
3335
  this.fullWidth = false;
3336
+ this.title = '';
3337
+ this.subtitle = '';
3338
+ this.icon = '';
3318
3339
  this.showBanner = false;
3319
- this.hasCustomTemplates = false;
3320
3340
  }
3321
3341
  CardComponent.prototype.ngAfterContentInit = function () {
3322
3342
  this._getTemplates();
3323
- this._testLoadImage();
3343
+ this._loadImage();
3324
3344
  };
3345
+ Object.defineProperty(CardComponent.prototype, "hasHeader", {
3346
+ get: function () {
3347
+ var headerTemplate = !!this.headerTemplate;
3348
+ var hasHeaderAttributes = this.title || this.subtitle || this.icon;
3349
+ return headerTemplate || hasHeaderAttributes;
3350
+ },
3351
+ enumerable: true,
3352
+ configurable: true
3353
+ });
3325
3354
  CardComponent.prototype._getHeaderTemplate = function () {
3326
3355
  return this._getCustomTemplate(exports.CardTemplateTypes.Header);
3327
3356
  };
@@ -3339,9 +3368,8 @@
3339
3368
  this.headerTemplate = this._getHeaderTemplate();
3340
3369
  this.bodyTemplate = this._getBodyTemplate();
3341
3370
  this.footerTemplate = this._getFooterTemplate();
3342
- this.hasCustomTemplates = !!(this.headerTemplate || this.bodyTemplate || this.footerTemplate);
3343
3371
  };
3344
- CardComponent.prototype._testLoadImage = function () {
3372
+ CardComponent.prototype._loadImage = function () {
3345
3373
  var _this = this;
3346
3374
  var img = new Image();
3347
3375
  img.src = this.bannerImage;
@@ -3354,14 +3382,23 @@
3354
3382
  __decorate([
3355
3383
  core.Input()
3356
3384
  ], CardComponent.prototype, "fullWidth", void 0);
3385
+ __decorate([
3386
+ core.Input()
3387
+ ], CardComponent.prototype, "title", void 0);
3388
+ __decorate([
3389
+ core.Input()
3390
+ ], CardComponent.prototype, "subtitle", void 0);
3391
+ __decorate([
3392
+ core.Input()
3393
+ ], CardComponent.prototype, "icon", void 0);
3357
3394
  __decorate([
3358
3395
  core.ContentChildren(TemplateDirective)
3359
3396
  ], CardComponent.prototype, "templates", void 0);
3360
3397
  CardComponent = __decorate([
3361
3398
  core.Component({
3362
3399
  selector: "s-card",
3363
- template: "<div class=\"card\" [ngClass]=\"{ 'card--full-width': fullWidth }\">\n <div\n *ngIf=\"showBanner\"\n class=\"banner\"\n [ngStyle]=\"{'background-image': 'url(' + bannerImage + ')'}\">\n </div>\n\n <ng-container *ngIf=\"hasCustomTemplates; then customTemplates; else contentTemplate\"> </ng-container>\n\n <ng-template #customTemplates>\n <div *ngIf=\"headerTemplate\" class=\"header\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </div>\n <div *ngIf=\"bodyTemplate\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\n </div>\n <div *ngIf=\"footerTemplate\" class=\"footer\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n </div>\n </ng-template>\n\n <ng-template #contentTemplate>\n <div class=\"body\">\n <ng-content></ng-content>\n </div>\n </ng-template>\n</div>\n",
3364
- styles: [".card{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border-radius:4px;box-shadow:0 1px 5px 0 #00000040;overflow:hidden}.card--full-width{width:100%}.card .banner{background-repeat:no-repeat;background-size:cover;height:150px;width:100%}.card .header{padding:16px 12px}.card .body,.card .footer{padding:16px}.card .body+.footer,.card .header+.body{border-top:1px solid #c1c1cc}"]
3400
+ template: "<div class=\"card\" [ngClass]=\"{ 'card--full-width': fullWidth }\">\n <div\n *ngIf=\"showBanner\"\n class=\"banner\"\n [ngStyle]=\"{'background-image': 'url(' + bannerImage + ')'}\">\n </div>\n\n <ng-container *ngIf=\"hasHeader\">\n <div class=\"header\">\n <ng-container *ngIf=\"headerTemplate\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"!headerTemplate\">\n <div class=\"header-content\">\n <div class=\"header-icon\" *ngIf=\"icon\">\n <i [class]=\"icon\"></i>\n </div>\n <div>\n <div class=\"header-title\" *ngIf=\"title\">\n {{ title }}\n </div>\n <div class=\"header-subtitle\" *ngIf=\"subtitle\">\n {{ subtitle }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n <div *ngIf=\"bodyTemplate\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\n </div>\n <ng-container *ngIf=\"!bodyTemplate\">\n <div class=\"body\">\n <ng-content></ng-content>\n </div>\n </ng-container>\n <div *ngIf=\"footerTemplate\" class=\"footer\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n </div>\n</div>\n",
3401
+ styles: [".card{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border-radius:4px;box-shadow:0 1px 5px 0 #00000040;overflow:hidden}.card--full-width{width:100%}.card .banner{background-repeat:no-repeat;background-size:cover;height:150px;width:100%}.card .header{padding:16px 12px}.card .header-content{display:-ms-flexbox;display:flex;gap:12px}.card .header-title{color:#212533;font-size:14px;font-style:normal;font-weight:700}.card .header-subtitle{color:#6e7280;font-size:14px;font-style:normal;font-weight:400}.card .header-icon{border-radius:50%;background-color:#dedce5;width:3em;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-height:3em}.card .body,.card .footer{padding:16px}.card .body+.footer,.card .header+.body{border-top:1px solid #c1c1cc}"]
3365
3402
  })
3366
3403
  ], CardComponent);
3367
3404
  return CardComponent;
@@ -6834,14 +6871,15 @@
6834
6871
  */
6835
6872
  var NumberInputDirective = /** @class */ (function (_super) {
6836
6873
  __extends(NumberInputDirective, _super);
6837
- function NumberInputDirective(_elementRef, _keyValueDiffers, localeService) {
6874
+ function NumberInputDirective(_keyValueDiffers, _elementRef, localeService) {
6838
6875
  var _this = _super.call(this, null, _elementRef, _keyValueDiffers) || this;
6876
+ _this._elementRef = _elementRef;
6839
6877
  _this.localeService = localeService;
6840
6878
  _this.precision = 15;
6841
6879
  _this.scale = 0;
6842
6880
  _this.alignTo = exports.NumberAlignmentOption.LEFT;
6843
6881
  _this.allowNegative = true;
6844
- _this.regex = /\d/;
6882
+ _this.pasteRejected = new core.EventEmitter();
6845
6883
  _this.onLocaleService();
6846
6884
  return _this;
6847
6885
  }
@@ -6849,6 +6887,10 @@
6849
6887
  NumberInputDirective.prototype.ngOnInit = function () {
6850
6888
  this.updateVariables();
6851
6889
  _super.prototype.ngOnInit.call(this);
6890
+ this.pasteListener = this._onPaste.bind(this);
6891
+ this._elementRef.nativeElement.addEventListener("paste", this.pasteListener);
6892
+ this.keypressListener = this._onKeypress.bind(this);
6893
+ this._elementRef.nativeElement.addEventListener("keypress", this.keypressListener);
6852
6894
  };
6853
6895
  NumberInputDirective.prototype.ngOnChanges = function (changes) {
6854
6896
  var placeholderChange = changes.placeholder && changes.placeholder.currentValue;
@@ -6863,6 +6905,33 @@
6863
6905
  this.updateVariables();
6864
6906
  }
6865
6907
  };
6908
+ NumberInputDirective.prototype.ngOnDestroy = function () {
6909
+ this._elementRef.nativeElement.removeEventListener("paste", this.pasteListener);
6910
+ this._elementRef.nativeElement.removeEventListener("keypress", this.keypressListener);
6911
+ };
6912
+ NumberInputDirective.prototype._onPaste = function (event) {
6913
+ var _a, _b;
6914
+ var pastedText = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
6915
+ var numericText = pastedText.replace(new RegExp("\\" + this.thousandsSeparator, "g"), "").replace(this.decimalSeparator, ".");
6916
+ var _c = __read(numericText.split("."), 2), intPart = _c[0], _d = _c[1], decimalPart = _d === void 0 ? "" : _d;
6917
+ var totalDigits = intPart.replace(/\D/g, "").length + decimalPart.slice(0, this.scale).length;
6918
+ if (totalDigits > this.precision) {
6919
+ event.preventDefault();
6920
+ event.stopPropagation();
6921
+ this.pasteRejected.emit(pastedText);
6922
+ }
6923
+ };
6924
+ NumberInputDirective.prototype._onKeypress = function (event) {
6925
+ var code = event.code;
6926
+ if (code === "Minus" || code === "NumpadSubtract") {
6927
+ if (this.allowNegative) {
6928
+ this.maxLength = this._maxLength + 1;
6929
+ }
6930
+ }
6931
+ else if (code === "Equal" || code === "NumpadAdd") {
6932
+ this.maxLength = this._maxLength;
6933
+ }
6934
+ };
6866
6935
  /**
6867
6936
  * Update the options values according to the directive input values.
6868
6937
  */
@@ -6886,24 +6955,9 @@
6886
6955
  var thoSepLength = this.thousandsSeparator.length;
6887
6956
  var maxLength = this.precision + (this.scale ? decSepLength : 0);
6888
6957
  maxLength += Math.ceil((this.precision - (this.scale ? this.scale : 0)) / 3 - 1) * thoSepLength;
6958
+ this._maxLength = maxLength;
6889
6959
  this.maxLength = maxLength;
6890
6960
  };
6891
- /**
6892
- * Prevents the default CurrencyMask behavior when typed a incorrect value.
6893
- * By default the CurrencyMask inputs the mask value to the component value when typed a incorrect value.
6894
- */
6895
- NumberInputDirective.prototype.handleKeypress = function (event) {
6896
- var negativeOperator = "-";
6897
- var key = event.key;
6898
- if (this.thousandsSeparator.includes(key) ||
6899
- this.decimalSeparator.includes(key) ||
6900
- negativeOperator.includes(key) ||
6901
- this.regex.test(key) ||
6902
- "Enter".toUpperCase() === key.toUpperCase())
6903
- _super.prototype.handleKeypress.call(this, event);
6904
- else
6905
- event.preventDefault();
6906
- };
6907
6961
  NumberInputDirective.prototype.onLocaleService = function () {
6908
6962
  var _this = this;
6909
6963
  this.localeService
@@ -6917,8 +6971,8 @@
6917
6971
  };
6918
6972
  var NumberInputDirective_1;
6919
6973
  NumberInputDirective.ctorParameters = function () { return [
6920
- { type: core.ElementRef },
6921
6974
  { type: core.KeyValueDiffers },
6975
+ { type: core.ElementRef },
6922
6976
  { type: LocaleService }
6923
6977
  ]; };
6924
6978
  __decorate([
@@ -6946,6 +7000,9 @@
6946
7000
  __decorate([
6947
7001
  core.HostBinding("attr.maxLength")
6948
7002
  ], NumberInputDirective.prototype, "maxLength", void 0);
7003
+ __decorate([
7004
+ core.Output()
7005
+ ], NumberInputDirective.prototype, "pasteRejected", void 0);
6949
7006
  NumberInputDirective = NumberInputDirective_1 = __decorate([
6950
7007
  core.Directive({
6951
7008
  selector: "input[sNumberInput]",
@@ -7191,13 +7248,18 @@
7191
7248
  var TextAreaIAField = /** @class */ (function (_super) {
7192
7249
  __extends(TextAreaIAField, _super);
7193
7250
  function TextAreaIAField(config) {
7251
+ var _a;
7194
7252
  var _this = _super.call(this, config) || this;
7253
+ _this.style = {
7254
+ resize: 'vertical'
7255
+ };
7195
7256
  _this.cols = config.cols;
7196
7257
  _this.rows = config.rows;
7197
7258
  _this.keyFilter = config.keyFilter;
7198
- _this.style = config.style;
7259
+ _this.style = __assign(__assign({}, config.style), _this.style);
7199
7260
  _this.prompt = config.prompt;
7200
7261
  _this.readonly = config.readonly;
7262
+ _this.speechRecognition = (_a = config.speechRecognition) !== null && _a !== void 0 ? _a : false;
7201
7263
  return _this;
7202
7264
  }
7203
7265
  return TextAreaIAField;
@@ -11426,11 +11488,115 @@
11426
11488
  return SliderFieldComponent;
11427
11489
  }(BaseFieldComponent));
11428
11490
 
11491
+ var SpeechRecognitionService = /** @class */ (function () {
11492
+ function SpeechRecognitionService(localeService, ngZone) {
11493
+ this.localeService = localeService;
11494
+ this.ngZone = ngZone;
11495
+ this.hasSupportSpeechRecognition = false;
11496
+ this.isListening = false;
11497
+ this.TIMEOUT_NO_MESSAGE = 3000;
11498
+ this.setRecognition();
11499
+ }
11500
+ SpeechRecognitionService.prototype.listen = function () {
11501
+ var _this = this;
11502
+ if (this.isListening) {
11503
+ return;
11504
+ }
11505
+ var speechSubject = new rxjs.Subject();
11506
+ this.isListening = true;
11507
+ this.recognition.continuous = true;
11508
+ this.recognition.interimResults = true;
11509
+ this.recognition.maxAlternatives = 1;
11510
+ var silenceTimer;
11511
+ var restartSilenceTimer = function () {
11512
+ if (silenceTimer !== undefined) {
11513
+ clearTimeout(silenceTimer);
11514
+ }
11515
+ silenceTimer = setTimeout(function () {
11516
+ _this.recognition.stop();
11517
+ }, _this.TIMEOUT_NO_MESSAGE);
11518
+ };
11519
+ var fullTranscript = '';
11520
+ var interimTranscript = '';
11521
+ this.recognition.onresult = function (event) {
11522
+ _this.ngZone.run(function () {
11523
+ restartSilenceTimer();
11524
+ var interimTranscript = '';
11525
+ for (var i = event.resultIndex; i < event.results.length; ++i) {
11526
+ var transcript = event.results[i][0].transcript;
11527
+ if (event.results[i].isFinal) {
11528
+ fullTranscript += transcript + '\n';
11529
+ }
11530
+ else {
11531
+ interimTranscript += transcript;
11532
+ }
11533
+ }
11534
+ interimTranscript = interimTranscript;
11535
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
11536
+ });
11537
+ };
11538
+ this.recognition.onerror = function () {
11539
+ _this.ngZone.run(function () {
11540
+ if (silenceTimer !== undefined) {
11541
+ clearTimeout(silenceTimer);
11542
+ }
11543
+ _this.isListening = false;
11544
+ speechSubject.next({
11545
+ isFinal: true,
11546
+ text: ''
11547
+ });
11548
+ });
11549
+ };
11550
+ this.recognition.onend = function () {
11551
+ _this.ngZone.run(function () {
11552
+ if (silenceTimer !== undefined) {
11553
+ clearTimeout(silenceTimer);
11554
+ }
11555
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
11556
+ _this.isListening = false;
11557
+ speechSubject.complete();
11558
+ });
11559
+ };
11560
+ this.recognition.start();
11561
+ return speechSubject;
11562
+ };
11563
+ SpeechRecognitionService.prototype.stop = function () {
11564
+ this.recognition.stop();
11565
+ };
11566
+ SpeechRecognitionService.prototype.setRecognition = function () {
11567
+ var _this = this;
11568
+ var _a;
11569
+ var SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
11570
+ if (!SpeechRecognitionConstructor) {
11571
+ console.warn('Speech recognition is not supported in this browser.');
11572
+ return;
11573
+ }
11574
+ this.hasSupportSpeechRecognition = true;
11575
+ this.recognition = new SpeechRecognitionConstructor();
11576
+ this.recognition.lang = ((_a = this.localeService.getLocaleOptions()) === null || _a === void 0 ? void 0 : _a.locale) || 'pt-BR';
11577
+ this.recognition.interimResults = false;
11578
+ this.recognition.maxAlternatives = 1;
11579
+ this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
11580
+ };
11581
+ SpeechRecognitionService.ctorParameters = function () { return [
11582
+ { type: LocaleService },
11583
+ { type: core.NgZone }
11584
+ ]; };
11585
+ SpeechRecognitionService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function SpeechRecognitionService_Factory() { return new SpeechRecognitionService(core["ɵɵinject"](LocaleService), core["ɵɵinject"](core.NgZone)); }, token: SpeechRecognitionService, providedIn: "root" });
11586
+ SpeechRecognitionService = __decorate([
11587
+ core.Injectable({
11588
+ providedIn: 'root'
11589
+ })
11590
+ ], SpeechRecognitionService);
11591
+ return SpeechRecognitionService;
11592
+ }());
11593
+
11429
11594
  var TextAreaIAFieldComponent = /** @class */ (function () {
11430
- function TextAreaIAFieldComponent(_iassistService, _formBuilder, _translateService) {
11595
+ function TextAreaIAFieldComponent(_iassistService, _formBuilder, _translateService, speechRecognitionService) {
11431
11596
  this._iassistService = _iassistService;
11432
11597
  this._formBuilder = _formBuilder;
11433
11598
  this._translateService = _translateService;
11599
+ this.speechRecognitionService = speechRecognitionService;
11434
11600
  this.isVisible = false;
11435
11601
  this.isLoading = false;
11436
11602
  }
@@ -11469,12 +11635,14 @@
11469
11635
  this.hideDialog();
11470
11636
  };
11471
11637
  TextAreaIAFieldComponent.prototype._createDialogFields = function () {
11638
+ var _a;
11472
11639
  this.fields = [
11473
11640
  new FormField({
11474
11641
  name: "context",
11475
11642
  type: exports.FieldType.Text,
11476
11643
  label: this._translateService.instant("platform.angular_components.context"),
11477
11644
  size: { sm: 12, md: 12, lg: 12, xl: 12 },
11645
+ speechRecognition: (_a = this.field.speechRecognition) !== null && _a !== void 0 ? _a : false
11478
11646
  }),
11479
11647
  ];
11480
11648
  };
@@ -11486,7 +11654,8 @@
11486
11654
  TextAreaIAFieldComponent.ctorParameters = function () { return [
11487
11655
  { type: IAssistService },
11488
11656
  { type: forms.FormBuilder },
11489
- { type: core$1.TranslateService }
11657
+ { type: core$1.TranslateService },
11658
+ { type: SpeechRecognitionService }
11490
11659
  ]; };
11491
11660
  __decorate([
11492
11661
  core.Input()
@@ -11494,13 +11663,10 @@
11494
11663
  __decorate([
11495
11664
  core.Input()
11496
11665
  ], TextAreaIAFieldComponent.prototype, "formControl", void 0);
11497
- __decorate([
11498
- core.ViewChild('inputRef')
11499
- ], TextAreaIAFieldComponent.prototype, "inputRef", void 0);
11500
11666
  TextAreaIAFieldComponent = __decorate([
11501
11667
  core.Component({
11502
- template: "<s-field-label [field]=\"field\"\n [fieldContainerRef]=\"inputRef?.nativeElement\"></s-field-label>\n\n<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\"> \n</s-loading-state>\n\n<p-dialog\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <p-header>\n <div class=\"dialog-header\">\n <span class=\"iassist-icon\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </span>\n IAssist - Content Generator\n </div>\n </p-header>\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <textarea #inputRef\n [id]=\"(field.id || field.name)\"\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 <button\n class=\"iassist-button\"\n (click)=\"showDialog()\"\n sTooltip=\"IAssist - Content Generator\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </button>\n</div>\n\n<ng-template #iassistIcon>\n <svg style=\"width: 100%; height: 100%;\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.81451 18.1054L5.99593 17.6059L7.52166 13.4099L7.60877 13.1726L7.61277 13.1614L7.94285 12.2543L8.01159 12.0648L8.05394 11.949L5.2998 8.52426L5.02726 8.18379C5.00569 8.15821 4.9881 8.13104 4.97292 8.10226C4.90099 7.9632 4.85063 7.81294 4.82186 7.6531C4.73075 7.1344 4.90418 6.60771 5.28382 6.24326C5.29421 6.23447 5.3038 6.22567 5.31419 6.21688L5.47164 6.0914L9.3439 3.00238L9.5469 2.84094L9.57088 2.82096L10.4101 2.15041L11.8007 1.04188C11.2181 0.925188 10.6163 0.863647 10.0001 0.863647C4.95374 0.863647 0.863281 4.9541 0.863281 9.99963C0.863281 13.5346 2.87254 16.5989 5.80971 18.1182\" fill=\"#0FA389\"/>\n <path d=\"M14.099 1.83472L13.9495 2.24632L11.997 7.61074L11.9427 7.7594L11.9003 7.87369L14.7448 11.4103C14.7463 11.4127 14.7479 11.4143 14.7495 11.4167L14.9414 11.654C14.9541 11.67 14.9661 11.6868 14.9765 11.7044C15.0764 11.8698 15.1444 12.0505 15.1779 12.2431C15.273 12.7826 15.0812 13.3284 14.676 13.6897C14.656 13.7129 14.6345 13.7344 14.6105 13.7536L11.8563 15.9507L11.6789 16.0922L11.6022 16.1537L10.7406 16.8402V16.841L10.3937 17.1176L9.85747 17.5452L9.39951 17.9112L8.11035 18.9398C8.72016 19.0677 9.35155 19.1364 9.99973 19.1364C15.0461 19.1364 19.1365 15.046 19.1365 9.99964C19.1365 6.42789 17.0857 3.33727 14.099 1.83472Z\" fill=\"#0FA389\"/>\n <path d=\"M14.7287 12.3222C14.7047 12.1832 14.6551 12.0545 14.5864 11.941L14.3954 11.7036C14.3954 11.7036 14.3946 11.7028 14.3938 11.7028L11.3839 7.96005L10.5031 6.86511L10.4256 6.7676L9.03255 5.03487L8.83674 4.79191C8.79278 4.71678 8.75681 4.63446 8.73204 4.54814C8.72085 4.51058 8.71286 4.47222 8.70566 4.43465C8.68568 4.32196 8.68408 4.21007 8.69847 4.10217L8.62334 4.16291L8.44511 4.30438L5.75731 6.44871L5.60066 6.57339C5.34011 6.82275 5.20584 7.19279 5.27218 7.57482C5.29296 7.68751 5.32892 7.79541 5.37927 7.89292C5.37927 7.89292 5.37927 7.89292 5.38007 7.89371L5.6566 8.23818L8.57139 11.8627L8.63293 11.9394L9.53047 13.0559L9.59041 13.1303L9.98363 13.6186L11.0178 14.9046C11.0186 14.9054 11.0194 14.9069 11.0202 14.9077L11.1361 15.0516V15.0524C11.2184 15.1755 11.2768 15.317 11.3048 15.4728C11.3239 15.5807 11.3263 15.6878 11.3143 15.7925L11.3175 15.7965L11.3943 15.735L11.5717 15.5935L14.3266 13.3964L14.3218 13.3908C14.6335 13.1438 14.8022 12.7394 14.7287 12.3222Z\" fill=\"#F3F3F5\"/>\n <path d=\"M10.6822 15.0082C10.6814 15.0074 10.6806 15.0058 10.6806 15.005L10.5672 14.8643L10.3809 14.6325L10.3282 14.567L10.2211 14.4335L9.40028 13.4129L9.32835 13.3242L8.77289 12.6345L8.68098 12.5194L8.44121 12.2205L8.37168 12.4099L8.04159 13.317L8.0376 13.329L7.95128 13.5664L6.42475 17.7623L6.24333 18.2618L5.90605 19.1881L5.73262 19.6645C5.73182 19.6661 5.73102 19.6677 5.73102 19.6685C5.72863 19.6749 5.72703 19.6821 5.72543 19.6885C5.71584 19.7228 5.71424 19.758 5.72063 19.7948C5.74461 19.929 5.87329 20.0193 6.00836 19.9962C6.04112 19.9898 6.07229 19.9778 6.09867 19.9602C6.09867 19.9602 6.09947 19.9602 6.10027 19.9594L6.14103 19.9266L7.39422 18.9268L9.11496 17.5537L9.57292 17.1877L10.1092 16.7601L10.4561 16.4827L10.4537 16.4811C10.7582 16.2382 10.9236 15.8402 10.8509 15.4294C10.8237 15.2735 10.7654 15.1313 10.6822 15.0082Z\" fill=\"#0C847B\"/>\n <path d=\"M9.17644 4.56325C9.2124 4.68713 9.26915 4.80062 9.34268 4.90053C9.34348 4.90053 9.34428 4.90213 9.34428 4.90213L9.40342 4.97645C9.40502 4.97805 9.40582 4.97885 9.40662 4.98045L9.56806 5.17946L9.64878 5.28096L9.67915 5.31932L9.8414 5.51993L10.5559 6.40947L10.7054 6.59569L11.2169 7.23188L11.5142 7.60192L11.5693 7.45247L13.5202 2.08964L14.1596 0.332135C14.1596 0.330536 14.1604 0.328139 14.1612 0.32654C14.174 0.288177 14.1772 0.246617 14.17 0.205058C14.1468 0.0699879 14.0182 -0.0195258 13.8823 0.00365186C13.8407 0.0116442 13.8024 0.028428 13.7712 0.0540033L12.578 1.00589L12.498 1.06982L10.6958 2.50844L9.85658 3.17819L9.8326 3.19737L9.6296 3.35961L9.45297 3.50028C9.2116 3.73925 9.08692 4.08931 9.15006 4.44976C9.15726 4.48813 9.16525 4.52649 9.17644 4.56325Z\" fill=\"#0C847B\"/>\n </svg>\n</ng-template>",
11503
- styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}.iassist-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;border:none;border-radius:50%;box-shadow:none;cursor:pointer;height:32px;width:32px}.dialog-header{display:-ms-flexbox;display:flex;gap:12px}.dialog-header .iassist-icon{display:block;height:24px;width:24px}"]
11668
+ template: "<s-field-label [field]=\"field\"\n *ngIf=\"textArea.renderTextArea\"\n [fieldContainerRef]=\"textArea.textAreaElement?.nativeElement\"></s-field-label>\n\n<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\">\n</s-loading-state>\n\n<p-dialog\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <p-header>\n <div class=\"dialog-header\">\n <span class=\"iassist-icon\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </span>\n IAssist - Content Generator\n </div>\n </p-header>\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <s-textarea\n #textArea\n [inputId]=\"(field.id || field.name)\"\n [rows]=\"field.rows\"\n [formControl]=\"formControl\"\n [inputStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n [speechRecognition]=\"field.speechRecognition\"\n [placeholder]=\"field.placeholder\"\n ></s-textarea>\n <button\n class=\"iassist-button\"\n [class.speech-recognition]=\"field.speechRecognition && speechRecognitionService.hasSupportSpeechRecognition\"\n (click)=\"showDialog()\"\n sTooltip=\"IAssist - Content Generator\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </button>\n</div>\n\n<ng-template #iassistIcon>\n <svg style=\"width: 100%; height: 100%;\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.81451 18.1054L5.99593 17.6059L7.52166 13.4099L7.60877 13.1726L7.61277 13.1614L7.94285 12.2543L8.01159 12.0648L8.05394 11.949L5.2998 8.52426L5.02726 8.18379C5.00569 8.15821 4.9881 8.13104 4.97292 8.10226C4.90099 7.9632 4.85063 7.81294 4.82186 7.6531C4.73075 7.1344 4.90418 6.60771 5.28382 6.24326C5.29421 6.23447 5.3038 6.22567 5.31419 6.21688L5.47164 6.0914L9.3439 3.00238L9.5469 2.84094L9.57088 2.82096L10.4101 2.15041L11.8007 1.04188C11.2181 0.925188 10.6163 0.863647 10.0001 0.863647C4.95374 0.863647 0.863281 4.9541 0.863281 9.99963C0.863281 13.5346 2.87254 16.5989 5.80971 18.1182\" fill=\"#0FA389\"/>\n <path d=\"M14.099 1.83472L13.9495 2.24632L11.997 7.61074L11.9427 7.7594L11.9003 7.87369L14.7448 11.4103C14.7463 11.4127 14.7479 11.4143 14.7495 11.4167L14.9414 11.654C14.9541 11.67 14.9661 11.6868 14.9765 11.7044C15.0764 11.8698 15.1444 12.0505 15.1779 12.2431C15.273 12.7826 15.0812 13.3284 14.676 13.6897C14.656 13.7129 14.6345 13.7344 14.6105 13.7536L11.8563 15.9507L11.6789 16.0922L11.6022 16.1537L10.7406 16.8402V16.841L10.3937 17.1176L9.85747 17.5452L9.39951 17.9112L8.11035 18.9398C8.72016 19.0677 9.35155 19.1364 9.99973 19.1364C15.0461 19.1364 19.1365 15.046 19.1365 9.99964C19.1365 6.42789 17.0857 3.33727 14.099 1.83472Z\" fill=\"#0FA389\"/>\n <path d=\"M14.7287 12.3222C14.7047 12.1832 14.6551 12.0545 14.5864 11.941L14.3954 11.7036C14.3954 11.7036 14.3946 11.7028 14.3938 11.7028L11.3839 7.96005L10.5031 6.86511L10.4256 6.7676L9.03255 5.03487L8.83674 4.79191C8.79278 4.71678 8.75681 4.63446 8.73204 4.54814C8.72085 4.51058 8.71286 4.47222 8.70566 4.43465C8.68568 4.32196 8.68408 4.21007 8.69847 4.10217L8.62334 4.16291L8.44511 4.30438L5.75731 6.44871L5.60066 6.57339C5.34011 6.82275 5.20584 7.19279 5.27218 7.57482C5.29296 7.68751 5.32892 7.79541 5.37927 7.89292C5.37927 7.89292 5.37927 7.89292 5.38007 7.89371L5.6566 8.23818L8.57139 11.8627L8.63293 11.9394L9.53047 13.0559L9.59041 13.1303L9.98363 13.6186L11.0178 14.9046C11.0186 14.9054 11.0194 14.9069 11.0202 14.9077L11.1361 15.0516V15.0524C11.2184 15.1755 11.2768 15.317 11.3048 15.4728C11.3239 15.5807 11.3263 15.6878 11.3143 15.7925L11.3175 15.7965L11.3943 15.735L11.5717 15.5935L14.3266 13.3964L14.3218 13.3908C14.6335 13.1438 14.8022 12.7394 14.7287 12.3222Z\" fill=\"#F3F3F5\"/>\n <path d=\"M10.6822 15.0082C10.6814 15.0074 10.6806 15.0058 10.6806 15.005L10.5672 14.8643L10.3809 14.6325L10.3282 14.567L10.2211 14.4335L9.40028 13.4129L9.32835 13.3242L8.77289 12.6345L8.68098 12.5194L8.44121 12.2205L8.37168 12.4099L8.04159 13.317L8.0376 13.329L7.95128 13.5664L6.42475 17.7623L6.24333 18.2618L5.90605 19.1881L5.73262 19.6645C5.73182 19.6661 5.73102 19.6677 5.73102 19.6685C5.72863 19.6749 5.72703 19.6821 5.72543 19.6885C5.71584 19.7228 5.71424 19.758 5.72063 19.7948C5.74461 19.929 5.87329 20.0193 6.00836 19.9962C6.04112 19.9898 6.07229 19.9778 6.09867 19.9602C6.09867 19.9602 6.09947 19.9602 6.10027 19.9594L6.14103 19.9266L7.39422 18.9268L9.11496 17.5537L9.57292 17.1877L10.1092 16.7601L10.4561 16.4827L10.4537 16.4811C10.7582 16.2382 10.9236 15.8402 10.8509 15.4294C10.8237 15.2735 10.7654 15.1313 10.6822 15.0082Z\" fill=\"#0C847B\"/>\n <path d=\"M9.17644 4.56325C9.2124 4.68713 9.26915 4.80062 9.34268 4.90053C9.34348 4.90053 9.34428 4.90213 9.34428 4.90213L9.40342 4.97645C9.40502 4.97805 9.40582 4.97885 9.40662 4.98045L9.56806 5.17946L9.64878 5.28096L9.67915 5.31932L9.8414 5.51993L10.5559 6.40947L10.7054 6.59569L11.2169 7.23188L11.5142 7.60192L11.5693 7.45247L13.5202 2.08964L14.1596 0.332135C14.1596 0.330536 14.1604 0.328139 14.1612 0.32654C14.174 0.288177 14.1772 0.246617 14.17 0.205058C14.1468 0.0699879 14.0182 -0.0195258 13.8823 0.00365186C13.8407 0.0116442 13.8024 0.028428 13.7712 0.0540033L12.578 1.00589L12.498 1.06982L10.6958 2.50844L9.85658 3.17819L9.8326 3.19737L9.6296 3.35961L9.45297 3.50028C9.2116 3.73925 9.08692 4.08931 9.15006 4.44976C9.15726 4.48813 9.16525 4.52649 9.17644 4.56325Z\" fill=\"#0C847B\"/>\n </svg>\n</ng-template>\n",
11669
+ styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}.textarea-ia s-textarea{width:100%}.iassist-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;border:none;border-radius:50%;box-shadow:none;cursor:pointer;height:32px;width:32px}.dialog-header{display:-ms-flexbox;display:flex;gap:12px}.dialog-header .iassist-icon{display:block;height:24px;width:24px}.speech-recognition{margin-bottom:12.5px}"]
11504
11670
  })
11505
11671
  ], TextAreaIAFieldComponent);
11506
11672
  return TextAreaIAFieldComponent;
@@ -11527,7 +11693,7 @@
11527
11693
  ], TextAreaFieldComponent.prototype, "inputRef", void 0);
11528
11694
  TextAreaFieldComponent = __decorate([
11529
11695
  core.Component({
11530
- 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"
11696
+ 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 [inputStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n [keyFilter]=\"field.keyFilter\"\n [placeholder]=\"field.placeholder\"\n [speechRecognition]=\"field.speechRecognition\">\n</s-textarea>\n"
11531
11697
  })
11532
11698
  ], TextAreaFieldComponent);
11533
11699
  return TextAreaFieldComponent;
@@ -13392,7 +13558,8 @@
13392
13558
  }());
13393
13559
 
13394
13560
  var TextAreaComponent = /** @class */ (function () {
13395
- function TextAreaComponent() {
13561
+ function TextAreaComponent(cdr) {
13562
+ this.cdr = cdr;
13396
13563
  this.onChange = function () { };
13397
13564
  this.onTouched = function () { };
13398
13565
  this.disabled = false;
@@ -13400,6 +13567,9 @@
13400
13567
  this.inputId = "textarea-" + Math.random();
13401
13568
  this.rows = 5;
13402
13569
  this.speechRecognition = false;
13570
+ this._inputStyle = {
13571
+ resize: 'vertical'
13572
+ };
13403
13573
  this.readOnly = false;
13404
13574
  this.renderTextArea = false;
13405
13575
  }
@@ -13413,11 +13583,37 @@
13413
13583
  this._textAreaElement = value;
13414
13584
  setTimeout(function () {
13415
13585
  _this.renderTextArea = true;
13586
+ _this.cdr.detectChanges();
13416
13587
  });
13417
13588
  },
13418
13589
  enumerable: true,
13419
13590
  configurable: true
13420
13591
  });
13592
+ Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
13593
+ get: function () {
13594
+ return this._placeholder;
13595
+ },
13596
+ set: function (value) {
13597
+ if (value) {
13598
+ this._placeholder = value;
13599
+ }
13600
+ else {
13601
+ this._placeholder = '';
13602
+ }
13603
+ },
13604
+ enumerable: true,
13605
+ configurable: true
13606
+ });
13607
+ Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
13608
+ get: function () {
13609
+ return this._inputStyle;
13610
+ },
13611
+ set: function (value) {
13612
+ this._inputStyle = __assign(__assign({}, value), this._inputStyle);
13613
+ },
13614
+ enumerable: true,
13615
+ configurable: true
13616
+ });
13421
13617
  TextAreaComponent.prototype.writeValue = function (obj) {
13422
13618
  this.value = obj;
13423
13619
  };
@@ -13443,6 +13639,9 @@
13443
13639
  this.setValue(recognizedText);
13444
13640
  };
13445
13641
  var TextAreaComponent_1;
13642
+ TextAreaComponent.ctorParameters = function () { return [
13643
+ { type: core.ChangeDetectorRef }
13644
+ ]; };
13446
13645
  __decorate([
13447
13646
  core.ViewChild('textArea', { read: core.ElementRef })
13448
13647
  ], TextAreaComponent.prototype, "textAreaElement", null);
@@ -13460,14 +13659,17 @@
13460
13659
  ], TextAreaComponent.prototype, "keyFilter", void 0);
13461
13660
  __decorate([
13462
13661
  core.Input()
13463
- ], TextAreaComponent.prototype, "inputStyle", void 0);
13662
+ ], TextAreaComponent.prototype, "placeholder", null);
13663
+ __decorate([
13664
+ core.Input()
13665
+ ], TextAreaComponent.prototype, "inputStyle", null);
13464
13666
  __decorate([
13465
13667
  core.Input()
13466
13668
  ], TextAreaComponent.prototype, "readOnly", void 0);
13467
13669
  TextAreaComponent = TextAreaComponent_1 = __decorate([
13468
13670
  core.Component({
13469
13671
  selector: 's-textarea',
13470
- 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",
13672
+ 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 (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 (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",
13471
13673
  providers: [
13472
13674
  {
13473
13675
  provide: forms.NG_VALUE_ACCESSOR,
@@ -13481,103 +13683,6 @@
13481
13683
  return TextAreaComponent;
13482
13684
  }());
13483
13685
 
13484
- var SpeechRecognitionService = /** @class */ (function () {
13485
- function SpeechRecognitionService(localeService, ngZone) {
13486
- this.localeService = localeService;
13487
- this.ngZone = ngZone;
13488
- this.isListening = false;
13489
- this.TIMEOUT_NO_MESSAGE = 3000;
13490
- this.setRecognition();
13491
- }
13492
- SpeechRecognitionService.prototype.listen = function () {
13493
- var _this = this;
13494
- if (this.isListening) {
13495
- return;
13496
- }
13497
- var speechSubject = new rxjs.Subject();
13498
- this.isListening = true;
13499
- this.recognition.continuous = true;
13500
- this.recognition.interimResults = true;
13501
- this.recognition.maxAlternatives = 1;
13502
- var silenceTimer;
13503
- var restartSilenceTimer = function () {
13504
- if (silenceTimer !== undefined) {
13505
- clearTimeout(silenceTimer);
13506
- }
13507
- silenceTimer = setTimeout(function () {
13508
- _this.recognition.stop();
13509
- }, _this.TIMEOUT_NO_MESSAGE);
13510
- };
13511
- var fullTranscript = '';
13512
- var interimTranscript = '';
13513
- this.recognition.onresult = function (event) {
13514
- _this.ngZone.run(function () {
13515
- restartSilenceTimer();
13516
- var interimTranscript = '';
13517
- for (var i = event.resultIndex; i < event.results.length; ++i) {
13518
- var transcript = event.results[i][0].transcript;
13519
- if (event.results[i].isFinal) {
13520
- fullTranscript += transcript + '\n';
13521
- }
13522
- else {
13523
- interimTranscript += transcript;
13524
- }
13525
- }
13526
- interimTranscript = interimTranscript;
13527
- speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
13528
- });
13529
- };
13530
- this.recognition.onerror = function () {
13531
- _this.ngZone.run(function () {
13532
- if (silenceTimer !== undefined) {
13533
- clearTimeout(silenceTimer);
13534
- }
13535
- _this.isListening = false;
13536
- speechSubject.next({
13537
- isFinal: true,
13538
- text: ''
13539
- });
13540
- });
13541
- };
13542
- this.recognition.onend = function () {
13543
- _this.ngZone.run(function () {
13544
- if (silenceTimer !== undefined) {
13545
- clearTimeout(silenceTimer);
13546
- }
13547
- speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
13548
- _this.isListening = false;
13549
- speechSubject.complete();
13550
- });
13551
- };
13552
- this.recognition.start();
13553
- return speechSubject;
13554
- };
13555
- SpeechRecognitionService.prototype.stop = function () {
13556
- this.recognition.stop();
13557
- };
13558
- SpeechRecognitionService.prototype.setRecognition = function () {
13559
- var SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
13560
- if (!SpeechRecognitionConstructor) {
13561
- throw new Error('Speech recognition is not supported in this browser.');
13562
- }
13563
- this.recognition = new SpeechRecognitionConstructor();
13564
- this.recognition.lang = this.localeService.getLocaleOptions().locale || 'pt-BR';
13565
- this.recognition.interimResults = false;
13566
- this.recognition.maxAlternatives = 1;
13567
- };
13568
- SpeechRecognitionService.ctorParameters = function () { return [
13569
- { type: LocaleService },
13570
- { type: core.NgZone }
13571
- ]; };
13572
- SpeechRecognitionService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function SpeechRecognitionService_Factory() { return new SpeechRecognitionService(core["ɵɵinject"](LocaleService), core["ɵɵinject"](core.NgZone)); }, token: SpeechRecognitionService, providedIn: "root" });
13573
- SpeechRecognitionService = __decorate([
13574
- core.Injectable({
13575
- providedIn: 'root'
13576
- })
13577
- ], SpeechRecognitionService);
13578
- return SpeechRecognitionService;
13579
- }());
13580
-
13581
13686
  var TextToSpeechService = /** @class */ (function () {
13582
13687
  function TextToSpeechService(locale, ngZone) {
13583
13688
  this.locale = locale;
@@ -13592,10 +13697,13 @@
13592
13697
  if (!_voices.length) {
13593
13698
  speechSynthesis.onvoiceschanged = function () {
13594
13699
  _this.ngZone.run(function () {
13700
+ var _a;
13595
13701
  _voices = speechSynthesis.getVoices();
13596
- var currentLang = _this.locale.getLocaleOptions().locale || 'pt-BR';
13597
- _this.voices = _voices.filter(function (voice) { return voice.lang === currentLang; });
13598
- _this.activeVoice = _this.voices[0];
13702
+ var currentLang = ((_a = _this.locale.getLocaleOptions()) === null || _a === void 0 ? void 0 : _a.locale) || 'pt-BR';
13703
+ _this.setActiveVoice(_voices, currentLang);
13704
+ _this.locale.getLocale().subscribe(function (locale) {
13705
+ _this.setActiveVoice(_voices, locale);
13706
+ });
13599
13707
  });
13600
13708
  };
13601
13709
  }
@@ -13642,6 +13750,12 @@
13642
13750
  enumerable: true,
13643
13751
  configurable: true
13644
13752
  });
13753
+ TextToSpeechService.prototype.setActiveVoice = function (voices, lang) {
13754
+ var _voice = voices.find(function (voice) { return voice.lang === lang; });
13755
+ if (_voice) {
13756
+ this.activeVoice = _voice;
13757
+ }
13758
+ };
13645
13759
  TextToSpeechService.ctorParameters = function () { return [
13646
13760
  { type: LocaleService },
13647
13761
  { type: core.NgZone }
@@ -13666,19 +13780,11 @@
13666
13780
  this.isDoneSpeaking = false;
13667
13781
  this.onDestroy$ = new rxjs.Subject();
13668
13782
  this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
13669
- this.SPEECH_RECOGNITION_MARGIN_OFFSET = 13;
13670
13783
  this.keydownEventListener = function (event) {
13671
13784
  if (_this.disabled) {
13672
13785
  event.preventDefault();
13673
13786
  }
13674
13787
  };
13675
- this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER = new MutationObserver(function () {
13676
- _this.SPEECH_CONTAINER_WIDTH_CALLBACK();
13677
- });
13678
- this.SPEECH_CONTAINER_WIDTH_CALLBACK = function () {
13679
- _this.setSpeechContainerWidth();
13680
- };
13681
- this.speechRecognitionContainerWidth = 0;
13682
13788
  this.disabled = false;
13683
13789
  this.isSpeaking = false;
13684
13790
  this.voiceSpeed = 1;
@@ -13693,20 +13799,14 @@
13693
13799
  this.recognizedText = new core.EventEmitter();
13694
13800
  }
13695
13801
  SpeechRecognitionComponent.prototype.ngOnInit = function () {
13802
+ if (!this.hasSpeechRecognitionBrowserApi) {
13803
+ return;
13804
+ }
13696
13805
  if (!this.textAreaElement) {
13697
13806
  throw new Error('textAreaElement is required');
13698
13807
  }
13699
13808
  this.textAreaElement.placeholder = this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
13700
13809
  this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
13701
- var config = { attributes: true, childList: true, subtree: true };
13702
- this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER.observe(this.textAreaElement, config);
13703
- window.addEventListener('resize', this.SPEECH_CONTAINER_WIDTH_CALLBACK);
13704
- };
13705
- SpeechRecognitionComponent.prototype.ngAfterViewInit = function () {
13706
- var _this = this;
13707
- setTimeout(function () {
13708
- _this.setSpeechContainerWidth();
13709
- });
13710
13810
  };
13711
13811
  SpeechRecognitionComponent.prototype.onListen = function () {
13712
13812
  var _this = this;
@@ -13780,9 +13880,6 @@
13780
13880
  SpeechRecognitionComponent.prototype.ngOnDestroy = function () {
13781
13881
  this.onDestroy$.next();
13782
13882
  this.onDestroy$.complete();
13783
- this.textAreaElement.removeEventListener('keydown', this.keydownEventListener);
13784
- window.removeEventListener('resize', this.SPEECH_CONTAINER_WIDTH_CALLBACK);
13785
- this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER.disconnect();
13786
13883
  };
13787
13884
  SpeechRecognitionComponent.prototype.toggleTextToSpeech = function () {
13788
13885
  if (this.isPlayingTextToSpeech) {
@@ -13820,6 +13917,13 @@
13820
13917
  enumerable: true,
13821
13918
  configurable: true
13822
13919
  });
13920
+ Object.defineProperty(SpeechRecognitionComponent.prototype, "hasSpeechRecognitionBrowserApi", {
13921
+ get: function () {
13922
+ return this.speechRecognitionService.hasSupportSpeechRecognition;
13923
+ },
13924
+ enumerable: true,
13925
+ configurable: true
13926
+ });
13823
13927
  Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
13824
13928
  get: function () {
13825
13929
  var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
@@ -13839,9 +13943,6 @@
13839
13943
  _this.isDoneSpeaking = true;
13840
13944
  });
13841
13945
  };
13842
- SpeechRecognitionComponent.prototype.setSpeechContainerWidth = function () {
13843
- this.speechRecognitionContainerWidth = this.textAreaElement.getBoundingClientRect().width - this.SPEECH_RECOGNITION_MARGIN_OFFSET;
13844
- };
13845
13946
  SpeechRecognitionComponent.ctorParameters = function () { return [
13846
13947
  { type: SpeechRecognitionService },
13847
13948
  { type: TextToSpeechService },
@@ -13856,8 +13957,8 @@
13856
13957
  SpeechRecognitionComponent = __decorate([
13857
13958
  core.Component({
13858
13959
  selector: 's-speech-recognition',
13859
- 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",
13860
- 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}"]
13960
+ 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",
13961
+ 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}"]
13861
13962
  })
13862
13963
  ], SpeechRecognitionComponent);
13863
13964
  return SpeechRecognitionComponent;
@@ -17825,10 +17926,12 @@
17825
17926
 
17826
17927
  var TextAreaIAComponent = /** @class */ (function () {
17827
17928
  function TextAreaIAComponent(_iassistService, // Mover pra uma pasta global
17828
- _formBuilder, _translateService) {
17929
+ _formBuilder, _translateService, speechRecognitionService) {
17829
17930
  this._iassistService = _iassistService;
17830
17931
  this._formBuilder = _formBuilder;
17831
17932
  this._translateService = _translateService;
17933
+ this.speechRecognitionService = speechRecognitionService;
17934
+ this.speechRecognition = false;
17832
17935
  this.isVisible = false;
17833
17936
  this.isLoading = false;
17834
17937
  }
@@ -17893,6 +17996,7 @@
17893
17996
  type: exports.FieldType.Text,
17894
17997
  label: this._translateService.instant("platform.angular_components.context"),
17895
17998
  size: { sm: 12, md: 12, lg: 12, xl: 12 },
17999
+ speechRecognition: this.speechRecognition
17896
18000
  }),
17897
18001
  ];
17898
18002
  };
@@ -17905,7 +18009,8 @@
17905
18009
  TextAreaIAComponent.ctorParameters = function () { return [
17906
18010
  { type: IAssistService },
17907
18011
  { type: forms.FormBuilder },
17908
- { type: core$1.TranslateService }
18012
+ { type: core$1.TranslateService },
18013
+ { type: SpeechRecognitionService }
17909
18014
  ]; };
17910
18015
  __decorate([
17911
18016
  core.Input()
@@ -17928,10 +18033,13 @@
17928
18033
  __decorate([
17929
18034
  core.Input()
17930
18035
  ], TextAreaIAComponent.prototype, "cols", void 0);
18036
+ __decorate([
18037
+ core.Input()
18038
+ ], TextAreaIAComponent.prototype, "speechRecognition", void 0);
17931
18039
  TextAreaIAComponent = TextAreaIAComponent_1 = __decorate([
17932
18040
  core.Component({
17933
18041
  selector: "s-text-area-ia",
17934
- template: "<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\"> \n</s-loading-state>\n\n<p-dialog\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <p-header>\n <div class=\"dialog-header\">\n <span class=\"iassist-icon\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </span>\n IAssist - Content Generator\n </div>\n </p-header>\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <textarea\n [id]=\"id\"\n class=\"textarea-input\"\n pInputTextarea\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [rows]=\"rows\"\n [cols]=\"cols\"\n [readOnly]=\"readonly\">\n </textarea>\n <button\n class=\"iassist-button\"\n (click)=\"showDialog()\"\n sTooltip=\"IAssist - Content Generator\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </button>\n</div>\n\n<ng-template #iassistIcon>\n <svg style=\"width: 100%; height: 100%;\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.81451 18.1054L5.99593 17.6059L7.52166 13.4099L7.60877 13.1726L7.61277 13.1614L7.94285 12.2543L8.01159 12.0648L8.05394 11.949L5.2998 8.52426L5.02726 8.18379C5.00569 8.15821 4.9881 8.13104 4.97292 8.10226C4.90099 7.9632 4.85063 7.81294 4.82186 7.6531C4.73075 7.1344 4.90418 6.60771 5.28382 6.24326C5.29421 6.23447 5.3038 6.22567 5.31419 6.21688L5.47164 6.0914L9.3439 3.00238L9.5469 2.84094L9.57088 2.82096L10.4101 2.15041L11.8007 1.04188C11.2181 0.925188 10.6163 0.863647 10.0001 0.863647C4.95374 0.863647 0.863281 4.9541 0.863281 9.99963C0.863281 13.5346 2.87254 16.5989 5.80971 18.1182\" fill=\"#0FA389\"/>\n <path d=\"M14.099 1.83472L13.9495 2.24632L11.997 7.61074L11.9427 7.7594L11.9003 7.87369L14.7448 11.4103C14.7463 11.4127 14.7479 11.4143 14.7495 11.4167L14.9414 11.654C14.9541 11.67 14.9661 11.6868 14.9765 11.7044C15.0764 11.8698 15.1444 12.0505 15.1779 12.2431C15.273 12.7826 15.0812 13.3284 14.676 13.6897C14.656 13.7129 14.6345 13.7344 14.6105 13.7536L11.8563 15.9507L11.6789 16.0922L11.6022 16.1537L10.7406 16.8402V16.841L10.3937 17.1176L9.85747 17.5452L9.39951 17.9112L8.11035 18.9398C8.72016 19.0677 9.35155 19.1364 9.99973 19.1364C15.0461 19.1364 19.1365 15.046 19.1365 9.99964C19.1365 6.42789 17.0857 3.33727 14.099 1.83472Z\" fill=\"#0FA389\"/>\n <path d=\"M14.7287 12.3222C14.7047 12.1832 14.6551 12.0545 14.5864 11.941L14.3954 11.7036C14.3954 11.7036 14.3946 11.7028 14.3938 11.7028L11.3839 7.96005L10.5031 6.86511L10.4256 6.7676L9.03255 5.03487L8.83674 4.79191C8.79278 4.71678 8.75681 4.63446 8.73204 4.54814C8.72085 4.51058 8.71286 4.47222 8.70566 4.43465C8.68568 4.32196 8.68408 4.21007 8.69847 4.10217L8.62334 4.16291L8.44511 4.30438L5.75731 6.44871L5.60066 6.57339C5.34011 6.82275 5.20584 7.19279 5.27218 7.57482C5.29296 7.68751 5.32892 7.79541 5.37927 7.89292C5.37927 7.89292 5.37927 7.89292 5.38007 7.89371L5.6566 8.23818L8.57139 11.8627L8.63293 11.9394L9.53047 13.0559L9.59041 13.1303L9.98363 13.6186L11.0178 14.9046C11.0186 14.9054 11.0194 14.9069 11.0202 14.9077L11.1361 15.0516V15.0524C11.2184 15.1755 11.2768 15.317 11.3048 15.4728C11.3239 15.5807 11.3263 15.6878 11.3143 15.7925L11.3175 15.7965L11.3943 15.735L11.5717 15.5935L14.3266 13.3964L14.3218 13.3908C14.6335 13.1438 14.8022 12.7394 14.7287 12.3222Z\" fill=\"#F3F3F5\"/>\n <path d=\"M10.6822 15.0082C10.6814 15.0074 10.6806 15.0058 10.6806 15.005L10.5672 14.8643L10.3809 14.6325L10.3282 14.567L10.2211 14.4335L9.40028 13.4129L9.32835 13.3242L8.77289 12.6345L8.68098 12.5194L8.44121 12.2205L8.37168 12.4099L8.04159 13.317L8.0376 13.329L7.95128 13.5664L6.42475 17.7623L6.24333 18.2618L5.90605 19.1881L5.73262 19.6645C5.73182 19.6661 5.73102 19.6677 5.73102 19.6685C5.72863 19.6749 5.72703 19.6821 5.72543 19.6885C5.71584 19.7228 5.71424 19.758 5.72063 19.7948C5.74461 19.929 5.87329 20.0193 6.00836 19.9962C6.04112 19.9898 6.07229 19.9778 6.09867 19.9602C6.09867 19.9602 6.09947 19.9602 6.10027 19.9594L6.14103 19.9266L7.39422 18.9268L9.11496 17.5537L9.57292 17.1877L10.1092 16.7601L10.4561 16.4827L10.4537 16.4811C10.7582 16.2382 10.9236 15.8402 10.8509 15.4294C10.8237 15.2735 10.7654 15.1313 10.6822 15.0082Z\" fill=\"#0C847B\"/>\n <path d=\"M9.17644 4.56325C9.2124 4.68713 9.26915 4.80062 9.34268 4.90053C9.34348 4.90053 9.34428 4.90213 9.34428 4.90213L9.40342 4.97645C9.40502 4.97805 9.40582 4.97885 9.40662 4.98045L9.56806 5.17946L9.64878 5.28096L9.67915 5.31932L9.8414 5.51993L10.5559 6.40947L10.7054 6.59569L11.2169 7.23188L11.5142 7.60192L11.5693 7.45247L13.5202 2.08964L14.1596 0.332135C14.1596 0.330536 14.1604 0.328139 14.1612 0.32654C14.174 0.288177 14.1772 0.246617 14.17 0.205058C14.1468 0.0699879 14.0182 -0.0195258 13.8823 0.00365186C13.8407 0.0116442 13.8024 0.028428 13.7712 0.0540033L12.578 1.00589L12.498 1.06982L10.6958 2.50844L9.85658 3.17819L9.8326 3.19737L9.6296 3.35961L9.45297 3.50028C9.2116 3.73925 9.08692 4.08931 9.15006 4.44976C9.15726 4.48813 9.16525 4.52649 9.17644 4.56325Z\" fill=\"#0C847B\"/>\n </svg>\n</ng-template>",
18042
+ template: "<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\">\n</s-loading-state>\n\n<p-dialog\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <p-header>\n <div class=\"dialog-header\">\n <span class=\"iassist-icon\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </span>\n IAssist - Content Generator\n </div>\n </p-header>\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <s-textarea\n [inputId]=\"id\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [readOnly]=\"readonly\"\n [placeholder]=\"placeholder\"\n [speechRecognition]=\"speechRecognition\"\n ></s-textarea>\n <button\n class=\"iassist-button\"\n [class.speech-recognition]=\"speechRecognition && speechRecognitionService.hasSupportSpeechRecognition\"\n (click)=\"showDialog()\"\n sTooltip=\"IAssist - Content Generator\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </button>\n</div>\n\n<ng-template #iassistIcon>\n <svg style=\"width: 100%; height: 100%;\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.81451 18.1054L5.99593 17.6059L7.52166 13.4099L7.60877 13.1726L7.61277 13.1614L7.94285 12.2543L8.01159 12.0648L8.05394 11.949L5.2998 8.52426L5.02726 8.18379C5.00569 8.15821 4.9881 8.13104 4.97292 8.10226C4.90099 7.9632 4.85063 7.81294 4.82186 7.6531C4.73075 7.1344 4.90418 6.60771 5.28382 6.24326C5.29421 6.23447 5.3038 6.22567 5.31419 6.21688L5.47164 6.0914L9.3439 3.00238L9.5469 2.84094L9.57088 2.82096L10.4101 2.15041L11.8007 1.04188C11.2181 0.925188 10.6163 0.863647 10.0001 0.863647C4.95374 0.863647 0.863281 4.9541 0.863281 9.99963C0.863281 13.5346 2.87254 16.5989 5.80971 18.1182\" fill=\"#0FA389\"/>\n <path d=\"M14.099 1.83472L13.9495 2.24632L11.997 7.61074L11.9427 7.7594L11.9003 7.87369L14.7448 11.4103C14.7463 11.4127 14.7479 11.4143 14.7495 11.4167L14.9414 11.654C14.9541 11.67 14.9661 11.6868 14.9765 11.7044C15.0764 11.8698 15.1444 12.0505 15.1779 12.2431C15.273 12.7826 15.0812 13.3284 14.676 13.6897C14.656 13.7129 14.6345 13.7344 14.6105 13.7536L11.8563 15.9507L11.6789 16.0922L11.6022 16.1537L10.7406 16.8402V16.841L10.3937 17.1176L9.85747 17.5452L9.39951 17.9112L8.11035 18.9398C8.72016 19.0677 9.35155 19.1364 9.99973 19.1364C15.0461 19.1364 19.1365 15.046 19.1365 9.99964C19.1365 6.42789 17.0857 3.33727 14.099 1.83472Z\" fill=\"#0FA389\"/>\n <path d=\"M14.7287 12.3222C14.7047 12.1832 14.6551 12.0545 14.5864 11.941L14.3954 11.7036C14.3954 11.7036 14.3946 11.7028 14.3938 11.7028L11.3839 7.96005L10.5031 6.86511L10.4256 6.7676L9.03255 5.03487L8.83674 4.79191C8.79278 4.71678 8.75681 4.63446 8.73204 4.54814C8.72085 4.51058 8.71286 4.47222 8.70566 4.43465C8.68568 4.32196 8.68408 4.21007 8.69847 4.10217L8.62334 4.16291L8.44511 4.30438L5.75731 6.44871L5.60066 6.57339C5.34011 6.82275 5.20584 7.19279 5.27218 7.57482C5.29296 7.68751 5.32892 7.79541 5.37927 7.89292C5.37927 7.89292 5.37927 7.89292 5.38007 7.89371L5.6566 8.23818L8.57139 11.8627L8.63293 11.9394L9.53047 13.0559L9.59041 13.1303L9.98363 13.6186L11.0178 14.9046C11.0186 14.9054 11.0194 14.9069 11.0202 14.9077L11.1361 15.0516V15.0524C11.2184 15.1755 11.2768 15.317 11.3048 15.4728C11.3239 15.5807 11.3263 15.6878 11.3143 15.7925L11.3175 15.7965L11.3943 15.735L11.5717 15.5935L14.3266 13.3964L14.3218 13.3908C14.6335 13.1438 14.8022 12.7394 14.7287 12.3222Z\" fill=\"#F3F3F5\"/>\n <path d=\"M10.6822 15.0082C10.6814 15.0074 10.6806 15.0058 10.6806 15.005L10.5672 14.8643L10.3809 14.6325L10.3282 14.567L10.2211 14.4335L9.40028 13.4129L9.32835 13.3242L8.77289 12.6345L8.68098 12.5194L8.44121 12.2205L8.37168 12.4099L8.04159 13.317L8.0376 13.329L7.95128 13.5664L6.42475 17.7623L6.24333 18.2618L5.90605 19.1881L5.73262 19.6645C5.73182 19.6661 5.73102 19.6677 5.73102 19.6685C5.72863 19.6749 5.72703 19.6821 5.72543 19.6885C5.71584 19.7228 5.71424 19.758 5.72063 19.7948C5.74461 19.929 5.87329 20.0193 6.00836 19.9962C6.04112 19.9898 6.07229 19.9778 6.09867 19.9602C6.09867 19.9602 6.09947 19.9602 6.10027 19.9594L6.14103 19.9266L7.39422 18.9268L9.11496 17.5537L9.57292 17.1877L10.1092 16.7601L10.4561 16.4827L10.4537 16.4811C10.7582 16.2382 10.9236 15.8402 10.8509 15.4294C10.8237 15.2735 10.7654 15.1313 10.6822 15.0082Z\" fill=\"#0C847B\"/>\n <path d=\"M9.17644 4.56325C9.2124 4.68713 9.26915 4.80062 9.34268 4.90053C9.34348 4.90053 9.34428 4.90213 9.34428 4.90213L9.40342 4.97645C9.40502 4.97805 9.40582 4.97885 9.40662 4.98045L9.56806 5.17946L9.64878 5.28096L9.67915 5.31932L9.8414 5.51993L10.5559 6.40947L10.7054 6.59569L11.2169 7.23188L11.5142 7.60192L11.5693 7.45247L13.5202 2.08964L14.1596 0.332135C14.1596 0.330536 14.1604 0.328139 14.1612 0.32654C14.174 0.288177 14.1772 0.246617 14.17 0.205058C14.1468 0.0699879 14.0182 -0.0195258 13.8823 0.00365186C13.8407 0.0116442 13.8024 0.028428 13.7712 0.0540033L12.578 1.00589L12.498 1.06982L10.6958 2.50844L9.85658 3.17819L9.8326 3.19737L9.6296 3.35961L9.45297 3.50028C9.2116 3.73925 9.08692 4.08931 9.15006 4.44976C9.15726 4.48813 9.16525 4.52649 9.17644 4.56325Z\" fill=\"#0C847B\"/>\n </svg>\n</ng-template>\n",
17935
18043
  providers: [
17936
18044
  {
17937
18045
  provide: forms.NG_VALUE_ACCESSOR,
@@ -17939,7 +18047,7 @@
17939
18047
  multi: true,
17940
18048
  },
17941
18049
  ],
17942
- styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}.textarea-ia .textarea-input{resize:vertical;width:100%}.iassist-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;border:none;border-radius:50%;box-shadow:none;cursor:pointer;height:32px;width:32px}.dialog-header{display:-ms-flexbox;display:flex;gap:12px}.dialog-header .iassist-icon{display:block;height:24px;width:24px}"]
18050
+ styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}.textarea-ia s-textarea{width:100%}.iassist-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;border:none;border-radius:50%;box-shadow:none;cursor:pointer;height:32px;width:32px}.dialog-header{display:-ms-flexbox;display:flex;gap:12px}.dialog-header .iassist-icon{display:block;height:24px;width:24px}.speech-recognition{margin-bottom:12.5px}"]
17943
18051
  })
17944
18052
  ], TextAreaIAComponent);
17945
18053
  return TextAreaIAComponent;
@@ -17956,10 +18064,10 @@
17956
18064
  forms.ReactiveFormsModule,
17957
18065
  core$1.TranslateModule,
17958
18066
  dialog.DialogModule,
17959
- inputtextarea.InputTextareaModule,
17960
18067
  ButtonModule,
17961
18068
  DynamicFormModule,
17962
18069
  LoadingStateModule,
18070
+ TextAreaModule
17963
18071
  ],
17964
18072
  declarations: [TextAreaIAComponent],
17965
18073
  exports: [TextAreaIAComponent],
@@ -23153,9 +23261,9 @@
23153
23261
  "platform.angular_components.remove_all": "Remover todos",
23154
23262
  "platform.angular_components.country_name_gb": "Reino Unido",
23155
23263
  "platform.angular_components.insight_footer": "Conteúdo gerado por inteligência artificial. Sujeito a imprecisões.",
23156
- "platform.angular_components.text_area_speech_recognition_placeholder": "Preencha o campo, com pelo menos, uma frase",
23157
- "platform.angular_components.text_area_before_speech": "Grave ou ouça o texto clicando nos Ícones",
23158
- "platform.angular_components.text_area_while_speech": "Clique novamente no Ícone para finalizar",
23264
+ "platform.angular_components.text_area_speech_recognition_placeholder": "Preencha o campo com, pelo menos, uma frase",
23265
+ "platform.angular_components.text_area_before_speech": "Grave ou ouça o texto clicando nos ícones",
23266
+ "platform.angular_components.text_area_while_speech": "Clique novamente no ícone para finalizar",
23159
23267
  "platform.angular_components.text_area_end_speech": "Gravação finalizada"
23160
23268
  };
23161
23269