@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.
- package/bundles/seniorsistemas-angular-components.umd.js +278 -170
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/bignumber-input/{number-input.directive.d.ts → bignumber-input.directive.d.ts} +3 -1
- package/components/bignumber-input/index.d.ts +2 -2
- package/components/card/card.component.d.ts +5 -2
- package/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.d.ts +7 -6
- package/components/dynamic-form/configurations/fields/text-area-ia-field.d.ts +4 -6
- package/components/number-input/number-input.directive.d.ts +11 -9
- package/components/speech-recognition/speech-recognition/speech-recognition.component.d.ts +3 -8
- package/components/speech-recognition/speech-recognition.service.d.ts +1 -0
- package/components/speech-recognition/text-to-speech.service.d.ts +1 -0
- package/components/text-area/text-area/text-area.component.d.ts +9 -2
- package/components/text-area-ia/text-area-ia.component.d.ts +4 -1
- package/esm2015/components/bignumber-input/bignumber-input.directive.js +150 -0
- package/esm2015/components/bignumber-input/bignumber-input.module.js +15 -0
- package/esm2015/components/bignumber-input/index.js +3 -3
- package/esm2015/components/card/card.component.js +22 -7
- package/esm2015/components/dynamic-form/components/fields/bignumber/bignumber-field.module.js +2 -2
- package/esm2015/components/dynamic-form/components/fields/text-area/text-area-field.component.js +2 -2
- package/esm2015/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +15 -13
- package/esm2015/components/dynamic-form/configurations/fields/text-area-ia-field.js +7 -2
- package/esm2015/components/dynamic-form/dynamic-form.module.js +2 -2
- package/esm2015/components/inline-edit/inline-edit.module.js +2 -2
- package/esm2015/components/number-input/number-input.directive.js +41 -21
- package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +9 -25
- package/esm2015/components/speech-recognition/speech-recognition.service.js +8 -3
- package/esm2015/components/speech-recognition/text-to-speech.service.js +13 -4
- package/esm2015/components/text-area/text-area/text-area.component.js +33 -5
- package/esm2015/components/text-area-ia/text-area-ia.component.js +13 -5
- package/esm2015/components/text-area-ia/text-area-ia.module.js +3 -3
- package/esm2015/locale/fallback.js +4 -4
- package/esm5/components/bignumber-input/bignumber-input.directive.js +155 -0
- package/esm5/components/bignumber-input/bignumber-input.module.js +18 -0
- package/esm5/components/bignumber-input/index.js +3 -3
- package/esm5/components/card/card.component.js +26 -7
- package/esm5/components/dynamic-form/components/fields/bignumber/bignumber-field.module.js +2 -2
- package/esm5/components/dynamic-form/components/fields/text-area/text-area-field.component.js +2 -2
- package/esm5/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +15 -13
- package/esm5/components/dynamic-form/configurations/fields/text-area-ia-field.js +8 -3
- package/esm5/components/dynamic-form/dynamic-form.module.js +2 -2
- package/esm5/components/inline-edit/inline-edit.module.js +2 -2
- package/esm5/components/number-input/number-input.directive.js +42 -22
- package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +13 -26
- package/esm5/components/speech-recognition/speech-recognition.service.js +9 -3
- package/esm5/components/speech-recognition/text-to-speech.service.js +13 -4
- package/esm5/components/text-area/text-area/text-area.component.js +42 -6
- package/esm5/components/text-area-ia/text-area-ia.component.js +13 -5
- package/esm5/components/text-area-ia/text-area-ia.module.js +3 -3
- package/esm5/locale/fallback.js +4 -4
- package/fesm2015/seniorsistemas-angular-components.js +260 -168
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +280 -172
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
- package/esm2015/components/bignumber-input/number-input.directive.js +0 -132
- package/esm2015/components/bignumber-input/number-input.module.js +0 -15
- package/esm5/components/bignumber-input/number-input.directive.js +0 -137
- package/esm5/components/bignumber-input/number-input.module.js +0 -18
- /package/components/bignumber-input/{number-input.module.d.ts → bignumber-input.module.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __decorate, __assign, __extends, __spread, __awaiter, __generator, __param, __values, __rest
|
|
2
|
-
import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, KeyValueDiffers, HostBinding, ChangeDetectorRef, ViewChildren, Pipe, ɵɵinject, InjectionToken, Inject, PLATFORM_ID, ViewEncapsulation, INJECTOR,
|
|
1
|
+
import { __decorate, __assign, __extends, __read, __spread, __awaiter, __generator, __param, __values, __rest } from 'tslib';
|
|
2
|
+
import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, KeyValueDiffers, HostBinding, ChangeDetectorRef, ViewChildren, Pipe, ɵɵinject, InjectionToken, Inject, PLATFORM_ID, ViewEncapsulation, INJECTOR, NgZone, ContentChild, Optional } from '@angular/core';
|
|
3
3
|
import { trigger, transition, style as style$7, animate, state, group, query, animateChild } from '@angular/animations';
|
|
4
4
|
import { Subject, of, from, ReplaySubject, throwError, fromEvent, forkJoin, pipe } from 'rxjs';
|
|
5
5
|
import { takeUntil, tap, map, switchMap, catchError, first, filter, take, delay, debounceTime, repeat, finalize } from 'rxjs/operators';
|
|
@@ -1290,6 +1290,7 @@ var BignumberInputDirective = /** @class */ (function (_super) {
|
|
|
1290
1290
|
_this.scale = 0;
|
|
1291
1291
|
_this.alignTo = AlignmentOptions.LEFT;
|
|
1292
1292
|
_this.allowNegative = true;
|
|
1293
|
+
_this.pasteRejected = new EventEmitter();
|
|
1293
1294
|
_this.onLocaleService();
|
|
1294
1295
|
return _this;
|
|
1295
1296
|
}
|
|
@@ -1312,6 +1313,17 @@ var BignumberInputDirective = /** @class */ (function (_super) {
|
|
|
1312
1313
|
this.updateVariables();
|
|
1313
1314
|
}
|
|
1314
1315
|
};
|
|
1316
|
+
BignumberInputDirective.prototype.onPaste = function (event) {
|
|
1317
|
+
var _a, _b;
|
|
1318
|
+
var pastedText = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
|
|
1319
|
+
var numericText = pastedText.replace(new RegExp("\\" + this.thousandsSeparator, "g"), "").replace(this.decimalSeparator, ".");
|
|
1320
|
+
var _c = __read(numericText.split("."), 2), intPart = _c[0], _d = _c[1], decimalPart = _d === void 0 ? "" : _d;
|
|
1321
|
+
var totalDigits = intPart.replace(/\D/g, "").length + decimalPart.slice(0, this.scale).length;
|
|
1322
|
+
if (totalDigits > this.precision) {
|
|
1323
|
+
event.preventDefault();
|
|
1324
|
+
this.pasteRejected.emit(pastedText);
|
|
1325
|
+
}
|
|
1326
|
+
};
|
|
1315
1327
|
BignumberInputDirective.prototype.onKeypress = function (event) {
|
|
1316
1328
|
var code = event.code;
|
|
1317
1329
|
if (code === "Minus" || code === "NumpadSubtract") {
|
|
@@ -1393,6 +1405,12 @@ var BignumberInputDirective = /** @class */ (function (_super) {
|
|
|
1393
1405
|
__decorate([
|
|
1394
1406
|
HostBinding("attr.maxLength")
|
|
1395
1407
|
], BignumberInputDirective.prototype, "maxLength", void 0);
|
|
1408
|
+
__decorate([
|
|
1409
|
+
Output()
|
|
1410
|
+
], BignumberInputDirective.prototype, "pasteRejected", void 0);
|
|
1411
|
+
__decorate([
|
|
1412
|
+
HostListener("paste", ["$event"])
|
|
1413
|
+
], BignumberInputDirective.prototype, "onPaste", null);
|
|
1396
1414
|
__decorate([
|
|
1397
1415
|
HostListener("keypress", ["$event"])
|
|
1398
1416
|
], BignumberInputDirective.prototype, "onKeypress", null);
|
|
@@ -3170,13 +3188,24 @@ var CardTemplateTypes;
|
|
|
3170
3188
|
var CardComponent = /** @class */ (function () {
|
|
3171
3189
|
function CardComponent() {
|
|
3172
3190
|
this.fullWidth = false;
|
|
3191
|
+
this.title = '';
|
|
3192
|
+
this.subtitle = '';
|
|
3193
|
+
this.icon = '';
|
|
3173
3194
|
this.showBanner = false;
|
|
3174
|
-
this.hasCustomTemplates = false;
|
|
3175
3195
|
}
|
|
3176
3196
|
CardComponent.prototype.ngAfterContentInit = function () {
|
|
3177
3197
|
this._getTemplates();
|
|
3178
|
-
this.
|
|
3198
|
+
this._loadImage();
|
|
3179
3199
|
};
|
|
3200
|
+
Object.defineProperty(CardComponent.prototype, "hasHeader", {
|
|
3201
|
+
get: function () {
|
|
3202
|
+
var headerTemplate = !!this.headerTemplate;
|
|
3203
|
+
var hasHeaderAttributes = this.title || this.subtitle || this.icon;
|
|
3204
|
+
return headerTemplate || hasHeaderAttributes;
|
|
3205
|
+
},
|
|
3206
|
+
enumerable: true,
|
|
3207
|
+
configurable: true
|
|
3208
|
+
});
|
|
3180
3209
|
CardComponent.prototype._getHeaderTemplate = function () {
|
|
3181
3210
|
return this._getCustomTemplate(CardTemplateTypes.Header);
|
|
3182
3211
|
};
|
|
@@ -3194,9 +3223,8 @@ var CardComponent = /** @class */ (function () {
|
|
|
3194
3223
|
this.headerTemplate = this._getHeaderTemplate();
|
|
3195
3224
|
this.bodyTemplate = this._getBodyTemplate();
|
|
3196
3225
|
this.footerTemplate = this._getFooterTemplate();
|
|
3197
|
-
this.hasCustomTemplates = !!(this.headerTemplate || this.bodyTemplate || this.footerTemplate);
|
|
3198
3226
|
};
|
|
3199
|
-
CardComponent.prototype.
|
|
3227
|
+
CardComponent.prototype._loadImage = function () {
|
|
3200
3228
|
var _this = this;
|
|
3201
3229
|
var img = new Image();
|
|
3202
3230
|
img.src = this.bannerImage;
|
|
@@ -3209,14 +3237,23 @@ var CardComponent = /** @class */ (function () {
|
|
|
3209
3237
|
__decorate([
|
|
3210
3238
|
Input()
|
|
3211
3239
|
], CardComponent.prototype, "fullWidth", void 0);
|
|
3240
|
+
__decorate([
|
|
3241
|
+
Input()
|
|
3242
|
+
], CardComponent.prototype, "title", void 0);
|
|
3243
|
+
__decorate([
|
|
3244
|
+
Input()
|
|
3245
|
+
], CardComponent.prototype, "subtitle", void 0);
|
|
3246
|
+
__decorate([
|
|
3247
|
+
Input()
|
|
3248
|
+
], CardComponent.prototype, "icon", void 0);
|
|
3212
3249
|
__decorate([
|
|
3213
3250
|
ContentChildren(TemplateDirective)
|
|
3214
3251
|
], CardComponent.prototype, "templates", void 0);
|
|
3215
3252
|
CardComponent = __decorate([
|
|
3216
3253
|
Component({
|
|
3217
3254
|
selector: "s-card",
|
|
3218
|
-
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=\"
|
|
3219
|
-
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}"]
|
|
3255
|
+
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",
|
|
3256
|
+
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}"]
|
|
3220
3257
|
})
|
|
3221
3258
|
], CardComponent);
|
|
3222
3259
|
return CardComponent;
|
|
@@ -6689,14 +6726,15 @@ var NumberAlignmentOption;
|
|
|
6689
6726
|
*/
|
|
6690
6727
|
var NumberInputDirective = /** @class */ (function (_super) {
|
|
6691
6728
|
__extends(NumberInputDirective, _super);
|
|
6692
|
-
function NumberInputDirective(
|
|
6729
|
+
function NumberInputDirective(_keyValueDiffers, _elementRef, localeService) {
|
|
6693
6730
|
var _this = _super.call(this, null, _elementRef, _keyValueDiffers) || this;
|
|
6731
|
+
_this._elementRef = _elementRef;
|
|
6694
6732
|
_this.localeService = localeService;
|
|
6695
6733
|
_this.precision = 15;
|
|
6696
6734
|
_this.scale = 0;
|
|
6697
6735
|
_this.alignTo = NumberAlignmentOption.LEFT;
|
|
6698
6736
|
_this.allowNegative = true;
|
|
6699
|
-
_this.
|
|
6737
|
+
_this.pasteRejected = new EventEmitter();
|
|
6700
6738
|
_this.onLocaleService();
|
|
6701
6739
|
return _this;
|
|
6702
6740
|
}
|
|
@@ -6704,6 +6742,10 @@ var NumberInputDirective = /** @class */ (function (_super) {
|
|
|
6704
6742
|
NumberInputDirective.prototype.ngOnInit = function () {
|
|
6705
6743
|
this.updateVariables();
|
|
6706
6744
|
_super.prototype.ngOnInit.call(this);
|
|
6745
|
+
this.pasteListener = this._onPaste.bind(this);
|
|
6746
|
+
this._elementRef.nativeElement.addEventListener("paste", this.pasteListener);
|
|
6747
|
+
this.keypressListener = this._onKeypress.bind(this);
|
|
6748
|
+
this._elementRef.nativeElement.addEventListener("keypress", this.keypressListener);
|
|
6707
6749
|
};
|
|
6708
6750
|
NumberInputDirective.prototype.ngOnChanges = function (changes) {
|
|
6709
6751
|
var placeholderChange = changes.placeholder && changes.placeholder.currentValue;
|
|
@@ -6718,6 +6760,33 @@ var NumberInputDirective = /** @class */ (function (_super) {
|
|
|
6718
6760
|
this.updateVariables();
|
|
6719
6761
|
}
|
|
6720
6762
|
};
|
|
6763
|
+
NumberInputDirective.prototype.ngOnDestroy = function () {
|
|
6764
|
+
this._elementRef.nativeElement.removeEventListener("paste", this.pasteListener);
|
|
6765
|
+
this._elementRef.nativeElement.removeEventListener("keypress", this.keypressListener);
|
|
6766
|
+
};
|
|
6767
|
+
NumberInputDirective.prototype._onPaste = function (event) {
|
|
6768
|
+
var _a, _b;
|
|
6769
|
+
var pastedText = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
|
|
6770
|
+
var numericText = pastedText.replace(new RegExp("\\" + this.thousandsSeparator, "g"), "").replace(this.decimalSeparator, ".");
|
|
6771
|
+
var _c = __read(numericText.split("."), 2), intPart = _c[0], _d = _c[1], decimalPart = _d === void 0 ? "" : _d;
|
|
6772
|
+
var totalDigits = intPart.replace(/\D/g, "").length + decimalPart.slice(0, this.scale).length;
|
|
6773
|
+
if (totalDigits > this.precision) {
|
|
6774
|
+
event.preventDefault();
|
|
6775
|
+
event.stopPropagation();
|
|
6776
|
+
this.pasteRejected.emit(pastedText);
|
|
6777
|
+
}
|
|
6778
|
+
};
|
|
6779
|
+
NumberInputDirective.prototype._onKeypress = function (event) {
|
|
6780
|
+
var code = event.code;
|
|
6781
|
+
if (code === "Minus" || code === "NumpadSubtract") {
|
|
6782
|
+
if (this.allowNegative) {
|
|
6783
|
+
this.maxLength = this._maxLength + 1;
|
|
6784
|
+
}
|
|
6785
|
+
}
|
|
6786
|
+
else if (code === "Equal" || code === "NumpadAdd") {
|
|
6787
|
+
this.maxLength = this._maxLength;
|
|
6788
|
+
}
|
|
6789
|
+
};
|
|
6721
6790
|
/**
|
|
6722
6791
|
* Update the options values according to the directive input values.
|
|
6723
6792
|
*/
|
|
@@ -6741,24 +6810,9 @@ var NumberInputDirective = /** @class */ (function (_super) {
|
|
|
6741
6810
|
var thoSepLength = this.thousandsSeparator.length;
|
|
6742
6811
|
var maxLength = this.precision + (this.scale ? decSepLength : 0);
|
|
6743
6812
|
maxLength += Math.ceil((this.precision - (this.scale ? this.scale : 0)) / 3 - 1) * thoSepLength;
|
|
6813
|
+
this._maxLength = maxLength;
|
|
6744
6814
|
this.maxLength = maxLength;
|
|
6745
6815
|
};
|
|
6746
|
-
/**
|
|
6747
|
-
* Prevents the default CurrencyMask behavior when typed a incorrect value.
|
|
6748
|
-
* By default the CurrencyMask inputs the mask value to the component value when typed a incorrect value.
|
|
6749
|
-
*/
|
|
6750
|
-
NumberInputDirective.prototype.handleKeypress = function (event) {
|
|
6751
|
-
var negativeOperator = "-";
|
|
6752
|
-
var key = event.key;
|
|
6753
|
-
if (this.thousandsSeparator.includes(key) ||
|
|
6754
|
-
this.decimalSeparator.includes(key) ||
|
|
6755
|
-
negativeOperator.includes(key) ||
|
|
6756
|
-
this.regex.test(key) ||
|
|
6757
|
-
"Enter".toUpperCase() === key.toUpperCase())
|
|
6758
|
-
_super.prototype.handleKeypress.call(this, event);
|
|
6759
|
-
else
|
|
6760
|
-
event.preventDefault();
|
|
6761
|
-
};
|
|
6762
6816
|
NumberInputDirective.prototype.onLocaleService = function () {
|
|
6763
6817
|
var _this = this;
|
|
6764
6818
|
this.localeService
|
|
@@ -6772,8 +6826,8 @@ var NumberInputDirective = /** @class */ (function (_super) {
|
|
|
6772
6826
|
};
|
|
6773
6827
|
var NumberInputDirective_1;
|
|
6774
6828
|
NumberInputDirective.ctorParameters = function () { return [
|
|
6775
|
-
{ type: ElementRef },
|
|
6776
6829
|
{ type: KeyValueDiffers },
|
|
6830
|
+
{ type: ElementRef },
|
|
6777
6831
|
{ type: LocaleService }
|
|
6778
6832
|
]; };
|
|
6779
6833
|
__decorate([
|
|
@@ -6801,6 +6855,9 @@ var NumberInputDirective = /** @class */ (function (_super) {
|
|
|
6801
6855
|
__decorate([
|
|
6802
6856
|
HostBinding("attr.maxLength")
|
|
6803
6857
|
], NumberInputDirective.prototype, "maxLength", void 0);
|
|
6858
|
+
__decorate([
|
|
6859
|
+
Output()
|
|
6860
|
+
], NumberInputDirective.prototype, "pasteRejected", void 0);
|
|
6804
6861
|
NumberInputDirective = NumberInputDirective_1 = __decorate([
|
|
6805
6862
|
Directive({
|
|
6806
6863
|
selector: "input[sNumberInput]",
|
|
@@ -7046,13 +7103,18 @@ var TextAreaField = /** @class */ (function (_super) {
|
|
|
7046
7103
|
var TextAreaIAField = /** @class */ (function (_super) {
|
|
7047
7104
|
__extends(TextAreaIAField, _super);
|
|
7048
7105
|
function TextAreaIAField(config) {
|
|
7106
|
+
var _a;
|
|
7049
7107
|
var _this = _super.call(this, config) || this;
|
|
7108
|
+
_this.style = {
|
|
7109
|
+
resize: 'vertical'
|
|
7110
|
+
};
|
|
7050
7111
|
_this.cols = config.cols;
|
|
7051
7112
|
_this.rows = config.rows;
|
|
7052
7113
|
_this.keyFilter = config.keyFilter;
|
|
7053
|
-
_this.style = config.style;
|
|
7114
|
+
_this.style = __assign(__assign({}, config.style), _this.style);
|
|
7054
7115
|
_this.prompt = config.prompt;
|
|
7055
7116
|
_this.readonly = config.readonly;
|
|
7117
|
+
_this.speechRecognition = (_a = config.speechRecognition) !== null && _a !== void 0 ? _a : false;
|
|
7056
7118
|
return _this;
|
|
7057
7119
|
}
|
|
7058
7120
|
return TextAreaIAField;
|
|
@@ -11281,11 +11343,115 @@ var SliderFieldComponent = /** @class */ (function (_super) {
|
|
|
11281
11343
|
return SliderFieldComponent;
|
|
11282
11344
|
}(BaseFieldComponent));
|
|
11283
11345
|
|
|
11346
|
+
var SpeechRecognitionService = /** @class */ (function () {
|
|
11347
|
+
function SpeechRecognitionService(localeService, ngZone) {
|
|
11348
|
+
this.localeService = localeService;
|
|
11349
|
+
this.ngZone = ngZone;
|
|
11350
|
+
this.hasSupportSpeechRecognition = false;
|
|
11351
|
+
this.isListening = false;
|
|
11352
|
+
this.TIMEOUT_NO_MESSAGE = 3000;
|
|
11353
|
+
this.setRecognition();
|
|
11354
|
+
}
|
|
11355
|
+
SpeechRecognitionService.prototype.listen = function () {
|
|
11356
|
+
var _this = this;
|
|
11357
|
+
if (this.isListening) {
|
|
11358
|
+
return;
|
|
11359
|
+
}
|
|
11360
|
+
var speechSubject = new Subject();
|
|
11361
|
+
this.isListening = true;
|
|
11362
|
+
this.recognition.continuous = true;
|
|
11363
|
+
this.recognition.interimResults = true;
|
|
11364
|
+
this.recognition.maxAlternatives = 1;
|
|
11365
|
+
var silenceTimer;
|
|
11366
|
+
var restartSilenceTimer = function () {
|
|
11367
|
+
if (silenceTimer !== undefined) {
|
|
11368
|
+
clearTimeout(silenceTimer);
|
|
11369
|
+
}
|
|
11370
|
+
silenceTimer = setTimeout(function () {
|
|
11371
|
+
_this.recognition.stop();
|
|
11372
|
+
}, _this.TIMEOUT_NO_MESSAGE);
|
|
11373
|
+
};
|
|
11374
|
+
var fullTranscript = '';
|
|
11375
|
+
var interimTranscript = '';
|
|
11376
|
+
this.recognition.onresult = function (event) {
|
|
11377
|
+
_this.ngZone.run(function () {
|
|
11378
|
+
restartSilenceTimer();
|
|
11379
|
+
var interimTranscript = '';
|
|
11380
|
+
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
11381
|
+
var transcript = event.results[i][0].transcript;
|
|
11382
|
+
if (event.results[i].isFinal) {
|
|
11383
|
+
fullTranscript += transcript + '\n';
|
|
11384
|
+
}
|
|
11385
|
+
else {
|
|
11386
|
+
interimTranscript += transcript;
|
|
11387
|
+
}
|
|
11388
|
+
}
|
|
11389
|
+
interimTranscript = interimTranscript;
|
|
11390
|
+
speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
|
|
11391
|
+
});
|
|
11392
|
+
};
|
|
11393
|
+
this.recognition.onerror = function () {
|
|
11394
|
+
_this.ngZone.run(function () {
|
|
11395
|
+
if (silenceTimer !== undefined) {
|
|
11396
|
+
clearTimeout(silenceTimer);
|
|
11397
|
+
}
|
|
11398
|
+
_this.isListening = false;
|
|
11399
|
+
speechSubject.next({
|
|
11400
|
+
isFinal: true,
|
|
11401
|
+
text: ''
|
|
11402
|
+
});
|
|
11403
|
+
});
|
|
11404
|
+
};
|
|
11405
|
+
this.recognition.onend = function () {
|
|
11406
|
+
_this.ngZone.run(function () {
|
|
11407
|
+
if (silenceTimer !== undefined) {
|
|
11408
|
+
clearTimeout(silenceTimer);
|
|
11409
|
+
}
|
|
11410
|
+
speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
|
|
11411
|
+
_this.isListening = false;
|
|
11412
|
+
speechSubject.complete();
|
|
11413
|
+
});
|
|
11414
|
+
};
|
|
11415
|
+
this.recognition.start();
|
|
11416
|
+
return speechSubject;
|
|
11417
|
+
};
|
|
11418
|
+
SpeechRecognitionService.prototype.stop = function () {
|
|
11419
|
+
this.recognition.stop();
|
|
11420
|
+
};
|
|
11421
|
+
SpeechRecognitionService.prototype.setRecognition = function () {
|
|
11422
|
+
var _this = this;
|
|
11423
|
+
var _a;
|
|
11424
|
+
var SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
11425
|
+
if (!SpeechRecognitionConstructor) {
|
|
11426
|
+
console.warn('Speech recognition is not supported in this browser.');
|
|
11427
|
+
return;
|
|
11428
|
+
}
|
|
11429
|
+
this.hasSupportSpeechRecognition = true;
|
|
11430
|
+
this.recognition = new SpeechRecognitionConstructor();
|
|
11431
|
+
this.recognition.lang = ((_a = this.localeService.getLocaleOptions()) === null || _a === void 0 ? void 0 : _a.locale) || 'pt-BR';
|
|
11432
|
+
this.recognition.interimResults = false;
|
|
11433
|
+
this.recognition.maxAlternatives = 1;
|
|
11434
|
+
this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
|
|
11435
|
+
};
|
|
11436
|
+
SpeechRecognitionService.ctorParameters = function () { return [
|
|
11437
|
+
{ type: LocaleService },
|
|
11438
|
+
{ type: NgZone }
|
|
11439
|
+
]; };
|
|
11440
|
+
SpeechRecognitionService.ɵprov = ɵɵdefineInjectable({ factory: function SpeechRecognitionService_Factory() { return new SpeechRecognitionService(ɵɵinject(LocaleService), ɵɵinject(NgZone)); }, token: SpeechRecognitionService, providedIn: "root" });
|
|
11441
|
+
SpeechRecognitionService = __decorate([
|
|
11442
|
+
Injectable({
|
|
11443
|
+
providedIn: 'root'
|
|
11444
|
+
})
|
|
11445
|
+
], SpeechRecognitionService);
|
|
11446
|
+
return SpeechRecognitionService;
|
|
11447
|
+
}());
|
|
11448
|
+
|
|
11284
11449
|
var TextAreaIAFieldComponent = /** @class */ (function () {
|
|
11285
|
-
function TextAreaIAFieldComponent(_iassistService, _formBuilder, _translateService) {
|
|
11450
|
+
function TextAreaIAFieldComponent(_iassistService, _formBuilder, _translateService, speechRecognitionService) {
|
|
11286
11451
|
this._iassistService = _iassistService;
|
|
11287
11452
|
this._formBuilder = _formBuilder;
|
|
11288
11453
|
this._translateService = _translateService;
|
|
11454
|
+
this.speechRecognitionService = speechRecognitionService;
|
|
11289
11455
|
this.isVisible = false;
|
|
11290
11456
|
this.isLoading = false;
|
|
11291
11457
|
}
|
|
@@ -11324,12 +11490,14 @@ var TextAreaIAFieldComponent = /** @class */ (function () {
|
|
|
11324
11490
|
this.hideDialog();
|
|
11325
11491
|
};
|
|
11326
11492
|
TextAreaIAFieldComponent.prototype._createDialogFields = function () {
|
|
11493
|
+
var _a;
|
|
11327
11494
|
this.fields = [
|
|
11328
11495
|
new FormField({
|
|
11329
11496
|
name: "context",
|
|
11330
11497
|
type: FieldType.Text,
|
|
11331
11498
|
label: this._translateService.instant("platform.angular_components.context"),
|
|
11332
11499
|
size: { sm: 12, md: 12, lg: 12, xl: 12 },
|
|
11500
|
+
speechRecognition: (_a = this.field.speechRecognition) !== null && _a !== void 0 ? _a : false
|
|
11333
11501
|
}),
|
|
11334
11502
|
];
|
|
11335
11503
|
};
|
|
@@ -11341,7 +11509,8 @@ var TextAreaIAFieldComponent = /** @class */ (function () {
|
|
|
11341
11509
|
TextAreaIAFieldComponent.ctorParameters = function () { return [
|
|
11342
11510
|
{ type: IAssistService },
|
|
11343
11511
|
{ type: FormBuilder },
|
|
11344
|
-
{ type: TranslateService }
|
|
11512
|
+
{ type: TranslateService },
|
|
11513
|
+
{ type: SpeechRecognitionService }
|
|
11345
11514
|
]; };
|
|
11346
11515
|
__decorate([
|
|
11347
11516
|
Input()
|
|
@@ -11349,13 +11518,10 @@ var TextAreaIAFieldComponent = /** @class */ (function () {
|
|
|
11349
11518
|
__decorate([
|
|
11350
11519
|
Input()
|
|
11351
11520
|
], TextAreaIAFieldComponent.prototype, "formControl", void 0);
|
|
11352
|
-
__decorate([
|
|
11353
|
-
ViewChild('inputRef')
|
|
11354
|
-
], TextAreaIAFieldComponent.prototype, "inputRef", void 0);
|
|
11355
11521
|
TextAreaIAFieldComponent = __decorate([
|
|
11356
11522
|
Component({
|
|
11357
|
-
template: "<s-field-label [field]=\"field\"\n [fieldContainerRef]=\"
|
|
11358
|
-
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}"]
|
|
11523
|
+
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",
|
|
11524
|
+
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}"]
|
|
11359
11525
|
})
|
|
11360
11526
|
], TextAreaIAFieldComponent);
|
|
11361
11527
|
return TextAreaIAFieldComponent;
|
|
@@ -11382,7 +11548,7 @@ var TextAreaFieldComponent = /** @class */ (function () {
|
|
|
11382
11548
|
], TextAreaFieldComponent.prototype, "inputRef", void 0);
|
|
11383
11549
|
TextAreaFieldComponent = __decorate([
|
|
11384
11550
|
Component({
|
|
11385
|
-
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
|
|
11551
|
+
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"
|
|
11386
11552
|
})
|
|
11387
11553
|
], TextAreaFieldComponent);
|
|
11388
11554
|
return TextAreaFieldComponent;
|
|
@@ -13247,7 +13413,8 @@ var TextFieldModule = /** @class */ (function () {
|
|
|
13247
13413
|
}());
|
|
13248
13414
|
|
|
13249
13415
|
var TextAreaComponent = /** @class */ (function () {
|
|
13250
|
-
function TextAreaComponent() {
|
|
13416
|
+
function TextAreaComponent(cdr) {
|
|
13417
|
+
this.cdr = cdr;
|
|
13251
13418
|
this.onChange = function () { };
|
|
13252
13419
|
this.onTouched = function () { };
|
|
13253
13420
|
this.disabled = false;
|
|
@@ -13255,6 +13422,9 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13255
13422
|
this.inputId = "textarea-" + Math.random();
|
|
13256
13423
|
this.rows = 5;
|
|
13257
13424
|
this.speechRecognition = false;
|
|
13425
|
+
this._inputStyle = {
|
|
13426
|
+
resize: 'vertical'
|
|
13427
|
+
};
|
|
13258
13428
|
this.readOnly = false;
|
|
13259
13429
|
this.renderTextArea = false;
|
|
13260
13430
|
}
|
|
@@ -13268,11 +13438,37 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13268
13438
|
this._textAreaElement = value;
|
|
13269
13439
|
setTimeout(function () {
|
|
13270
13440
|
_this.renderTextArea = true;
|
|
13441
|
+
_this.cdr.detectChanges();
|
|
13271
13442
|
});
|
|
13272
13443
|
},
|
|
13273
13444
|
enumerable: true,
|
|
13274
13445
|
configurable: true
|
|
13275
13446
|
});
|
|
13447
|
+
Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
|
|
13448
|
+
get: function () {
|
|
13449
|
+
return this._placeholder;
|
|
13450
|
+
},
|
|
13451
|
+
set: function (value) {
|
|
13452
|
+
if (value) {
|
|
13453
|
+
this._placeholder = value;
|
|
13454
|
+
}
|
|
13455
|
+
else {
|
|
13456
|
+
this._placeholder = '';
|
|
13457
|
+
}
|
|
13458
|
+
},
|
|
13459
|
+
enumerable: true,
|
|
13460
|
+
configurable: true
|
|
13461
|
+
});
|
|
13462
|
+
Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
|
|
13463
|
+
get: function () {
|
|
13464
|
+
return this._inputStyle;
|
|
13465
|
+
},
|
|
13466
|
+
set: function (value) {
|
|
13467
|
+
this._inputStyle = __assign(__assign({}, value), this._inputStyle);
|
|
13468
|
+
},
|
|
13469
|
+
enumerable: true,
|
|
13470
|
+
configurable: true
|
|
13471
|
+
});
|
|
13276
13472
|
TextAreaComponent.prototype.writeValue = function (obj) {
|
|
13277
13473
|
this.value = obj;
|
|
13278
13474
|
};
|
|
@@ -13298,6 +13494,9 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13298
13494
|
this.setValue(recognizedText);
|
|
13299
13495
|
};
|
|
13300
13496
|
var TextAreaComponent_1;
|
|
13497
|
+
TextAreaComponent.ctorParameters = function () { return [
|
|
13498
|
+
{ type: ChangeDetectorRef }
|
|
13499
|
+
]; };
|
|
13301
13500
|
__decorate([
|
|
13302
13501
|
ViewChild('textArea', { read: ElementRef })
|
|
13303
13502
|
], TextAreaComponent.prototype, "textAreaElement", null);
|
|
@@ -13315,14 +13514,17 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13315
13514
|
], TextAreaComponent.prototype, "keyFilter", void 0);
|
|
13316
13515
|
__decorate([
|
|
13317
13516
|
Input()
|
|
13318
|
-
], TextAreaComponent.prototype, "
|
|
13517
|
+
], TextAreaComponent.prototype, "placeholder", null);
|
|
13518
|
+
__decorate([
|
|
13519
|
+
Input()
|
|
13520
|
+
], TextAreaComponent.prototype, "inputStyle", null);
|
|
13319
13521
|
__decorate([
|
|
13320
13522
|
Input()
|
|
13321
13523
|
], TextAreaComponent.prototype, "readOnly", void 0);
|
|
13322
13524
|
TextAreaComponent = TextAreaComponent_1 = __decorate([
|
|
13323
13525
|
Component({
|
|
13324
13526
|
selector: 's-textarea',
|
|
13325
|
-
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",
|
|
13527
|
+
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",
|
|
13326
13528
|
providers: [
|
|
13327
13529
|
{
|
|
13328
13530
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -13336,103 +13538,6 @@ var TextAreaComponent = /** @class */ (function () {
|
|
|
13336
13538
|
return TextAreaComponent;
|
|
13337
13539
|
}());
|
|
13338
13540
|
|
|
13339
|
-
var SpeechRecognitionService = /** @class */ (function () {
|
|
13340
|
-
function SpeechRecognitionService(localeService, ngZone) {
|
|
13341
|
-
this.localeService = localeService;
|
|
13342
|
-
this.ngZone = ngZone;
|
|
13343
|
-
this.isListening = false;
|
|
13344
|
-
this.TIMEOUT_NO_MESSAGE = 3000;
|
|
13345
|
-
this.setRecognition();
|
|
13346
|
-
}
|
|
13347
|
-
SpeechRecognitionService.prototype.listen = function () {
|
|
13348
|
-
var _this = this;
|
|
13349
|
-
if (this.isListening) {
|
|
13350
|
-
return;
|
|
13351
|
-
}
|
|
13352
|
-
var speechSubject = new Subject();
|
|
13353
|
-
this.isListening = true;
|
|
13354
|
-
this.recognition.continuous = true;
|
|
13355
|
-
this.recognition.interimResults = true;
|
|
13356
|
-
this.recognition.maxAlternatives = 1;
|
|
13357
|
-
var silenceTimer;
|
|
13358
|
-
var restartSilenceTimer = function () {
|
|
13359
|
-
if (silenceTimer !== undefined) {
|
|
13360
|
-
clearTimeout(silenceTimer);
|
|
13361
|
-
}
|
|
13362
|
-
silenceTimer = setTimeout(function () {
|
|
13363
|
-
_this.recognition.stop();
|
|
13364
|
-
}, _this.TIMEOUT_NO_MESSAGE);
|
|
13365
|
-
};
|
|
13366
|
-
var fullTranscript = '';
|
|
13367
|
-
var interimTranscript = '';
|
|
13368
|
-
this.recognition.onresult = function (event) {
|
|
13369
|
-
_this.ngZone.run(function () {
|
|
13370
|
-
restartSilenceTimer();
|
|
13371
|
-
var interimTranscript = '';
|
|
13372
|
-
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
13373
|
-
var transcript = event.results[i][0].transcript;
|
|
13374
|
-
if (event.results[i].isFinal) {
|
|
13375
|
-
fullTranscript += transcript + '\n';
|
|
13376
|
-
}
|
|
13377
|
-
else {
|
|
13378
|
-
interimTranscript += transcript;
|
|
13379
|
-
}
|
|
13380
|
-
}
|
|
13381
|
-
interimTranscript = interimTranscript;
|
|
13382
|
-
speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
|
|
13383
|
-
});
|
|
13384
|
-
};
|
|
13385
|
-
this.recognition.onerror = function () {
|
|
13386
|
-
_this.ngZone.run(function () {
|
|
13387
|
-
if (silenceTimer !== undefined) {
|
|
13388
|
-
clearTimeout(silenceTimer);
|
|
13389
|
-
}
|
|
13390
|
-
_this.isListening = false;
|
|
13391
|
-
speechSubject.next({
|
|
13392
|
-
isFinal: true,
|
|
13393
|
-
text: ''
|
|
13394
|
-
});
|
|
13395
|
-
});
|
|
13396
|
-
};
|
|
13397
|
-
this.recognition.onend = function () {
|
|
13398
|
-
_this.ngZone.run(function () {
|
|
13399
|
-
if (silenceTimer !== undefined) {
|
|
13400
|
-
clearTimeout(silenceTimer);
|
|
13401
|
-
}
|
|
13402
|
-
speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
|
|
13403
|
-
_this.isListening = false;
|
|
13404
|
-
speechSubject.complete();
|
|
13405
|
-
});
|
|
13406
|
-
};
|
|
13407
|
-
this.recognition.start();
|
|
13408
|
-
return speechSubject;
|
|
13409
|
-
};
|
|
13410
|
-
SpeechRecognitionService.prototype.stop = function () {
|
|
13411
|
-
this.recognition.stop();
|
|
13412
|
-
};
|
|
13413
|
-
SpeechRecognitionService.prototype.setRecognition = function () {
|
|
13414
|
-
var SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
13415
|
-
if (!SpeechRecognitionConstructor) {
|
|
13416
|
-
throw new Error('Speech recognition is not supported in this browser.');
|
|
13417
|
-
}
|
|
13418
|
-
this.recognition = new SpeechRecognitionConstructor();
|
|
13419
|
-
this.recognition.lang = this.localeService.getLocaleOptions().locale || 'pt-BR';
|
|
13420
|
-
this.recognition.interimResults = false;
|
|
13421
|
-
this.recognition.maxAlternatives = 1;
|
|
13422
|
-
};
|
|
13423
|
-
SpeechRecognitionService.ctorParameters = function () { return [
|
|
13424
|
-
{ type: LocaleService },
|
|
13425
|
-
{ type: NgZone }
|
|
13426
|
-
]; };
|
|
13427
|
-
SpeechRecognitionService.ɵprov = ɵɵdefineInjectable({ factory: function SpeechRecognitionService_Factory() { return new SpeechRecognitionService(ɵɵinject(LocaleService), ɵɵinject(NgZone)); }, token: SpeechRecognitionService, providedIn: "root" });
|
|
13428
|
-
SpeechRecognitionService = __decorate([
|
|
13429
|
-
Injectable({
|
|
13430
|
-
providedIn: 'root'
|
|
13431
|
-
})
|
|
13432
|
-
], SpeechRecognitionService);
|
|
13433
|
-
return SpeechRecognitionService;
|
|
13434
|
-
}());
|
|
13435
|
-
|
|
13436
13541
|
var TextToSpeechService = /** @class */ (function () {
|
|
13437
13542
|
function TextToSpeechService(locale, ngZone) {
|
|
13438
13543
|
this.locale = locale;
|
|
@@ -13447,10 +13552,13 @@ var TextToSpeechService = /** @class */ (function () {
|
|
|
13447
13552
|
if (!_voices.length) {
|
|
13448
13553
|
speechSynthesis.onvoiceschanged = function () {
|
|
13449
13554
|
_this.ngZone.run(function () {
|
|
13555
|
+
var _a;
|
|
13450
13556
|
_voices = speechSynthesis.getVoices();
|
|
13451
|
-
var currentLang = _this.locale.getLocaleOptions().locale || 'pt-BR';
|
|
13452
|
-
_this.
|
|
13453
|
-
_this.
|
|
13557
|
+
var currentLang = ((_a = _this.locale.getLocaleOptions()) === null || _a === void 0 ? void 0 : _a.locale) || 'pt-BR';
|
|
13558
|
+
_this.setActiveVoice(_voices, currentLang);
|
|
13559
|
+
_this.locale.getLocale().subscribe(function (locale) {
|
|
13560
|
+
_this.setActiveVoice(_voices, locale);
|
|
13561
|
+
});
|
|
13454
13562
|
});
|
|
13455
13563
|
};
|
|
13456
13564
|
}
|
|
@@ -13497,6 +13605,12 @@ var TextToSpeechService = /** @class */ (function () {
|
|
|
13497
13605
|
enumerable: true,
|
|
13498
13606
|
configurable: true
|
|
13499
13607
|
});
|
|
13608
|
+
TextToSpeechService.prototype.setActiveVoice = function (voices, lang) {
|
|
13609
|
+
var _voice = voices.find(function (voice) { return voice.lang === lang; });
|
|
13610
|
+
if (_voice) {
|
|
13611
|
+
this.activeVoice = _voice;
|
|
13612
|
+
}
|
|
13613
|
+
};
|
|
13500
13614
|
TextToSpeechService.ctorParameters = function () { return [
|
|
13501
13615
|
{ type: LocaleService },
|
|
13502
13616
|
{ type: NgZone }
|
|
@@ -13521,19 +13635,11 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13521
13635
|
this.isDoneSpeaking = false;
|
|
13522
13636
|
this.onDestroy$ = new Subject();
|
|
13523
13637
|
this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
|
|
13524
|
-
this.SPEECH_RECOGNITION_MARGIN_OFFSET = 13;
|
|
13525
13638
|
this.keydownEventListener = function (event) {
|
|
13526
13639
|
if (_this.disabled) {
|
|
13527
13640
|
event.preventDefault();
|
|
13528
13641
|
}
|
|
13529
13642
|
};
|
|
13530
|
-
this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER = new MutationObserver(function () {
|
|
13531
|
-
_this.SPEECH_CONTAINER_WIDTH_CALLBACK();
|
|
13532
|
-
});
|
|
13533
|
-
this.SPEECH_CONTAINER_WIDTH_CALLBACK = function () {
|
|
13534
|
-
_this.setSpeechContainerWidth();
|
|
13535
|
-
};
|
|
13536
|
-
this.speechRecognitionContainerWidth = 0;
|
|
13537
13643
|
this.disabled = false;
|
|
13538
13644
|
this.isSpeaking = false;
|
|
13539
13645
|
this.voiceSpeed = 1;
|
|
@@ -13548,20 +13654,14 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13548
13654
|
this.recognizedText = new EventEmitter();
|
|
13549
13655
|
}
|
|
13550
13656
|
SpeechRecognitionComponent.prototype.ngOnInit = function () {
|
|
13657
|
+
if (!this.hasSpeechRecognitionBrowserApi) {
|
|
13658
|
+
return;
|
|
13659
|
+
}
|
|
13551
13660
|
if (!this.textAreaElement) {
|
|
13552
13661
|
throw new Error('textAreaElement is required');
|
|
13553
13662
|
}
|
|
13554
13663
|
this.textAreaElement.placeholder = this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
|
|
13555
13664
|
this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
|
|
13556
|
-
var config = { attributes: true, childList: true, subtree: true };
|
|
13557
|
-
this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER.observe(this.textAreaElement, config);
|
|
13558
|
-
window.addEventListener('resize', this.SPEECH_CONTAINER_WIDTH_CALLBACK);
|
|
13559
|
-
};
|
|
13560
|
-
SpeechRecognitionComponent.prototype.ngAfterViewInit = function () {
|
|
13561
|
-
var _this = this;
|
|
13562
|
-
setTimeout(function () {
|
|
13563
|
-
_this.setSpeechContainerWidth();
|
|
13564
|
-
});
|
|
13565
13665
|
};
|
|
13566
13666
|
SpeechRecognitionComponent.prototype.onListen = function () {
|
|
13567
13667
|
var _this = this;
|
|
@@ -13635,9 +13735,6 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13635
13735
|
SpeechRecognitionComponent.prototype.ngOnDestroy = function () {
|
|
13636
13736
|
this.onDestroy$.next();
|
|
13637
13737
|
this.onDestroy$.complete();
|
|
13638
|
-
this.textAreaElement.removeEventListener('keydown', this.keydownEventListener);
|
|
13639
|
-
window.removeEventListener('resize', this.SPEECH_CONTAINER_WIDTH_CALLBACK);
|
|
13640
|
-
this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER.disconnect();
|
|
13641
13738
|
};
|
|
13642
13739
|
SpeechRecognitionComponent.prototype.toggleTextToSpeech = function () {
|
|
13643
13740
|
if (this.isPlayingTextToSpeech) {
|
|
@@ -13675,6 +13772,13 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13675
13772
|
enumerable: true,
|
|
13676
13773
|
configurable: true
|
|
13677
13774
|
});
|
|
13775
|
+
Object.defineProperty(SpeechRecognitionComponent.prototype, "hasSpeechRecognitionBrowserApi", {
|
|
13776
|
+
get: function () {
|
|
13777
|
+
return this.speechRecognitionService.hasSupportSpeechRecognition;
|
|
13778
|
+
},
|
|
13779
|
+
enumerable: true,
|
|
13780
|
+
configurable: true
|
|
13781
|
+
});
|
|
13678
13782
|
Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
|
|
13679
13783
|
get: function () {
|
|
13680
13784
|
var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
|
|
@@ -13694,9 +13798,6 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13694
13798
|
_this.isDoneSpeaking = true;
|
|
13695
13799
|
});
|
|
13696
13800
|
};
|
|
13697
|
-
SpeechRecognitionComponent.prototype.setSpeechContainerWidth = function () {
|
|
13698
|
-
this.speechRecognitionContainerWidth = this.textAreaElement.getBoundingClientRect().width - this.SPEECH_RECOGNITION_MARGIN_OFFSET;
|
|
13699
|
-
};
|
|
13700
13801
|
SpeechRecognitionComponent.ctorParameters = function () { return [
|
|
13701
13802
|
{ type: SpeechRecognitionService },
|
|
13702
13803
|
{ type: TextToSpeechService },
|
|
@@ -13711,8 +13812,8 @@ var SpeechRecognitionComponent = /** @class */ (function () {
|
|
|
13711
13812
|
SpeechRecognitionComponent = __decorate([
|
|
13712
13813
|
Component({
|
|
13713
13814
|
selector: 's-speech-recognition',
|
|
13714
|
-
template: "<section class=\"speech-recognition\"
|
|
13715
|
-
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}"]
|
|
13815
|
+
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",
|
|
13816
|
+
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}"]
|
|
13716
13817
|
})
|
|
13717
13818
|
], SpeechRecognitionComponent);
|
|
13718
13819
|
return SpeechRecognitionComponent;
|
|
@@ -17680,10 +17781,12 @@ var InlineEditComponent = /** @class */ (function () {
|
|
|
17680
17781
|
|
|
17681
17782
|
var TextAreaIAComponent = /** @class */ (function () {
|
|
17682
17783
|
function TextAreaIAComponent(_iassistService, // Mover pra uma pasta global
|
|
17683
|
-
_formBuilder, _translateService) {
|
|
17784
|
+
_formBuilder, _translateService, speechRecognitionService) {
|
|
17684
17785
|
this._iassistService = _iassistService;
|
|
17685
17786
|
this._formBuilder = _formBuilder;
|
|
17686
17787
|
this._translateService = _translateService;
|
|
17788
|
+
this.speechRecognitionService = speechRecognitionService;
|
|
17789
|
+
this.speechRecognition = false;
|
|
17687
17790
|
this.isVisible = false;
|
|
17688
17791
|
this.isLoading = false;
|
|
17689
17792
|
}
|
|
@@ -17748,6 +17851,7 @@ var TextAreaIAComponent = /** @class */ (function () {
|
|
|
17748
17851
|
type: FieldType.Text,
|
|
17749
17852
|
label: this._translateService.instant("platform.angular_components.context"),
|
|
17750
17853
|
size: { sm: 12, md: 12, lg: 12, xl: 12 },
|
|
17854
|
+
speechRecognition: this.speechRecognition
|
|
17751
17855
|
}),
|
|
17752
17856
|
];
|
|
17753
17857
|
};
|
|
@@ -17760,7 +17864,8 @@ var TextAreaIAComponent = /** @class */ (function () {
|
|
|
17760
17864
|
TextAreaIAComponent.ctorParameters = function () { return [
|
|
17761
17865
|
{ type: IAssistService },
|
|
17762
17866
|
{ type: FormBuilder },
|
|
17763
|
-
{ type: TranslateService }
|
|
17867
|
+
{ type: TranslateService },
|
|
17868
|
+
{ type: SpeechRecognitionService }
|
|
17764
17869
|
]; };
|
|
17765
17870
|
__decorate([
|
|
17766
17871
|
Input()
|
|
@@ -17783,10 +17888,13 @@ var TextAreaIAComponent = /** @class */ (function () {
|
|
|
17783
17888
|
__decorate([
|
|
17784
17889
|
Input()
|
|
17785
17890
|
], TextAreaIAComponent.prototype, "cols", void 0);
|
|
17891
|
+
__decorate([
|
|
17892
|
+
Input()
|
|
17893
|
+
], TextAreaIAComponent.prototype, "speechRecognition", void 0);
|
|
17786
17894
|
TextAreaIAComponent = TextAreaIAComponent_1 = __decorate([
|
|
17787
17895
|
Component({
|
|
17788
17896
|
selector: "s-text-area-ia",
|
|
17789
|
-
template: "<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\"
|
|
17897
|
+
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",
|
|
17790
17898
|
providers: [
|
|
17791
17899
|
{
|
|
17792
17900
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -17794,7 +17902,7 @@ var TextAreaIAComponent = /** @class */ (function () {
|
|
|
17794
17902
|
multi: true,
|
|
17795
17903
|
},
|
|
17796
17904
|
],
|
|
17797
|
-
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
|
|
17905
|
+
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}"]
|
|
17798
17906
|
})
|
|
17799
17907
|
], TextAreaIAComponent);
|
|
17800
17908
|
return TextAreaIAComponent;
|
|
@@ -17811,10 +17919,10 @@ var TextAreaIAModule = /** @class */ (function () {
|
|
|
17811
17919
|
ReactiveFormsModule,
|
|
17812
17920
|
TranslateModule,
|
|
17813
17921
|
DialogModule,
|
|
17814
|
-
InputTextareaModule,
|
|
17815
17922
|
ButtonModule,
|
|
17816
17923
|
DynamicFormModule,
|
|
17817
17924
|
LoadingStateModule,
|
|
17925
|
+
TextAreaModule
|
|
17818
17926
|
],
|
|
17819
17927
|
declarations: [TextAreaIAComponent],
|
|
17820
17928
|
exports: [TextAreaIAComponent],
|
|
@@ -23008,9 +23116,9 @@ var fallback = {
|
|
|
23008
23116
|
"platform.angular_components.remove_all": "Remover todos",
|
|
23009
23117
|
"platform.angular_components.country_name_gb": "Reino Unido",
|
|
23010
23118
|
"platform.angular_components.insight_footer": "Conteúdo gerado por inteligência artificial. Sujeito a imprecisões.",
|
|
23011
|
-
"platform.angular_components.text_area_speech_recognition_placeholder": "Preencha o campo
|
|
23012
|
-
"platform.angular_components.text_area_before_speech": "Grave ou ouça o texto clicando nos
|
|
23013
|
-
"platform.angular_components.text_area_while_speech": "Clique novamente no
|
|
23119
|
+
"platform.angular_components.text_area_speech_recognition_placeholder": "Preencha o campo com, pelo menos, uma frase",
|
|
23120
|
+
"platform.angular_components.text_area_before_speech": "Grave ou ouça o texto clicando nos ícones",
|
|
23121
|
+
"platform.angular_components.text_area_while_speech": "Clique novamente no ícone para finalizar",
|
|
23014
23122
|
"platform.angular_components.text_area_end_speech": "Gravação finalizada"
|
|
23015
23123
|
};
|
|
23016
23124
|
|