@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
@@ -463,14 +463,13 @@ let TooltipDirective = class TooltipDirective {
463
463
  */
464
464
  updateTooltipVisibilityWhenFocusOnInput() {
465
465
  if (this.focusedInputRef) {
466
- const inputFocus = this.focusedInputRef;
467
- const icon = this.getIconFromFocusedInput(inputFocus);
468
- this.renderer.listen(inputFocus, 'focus', () => {
466
+ const icon = this.getIconFromFocusedInput();
467
+ this.renderer.listen(this.focusedInputRef, 'focus', () => {
469
468
  if (icon && this.isMatchingTooltip(icon)) {
470
469
  this.createTootipByFocus(icon);
471
470
  }
472
471
  });
473
- this.renderer.listen(inputFocus, 'blur', () => {
472
+ this.renderer.listen(this.focusedInputRef, 'blur', () => {
474
473
  if (icon && this.isMatchingTooltip(icon)) {
475
474
  this.removeTooltip(icon);
476
475
  this.destroy();
@@ -480,16 +479,10 @@ let TooltipDirective = class TooltipDirective {
480
479
  }
481
480
  /**
482
481
  * Obtém o elemento do ícone associado ao label do input em focus.
483
- * @param focusedInput O input em focus.
484
- * @returns O ícone do input em focus ou null.
482
+ * @returns O ícone do input em focus.
485
483
  */
486
- getIconFromFocusedInput(focusedInput) {
487
- const label = document.querySelector(`label[for='${focusedInput.id}']`);
488
- if (label) {
489
- const icon = label.nextElementSibling;
490
- return (icon === null || icon === void 0 ? void 0 : icon.classList.contains('info-sign__icon')) ? icon : null;
491
- }
492
- return null;
484
+ getIconFromFocusedInput() {
485
+ return this.elementRef.nativeElement;
493
486
  }
494
487
  /**
495
488
  * Verifica se o ícone tem o tooltip correspondente ao atual.
@@ -4580,11 +4573,10 @@ class NumberField extends Field {
4580
4573
  */
4581
4574
  class DecimalField extends NumberField {
4582
4575
  constructor(config) {
4583
- var _a;
4584
4576
  super(config);
4585
4577
  this.numberLocaleOptions = config.numberLocaleOptions;
4586
4578
  this.alignTo = config.alignTo || NumberAlignmentOption.RIGHT;
4587
- this.scale = typeof config.scale === "function" ? config.scale() : (_a = config.scale) !== null && _a !== void 0 ? _a : 2;
4579
+ this.scale = typeof config.scale === "function" ? config.scale() : config.scale;
4588
4580
  }
4589
4581
  }
4590
4582
 
@@ -4594,6 +4586,7 @@ class DecimalField extends NumberField {
4594
4586
  class CurrencyField extends DecimalField {
4595
4587
  constructor(config) {
4596
4588
  super(config);
4589
+ this.currency = config['currency'];
4597
4590
  this.numberLocaleOptions = config.numberLocaleOptions;
4598
4591
  }
4599
4592
  }
@@ -9186,13 +9179,197 @@ BignumberFieldComponent = __decorate([
9186
9179
  })
9187
9180
  ], BignumberFieldComponent);
9188
9181
 
9182
+ let CurrencyService = class CurrencyService {
9183
+ constructor(localeService) {
9184
+ this.localeService = localeService;
9185
+ this.currencies = {
9186
+ KHR: { precision: 12, scale: 2 },
9187
+ SSP: { precision: 12, scale: 2 },
9188
+ XCD: { precision: 12, scale: 2 },
9189
+ EGP: { precision: 12, scale: 2 },
9190
+ KWD: { precision: 12, scale: 3 },
9191
+ YER: { precision: 12, scale: 2 },
9192
+ HUF: { precision: 12, scale: 2 },
9193
+ MXN: { precision: 12, scale: 2 },
9194
+ MYR: { precision: 12, scale: 2 },
9195
+ ZWL: { precision: 12, scale: 2 },
9196
+ MUR: { precision: 12, scale: 2 },
9197
+ DKK: { precision: 12, scale: 2 },
9198
+ NOK: { precision: 12, scale: 2 },
9199
+ DJF: { precision: 12, scale: 0 },
9200
+ CRC: { precision: 12, scale: 2 },
9201
+ BND: { precision: 12, scale: 2 },
9202
+ NAD: { precision: 12, scale: 2 },
9203
+ MKD: { precision: 12, scale: 2 },
9204
+ CDF: { precision: 12, scale: 2 },
9205
+ GNF: { precision: 12, scale: 0 },
9206
+ EUR: { precision: 12, scale: 2 },
9207
+ OMR: { precision: 12, scale: 3 },
9208
+ CLP: { precision: 12, scale: 0 },
9209
+ BSD: { precision: 12, scale: 2 },
9210
+ TOP: { precision: 12, scale: 2 },
9211
+ IRR: { precision: 12, scale: 2 },
9212
+ BGN: { precision: 12, scale: 2 },
9213
+ BZD: { precision: 12, scale: 2 },
9214
+ CNY: { precision: 12, scale: 2 },
9215
+ FJD: { precision: 12, scale: 2 },
9216
+ SRD: { precision: 12, scale: 2 },
9217
+ SOS: { precision: 12, scale: 2 },
9218
+ GYD: { precision: 12, scale: 2 },
9219
+ VUV: { precision: 12, scale: 0 },
9220
+ MWK: { precision: 12, scale: 2 },
9221
+ MRU: { precision: 12, scale: 2 },
9222
+ LSL: { precision: 12, scale: 2 },
9223
+ ERN: { precision: 12, scale: 2 },
9224
+ BMD: { precision: 12, scale: 2 },
9225
+ WST: { precision: 12, scale: 2 },
9226
+ LRD: { precision: 12, scale: 2 },
9227
+ GMD: { precision: 12, scale: 2 },
9228
+ ARS: { precision: 12, scale: 2 },
9229
+ ZAR: { precision: 12, scale: 2 },
9230
+ RSD: { precision: 12, scale: 2 },
9231
+ MDL: { precision: 12, scale: 2 },
9232
+ USD: { precision: 12, scale: 2 },
9233
+ QAR: { precision: 12, scale: 2 },
9234
+ HRK: { precision: 12, scale: 2 },
9235
+ GIP: { precision: 12, scale: 2 },
9236
+ NPR: { precision: 12, scale: 2 },
9237
+ "002": { precision: 9, scale: 4 },
9238
+ PLN: { precision: 12, scale: 2 },
9239
+ MAD: { precision: 12, scale: 2 },
9240
+ BAM: { precision: 12, scale: 2 },
9241
+ BTN: { precision: 12, scale: 2 },
9242
+ BBD: { precision: 12, scale: 2 },
9243
+ SHP: { precision: 12, scale: 2 },
9244
+ LKR: { precision: 12, scale: 2 },
9245
+ KPW: { precision: 12, scale: 2 },
9246
+ LAK: { precision: 12, scale: 2 },
9247
+ SZL: { precision: 12, scale: 2 },
9248
+ PHP: { precision: 12, scale: 2 },
9249
+ RWF: { precision: 12, scale: 0 },
9250
+ ISK: { precision: 12, scale: 0 },
9251
+ XOF: { precision: 12, scale: 0 },
9252
+ AUD: { precision: 12, scale: 2 },
9253
+ NGN: { precision: 12, scale: 2 },
9254
+ KGS: { precision: 12, scale: 2 },
9255
+ KYD: { precision: 12, scale: 2 },
9256
+ PGK: { precision: 12, scale: 2 },
9257
+ DZD: { precision: 12, scale: 2 },
9258
+ XAF: { precision: 12, scale: 0 },
9259
+ PEN: { precision: 12, scale: 2 },
9260
+ JPY: { precision: 12, scale: 0 },
9261
+ SBD: { precision: 12, scale: 2 },
9262
+ UGX: { precision: 12, scale: 0 },
9263
+ AMD: { precision: 12, scale: 2 },
9264
+ AED: { precision: 12, scale: 2 },
9265
+ ALL: { precision: 12, scale: 2 },
9266
+ XPF: { precision: 12, scale: 0 },
9267
+ AFN: { precision: 12, scale: 2 },
9268
+ RON: { precision: 12, scale: 2 },
9269
+ TND: { precision: 12, scale: 3 },
9270
+ NZD: { precision: 12, scale: 2 },
9271
+ JOD: { precision: 12, scale: 3 },
9272
+ VND: { precision: 12, scale: 0 },
9273
+ ETB: { precision: 12, scale: 2 },
9274
+ PYG: { precision: 12, scale: 0 },
9275
+ JMD: { precision: 12, scale: 2 },
9276
+ KES: { precision: 12, scale: 2 },
9277
+ IDR: { precision: 12, scale: 2 },
9278
+ HKD: { precision: 12, scale: 2 },
9279
+ BDT: { precision: 12, scale: 2 },
9280
+ GBP: { precision: 12, scale: 2 },
9281
+ AOA: { precision: 12, scale: 2 },
9282
+ PKR: { precision: 12, scale: 2 },
9283
+ TRY: { precision: 12, scale: 2 },
9284
+ SLL: { precision: 12, scale: 2 },
9285
+ CVE: { precision: 12, scale: 2 },
9286
+ LYD: { precision: 12, scale: 3 },
9287
+ ILS: { precision: 12, scale: 2 },
9288
+ UZS: { precision: 12, scale: 2 },
9289
+ CHF: { precision: 12, scale: 2 },
9290
+ SVC: { precision: 12, scale: 2 },
9291
+ BRL: { precision: 12, scale: 2 },
9292
+ GHS: { precision: 12, scale: 2 },
9293
+ CUP: { precision: 12, scale: 2 },
9294
+ FKP: { precision: 12, scale: 2 },
9295
+ NIO: { precision: 12, scale: 2 },
9296
+ GEL: { precision: 12, scale: 2 },
9297
+ TTD: { precision: 12, scale: 2 },
9298
+ AAA: { precision: 1, scale: 1 },
9299
+ COP: { precision: 12, scale: 2 },
9300
+ MGA: { precision: 12, scale: 2 },
9301
+ INR: { precision: 12, scale: 2 },
9302
+ KRW: { precision: 12, scale: 0 },
9303
+ HNL: { precision: 12, scale: 2 },
9304
+ MMK: { precision: 12, scale: 2 },
9305
+ TZS: { precision: 12, scale: 2 },
9306
+ THB: { precision: 12, scale: 2 },
9307
+ TMT: { precision: 12, scale: 2 },
9308
+ SAR: { precision: 12, scale: 2 },
9309
+ UYU: { precision: 12, scale: 2 },
9310
+ BIF: { precision: 12, scale: 0 },
9311
+ MVR: { precision: 12, scale: 2 },
9312
+ RUB: { precision: 12, scale: 2 },
9313
+ GTQ: { precision: 12, scale: 2 },
9314
+ SCR: { precision: 12, scale: 2 },
9315
+ IQD: { precision: 12, scale: 3 },
9316
+ UAH: { precision: 12, scale: 2 },
9317
+ BYN: { precision: 12, scale: 2 },
9318
+ VES: { precision: 12, scale: 2 },
9319
+ BOB: { precision: 12, scale: 2 },
9320
+ SGD: { precision: 12, scale: 2 },
9321
+ ZMW: { precision: 12, scale: 2 },
9322
+ CZK: { precision: 12, scale: 2 },
9323
+ TJS: { precision: 12, scale: 2 },
9324
+ DOP: { precision: 12, scale: 2 },
9325
+ AZN: { precision: 12, scale: 2 },
9326
+ PAB: { precision: 12, scale: 2 },
9327
+ STN: { precision: 12, scale: 2 },
9328
+ SDG: { precision: 12, scale: 2 },
9329
+ BWP: { precision: 12, scale: 2 },
9330
+ BHD: { precision: 12, scale: 3 },
9331
+ CAD: { precision: 12, scale: 2 },
9332
+ MNT: { precision: 12, scale: 2 },
9333
+ MOP: { precision: 12, scale: 2 },
9334
+ HTG: { precision: 12, scale: 2 },
9335
+ KZT: { precision: 12, scale: 2 },
9336
+ LBP: { precision: 12, scale: 2 },
9337
+ SYP: { precision: 12, scale: 2 },
9338
+ TWD: { precision: 12, scale: 2 },
9339
+ MZN: { precision: 12, scale: 2 },
9340
+ ANG: { precision: 12, scale: 2 },
9341
+ SEK: { precision: 12, scale: 2 },
9342
+ KMF: { precision: 12, scale: 0 },
9343
+ AWG: { precision: 12, scale: 2 },
9344
+ };
9345
+ }
9346
+ getCurrencySymbol({ currency }) {
9347
+ var _a, _b;
9348
+ const numberFormat = new Intl.NumberFormat(this.localeService.getLocaleOptions().locale, {
9349
+ style: "currency",
9350
+ currency: currency !== null && currency !== void 0 ? currency : "BRL",
9351
+ currencyDisplay: "narrowSymbol",
9352
+ maximumFractionDigits: 5,
9353
+ });
9354
+ return (_b = (_a = numberFormat.formatToParts(1).find((x) => x.type === "currency")) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
9355
+ }
9356
+ };
9357
+ CurrencyService.ctorParameters = () => [
9358
+ { type: LocaleService }
9359
+ ];
9360
+ CurrencyService.ɵprov = ɵɵdefineInjectable({ factory: function CurrencyService_Factory() { return new CurrencyService(ɵɵinject(LocaleService)); }, token: CurrencyService, providedIn: "root" });
9361
+ CurrencyService = __decorate([
9362
+ Injectable({ providedIn: "root" })
9363
+ ], CurrencyService);
9364
+
9189
9365
  /**
9190
9366
  * @deprecated Should use bignumber instead
9191
9367
  */
9192
9368
  let CurrencyFieldComponent = class CurrencyFieldComponent extends BaseFieldComponent {
9193
- constructor(localeService) {
9369
+ constructor(localeService, currencyService) {
9194
9370
  super();
9195
9371
  this.localeService = localeService;
9372
+ this.currencyService = currencyService;
9196
9373
  }
9197
9374
  ngOnInit() {
9198
9375
  this.onLocaleService();
@@ -9226,7 +9403,8 @@ let CurrencyFieldComponent = class CurrencyFieldComponent extends BaseFieldCompo
9226
9403
  }
9227
9404
  };
9228
9405
  CurrencyFieldComponent.ctorParameters = () => [
9229
- { type: LocaleService }
9406
+ { type: LocaleService },
9407
+ { type: CurrencyService }
9230
9408
  ];
9231
9409
  __decorate([
9232
9410
  Input()
@@ -9236,7 +9414,7 @@ __decorate([
9236
9414
  ], CurrencyFieldComponent.prototype, "formControl", void 0);
9237
9415
  CurrencyFieldComponent = __decorate([
9238
9416
  Component({
9239
- 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"
9417
+ 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"
9240
9418
  })
9241
9419
  ], CurrencyFieldComponent);
9242
9420
 
@@ -13965,6 +14143,10 @@ let NavigationButtonComponent = NavigationButtonComponent_1 = class NavigationBu
13965
14143
  this._value = this.defaultValue;
13966
14144
  const index = this.steps.findIndex((step) => step.value === this._value);
13967
14145
  this.currentIndex = index !== -1 ? index : 0;
14146
+ this.stepChanged.emit({
14147
+ previous: undefined,
14148
+ current: this.steps[this.currentIndex],
14149
+ });
13968
14150
  this.changeDetectorRef.detectChanges();
13969
14151
  }
13970
14152
  }
@@ -16849,29 +17031,6 @@ WorkspaceSwitchModule = __decorate([
16849
17031
  })
16850
17032
  ], WorkspaceSwitchModule);
16851
17033
 
16852
- let CurrencyService = class CurrencyService {
16853
- constructor(localeService) {
16854
- this.localeService = localeService;
16855
- }
16856
- getCurrencySymbol({ currency }) {
16857
- var _a, _b;
16858
- const numberFormat = new Intl.NumberFormat(this.localeService.getLocaleOptions().locale, {
16859
- style: "currency",
16860
- currency: currency !== null && currency !== void 0 ? currency : "BRL",
16861
- currencyDisplay: 'narrowSymbol',
16862
- maximumFractionDigits: 5,
16863
- });
16864
- return (_b = (_a = numberFormat.formatToParts(1).find((x) => x.type === "currency")) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
16865
- }
16866
- };
16867
- CurrencyService.ctorParameters = () => [
16868
- { type: LocaleService }
16869
- ];
16870
- CurrencyService.ɵprov = ɵɵdefineInjectable({ factory: function CurrencyService_Factory() { return new CurrencyService(ɵɵinject(LocaleService)); }, token: CurrencyService, providedIn: "root" });
16871
- CurrencyService = __decorate([
16872
- Injectable({ providedIn: "root" })
16873
- ], CurrencyService);
16874
-
16875
17034
  const fallback = {
16876
17035
  "platform.angular_components.drag_your_photo_or": "Arraste sua foto ou",
16877
17036
  "platform.angular_components.select_a_file": "selecione um arquivo",