@seniorsistemas/angular-components 17.9.3 → 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 (21) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +192 -30
  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/esm2015/components/dynamic-form/components/fields/currency/currency-field.component.js +7 -4
  8. package/esm2015/components/dynamic-form/configurations/fields/currency-field.js +2 -1
  9. package/esm2015/components/dynamic-form/configurations/fields/decimal-field.js +2 -3
  10. package/esm2015/utils/currency/currency.service.js +162 -2
  11. package/esm5/components/dynamic-form/components/fields/currency/currency-field.component.js +7 -4
  12. package/esm5/components/dynamic-form/configurations/fields/currency-field.js +2 -1
  13. package/esm5/components/dynamic-form/configurations/fields/decimal-field.js +2 -3
  14. package/esm5/utils/currency/currency.service.js +162 -2
  15. package/fesm2015/seniorsistemas-angular-components.js +190 -28
  16. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  17. package/fesm5/seniorsistemas-angular-components.js +192 -30
  18. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  19. package/package.json +1 -1
  20. package/seniorsistemas-angular-components.metadata.json +1 -1
  21. package/utils/currency/currency.service.d.ts +634 -0
@@ -5011,11 +5011,10 @@
5011
5011
  var DecimalField = /** @class */ (function (_super) {
5012
5012
  __extends(DecimalField, _super);
5013
5013
  function DecimalField(config) {
5014
- var _a;
5015
5014
  var _this = _super.call(this, config) || this;
5016
5015
  _this.numberLocaleOptions = config.numberLocaleOptions;
5017
5016
  _this.alignTo = config.alignTo || exports.NumberAlignmentOption.RIGHT;
5018
- _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;
5019
5018
  return _this;
5020
5019
  }
5021
5020
  return DecimalField;
@@ -5028,6 +5027,7 @@
5028
5027
  __extends(CurrencyField, _super);
5029
5028
  function CurrencyField(config) {
5030
5029
  var _this = _super.call(this, config) || this;
5030
+ _this.currency = config['currency'];
5031
5031
  _this.numberLocaleOptions = config.numberLocaleOptions;
5032
5032
  return _this;
5033
5033
  }
@@ -9931,14 +9931,200 @@
9931
9931
  return BignumberFieldComponent;
9932
9932
  }(BaseFieldComponent));
9933
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
+
9934
10119
  /**
9935
10120
  * @deprecated Should use bignumber instead
9936
10121
  */
9937
10122
  var CurrencyFieldComponent = /** @class */ (function (_super) {
9938
10123
  __extends(CurrencyFieldComponent, _super);
9939
- function CurrencyFieldComponent(localeService) {
10124
+ function CurrencyFieldComponent(localeService, currencyService) {
9940
10125
  var _this = _super.call(this) || this;
9941
10126
  _this.localeService = localeService;
10127
+ _this.currencyService = currencyService;
9942
10128
  return _this;
9943
10129
  }
9944
10130
  CurrencyFieldComponent.prototype.ngOnInit = function () {
@@ -9973,7 +10159,8 @@
9973
10159
  });
9974
10160
  };
9975
10161
  CurrencyFieldComponent.ctorParameters = function () { return [
9976
- { type: LocaleService }
10162
+ { type: LocaleService },
10163
+ { type: CurrencyService }
9977
10164
  ]; };
9978
10165
  __decorate([
9979
10166
  core.Input()
@@ -9983,7 +10170,7 @@
9983
10170
  ], CurrencyFieldComponent.prototype, "formControl", void 0);
9984
10171
  CurrencyFieldComponent = __decorate([
9985
10172
  core.Component({
9986
- 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"
9987
10174
  })
9988
10175
  ], CurrencyFieldComponent);
9989
10176
  return CurrencyFieldComponent;
@@ -18127,31 +18314,6 @@
18127
18314
  return WorkspaceSwitchModule;
18128
18315
  }());
18129
18316
 
18130
- var CurrencyService = /** @class */ (function () {
18131
- function CurrencyService(localeService) {
18132
- this.localeService = localeService;
18133
- }
18134
- CurrencyService.prototype.getCurrencySymbol = function (_a) {
18135
- var currency = _a.currency;
18136
- var _b, _c;
18137
- var numberFormat = new Intl.NumberFormat(this.localeService.getLocaleOptions().locale, {
18138
- style: "currency",
18139
- currency: currency !== null && currency !== void 0 ? currency : "BRL",
18140
- currencyDisplay: 'narrowSymbol',
18141
- maximumFractionDigits: 5,
18142
- });
18143
- 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 : "";
18144
- };
18145
- CurrencyService.ctorParameters = function () { return [
18146
- { type: LocaleService }
18147
- ]; };
18148
- CurrencyService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function CurrencyService_Factory() { return new CurrencyService(core["ɵɵinject"](LocaleService)); }, token: CurrencyService, providedIn: "root" });
18149
- CurrencyService = __decorate([
18150
- core.Injectable({ providedIn: "root" })
18151
- ], CurrencyService);
18152
- return CurrencyService;
18153
- }());
18154
-
18155
18317
  var fallback = {
18156
18318
  "platform.angular_components.drag_your_photo_or": "Arraste sua foto ou",
18157
18319
  "platform.angular_components.select_a_file": "selecione um arquivo",