intelica-library-ui 0.1.101 → 0.1.102
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.
|
@@ -425,6 +425,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
425
425
|
args: [{ name: "term" }]
|
|
426
426
|
}] });
|
|
427
427
|
|
|
428
|
+
class FormatAmountPipe {
|
|
429
|
+
transform(value, shortFormat = false, decimalPlaces = 2) {
|
|
430
|
+
if (value === null || value === undefined) {
|
|
431
|
+
return "0";
|
|
432
|
+
}
|
|
433
|
+
const numericValue = typeof value === "string" ? parseFloat(value) : value;
|
|
434
|
+
if (isNaN(numericValue)) {
|
|
435
|
+
return "0";
|
|
436
|
+
}
|
|
437
|
+
let formattedValue;
|
|
438
|
+
if (shortFormat) {
|
|
439
|
+
formattedValue = this.getShortFormat(numericValue, decimalPlaces);
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
formattedValue = this.formatWithThousandSeparators(numericValue, decimalPlaces);
|
|
443
|
+
}
|
|
444
|
+
return formattedValue;
|
|
445
|
+
}
|
|
446
|
+
getShortFormat(value, decimalPlaces) {
|
|
447
|
+
const absValue = Math.abs(value);
|
|
448
|
+
const suffixes = [
|
|
449
|
+
{ limit: 1e12, suffix: "T" },
|
|
450
|
+
{ limit: 1e9, suffix: "B" },
|
|
451
|
+
{ limit: 1e6, suffix: "M" },
|
|
452
|
+
{ limit: 1e3, suffix: "K" },
|
|
453
|
+
];
|
|
454
|
+
for (const { limit, suffix } of suffixes) {
|
|
455
|
+
if (absValue >= limit) {
|
|
456
|
+
return (value / limit).toFixed(decimalPlaces) + suffix;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return value.toFixed(decimalPlaces);
|
|
460
|
+
}
|
|
461
|
+
formatWithThousandSeparators(value, decimalPlaces) {
|
|
462
|
+
return new Intl.NumberFormat("en-US", {
|
|
463
|
+
minimumFractionDigits: decimalPlaces,
|
|
464
|
+
maximumFractionDigits: decimalPlaces,
|
|
465
|
+
}).format(value);
|
|
466
|
+
}
|
|
467
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatAmountPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
468
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: FormatAmountPipe, isStandalone: true, name: "amount" });
|
|
469
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatAmountPipe, providedIn: "root" });
|
|
470
|
+
}
|
|
471
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatAmountPipe, decorators: [{
|
|
472
|
+
type: Injectable,
|
|
473
|
+
args: [{
|
|
474
|
+
providedIn: "root",
|
|
475
|
+
}]
|
|
476
|
+
}, {
|
|
477
|
+
type: Pipe,
|
|
478
|
+
args: [{
|
|
479
|
+
name: "amount",
|
|
480
|
+
}]
|
|
481
|
+
}] });
|
|
482
|
+
|
|
428
483
|
class TruncatePipe {
|
|
429
484
|
transform(value, size = 15, original = false) {
|
|
430
485
|
if (!value)
|
|
@@ -6075,5 +6130,5 @@ const IntelicaTheme = definePreset(Aura, {
|
|
|
6075
6130
|
* Generated bundle index. Do not edit.
|
|
6076
6131
|
*/
|
|
6077
6132
|
|
|
6078
|
-
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DynamicInputValidation, EchartComponent, EchartService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaTheme, ItemSplitDirective, LanguageService, ModalDialogComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RowResumenComponent, SearchComponent, SharedService, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TemplateMenuComponent, TermGuard, TermPipe, TermService, TruncatePipe, decryptData, encryptData, getColor };
|
|
6133
|
+
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DynamicInputValidation, EchartComponent, EchartService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FormatAmountPipe, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaTheme, ItemSplitDirective, LanguageService, ModalDialogComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RowResumenComponent, SearchComponent, SharedService, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TemplateMenuComponent, TermGuard, TermPipe, TermService, TruncatePipe, decryptData, encryptData, getColor };
|
|
6079
6134
|
//# sourceMappingURL=intelica-library-ui.mjs.map
|