@seniorsistemas/angular-components 17.6.4 → 17.7.0

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 (27) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +186 -84
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/locale/locale.service.d.ts +5 -0
  6. package/components/locale/options/index.d.ts +1 -0
  7. package/components/locale/pipes/numeric.pipe.d.ts +13 -0
  8. package/components/locale/services/numeric.service.d.ts +24 -0
  9. package/esm2015/components/locale/locale.module.js +8 -4
  10. package/esm2015/components/locale/locale.service.js +9 -2
  11. package/esm2015/components/locale/options/index.js +1 -1
  12. package/esm2015/components/locale/pipes/numeric.pipe.js +28 -0
  13. package/esm2015/components/locale/services/numeric.service.js +70 -0
  14. package/esm2015/seniorsistemas-angular-components.js +83 -81
  15. package/esm5/components/locale/locale.module.js +8 -4
  16. package/esm5/components/locale/locale.service.js +10 -3
  17. package/esm5/components/locale/options/index.js +1 -1
  18. package/esm5/components/locale/pipes/numeric.pipe.js +32 -0
  19. package/esm5/components/locale/services/numeric.service.js +71 -0
  20. package/esm5/seniorsistemas-angular-components.js +83 -81
  21. package/fesm2015/seniorsistemas-angular-components.js +101 -6
  22. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  23. package/fesm5/seniorsistemas-angular-components.js +107 -7
  24. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  25. package/package.json +1 -1
  26. package/seniorsistemas-angular-components.d.ts +82 -80
  27. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -1090,7 +1090,7 @@
1090
1090
  var _this = this;
1091
1091
  return this.localeOptions
1092
1092
  ? rxjs.of(this.localeOptions)
1093
- : this.getLocaleConfig().pipe(operators.tap(function (localeOptions) { return (_this.localeOptions = localeOptions); }));
1093
+ : this.getLocaleConfig().pipe(operators.tap(function (localeOptions) { return (_this.localeOptions = __assign(__assign({}, localeOptions), { locale: _this.locale })); }));
1094
1094
  };
1095
1095
  LocaleService.prototype.getLocale = function () {
1096
1096
  var _this = this;
@@ -1101,6 +1101,13 @@
1101
1101
  return _this.locale;
1102
1102
  }));
1103
1103
  };
1104
+ /**
1105
+ * Returns an object with the locale options based on the user's locale(platform locale).
1106
+ * @return The locale options object.
1107
+ */
1108
+ LocaleService.prototype.getLocaleOptions = function () {
1109
+ return this.localeOptions;
1110
+ };
1104
1111
  LocaleService.prototype.getUserData = function () {
1105
1112
  try {
1106
1113
  return rxjs.of(JSON.parse(this.cookieService.get("com.senior.token")));
@@ -6511,6 +6518,96 @@
6511
6518
  return LocalizedTimeImpurePipe;
6512
6519
  }(LocalizedTimePipe));
6513
6520
 
6521
+ var NumericService = /** @class */ (function () {
6522
+ function NumericService(localeService) {
6523
+ this.localeService = localeService;
6524
+ }
6525
+ /**
6526
+ * Wrapper around Intl.NumberFormat that returns the localized value using the user's locale by default(platform's preferential language).
6527
+ *
6528
+ * This method should only be used after the localeService has been initialized by the host application, either by a resolver or a manual call.
6529
+ *
6530
+ * Can be overwritten by the provided Intl.NumberFormatOptions.
6531
+ *
6532
+ * Documentation is available at {@link https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat Intl.NumberFormatOptions}.
6533
+ *
6534
+ * @param {number | string | BigNumber} value The value to be formatted.
6535
+ * @param {Intl.NumberFormatOptions} options Options that overwrites the default Intl.NumberFormatOptions.
6536
+ * @return `string` The formatted value.
6537
+ */
6538
+ NumericService.prototype.instant = function (value, options) {
6539
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
6540
+ options = __assign(__assign({}, options), { locale: (_c = (_a = options === null || options === void 0 ? void 0 : options.locale) !== null && _a !== void 0 ? _a : (_b = this.localeService.getLocaleOptions()) === null || _b === void 0 ? void 0 : _b.locale) !== null && _c !== void 0 ? _c : "pt-BR", options: __assign(__assign({}, options === null || options === void 0 ? void 0 : options.options), { currency: ((_d = options === null || options === void 0 ? void 0 : options.options) === null || _d === void 0 ? void 0 : _d.style) === "currency" ? (_f = (_e = options === null || options === void 0 ? void 0 : options.options) === null || _e === void 0 ? void 0 : _e.currency) !== null && _f !== void 0 ? _f : "BRL" : undefined, currencyDisplay: ((_g = options === null || options === void 0 ? void 0 : options.options) === null || _g === void 0 ? void 0 : _g.style) === "currency" ? (_j = (_h = options === null || options === void 0 ? void 0 : options.options) === null || _h === void 0 ? void 0 : _h.currencyDisplay) !== null && _j !== void 0 ? _j : "narrowSymbol" : undefined, minimumFractionDigits: (_l = (_k = options === null || options === void 0 ? void 0 : options.options) === null || _k === void 0 ? void 0 : _k.minimumFractionDigits) !== null && _l !== void 0 ? _l : 0 }) });
6541
+ // From https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
6542
+ return new Intl.NumberFormat(options.locale, options.options).format(this.getType(value) === "number" || this.getType(value) === "string" ? value : value.toString());
6543
+ };
6544
+ NumericService.prototype.getType = function (value) {
6545
+ // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
6546
+ if (value === null) {
6547
+ return "null";
6548
+ }
6549
+ var baseType = typeof value;
6550
+ // Primitive types
6551
+ if (baseType !== "object" && baseType !== "function") {
6552
+ return baseType;
6553
+ }
6554
+ // Symbol.toStringTag often specifies the "display name" of the
6555
+ // object's class. It's used in Object.prototype.toString().
6556
+ var tag = value[Symbol.toStringTag];
6557
+ if (typeof tag === "string") {
6558
+ return tag;
6559
+ }
6560
+ // If it's a function whose source code starts with the "class" keyword
6561
+ if (baseType === "function" && Function.prototype.toString.call(value).startsWith("class")) {
6562
+ return "class";
6563
+ }
6564
+ // The name of the constructor; for example `Array`, `GeneratorFunction`,
6565
+ // `Number`, `String`, `Boolean` or `MyCustomClass`
6566
+ var className = value.constructor.name;
6567
+ if (typeof className === "string" && className !== "") {
6568
+ return className;
6569
+ }
6570
+ // At this point there's no robust way to get the type of value,
6571
+ // so we use the base implementation.
6572
+ return baseType;
6573
+ };
6574
+ NumericService.ctorParameters = function () { return [
6575
+ { type: LocaleService }
6576
+ ]; };
6577
+ NumericService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function NumericService_Factory() { return new NumericService(core["ɵɵinject"](LocaleService)); }, token: NumericService, providedIn: "root" });
6578
+ NumericService = __decorate([
6579
+ core.Injectable({
6580
+ providedIn: "root",
6581
+ })
6582
+ ], NumericService);
6583
+ return NumericService;
6584
+ }());
6585
+
6586
+ var NumericPipe = /** @class */ (function () {
6587
+ function NumericPipe(numericService, localeService) {
6588
+ this.numericService = numericService;
6589
+ this.localeService = localeService;
6590
+ }
6591
+ NumericPipe.prototype.transform = function (value, options) {
6592
+ var _this = this;
6593
+ return (options === null || options === void 0 ? void 0 : options.locale) ? rxjs.of(this.numericService.instant(value, options))
6594
+ : this.localeService.getLocale().pipe(operators.map(function (locale) {
6595
+ return _this.numericService.instant(value, {
6596
+ locale: locale,
6597
+ options: options === null || options === void 0 ? void 0 : options.options,
6598
+ });
6599
+ }));
6600
+ };
6601
+ NumericPipe.ctorParameters = function () { return [
6602
+ { type: NumericService },
6603
+ { type: LocaleService }
6604
+ ]; };
6605
+ NumericPipe = __decorate([
6606
+ core.Pipe({ name: "numeric" })
6607
+ ], NumericPipe);
6608
+ return NumericPipe;
6609
+ }());
6610
+
6514
6611
  var LocaleModule = /** @class */ (function () {
6515
6612
  function LocaleModule() {
6516
6613
  }
@@ -6528,7 +6625,8 @@
6528
6625
  LocalizedDateImpurePipe,
6529
6626
  LocalizedTimeImpurePipe,
6530
6627
  LocalizedBignumberPipe,
6531
- LocalizedBignumberImpurePipe
6628
+ LocalizedBignumberImpurePipe,
6629
+ NumericPipe
6532
6630
  ],
6533
6631
  };
6534
6632
  };
@@ -6550,7 +6648,8 @@
6550
6648
  LocalizedDateImpurePipe,
6551
6649
  LocalizedTimeImpurePipe,
6552
6650
  LocalizedBignumberPipe,
6553
- LocalizedBignumberImpurePipe
6651
+ LocalizedBignumberImpurePipe,
6652
+ NumericPipe
6554
6653
  ],
6555
6654
  declarations: [
6556
6655
  LocalizedCurrencyPipe,
@@ -6561,7 +6660,8 @@
6561
6660
  LocalizedDateImpurePipe,
6562
6661
  LocalizedTimeImpurePipe,
6563
6662
  LocalizedBignumberPipe,
6564
- LocalizedBignumberImpurePipe
6663
+ LocalizedBignumberImpurePipe,
6664
+ NumericPipe
6565
6665
  ],
6566
6666
  })
6567
6667
  ], LocaleModule);
@@ -17933,74 +18033,76 @@
17933
18033
  exports.fallback = fallback;
17934
18034
  exports.ɵa = TooltipComponent;
17935
18035
  exports.ɵb = TooltipDirective;
17936
- exports.ɵba = TextFieldComponent;
17937
- exports.ɵbb = NumberFieldModule;
17938
- exports.ɵbc = LocalizedNumberInputModule;
17939
- exports.ɵbd = NumberInputModule;
17940
- exports.ɵbe = NumberFieldComponent;
17941
- exports.ɵbf = CurrencyFieldModule;
17942
- exports.ɵbg = CurrencyFieldComponent;
17943
- exports.ɵbh = NumberFieldModule$1;
17944
- exports.ɵbi = BignumberInputModule;
17945
- exports.ɵbj = BignumberFieldComponent;
17946
- exports.ɵbk = AutocompleteFieldComponent;
17947
- exports.ɵbl = BooleanFieldComponent;
17948
- exports.ɵbm = BooleanSwitchFieldComponent;
17949
- exports.ɵbn = CalendarFieldComponent;
17950
- exports.ɵbo = ChipsFieldComponent;
17951
- exports.ɵbp = CountryPhonePickerFieldComponent;
17952
- exports.ɵbq = DynamicFieldComponent;
17953
- exports.ɵbr = DynamicFormDirective;
17954
- exports.ɵbs = FieldsetComponent;
17955
- exports.ɵbt = FileUploadComponent$1;
17956
- exports.ɵbu = LookupFieldComponent;
17957
- exports.ɵbv = PasswordFieldComponent;
17958
- exports.ɵbw = RadioButtonComponent;
17959
- exports.ɵbx = RowComponent;
17960
- exports.ɵby = SectionComponent;
17961
- exports.ɵbz = SelectFieldComponent;
18036
+ exports.ɵba = TablePagingComponent;
18037
+ exports.ɵbb = TextFieldModule;
18038
+ exports.ɵbc = TextFieldComponent;
18039
+ exports.ɵbd = NumberFieldModule;
18040
+ exports.ɵbe = LocalizedNumberInputModule;
18041
+ exports.ɵbf = NumberInputModule;
18042
+ exports.ɵbg = NumberFieldComponent;
18043
+ exports.ɵbh = CurrencyFieldModule;
18044
+ exports.ɵbi = CurrencyFieldComponent;
18045
+ exports.ɵbj = NumberFieldModule$1;
18046
+ exports.ɵbk = BignumberInputModule;
18047
+ exports.ɵbl = BignumberFieldComponent;
18048
+ exports.ɵbm = AutocompleteFieldComponent;
18049
+ exports.ɵbn = BooleanFieldComponent;
18050
+ exports.ɵbo = BooleanSwitchFieldComponent;
18051
+ exports.ɵbp = CalendarFieldComponent;
18052
+ exports.ɵbq = ChipsFieldComponent;
18053
+ exports.ɵbr = CountryPhonePickerFieldComponent;
18054
+ exports.ɵbs = DynamicFieldComponent;
18055
+ exports.ɵbt = DynamicFormDirective;
18056
+ exports.ɵbu = FieldsetComponent;
18057
+ exports.ɵbv = FileUploadComponent$1;
18058
+ exports.ɵbw = LookupFieldComponent;
18059
+ exports.ɵbx = PasswordFieldComponent;
18060
+ exports.ɵby = RadioButtonComponent;
18061
+ exports.ɵbz = RowComponent;
17962
18062
  exports.ɵc = TemplateDirective;
17963
- exports.ɵca = SliderFieldComponent;
17964
- exports.ɵcb = TextAreaFieldComponent;
17965
- exports.ɵcc = TextAreaIAFieldComponent;
17966
- exports.ɵcd = IAssistService;
17967
- exports.ɵcf = DecimalField;
17968
- exports.ɵcg = SideTableComponent;
17969
- exports.ɵch = ThumbnailService;
17970
- exports.ɵci = InfiniteScrollModule;
17971
- exports.ɵcj = InfiniteScrollDirective;
17972
- exports.ɵck = IAInsightSidebarComponent;
17973
- exports.ɵcl = IAInsightCardComponent;
17974
- exports.ɵcm = IAInsightCardLoaderComponent;
17975
- exports.ɵcn = StructureModule;
17976
- exports.ɵco = HeaderComponent;
17977
- exports.ɵcp = FooterComponent;
17978
- exports.ɵcq = KanbanEventService;
17979
- exports.ɵcr = KanbanItemComponent;
17980
- exports.ɵcs = KanbanColumnComponent;
17981
- exports.ɵct = KanbanItemDraggingComponent;
17982
- exports.ɵcu = NumberLocaleOptions;
17983
- exports.ɵcv = BorderButtonModule;
17984
- exports.ɵcw = BorderButtonComponent;
17985
- exports.ɵcx = SelectButtonItemComponent;
17986
- exports.ɵcy = SlidePanelService;
17987
- exports.ɵcz = TieredMenuEventService;
18063
+ exports.ɵca = SectionComponent;
18064
+ exports.ɵcb = SelectFieldComponent;
18065
+ exports.ɵcc = SliderFieldComponent;
18066
+ exports.ɵcd = TextAreaFieldComponent;
18067
+ exports.ɵce = TextAreaIAFieldComponent;
18068
+ exports.ɵcf = IAssistService;
18069
+ exports.ɵch = DecimalField;
18070
+ exports.ɵci = SideTableComponent;
18071
+ exports.ɵcj = ThumbnailService;
18072
+ exports.ɵck = InfiniteScrollModule;
18073
+ exports.ɵcl = InfiniteScrollDirective;
18074
+ exports.ɵcm = IAInsightSidebarComponent;
18075
+ exports.ɵcn = IAInsightCardComponent;
18076
+ exports.ɵco = IAInsightCardLoaderComponent;
18077
+ exports.ɵcp = StructureModule;
18078
+ exports.ɵcq = HeaderComponent;
18079
+ exports.ɵcr = FooterComponent;
18080
+ exports.ɵcs = KanbanEventService;
18081
+ exports.ɵct = KanbanItemComponent;
18082
+ exports.ɵcu = KanbanColumnComponent;
18083
+ exports.ɵcv = KanbanItemDraggingComponent;
18084
+ exports.ɵcw = NumberLocaleOptions;
18085
+ exports.ɵcx = BorderButtonModule;
18086
+ exports.ɵcy = BorderButtonComponent;
18087
+ exports.ɵcz = SelectButtonItemComponent;
17988
18088
  exports.ɵd = TemplateModule;
17989
- exports.ɵda = TieredMenuService;
17990
- exports.ɵdb = TieredMenuComponent;
17991
- exports.ɵdc = TieredMenuNestedComponent;
17992
- exports.ɵdd = TieredMenuItemComponent;
17993
- exports.ɵde = TieredMenuDividerComponent;
17994
- exports.ɵdf = TimelineItemModule;
17995
- exports.ɵdg = TimelineIconItemComponent;
17996
- exports.ɵdh = HorizontalTimelineModule;
17997
- exports.ɵdi = HorizontalTimelineComponent;
17998
- exports.ɵdj = VerticalTimelineModule;
17999
- exports.ɵdk = VerticalTimelineComponent;
18000
- exports.ɵdl = RangeLineComponent;
18001
- exports.ɵdm = CollapseOptionComponent;
18002
- exports.ɵdn = CollapsedItemsComponent;
18003
- exports.ɵdo = VerticalItemsComponent;
18089
+ exports.ɵda = SlidePanelService;
18090
+ exports.ɵdb = TieredMenuEventService;
18091
+ exports.ɵdc = TieredMenuService;
18092
+ exports.ɵdd = TieredMenuComponent;
18093
+ exports.ɵde = TieredMenuNestedComponent;
18094
+ exports.ɵdf = TieredMenuItemComponent;
18095
+ exports.ɵdg = TieredMenuDividerComponent;
18096
+ exports.ɵdh = TimelineItemModule;
18097
+ exports.ɵdi = TimelineIconItemComponent;
18098
+ exports.ɵdj = HorizontalTimelineModule;
18099
+ exports.ɵdk = HorizontalTimelineComponent;
18100
+ exports.ɵdl = VerticalTimelineModule;
18101
+ exports.ɵdm = VerticalTimelineComponent;
18102
+ exports.ɵdn = RangeLineComponent;
18103
+ exports.ɵdo = CollapseOptionComponent;
18104
+ exports.ɵdp = CollapsedItemsComponent;
18105
+ exports.ɵdq = VerticalItemsComponent;
18004
18106
  exports.ɵe = CustomTranslationsModule;
18005
18107
  exports.ɵf = CodeEditorComponent;
18006
18108
  exports.ɵg = CoreFacade;
@@ -18009,20 +18111,20 @@
18009
18111
  exports.ɵj = LocalizedCurrencyImpurePipe;
18010
18112
  exports.ɵk = LocalizedBignumberPipe;
18011
18113
  exports.ɵl = LocalizedBignumberImpurePipe;
18012
- exports.ɵm = EmptyStateGoBackComponent;
18013
- exports.ɵn = IAssistIconComponent;
18014
- exports.ɵo = SeniorIconComponent;
18015
- exports.ɵp = DotsIndicatorComponent;
18016
- exports.ɵq = LoadingIndicatorComponent;
18017
- exports.ɵr = ProgressBarDeterminateComponent;
18018
- exports.ɵs = ProgressBarIndeterminateComponent;
18019
- exports.ɵt = FileUploadService;
18020
- exports.ɵu = FileItemComponent;
18021
- exports.ɵv = LocaleService;
18022
- exports.ɵw = InfoSignComponent;
18023
- exports.ɵx = TableColumnsComponent;
18024
- exports.ɵy = TablePagingComponent;
18025
- exports.ɵz = TextFieldModule;
18114
+ exports.ɵm = NumericPipe;
18115
+ exports.ɵn = NumericService;
18116
+ exports.ɵo = EmptyStateGoBackComponent;
18117
+ exports.ɵp = IAssistIconComponent;
18118
+ exports.ɵq = SeniorIconComponent;
18119
+ exports.ɵr = DotsIndicatorComponent;
18120
+ exports.ɵs = LoadingIndicatorComponent;
18121
+ exports.ɵt = ProgressBarDeterminateComponent;
18122
+ exports.ɵu = ProgressBarIndeterminateComponent;
18123
+ exports.ɵv = FileUploadService;
18124
+ exports.ɵw = FileItemComponent;
18125
+ exports.ɵx = LocaleService;
18126
+ exports.ɵy = InfoSignComponent;
18127
+ exports.ɵz = TableColumnsComponent;
18026
18128
 
18027
18129
  Object.defineProperty(exports, '__esModule', { value: true });
18028
18130