@seniorsistemas/angular-components 17.9.2 → 17.9.4

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 (26) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +202 -43
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/dynamic-form/components/fields/currency/currency-field.component.d.ts +3 -1
  6. package/components/dynamic-form/configurations/fields/currency-field.d.ts +1 -0
  7. package/components/tooltip/tooltip.directive.d.ts +1 -2
  8. package/esm2015/components/dynamic-form/components/fields/currency/currency-field.component.js +7 -4
  9. package/esm2015/components/dynamic-form/configurations/fields/currency-field.js +2 -1
  10. package/esm2015/components/dynamic-form/configurations/fields/decimal-field.js +2 -3
  11. package/esm2015/components/navigation-button/navigation-button.component.js +5 -1
  12. package/esm2015/components/tooltip/tooltip.directive.js +7 -14
  13. package/esm2015/utils/currency/currency.service.js +162 -2
  14. package/esm5/components/dynamic-form/components/fields/currency/currency-field.component.js +7 -4
  15. package/esm5/components/dynamic-form/configurations/fields/currency-field.js +2 -1
  16. package/esm5/components/dynamic-form/configurations/fields/decimal-field.js +2 -3
  17. package/esm5/components/navigation-button/navigation-button.component.js +5 -1
  18. package/esm5/components/tooltip/tooltip.directive.js +7 -14
  19. package/esm5/utils/currency/currency.service.js +162 -2
  20. package/fesm2015/seniorsistemas-angular-components.js +200 -41
  21. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  22. package/fesm5/seniorsistemas-angular-components.js +202 -43
  23. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  24. package/package.json +1 -1
  25. package/seniorsistemas-angular-components.metadata.json +1 -1
  26. package/utils/currency/currency.service.d.ts +634 -0
@@ -641,14 +641,13 @@
641
641
  TooltipDirective.prototype.updateTooltipVisibilityWhenFocusOnInput = function () {
642
642
  var _this = this;
643
643
  if (this.focusedInputRef) {
644
- var inputFocus = this.focusedInputRef;
645
- var icon_1 = this.getIconFromFocusedInput(inputFocus);
646
- this.renderer.listen(inputFocus, 'focus', function () {
644
+ var icon_1 = this.getIconFromFocusedInput();
645
+ this.renderer.listen(this.focusedInputRef, 'focus', function () {
647
646
  if (icon_1 && _this.isMatchingTooltip(icon_1)) {
648
647
  _this.createTootipByFocus(icon_1);
649
648
  }
650
649
  });
651
- this.renderer.listen(inputFocus, 'blur', function () {
650
+ this.renderer.listen(this.focusedInputRef, 'blur', function () {
652
651
  if (icon_1 && _this.isMatchingTooltip(icon_1)) {
653
652
  _this.removeTooltip(icon_1);
654
653
  _this.destroy();
@@ -658,16 +657,10 @@
658
657
  };
659
658
  /**
660
659
  * Obtém o elemento do ícone associado ao label do input em focus.
661
- * @param focusedInput O input em focus.
662
- * @returns O ícone do input em focus ou null.
660
+ * @returns O ícone do input em focus.
663
661
  */
664
- TooltipDirective.prototype.getIconFromFocusedInput = function (focusedInput) {
665
- var label = document.querySelector("label[for='" + focusedInput.id + "']");
666
- if (label) {
667
- var icon = label.nextElementSibling;
668
- return (icon === null || icon === void 0 ? void 0 : icon.classList.contains('info-sign__icon')) ? icon : null;
669
- }
670
- return null;
662
+ TooltipDirective.prototype.getIconFromFocusedInput = function () {
663
+ return this.elementRef.nativeElement;
671
664
  };
672
665
  /**
673
666
  * Verifica se o ícone tem o tooltip correspondente ao atual.
@@ -5018,11 +5011,10 @@
5018
5011
  var DecimalField = /** @class */ (function (_super) {
5019
5012
  __extends(DecimalField, _super);
5020
5013
  function DecimalField(config) {
5021
- var _a;
5022
5014
  var _this = _super.call(this, config) || this;
5023
5015
  _this.numberLocaleOptions = config.numberLocaleOptions;
5024
5016
  _this.alignTo = config.alignTo || exports.NumberAlignmentOption.RIGHT;
5025
- _this.scale = typeof config.scale === "function" ? config.scale() : (_a = config.scale) !== null && _a !== void 0 ? _a : 2;
5017
+ _this.scale = typeof config.scale === "function" ? config.scale() : config.scale;
5026
5018
  return _this;
5027
5019
  }
5028
5020
  return DecimalField;
@@ -5035,6 +5027,7 @@
5035
5027
  __extends(CurrencyField, _super);
5036
5028
  function CurrencyField(config) {
5037
5029
  var _this = _super.call(this, config) || this;
5030
+ _this.currency = config['currency'];
5038
5031
  _this.numberLocaleOptions = config.numberLocaleOptions;
5039
5032
  return _this;
5040
5033
  }
@@ -9938,14 +9931,200 @@
9938
9931
  return BignumberFieldComponent;
9939
9932
  }(BaseFieldComponent));
9940
9933
 
9934
+ var CurrencyService = /** @class */ (function () {
9935
+ function CurrencyService(localeService) {
9936
+ this.localeService = localeService;
9937
+ this.currencies = {
9938
+ KHR: { precision: 12, scale: 2 },
9939
+ SSP: { precision: 12, scale: 2 },
9940
+ XCD: { precision: 12, scale: 2 },
9941
+ EGP: { precision: 12, scale: 2 },
9942
+ KWD: { precision: 12, scale: 3 },
9943
+ YER: { precision: 12, scale: 2 },
9944
+ HUF: { precision: 12, scale: 2 },
9945
+ MXN: { precision: 12, scale: 2 },
9946
+ MYR: { precision: 12, scale: 2 },
9947
+ ZWL: { precision: 12, scale: 2 },
9948
+ MUR: { precision: 12, scale: 2 },
9949
+ DKK: { precision: 12, scale: 2 },
9950
+ NOK: { precision: 12, scale: 2 },
9951
+ DJF: { precision: 12, scale: 0 },
9952
+ CRC: { precision: 12, scale: 2 },
9953
+ BND: { precision: 12, scale: 2 },
9954
+ NAD: { precision: 12, scale: 2 },
9955
+ MKD: { precision: 12, scale: 2 },
9956
+ CDF: { precision: 12, scale: 2 },
9957
+ GNF: { precision: 12, scale: 0 },
9958
+ EUR: { precision: 12, scale: 2 },
9959
+ OMR: { precision: 12, scale: 3 },
9960
+ CLP: { precision: 12, scale: 0 },
9961
+ BSD: { precision: 12, scale: 2 },
9962
+ TOP: { precision: 12, scale: 2 },
9963
+ IRR: { precision: 12, scale: 2 },
9964
+ BGN: { precision: 12, scale: 2 },
9965
+ BZD: { precision: 12, scale: 2 },
9966
+ CNY: { precision: 12, scale: 2 },
9967
+ FJD: { precision: 12, scale: 2 },
9968
+ SRD: { precision: 12, scale: 2 },
9969
+ SOS: { precision: 12, scale: 2 },
9970
+ GYD: { precision: 12, scale: 2 },
9971
+ VUV: { precision: 12, scale: 0 },
9972
+ MWK: { precision: 12, scale: 2 },
9973
+ MRU: { precision: 12, scale: 2 },
9974
+ LSL: { precision: 12, scale: 2 },
9975
+ ERN: { precision: 12, scale: 2 },
9976
+ BMD: { precision: 12, scale: 2 },
9977
+ WST: { precision: 12, scale: 2 },
9978
+ LRD: { precision: 12, scale: 2 },
9979
+ GMD: { precision: 12, scale: 2 },
9980
+ ARS: { precision: 12, scale: 2 },
9981
+ ZAR: { precision: 12, scale: 2 },
9982
+ RSD: { precision: 12, scale: 2 },
9983
+ MDL: { precision: 12, scale: 2 },
9984
+ USD: { precision: 12, scale: 2 },
9985
+ QAR: { precision: 12, scale: 2 },
9986
+ HRK: { precision: 12, scale: 2 },
9987
+ GIP: { precision: 12, scale: 2 },
9988
+ NPR: { precision: 12, scale: 2 },
9989
+ "002": { precision: 9, scale: 4 },
9990
+ PLN: { precision: 12, scale: 2 },
9991
+ MAD: { precision: 12, scale: 2 },
9992
+ BAM: { precision: 12, scale: 2 },
9993
+ BTN: { precision: 12, scale: 2 },
9994
+ BBD: { precision: 12, scale: 2 },
9995
+ SHP: { precision: 12, scale: 2 },
9996
+ LKR: { precision: 12, scale: 2 },
9997
+ KPW: { precision: 12, scale: 2 },
9998
+ LAK: { precision: 12, scale: 2 },
9999
+ SZL: { precision: 12, scale: 2 },
10000
+ PHP: { precision: 12, scale: 2 },
10001
+ RWF: { precision: 12, scale: 0 },
10002
+ ISK: { precision: 12, scale: 0 },
10003
+ XOF: { precision: 12, scale: 0 },
10004
+ AUD: { precision: 12, scale: 2 },
10005
+ NGN: { precision: 12, scale: 2 },
10006
+ KGS: { precision: 12, scale: 2 },
10007
+ KYD: { precision: 12, scale: 2 },
10008
+ PGK: { precision: 12, scale: 2 },
10009
+ DZD: { precision: 12, scale: 2 },
10010
+ XAF: { precision: 12, scale: 0 },
10011
+ PEN: { precision: 12, scale: 2 },
10012
+ JPY: { precision: 12, scale: 0 },
10013
+ SBD: { precision: 12, scale: 2 },
10014
+ UGX: { precision: 12, scale: 0 },
10015
+ AMD: { precision: 12, scale: 2 },
10016
+ AED: { precision: 12, scale: 2 },
10017
+ ALL: { precision: 12, scale: 2 },
10018
+ XPF: { precision: 12, scale: 0 },
10019
+ AFN: { precision: 12, scale: 2 },
10020
+ RON: { precision: 12, scale: 2 },
10021
+ TND: { precision: 12, scale: 3 },
10022
+ NZD: { precision: 12, scale: 2 },
10023
+ JOD: { precision: 12, scale: 3 },
10024
+ VND: { precision: 12, scale: 0 },
10025
+ ETB: { precision: 12, scale: 2 },
10026
+ PYG: { precision: 12, scale: 0 },
10027
+ JMD: { precision: 12, scale: 2 },
10028
+ KES: { precision: 12, scale: 2 },
10029
+ IDR: { precision: 12, scale: 2 },
10030
+ HKD: { precision: 12, scale: 2 },
10031
+ BDT: { precision: 12, scale: 2 },
10032
+ GBP: { precision: 12, scale: 2 },
10033
+ AOA: { precision: 12, scale: 2 },
10034
+ PKR: { precision: 12, scale: 2 },
10035
+ TRY: { precision: 12, scale: 2 },
10036
+ SLL: { precision: 12, scale: 2 },
10037
+ CVE: { precision: 12, scale: 2 },
10038
+ LYD: { precision: 12, scale: 3 },
10039
+ ILS: { precision: 12, scale: 2 },
10040
+ UZS: { precision: 12, scale: 2 },
10041
+ CHF: { precision: 12, scale: 2 },
10042
+ SVC: { precision: 12, scale: 2 },
10043
+ BRL: { precision: 12, scale: 2 },
10044
+ GHS: { precision: 12, scale: 2 },
10045
+ CUP: { precision: 12, scale: 2 },
10046
+ FKP: { precision: 12, scale: 2 },
10047
+ NIO: { precision: 12, scale: 2 },
10048
+ GEL: { precision: 12, scale: 2 },
10049
+ TTD: { precision: 12, scale: 2 },
10050
+ AAA: { precision: 1, scale: 1 },
10051
+ COP: { precision: 12, scale: 2 },
10052
+ MGA: { precision: 12, scale: 2 },
10053
+ INR: { precision: 12, scale: 2 },
10054
+ KRW: { precision: 12, scale: 0 },
10055
+ HNL: { precision: 12, scale: 2 },
10056
+ MMK: { precision: 12, scale: 2 },
10057
+ TZS: { precision: 12, scale: 2 },
10058
+ THB: { precision: 12, scale: 2 },
10059
+ TMT: { precision: 12, scale: 2 },
10060
+ SAR: { precision: 12, scale: 2 },
10061
+ UYU: { precision: 12, scale: 2 },
10062
+ BIF: { precision: 12, scale: 0 },
10063
+ MVR: { precision: 12, scale: 2 },
10064
+ RUB: { precision: 12, scale: 2 },
10065
+ GTQ: { precision: 12, scale: 2 },
10066
+ SCR: { precision: 12, scale: 2 },
10067
+ IQD: { precision: 12, scale: 3 },
10068
+ UAH: { precision: 12, scale: 2 },
10069
+ BYN: { precision: 12, scale: 2 },
10070
+ VES: { precision: 12, scale: 2 },
10071
+ BOB: { precision: 12, scale: 2 },
10072
+ SGD: { precision: 12, scale: 2 },
10073
+ ZMW: { precision: 12, scale: 2 },
10074
+ CZK: { precision: 12, scale: 2 },
10075
+ TJS: { precision: 12, scale: 2 },
10076
+ DOP: { precision: 12, scale: 2 },
10077
+ AZN: { precision: 12, scale: 2 },
10078
+ PAB: { precision: 12, scale: 2 },
10079
+ STN: { precision: 12, scale: 2 },
10080
+ SDG: { precision: 12, scale: 2 },
10081
+ BWP: { precision: 12, scale: 2 },
10082
+ BHD: { precision: 12, scale: 3 },
10083
+ CAD: { precision: 12, scale: 2 },
10084
+ MNT: { precision: 12, scale: 2 },
10085
+ MOP: { precision: 12, scale: 2 },
10086
+ HTG: { precision: 12, scale: 2 },
10087
+ KZT: { precision: 12, scale: 2 },
10088
+ LBP: { precision: 12, scale: 2 },
10089
+ SYP: { precision: 12, scale: 2 },
10090
+ TWD: { precision: 12, scale: 2 },
10091
+ MZN: { precision: 12, scale: 2 },
10092
+ ANG: { precision: 12, scale: 2 },
10093
+ SEK: { precision: 12, scale: 2 },
10094
+ KMF: { precision: 12, scale: 0 },
10095
+ AWG: { precision: 12, scale: 2 },
10096
+ };
10097
+ }
10098
+ CurrencyService.prototype.getCurrencySymbol = function (_a) {
10099
+ var currency = _a.currency;
10100
+ var _b, _c;
10101
+ var numberFormat = new Intl.NumberFormat(this.localeService.getLocaleOptions().locale, {
10102
+ style: "currency",
10103
+ currency: currency !== null && currency !== void 0 ? currency : "BRL",
10104
+ currencyDisplay: "narrowSymbol",
10105
+ maximumFractionDigits: 5,
10106
+ });
10107
+ return (_c = (_b = numberFormat.formatToParts(1).find(function (x) { return x.type === "currency"; })) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : "";
10108
+ };
10109
+ CurrencyService.ctorParameters = function () { return [
10110
+ { type: LocaleService }
10111
+ ]; };
10112
+ CurrencyService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function CurrencyService_Factory() { return new CurrencyService(core["ɵɵinject"](LocaleService)); }, token: CurrencyService, providedIn: "root" });
10113
+ CurrencyService = __decorate([
10114
+ core.Injectable({ providedIn: "root" })
10115
+ ], CurrencyService);
10116
+ return CurrencyService;
10117
+ }());
10118
+
9941
10119
  /**
9942
10120
  * @deprecated Should use bignumber instead
9943
10121
  */
9944
10122
  var CurrencyFieldComponent = /** @class */ (function (_super) {
9945
10123
  __extends(CurrencyFieldComponent, _super);
9946
- function CurrencyFieldComponent(localeService) {
10124
+ function CurrencyFieldComponent(localeService, currencyService) {
9947
10125
  var _this = _super.call(this) || this;
9948
10126
  _this.localeService = localeService;
10127
+ _this.currencyService = currencyService;
9949
10128
  return _this;
9950
10129
  }
9951
10130
  CurrencyFieldComponent.prototype.ngOnInit = function () {
@@ -9980,7 +10159,8 @@
9980
10159
  });
9981
10160
  };
9982
10161
  CurrencyFieldComponent.ctorParameters = function () { return [
9983
- { type: LocaleService }
10162
+ { type: LocaleService },
10163
+ { type: CurrencyService }
9984
10164
  ]; };
9985
10165
  __decorate([
9986
10166
  core.Input()
@@ -9990,7 +10170,7 @@
9990
10170
  ], CurrencyFieldComponent.prototype, "formControl", void 0);
9991
10171
  CurrencyFieldComponent = __decorate([
9992
10172
  core.Component({
9993
- template: "<div class=\"ui-inputgroup\">\n <span\n *ngIf=\"field.numberLocaleOptions.currencySymbol\"\n class=\"ui-inputgroup-addon\">\n {{ field.numberLocaleOptions.currencySymbol }}\n </span>\n <input\n *ngIf=\"!field.mask\"\n type=\"text\"\n [id]=\"(field.id || field.name)\"\n [name]=\"field.name\"\n [formControl]=\"formControl\"\n sNumberInput\n [precision]=\"isFunction(field.precision) ? trigger(field.precision) : field.precision\"\n [scale]=\"isFunction(field.scale) ? trigger(field.scale) : field.scale\"\n [decimalSeparator]=\"field.numberLocaleOptions.decimalSeparator\"\n [thousandsSeparator]=\"field.numberLocaleOptions.thousandsSeparator\"\n [alignTo]=\"field.alignTo\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [placeholder]=\"field.placeholder\"\n [showDelay]=\"500\"\n pInputText\n [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n [ngClass]=\"'mousetrap'\"\n (blur)=\"field.onBlur ? field.onBlur($event) : null\"\n (focus)=\"field.onFocus ? field.onFocus($event): null\" />\n <p-inputMask\n *ngIf=\"field.mask\"\n type=\"text\"\n [inputId]=\"(field.id || field.name)\"\n [name]=\"field.name\"\n [formControl]=\"formControl\"\n [mask]=\"field.mask\"\n [placeholder]=\"field.placeholder\"\n slotChar=\"_\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [showDelay]=\"500\"\n styleClass=\"mousetrap\"\n (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n (onFocus)=\"field.onFocus ? field.onFocus($event): null\"\n (onComplete)=\"field.onComplete ? field.onComplete($event) : null\"\n (onInput)=\"field.onInput ? field.onInput($event) : null\" >\n </p-inputMask>\n</div>\n"
10173
+ template: "<div class=\"ui-inputgroup\">\n <span\n *ngIf=\"field.currency || field.numberLocaleOptions?.currencySymbol\"\n class=\"ui-inputgroup-addon\"\n >\n {{\n field.currency\n ? currencyService.getCurrencySymbol({\n currency: field.currency()\n })\n : field.numberLocaleOptions.currencySymbol\n }}\n </span>\n\n <input\n *ngIf=\"!field.mask\"\n type=\"text\"\n [id]=\"field.id || field.name\"\n [name]=\"field.name\"\n [formControl]=\"formControl\"\n sNumberInput\n [precision]=\"\n field.precision\n ? isFunction(field.precision)\n ? trigger(field.precision)\n : field.precision\n : field.currency && field.currency()\n ? currencyService.currencies[field.currency()].precision\n : 15\n \"\n [scale]=\"\n field.scale\n ? isFunction(field.scale)\n ? trigger(field.scale)\n : field.scale\n : field.currency && field.currency()\n ? currencyService.currencies[field.currency()].scale\n : 0\n \"\n [decimalSeparator]=\"field.numberLocaleOptions.decimalSeparator\"\n [thousandsSeparator]=\"field.numberLocaleOptions.thousandsSeparator\"\n [alignTo]=\"field.alignTo\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [placeholder]=\"field.placeholder\"\n [showDelay]=\"500\"\n pInputText\n [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n [ngClass]=\"'mousetrap'\"\n (blur)=\"field.onBlur ? field.onBlur($event) : null\"\n (focus)=\"field.onFocus ? field.onFocus($event) : null\"\n />\n\n <p-inputMask\n *ngIf=\"field.mask\"\n type=\"text\"\n [inputId]=\"field.id || field.name\"\n [name]=\"field.name\"\n [formControl]=\"formControl\"\n [mask]=\"field.mask\"\n [placeholder]=\"field.placeholder\"\n slotChar=\"_\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [showDelay]=\"500\"\n styleClass=\"mousetrap\"\n (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n (onFocus)=\"field.onFocus ? field.onFocus($event) : null\"\n (onComplete)=\"field.onComplete ? field.onComplete($event) : null\"\n (onInput)=\"field.onInput ? field.onInput($event) : null\"\n ></p-inputMask>\n</div>\n"
9994
10174
  })
9995
10175
  ], CurrencyFieldComponent);
9996
10176
  return CurrencyFieldComponent;
@@ -15050,6 +15230,10 @@
15050
15230
  this._value = this.defaultValue;
15051
15231
  var index = this.steps.findIndex(function (step) { return step.value === _this._value; });
15052
15232
  this.currentIndex = index !== -1 ? index : 0;
15233
+ this.stepChanged.emit({
15234
+ previous: undefined,
15235
+ current: this.steps[this.currentIndex],
15236
+ });
15053
15237
  this.changeDetectorRef.detectChanges();
15054
15238
  }
15055
15239
  };
@@ -18130,31 +18314,6 @@
18130
18314
  return WorkspaceSwitchModule;
18131
18315
  }());
18132
18316
 
18133
- var CurrencyService = /** @class */ (function () {
18134
- function CurrencyService(localeService) {
18135
- this.localeService = localeService;
18136
- }
18137
- CurrencyService.prototype.getCurrencySymbol = function (_a) {
18138
- var currency = _a.currency;
18139
- var _b, _c;
18140
- var numberFormat = new Intl.NumberFormat(this.localeService.getLocaleOptions().locale, {
18141
- style: "currency",
18142
- currency: currency !== null && currency !== void 0 ? currency : "BRL",
18143
- currencyDisplay: 'narrowSymbol',
18144
- maximumFractionDigits: 5,
18145
- });
18146
- return (_c = (_b = numberFormat.formatToParts(1).find(function (x) { return x.type === "currency"; })) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : "";
18147
- };
18148
- CurrencyService.ctorParameters = function () { return [
18149
- { type: LocaleService }
18150
- ]; };
18151
- CurrencyService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function CurrencyService_Factory() { return new CurrencyService(core["ɵɵinject"](LocaleService)); }, token: CurrencyService, providedIn: "root" });
18152
- CurrencyService = __decorate([
18153
- core.Injectable({ providedIn: "root" })
18154
- ], CurrencyService);
18155
- return CurrencyService;
18156
- }());
18157
-
18158
18317
  var fallback = {
18159
18318
  "platform.angular_components.drag_your_photo_or": "Arraste sua foto ou",
18160
18319
  "platform.angular_components.select_a_file": "selecione um arquivo",