@kirbydesign/extensions-angular 6.0.0 → 6.2.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.
- package/fesm2022/kirbydesign-extensions-angular-combobox.mjs +9 -9
- package/fesm2022/kirbydesign-extensions-angular-combobox.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-image-banner.mjs +13 -20
- package/fesm2022/kirbydesign-extensions-angular-image-banner.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-localization.mjs +30 -30
- package/fesm2022/kirbydesign-extensions-angular-localization.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-sidebar-menu.mjs +58 -58
- package/fesm2022/kirbydesign-extensions-angular-sidebar-menu.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-skeleton-loader.mjs +10 -7
- package/fesm2022/kirbydesign-extensions-angular-skeleton-loader.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-spot-illustration.mjs +5 -5
- package/fesm2022/kirbydesign-extensions-angular-spot-illustration.mjs.map +1 -1
- package/package.json +1 -1
- package/types/kirbydesign-extensions-angular-localization.d.ts +0 -2
- package/types/kirbydesign-extensions-angular-skeleton-loader.d.ts +4 -3
- package/types/kirbydesign-extensions-angular-spot-illustration.d.ts +0 -6
- package/types/kirbydesign-extensions-angular.d.ts +1 -2
|
@@ -96,7 +96,7 @@ var DateOnlyPipe = class DateOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
|
96
96
|
static {
|
|
97
97
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
98
98
|
minVersion: "12.0.0",
|
|
99
|
-
version: "22.2.
|
|
99
|
+
version: "22.2.4",
|
|
100
100
|
ngImport: i0,
|
|
101
101
|
type: DateOnlyPipe,
|
|
102
102
|
deps: null,
|
|
@@ -106,7 +106,7 @@ var DateOnlyPipe = class DateOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
|
106
106
|
static {
|
|
107
107
|
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
108
108
|
minVersion: "14.0.0",
|
|
109
|
-
version: "22.2.
|
|
109
|
+
version: "22.2.4",
|
|
110
110
|
ngImport: i0,
|
|
111
111
|
type: DateOnlyPipe,
|
|
112
112
|
isStandalone: true,
|
|
@@ -116,7 +116,7 @@ var DateOnlyPipe = class DateOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
|
116
116
|
};
|
|
117
117
|
i0.ɵɵngDeclareClassMetadata({
|
|
118
118
|
minVersion: "12.0.0",
|
|
119
|
-
version: "22.2.
|
|
119
|
+
version: "22.2.4",
|
|
120
120
|
ngImport: i0,
|
|
121
121
|
type: DateOnlyPipe,
|
|
122
122
|
decorators: [{
|
|
@@ -141,7 +141,7 @@ var TimeOnlyPipe = class TimeOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
|
141
141
|
static {
|
|
142
142
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
143
143
|
minVersion: "12.0.0",
|
|
144
|
-
version: "22.2.
|
|
144
|
+
version: "22.2.4",
|
|
145
145
|
ngImport: i0,
|
|
146
146
|
type: TimeOnlyPipe,
|
|
147
147
|
deps: null,
|
|
@@ -151,7 +151,7 @@ var TimeOnlyPipe = class TimeOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
|
151
151
|
static {
|
|
152
152
|
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
153
153
|
minVersion: "14.0.0",
|
|
154
|
-
version: "22.2.
|
|
154
|
+
version: "22.2.4",
|
|
155
155
|
ngImport: i0,
|
|
156
156
|
type: TimeOnlyPipe,
|
|
157
157
|
isStandalone: true,
|
|
@@ -161,7 +161,7 @@ var TimeOnlyPipe = class TimeOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
|
161
161
|
};
|
|
162
162
|
i0.ɵɵngDeclareClassMetadata({
|
|
163
163
|
minVersion: "12.0.0",
|
|
164
|
-
version: "22.2.
|
|
164
|
+
version: "22.2.4",
|
|
165
165
|
ngImport: i0,
|
|
166
166
|
type: TimeOnlyPipe,
|
|
167
167
|
decorators: [{
|
|
@@ -186,7 +186,7 @@ var TimeOrDatePipe = class TimeOrDatePipe extends AbstractTimezoneCompensatingPi
|
|
|
186
186
|
static {
|
|
187
187
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
188
188
|
minVersion: "12.0.0",
|
|
189
|
-
version: "22.2.
|
|
189
|
+
version: "22.2.4",
|
|
190
190
|
ngImport: i0,
|
|
191
191
|
type: TimeOrDatePipe,
|
|
192
192
|
deps: null,
|
|
@@ -196,7 +196,7 @@ var TimeOrDatePipe = class TimeOrDatePipe extends AbstractTimezoneCompensatingPi
|
|
|
196
196
|
static {
|
|
197
197
|
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
198
198
|
minVersion: "14.0.0",
|
|
199
|
-
version: "22.2.
|
|
199
|
+
version: "22.2.4",
|
|
200
200
|
ngImport: i0,
|
|
201
201
|
type: TimeOrDatePipe,
|
|
202
202
|
isStandalone: true,
|
|
@@ -206,7 +206,7 @@ var TimeOrDatePipe = class TimeOrDatePipe extends AbstractTimezoneCompensatingPi
|
|
|
206
206
|
};
|
|
207
207
|
i0.ɵɵngDeclareClassMetadata({
|
|
208
208
|
minVersion: "12.0.0",
|
|
209
|
-
version: "22.2.
|
|
209
|
+
version: "22.2.4",
|
|
210
210
|
ngImport: i0,
|
|
211
211
|
type: TimeOrDatePipe,
|
|
212
212
|
decorators: [{
|
|
@@ -228,7 +228,7 @@ var FormatNumberService = class FormatNumberService {
|
|
|
228
228
|
static {
|
|
229
229
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
230
230
|
minVersion: "12.0.0",
|
|
231
|
-
version: "22.2.
|
|
231
|
+
version: "22.2.4",
|
|
232
232
|
ngImport: i0,
|
|
233
233
|
type: FormatNumberService,
|
|
234
234
|
deps: [{ token: LOCALE_ID }],
|
|
@@ -238,7 +238,7 @@ var FormatNumberService = class FormatNumberService {
|
|
|
238
238
|
static {
|
|
239
239
|
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
240
240
|
minVersion: "12.0.0",
|
|
241
|
-
version: "22.2.
|
|
241
|
+
version: "22.2.4",
|
|
242
242
|
ngImport: i0,
|
|
243
243
|
type: FormatNumberService,
|
|
244
244
|
providedIn: "root"
|
|
@@ -247,7 +247,7 @@ var FormatNumberService = class FormatNumberService {
|
|
|
247
247
|
};
|
|
248
248
|
i0.ɵɵngDeclareClassMetadata({
|
|
249
249
|
minVersion: "12.0.0",
|
|
250
|
-
version: "22.2.
|
|
250
|
+
version: "22.2.4",
|
|
251
251
|
ngImport: i0,
|
|
252
252
|
type: FormatNumberService,
|
|
253
253
|
decorators: [{
|
|
@@ -272,7 +272,7 @@ var FormatNumberPipe = class FormatNumberPipe {
|
|
|
272
272
|
static {
|
|
273
273
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
274
274
|
minVersion: "12.0.0",
|
|
275
|
-
version: "22.2.
|
|
275
|
+
version: "22.2.4",
|
|
276
276
|
ngImport: i0,
|
|
277
277
|
type: FormatNumberPipe,
|
|
278
278
|
deps: [{ token: FormatNumberService }],
|
|
@@ -282,7 +282,7 @@ var FormatNumberPipe = class FormatNumberPipe {
|
|
|
282
282
|
static {
|
|
283
283
|
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
284
284
|
minVersion: "14.0.0",
|
|
285
|
-
version: "22.2.
|
|
285
|
+
version: "22.2.4",
|
|
286
286
|
ngImport: i0,
|
|
287
287
|
type: FormatNumberPipe,
|
|
288
288
|
isStandalone: true,
|
|
@@ -292,7 +292,7 @@ var FormatNumberPipe = class FormatNumberPipe {
|
|
|
292
292
|
};
|
|
293
293
|
i0.ɵɵngDeclareClassMetadata({
|
|
294
294
|
minVersion: "12.0.0",
|
|
295
|
-
version: "22.2.
|
|
295
|
+
version: "22.2.4",
|
|
296
296
|
ngImport: i0,
|
|
297
297
|
type: FormatNumberPipe,
|
|
298
298
|
decorators: [{
|
|
@@ -348,7 +348,7 @@ var AmountService = class AmountService {
|
|
|
348
348
|
static {
|
|
349
349
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
350
350
|
minVersion: "12.0.0",
|
|
351
|
-
version: "22.2.
|
|
351
|
+
version: "22.2.4",
|
|
352
352
|
ngImport: i0,
|
|
353
353
|
type: AmountService,
|
|
354
354
|
deps: [],
|
|
@@ -358,7 +358,7 @@ var AmountService = class AmountService {
|
|
|
358
358
|
static {
|
|
359
359
|
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
360
360
|
minVersion: "12.0.0",
|
|
361
|
-
version: "22.2.
|
|
361
|
+
version: "22.2.4",
|
|
362
362
|
ngImport: i0,
|
|
363
363
|
type: AmountService,
|
|
364
364
|
providedIn: "root"
|
|
@@ -367,7 +367,7 @@ var AmountService = class AmountService {
|
|
|
367
367
|
};
|
|
368
368
|
i0.ɵɵngDeclareClassMetadata({
|
|
369
369
|
minVersion: "12.0.0",
|
|
370
|
-
version: "22.2.
|
|
370
|
+
version: "22.2.4",
|
|
371
371
|
ngImport: i0,
|
|
372
372
|
type: AmountService,
|
|
373
373
|
decorators: [{
|
|
@@ -385,7 +385,7 @@ var AmountPipe = class AmountPipe {
|
|
|
385
385
|
static {
|
|
386
386
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
387
387
|
minVersion: "12.0.0",
|
|
388
|
-
version: "22.2.
|
|
388
|
+
version: "22.2.4",
|
|
389
389
|
ngImport: i0,
|
|
390
390
|
type: AmountPipe,
|
|
391
391
|
deps: [{ token: AmountService }],
|
|
@@ -395,7 +395,7 @@ var AmountPipe = class AmountPipe {
|
|
|
395
395
|
static {
|
|
396
396
|
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
397
397
|
minVersion: "14.0.0",
|
|
398
|
-
version: "22.2.
|
|
398
|
+
version: "22.2.4",
|
|
399
399
|
ngImport: i0,
|
|
400
400
|
type: AmountPipe,
|
|
401
401
|
isStandalone: true,
|
|
@@ -405,7 +405,7 @@ var AmountPipe = class AmountPipe {
|
|
|
405
405
|
};
|
|
406
406
|
i0.ɵɵngDeclareClassMetadata({
|
|
407
407
|
minVersion: "12.0.0",
|
|
408
|
-
version: "22.2.
|
|
408
|
+
version: "22.2.4",
|
|
409
409
|
ngImport: i0,
|
|
410
410
|
type: AmountPipe,
|
|
411
411
|
decorators: [{
|
|
@@ -427,7 +427,7 @@ var AccountNumberPipe = class AccountNumberPipe {
|
|
|
427
427
|
static {
|
|
428
428
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
429
429
|
minVersion: "12.0.0",
|
|
430
|
-
version: "22.2.
|
|
430
|
+
version: "22.2.4",
|
|
431
431
|
ngImport: i0,
|
|
432
432
|
type: AccountNumberPipe,
|
|
433
433
|
deps: [],
|
|
@@ -437,7 +437,7 @@ var AccountNumberPipe = class AccountNumberPipe {
|
|
|
437
437
|
static {
|
|
438
438
|
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
439
439
|
minVersion: "14.0.0",
|
|
440
|
-
version: "22.2.
|
|
440
|
+
version: "22.2.4",
|
|
441
441
|
ngImport: i0,
|
|
442
442
|
type: AccountNumberPipe,
|
|
443
443
|
isStandalone: true,
|
|
@@ -447,7 +447,7 @@ var AccountNumberPipe = class AccountNumberPipe {
|
|
|
447
447
|
};
|
|
448
448
|
i0.ɵɵngDeclareClassMetadata({
|
|
449
449
|
minVersion: "12.0.0",
|
|
450
|
-
version: "22.2.
|
|
450
|
+
version: "22.2.4",
|
|
451
451
|
ngImport: i0,
|
|
452
452
|
type: AccountNumberPipe,
|
|
453
453
|
decorators: [{
|
|
@@ -478,7 +478,7 @@ var PhoneNumberService = class PhoneNumberService {
|
|
|
478
478
|
static {
|
|
479
479
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
480
480
|
minVersion: "12.0.0",
|
|
481
|
-
version: "22.2.
|
|
481
|
+
version: "22.2.4",
|
|
482
482
|
ngImport: i0,
|
|
483
483
|
type: PhoneNumberService,
|
|
484
484
|
deps: [],
|
|
@@ -488,7 +488,7 @@ var PhoneNumberService = class PhoneNumberService {
|
|
|
488
488
|
static {
|
|
489
489
|
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
490
490
|
minVersion: "12.0.0",
|
|
491
|
-
version: "22.2.
|
|
491
|
+
version: "22.2.4",
|
|
492
492
|
ngImport: i0,
|
|
493
493
|
type: PhoneNumberService,
|
|
494
494
|
providedIn: "root"
|
|
@@ -497,7 +497,7 @@ var PhoneNumberService = class PhoneNumberService {
|
|
|
497
497
|
};
|
|
498
498
|
i0.ɵɵngDeclareClassMetadata({
|
|
499
499
|
minVersion: "12.0.0",
|
|
500
|
-
version: "22.2.
|
|
500
|
+
version: "22.2.4",
|
|
501
501
|
ngImport: i0,
|
|
502
502
|
type: PhoneNumberService,
|
|
503
503
|
decorators: [{
|
|
@@ -515,7 +515,7 @@ var PhoneNumberPipe = class PhoneNumberPipe {
|
|
|
515
515
|
static {
|
|
516
516
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
517
517
|
minVersion: "12.0.0",
|
|
518
|
-
version: "22.2.
|
|
518
|
+
version: "22.2.4",
|
|
519
519
|
ngImport: i0,
|
|
520
520
|
type: PhoneNumberPipe,
|
|
521
521
|
deps: [{ token: PhoneNumberService }],
|
|
@@ -525,7 +525,7 @@ var PhoneNumberPipe = class PhoneNumberPipe {
|
|
|
525
525
|
static {
|
|
526
526
|
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
527
527
|
minVersion: "14.0.0",
|
|
528
|
-
version: "22.2.
|
|
528
|
+
version: "22.2.4",
|
|
529
529
|
ngImport: i0,
|
|
530
530
|
type: PhoneNumberPipe,
|
|
531
531
|
isStandalone: true,
|
|
@@ -535,7 +535,7 @@ var PhoneNumberPipe = class PhoneNumberPipe {
|
|
|
535
535
|
};
|
|
536
536
|
i0.ɵɵngDeclareClassMetadata({
|
|
537
537
|
minVersion: "12.0.0",
|
|
538
|
-
version: "22.2.
|
|
538
|
+
version: "22.2.4",
|
|
539
539
|
ngImport: i0,
|
|
540
540
|
type: PhoneNumberPipe,
|
|
541
541
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kirbydesign-extensions-angular-localization.mjs","names":[],"sources":["../../localization/src/date-time/date-formats.ts","../../localization/src/di-tokens.ts","../../localization/src/date-time/abstract-timezone-compensating.pipe.ts","../../localization/src/date-time/date-only/date-only.pipe.ts","../../localization/src/date-time/time-only/time-only.pipe.ts","../../localization/src/date-time/time-or-date/time-or-date.pipe.ts","../../localization/src/number/format-number.service.ts","../../localization/src/number/format-number.pipe.ts","../../localization/src/amount/amount-service-formatter.ts","../../localization/src/amount/amount.service.ts","../../localization/src/amount/amount.pipe.ts","../../localization/src/account-number/account-number-service-formatter.ts","../../localization/src/account-number/account-number.pipe.ts","../../localization/src/phone-number/phone-number.service.ts","../../localization/src/phone-number/phone-number.pipe.ts"],"sourcesContent":["export class DateFormats {\n static readonly SHORT_DATE_FORMAT = 'dd.MM.yyyy';\n static readonly MEDIUM_DATE_FORMAT = 'd. MMMM y';\n static readonly MEDIUM_LETTER_DATE_FORMAT = 'dd. MMM yyyy';\n static readonly SHORT_TIME_FORMAT = 'HH:mm';\n static readonly MEDIUM_TIME_FORMAT = 'HH:mm:ss';\n static readonly SHORT_DATE_MEDIUM_TIME_FORMAT = `${DateFormats.SHORT_DATE_FORMAT} ${DateFormats.MEDIUM_TIME_FORMAT}`;\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const KIRBY_EXTENSIONS_LOCALIZATION_TOKEN =\n new InjectionToken<KirbyExtensionsLocalizationToken>('KIRBY_EXTENSIONS_LOCALIZATION_TOKEN');\n\nexport function provideKirbyExtensionsLocalizationToken(\n factory: () => KirbyExtensionsLocalizationToken\n) {\n return {\n provide: KIRBY_EXTENSIONS_LOCALIZATION_TOKEN,\n useFactory: factory,\n };\n}\n\ntype DkkMapping = Record<'DKK', 'kr.'>;\n\ntype CurrencyMappings = DkkMapping & Record<string, string>;\n\nexport interface KirbyExtensionsLocalizationToken {\n /**\n * @example 'DKK | EUR'\n */\n nativeCurrency: string;\n /**\n * Default language for the application. Used to determine if the phone number country code should be shown, if not specified as input, based on the locale.\n * @example 'da'\n */\n defaultLang: string;\n /**\n * Default phone country code\n * @example '+45'\n */\n countryCode: string;\n /**\n * Default timezone for the application\n * @example 'Europe/Copenhagen'\n */\n timeZone: string;\n /**\n * @example { DKK: 'kr.', EUR: '€' }\n */\n currencyMappings?: CurrencyMappings;\n}\n","import { inject, LOCALE_ID, PipeTransform } from '@angular/core';\nimport { KIRBY_EXTENSIONS_LOCALIZATION_TOKEN } from '../di-tokens';\nimport { DateFormats } from './date-formats';\n\n/**\n * Abstract implementation of pipe that should format dates, and compensate for time-zone offset.\n *\n * This class provides tools for formatting dates (and timestamps) in a time zone\n */\nexport abstract class AbstractTimezoneCompensatingPipe implements PipeTransform {\n private config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);\n private locale = inject(LOCALE_ID);\n\n abstract transform(value: unknown, ...args: unknown[]): unknown;\n\n protected format(time: number | Date | string, formatPattern: string): string {\n if (!time) {\n return '';\n }\n\n const date = typeof time === 'number' || typeof time === 'string' ? new Date(time) : time;\n\n const timeZone = this.config.timeZone;\n const options = this.getIntlOptions(formatPattern);\n\n const formatter = new Intl.DateTimeFormat(this.locale, { ...options, timeZone });\n let formattedDate = formatter.format(date);\n\n // Capitalize month abbreviation and remove trailing period for `MEDIUM_LETTER_DATE_FORMAT`\n if (formatPattern === DateFormats.MEDIUM_LETTER_DATE_FORMAT) {\n formattedDate = formattedDate.replace(\n /(\\d{2}\\.\\s)(\\w+)\\.(\\s\\d{4})/,\n (_, day, month, year) => {\n return `${day}${month.charAt(0).toUpperCase()}${month.slice(1)}${year}`;\n }\n );\n }\n\n if (\n formatPattern === DateFormats.SHORT_TIME_FORMAT ||\n formatPattern === DateFormats.MEDIUM_TIME_FORMAT\n ) {\n formattedDate = formattedDate.replace(/\\./g, ':');\n }\n\n return formattedDate;\n }\n\n private getIntlOptions(formatPattern: string): Intl.DateTimeFormatOptions {\n switch (formatPattern) {\n case DateFormats.SHORT_DATE_FORMAT:\n return { year: 'numeric', month: '2-digit', day: '2-digit' };\n\n case DateFormats.MEDIUM_DATE_FORMAT:\n return { year: 'numeric', month: 'long', day: 'numeric' };\n\n case DateFormats.MEDIUM_LETTER_DATE_FORMAT:\n return {\n year: 'numeric',\n month: 'short',\n day: '2-digit',\n };\n\n case DateFormats.SHORT_TIME_FORMAT:\n return { hour: '2-digit', minute: '2-digit', hour12: false };\n\n case DateFormats.MEDIUM_TIME_FORMAT:\n return { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false };\n\n case DateFormats.SHORT_DATE_MEDIUM_TIME_FORMAT:\n return {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: false,\n };\n\n default:\n throw new Error(`Unsupported format pattern: ${formatPattern}`);\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { AbstractTimezoneCompensatingPipe } from '../abstract-timezone-compensating.pipe';\nimport { DateFormats } from '../date-formats';\n\n/**\n * Formats a given timestamp as a date.\n */\n@Pipe({\n name: 'dateOnly',\n standalone: true,\n})\nexport class DateOnlyPipe extends AbstractTimezoneCompensatingPipe implements PipeTransform {\n transform(input: number | Date | string): string {\n return this.format(input, DateFormats.SHORT_DATE_FORMAT);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { AbstractTimezoneCompensatingPipe } from '../abstract-timezone-compensating.pipe';\nimport { DateFormats } from '../date-formats';\n\nexport type TimeOnlyFormat = 'short' | 'medium';\n\n/**\n * Formats a given timestamp as a time.\n *\n * Timestamps can be formatted as 2 variants:\n * - 'short' being 'HH:mm' (hours and minutes)\n * - 'medium' being 'HH:mm:ss' (as above, but with seconds appended)\n *\n */\n@Pipe({\n name: 'timeOnly',\n standalone: true,\n})\nexport class TimeOnlyPipe extends AbstractTimezoneCompensatingPipe implements PipeTransform {\n transform(input: number | Date | string, format: TimeOnlyFormat = 'short'): string {\n return this.format(input, this.getFormat(format));\n }\n\n private getFormat(format: TimeOnlyFormat): string {\n switch (format) {\n case 'short':\n return DateFormats.SHORT_TIME_FORMAT;\n case 'medium':\n return DateFormats.MEDIUM_TIME_FORMAT;\n default:\n throw new Error(`Unable to derive format from \"${format}\"`);\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { AbstractTimezoneCompensatingPipe } from '../abstract-timezone-compensating.pipe';\nimport { DateFormats } from '../date-formats';\n\n/**\n * Formats a given timestamp so that:\n * - If timestamp is of \"today\", it's formatted as time with hours and minutes (eg. 23:56)\n * - If timestamp is different from \"today\", it's formatted as date with \"day of month\", month and year (eg. 28.02.2020)\n *\n * All formatting and parsing is expect to be handled in \"Europe/Copenhagen\" time zone and with\n * the locale provided by `LOCALE_ID`.\n */\n\n@Pipe({\n name: 'timeOrDate',\n standalone: true,\n})\nexport class TimeOrDatePipe extends AbstractTimezoneCompensatingPipe implements PipeTransform {\n transform(\n time: number | Date | string,\n showSeconds = false,\n formatMonth: 'month-as-digits' | 'month-as-letters' = 'month-as-digits'\n ): string {\n if (!time) {\n return '';\n }\n\n const date = typeof time === 'number' || typeof time === 'string' ? new Date(time) : time;\n\n const today = new Date();\n const sameDay =\n date.getFullYear() === today.getFullYear() &&\n date.getMonth() === today.getMonth() &&\n date.getDate() === today.getDate();\n\n let format = DateFormats.SHORT_DATE_FORMAT;\n\n if (formatMonth === 'month-as-letters') {\n format = DateFormats.MEDIUM_LETTER_DATE_FORMAT;\n }\n\n if (sameDay) {\n format = showSeconds ? DateFormats.MEDIUM_TIME_FORMAT : DateFormats.SHORT_TIME_FORMAT;\n }\n\n return this.format(date, format);\n }\n}\n","import { formatNumber } from '@angular/common';\nimport { Inject, Injectable, LOCALE_ID } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormatNumberService {\n constructor(@Inject(LOCALE_ID) private localeId: string) {}\n\n public formatNumber(value: number, digitsInfo: string) {\n if (value == null) {\n return '';\n }\n\n return formatNumber(value, this.localeId, digitsInfo);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { FormatNumberService } from './format-number.service';\n\n@Pipe({\n name: 'formatNumber',\n standalone: true,\n})\nexport class FormatNumberPipe implements PipeTransform {\n constructor(private formatNumberService: FormatNumberService) {}\n\n transform(value: number, digitsInfo = '1.2-2') {\n return this.formatNumberService.formatNumber(value, digitsInfo);\n }\n}\n","import { formatNumber } from '@angular/common';\nimport { KirbyExtensionsLocalizationToken } from '../di-tokens';\nimport { Amount } from './amount.model';\n\nexport function formatAmount(\n amount: Amount,\n locale: string,\n config: KirbyExtensionsLocalizationToken,\n amountServiceConfiguration?: AmountServiceConfiguration\n) {\n const amountConfig = deriveConfiguration(amountServiceConfiguration);\n\n let formattedAmount = formatNumber(amount && amount.amount, locale, amountConfig.digitsInfo);\n\n if (amountConfig.stripSign) {\n formattedAmount = formattedAmount.replace('-', '').trim();\n }\n\n const currencyCodeToAppend = deriveCurrencyCode(amountConfig, amount, config);\n\n if (!currencyCodeToAppend) {\n return formattedAmount;\n }\n if (amountConfig.currencyCodePosition === 'postfix') {\n return formattedAmount + ' ' + currencyCodeToAppend;\n } else {\n return currencyCodeToAppend + ' ' + formattedAmount;\n }\n}\n\nexport function deriveCurrencyCode(\n amountConfig: AmountServiceConfiguration,\n amount: Amount,\n config: KirbyExtensionsLocalizationToken\n) {\n let currencyCodeToAppend;\n\n if (amountConfig.showCurrencyCode) {\n if (amountConfig.showCurrencyCode === 'alwaysShowCurrency') {\n currencyCodeToAppend = amount.currencyCode;\n } else if (amountConfig.showCurrencyCode === 'showForeignCurrency') {\n currencyCodeToAppend =\n amount.currencyCode !== config.nativeCurrency ? amount.currencyCode : '';\n } else if (amountConfig.showCurrencyCode === 'useCurrencyMapping') {\n currencyCodeToAppend = config.currencyMappings?.[amount.currencyCode] || amount.currencyCode;\n }\n }\n\n return currencyCodeToAppend || '';\n}\n\nexport function deriveConfiguration(configuration: AmountServiceConfiguration = {}) {\n const config: AmountServiceConfiguration = {\n showCurrencyCode: '',\n digitsInfo: '1.2-2',\n stripSign: false,\n };\n\n return Object.assign({}, config, configuration);\n}\n\nexport type ShowCurrencyCode =\n | ''\n | 'alwaysShowCurrency'\n | 'showForeignCurrency'\n | 'useCurrencyMapping';\nexport type CurrencyCodePosition = '' | 'prefix' | 'postfix';\n\nexport interface AmountServiceConfiguration {\n /**\n * - '' - don't output CurrencyCode\n * - 'alwaysShowCurrency' - always shows CurrencyCode, regardless of presentation currency\n * - 'showForeignCurrency' - only show CurrencyCode if it differs from the presentation currency\n * - 'useCurrencyMapping' - Shows the currency symbol defined in KirbyExtensionsLocalizationToken.currencyMappings instead of the currency code. Fallback to currencyCode\n */\n showCurrencyCode?: ShowCurrencyCode;\n /**\n * The position of the currency code in the formatted amount\n * - 'postfix' - output CurrencyCode after the formatted amount, eg. 1.234,56 EUR\n * - 'prefix' - output CurrencyCode before the formatted amount, eg. DKK 1.234,56\n */\n currencyCodePosition?: CurrencyCodePosition;\n /**\n * A string that represents the format of the number. Learn more about the format here: https://angular.io/api/common/DecimalPipe#parameters\n */\n digitsInfo?: string;\n /**\n * Remove the minus sign from the formatted amount and trim any leading or trailing whitespace.\n */\n stripSign?: boolean;\n /**\n * The string to return if the amount is empty\n */\n returnValueOnEmptyAmount?: string;\n}\n","import { inject, Injectable, LOCALE_ID } from '@angular/core';\n\nimport { KIRBY_EXTENSIONS_LOCALIZATION_TOKEN } from '../di-tokens';\nimport { Amount } from './amount.model';\nimport {\n AmountServiceConfiguration,\n deriveConfiguration,\n formatAmount,\n} from './amount-service-formatter';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AmountService {\n private config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);\n private locale = inject(LOCALE_ID);\n /**\n * Applies the transformation logic, by taking the `amount`-argument, and a configuration object - {@link AmountServiceConfiguration}\n *\n * The number is always formatted according to Angular LOCALE_ID\n *\n * @param amount the {@link Amount} to configure\n * @param amountServiceConfiguration\n */\n\n formatAmount(amount: Amount, amountServiceConfiguration?: AmountServiceConfiguration) {\n if (amount == undefined) {\n const config = deriveConfiguration(amountServiceConfiguration);\n if (config.returnValueOnEmptyAmount) {\n return config.returnValueOnEmptyAmount;\n }\n amount = {\n amount: 0.0,\n currencyCode: '',\n };\n }\n\n return formatAmount(amount, this.locale, this.config, amountServiceConfiguration);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { Amount } from './amount.model';\nimport { AmountService } from './amount.service';\nimport { AmountServiceConfiguration } from './amount-service-formatter';\n\n/**\n * Configuration object for the amount-pipe. The configuration object can be used to control\n * the formatting of the amount, and can be passed as an argument to the amount-pipe when used on an {@link Amount}.\n * - `showCurrencyCode`: Controls whether the currency code should be displayed or not.\n * - `''`: Don't output currency code\n * - `alwaysShowCurrency`: Always show currency code, regardless of presentation currency\n * - `showForeignCurrency`: Only show currency code if it differs from the presentation currency\n * - `digitsInfo`: A string that represents the format of the number. Learn more about the format here: https://angular.io/api/common/DecimalPipe#parameters\n * - `stripSign`: Controls whether the minus sign should be stripped from a negative amount.\n * - `currencyCodePosition`: Controls the position of the currency code in the formatted amount.\n * - `postfix`: Output currency code after the formatted amount, e.g. 1.234,56 EUR\n * - `prefix`: Output currency code before the formatted amount, e.g. DKK 1.234,56\n */\n@Pipe({\n name: 'amount',\n standalone: true,\n})\nexport class AmountPipe implements PipeTransform {\n constructor(private amountService: AmountService) {}\n\n /**\n * Applies the transformation logic, by taking the `amount`-argument, and a configuration object - {@link AmountServiceConfiguration} (or a number of arguments, for backwards compatibility).\n *\n * @param amount the {@link Amount} to configure\n * @param amountServiceConfiguration\n */\n transform(amount: Amount, amountServiceConfiguration?: AmountServiceConfiguration) {\n return this.amountService.formatAmount(amount, amountServiceConfiguration);\n }\n}\n","import { AccountNumber } from './account-number.model';\n\nexport function formatAccountNumber(value: AccountNumber): string {\n return `${value.regNo.padStart(4, '0')} ${value.accountNo.replace(/^0+/, '')}`;\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { AccountNumber } from './account-number.model';\nimport { formatAccountNumber } from './account-number-service-formatter';\n\n/**\n * Pipe that formats a {@link AccountNumber}-object to a common format.\n */\n@Pipe({\n name: 'accountNumber',\n standalone: true,\n})\nexport class AccountNumberPipe implements PipeTransform {\n /**\n * Formats the {@link AccountNumber} to a common format.\n *\n * @param value the {@link AccountNumber} to format\n */\n transform(value: AccountNumber): string | undefined {\n return formatAccountNumber(value);\n }\n}\n","import { inject, Injectable, LOCALE_ID } from '@angular/core';\n\nimport { KIRBY_EXTENSIONS_LOCALIZATION_TOKEN } from '../di-tokens';\nimport { PhoneNumber } from './phone-number';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PhoneNumberService {\n private config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);\n private locale = inject(LOCALE_ID);\n\n private static chunkUpPhoneNumber(str: string, chunk: number): string {\n return str.match(new RegExp(`.{1,${chunk}}`, 'g'))?.join(' ') ?? '';\n }\n\n formatPhoneNumber(\n phoneNumber: PhoneNumber | string,\n chunk = 2,\n showCountryCode?: boolean\n ): string | undefined {\n const countryCode =\n typeof phoneNumber === 'string' ? this.config.countryCode : phoneNumber.countryCode;\n const number = typeof phoneNumber === 'string' ? phoneNumber : phoneNumber.number;\n\n if (!/^\\d+$/.test(number)) {\n return;\n }\n\n if (showCountryCode === undefined) {\n showCountryCode = !this.locale.match(`${this.config.defaultLang}.*`);\n }\n\n const formattedNumber = PhoneNumberService.chunkUpPhoneNumber(number, chunk);\n\n if (showCountryCode) {\n return `${countryCode} ${formattedNumber}`;\n } else {\n return formattedNumber;\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { PhoneNumber } from './phone-number';\nimport { PhoneNumberService } from './phone-number.service';\n\n@Pipe({\n name: 'phoneNumber',\n standalone: true,\n})\nexport class PhoneNumberPipe implements PipeTransform {\n constructor(private phoneNumberService: PhoneNumberService) {}\n\n /**\n * Transforms a phone number, chunked up with spaces between the chunks and the country code in front, if desired.\n *\n * @param phoneNumber A PhoneNumber or a string representation of a phone number\n * @param chunk The chunk size used to split up the phone number with spaces\n * @param showCountryCode Show the country code in front of the phone number. If a string representation is supplied, the KIRBY_EXTENSIONS_LOCALIZATION_TOKEN.countryCode is used.\n */\n transform(\n phoneNumber: PhoneNumber | string,\n chunk = 2,\n showCountryCode?: boolean\n ): string | undefined {\n return this.phoneNumberService.formatPhoneNumber(phoneNumber, chunk, showCountryCode);\n }\n}\n"],"mappings":";;;AAAA,IAAa,cAAb,MAAa,YAAW;CACN;EAAA,KAAA,oBAAoB;CAAa;CACjC;EAAA,KAAA,qBAAqB;CAAY;CACjC;EAAA,KAAA,4BAA4B;CAAe;CAC3C;EAAA,KAAA,oBAAoB;CAAQ;CAC5B;EAAA,KAAA,qBAAqB;CAAW;CAChC;EAAA,KAAA,gCAAgC,GAAG,YAAY,kBAAiB,GAAI,YAAY;CAAqB;;ACJvH,MAAa,sCACX,IAAI,eAAiD,qCAAqC;AAE5F,SAAgB,wCACd,SAA+C;CAE/C,OAAO;EACL,SAAS;EACT,YAAY;CACb;AACH;ACHA,IAAsB,mCAAtB,MAAsD;CAAtD,cAAA;EACU,KAAA,SAAS,OAAO,mCAAmC;EACnD,KAAA,SAAS,OAAO,SAAS;CAyEnC;CArEY,OAAO,MAA8B,eAAqB;EAClE,IAAI,CAAC,MACH,OAAO;EAGT,MAAM,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW,IAAI,KAAK,IAAI,IAAI;EAErF,MAAM,WAAW,KAAK,OAAO;EAC7B,MAAM,UAAU,KAAK,eAAe,aAAa;EAGjD,IAAI,gBAAgB,IADE,KAAK,eAAe,KAAK,QAAQ;GAAE,GAAG;GAAS;EAAQ,CACzD,CAAA,CAAU,OAAO,IAAI;EAGzC,IAAI,kBAAkB,YAAY,2BAChC,gBAAgB,cAAc,QAC5B,gCACC,GA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A;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAe,cAAA;GAAA,MAAA;EAAA,CAAA;CAAA;;AAAf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAJ3B,MAAA;EAAK,MAAA,CAAA;GACJ,MAAM;GACN,YAAY;EACb,CAAA"}
|
|
1
|
+
{"version":3,"file":"kirbydesign-extensions-angular-localization.mjs","names":["i1.FormatNumberService","i1.AmountService","i1.PhoneNumberService"],"sources":["../../localization/src/date-time/date-formats.ts","../../localization/src/di-tokens.ts","../../localization/src/date-time/abstract-timezone-compensating.pipe.ts","../../localization/src/date-time/date-only/date-only.pipe.ts","../../localization/src/date-time/time-only/time-only.pipe.ts","../../localization/src/date-time/time-or-date/time-or-date.pipe.ts","../../localization/src/number/format-number.service.ts","../../localization/src/number/format-number.pipe.ts","../../localization/src/amount/amount-service-formatter.ts","../../localization/src/amount/amount.service.ts","../../localization/src/amount/amount.pipe.ts","../../localization/src/account-number/account-number-service-formatter.ts","../../localization/src/account-number/account-number.pipe.ts","../../localization/src/phone-number/phone-number.service.ts","../../localization/src/phone-number/phone-number.pipe.ts"],"sourcesContent":["export class DateFormats {\n static readonly SHORT_DATE_FORMAT = 'dd.MM.yyyy';\n static readonly MEDIUM_DATE_FORMAT = 'd. MMMM y';\n static readonly MEDIUM_LETTER_DATE_FORMAT = 'dd. MMM yyyy';\n static readonly SHORT_TIME_FORMAT = 'HH:mm';\n static readonly MEDIUM_TIME_FORMAT = 'HH:mm:ss';\n static readonly SHORT_DATE_MEDIUM_TIME_FORMAT = `${DateFormats.SHORT_DATE_FORMAT} ${DateFormats.MEDIUM_TIME_FORMAT}`;\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const KIRBY_EXTENSIONS_LOCALIZATION_TOKEN =\n new InjectionToken<KirbyExtensionsLocalizationToken>('KIRBY_EXTENSIONS_LOCALIZATION_TOKEN');\n\nexport function provideKirbyExtensionsLocalizationToken(\n factory: () => KirbyExtensionsLocalizationToken\n) {\n return {\n provide: KIRBY_EXTENSIONS_LOCALIZATION_TOKEN,\n useFactory: factory,\n };\n}\n\ntype DkkMapping = Record<'DKK', 'kr.'>;\n\ntype CurrencyMappings = DkkMapping & Record<string, string>;\n\nexport interface KirbyExtensionsLocalizationToken {\n /**\n * @example 'DKK | EUR'\n */\n nativeCurrency: string;\n /**\n * Default language for the application. Used to determine if the phone number country code should be shown, if not specified as input, based on the locale.\n * @example 'da'\n */\n defaultLang: string;\n /**\n * Default phone country code\n * @example '+45'\n */\n countryCode: string;\n /**\n * Default timezone for the application\n * @example 'Europe/Copenhagen'\n */\n timeZone: string;\n /**\n * @example { DKK: 'kr.', EUR: '€' }\n */\n currencyMappings?: CurrencyMappings;\n}\n","import { inject, LOCALE_ID, PipeTransform } from '@angular/core';\nimport { KIRBY_EXTENSIONS_LOCALIZATION_TOKEN } from '../di-tokens';\nimport { DateFormats } from './date-formats';\n\n/**\n * Abstract implementation of pipe that should format dates, and compensate for time-zone offset.\n *\n * This class provides tools for formatting dates (and timestamps) in a time zone\n */\nexport abstract class AbstractTimezoneCompensatingPipe implements PipeTransform {\n private config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);\n private locale = inject(LOCALE_ID);\n\n abstract transform(value: unknown, ...args: unknown[]): unknown;\n\n protected format(time: number | Date | string, formatPattern: string): string {\n if (!time) {\n return '';\n }\n\n const date = typeof time === 'number' || typeof time === 'string' ? new Date(time) : time;\n\n const timeZone = this.config.timeZone;\n const options = this.getIntlOptions(formatPattern);\n\n const formatter = new Intl.DateTimeFormat(this.locale, { ...options, timeZone });\n let formattedDate = formatter.format(date);\n\n // Capitalize month abbreviation and remove trailing period for `MEDIUM_LETTER_DATE_FORMAT`\n if (formatPattern === DateFormats.MEDIUM_LETTER_DATE_FORMAT) {\n formattedDate = formattedDate.replace(\n /(\\d{2}\\.\\s)(\\w+)\\.(\\s\\d{4})/,\n (_, day, month, year) => {\n return `${day}${month.charAt(0).toUpperCase()}${month.slice(1)}${year}`;\n }\n );\n }\n\n if (\n formatPattern === DateFormats.SHORT_TIME_FORMAT ||\n formatPattern === DateFormats.MEDIUM_TIME_FORMAT\n ) {\n formattedDate = formattedDate.replace(/\\./g, ':');\n }\n\n return formattedDate;\n }\n\n private getIntlOptions(formatPattern: string): Intl.DateTimeFormatOptions {\n switch (formatPattern) {\n case DateFormats.SHORT_DATE_FORMAT:\n return { year: 'numeric', month: '2-digit', day: '2-digit' };\n\n case DateFormats.MEDIUM_DATE_FORMAT:\n return { year: 'numeric', month: 'long', day: 'numeric' };\n\n case DateFormats.MEDIUM_LETTER_DATE_FORMAT:\n return {\n year: 'numeric',\n month: 'short',\n day: '2-digit',\n };\n\n case DateFormats.SHORT_TIME_FORMAT:\n return { hour: '2-digit', minute: '2-digit', hour12: false };\n\n case DateFormats.MEDIUM_TIME_FORMAT:\n return { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false };\n\n case DateFormats.SHORT_DATE_MEDIUM_TIME_FORMAT:\n return {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: false,\n };\n\n default:\n throw new Error(`Unsupported format pattern: ${formatPattern}`);\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { AbstractTimezoneCompensatingPipe } from '../abstract-timezone-compensating.pipe';\nimport { DateFormats } from '../date-formats';\n\n/**\n * Formats a given timestamp as a date.\n */\n@Pipe({\n name: 'dateOnly',\n standalone: true,\n})\nexport class DateOnlyPipe extends AbstractTimezoneCompensatingPipe implements PipeTransform {\n transform(input: number | Date | string): string {\n return this.format(input, DateFormats.SHORT_DATE_FORMAT);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { AbstractTimezoneCompensatingPipe } from '../abstract-timezone-compensating.pipe';\nimport { DateFormats } from '../date-formats';\n\nexport type TimeOnlyFormat = 'short' | 'medium';\n\n/**\n * Formats a given timestamp as a time.\n *\n * Timestamps can be formatted as 2 variants:\n * - 'short' being 'HH:mm' (hours and minutes)\n * - 'medium' being 'HH:mm:ss' (as above, but with seconds appended)\n *\n */\n@Pipe({\n name: 'timeOnly',\n standalone: true,\n})\nexport class TimeOnlyPipe extends AbstractTimezoneCompensatingPipe implements PipeTransform {\n transform(input: number | Date | string, format: TimeOnlyFormat = 'short'): string {\n return this.format(input, this.getFormat(format));\n }\n\n private getFormat(format: TimeOnlyFormat): string {\n switch (format) {\n case 'short':\n return DateFormats.SHORT_TIME_FORMAT;\n case 'medium':\n return DateFormats.MEDIUM_TIME_FORMAT;\n default:\n throw new Error(`Unable to derive format from \"${format}\"`);\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { AbstractTimezoneCompensatingPipe } from '../abstract-timezone-compensating.pipe';\nimport { DateFormats } from '../date-formats';\n\n/**\n * Formats a given timestamp so that:\n * - If timestamp is of \"today\", it's formatted as time with hours and minutes (eg. 23:56)\n * - If timestamp is different from \"today\", it's formatted as date with \"day of month\", month and year (eg. 28.02.2020)\n *\n * All formatting and parsing is expect to be handled in \"Europe/Copenhagen\" time zone and with\n * the locale provided by `LOCALE_ID`.\n */\n\n@Pipe({\n name: 'timeOrDate',\n standalone: true,\n})\nexport class TimeOrDatePipe extends AbstractTimezoneCompensatingPipe implements PipeTransform {\n transform(\n time: number | Date | string,\n showSeconds = false,\n formatMonth: 'month-as-digits' | 'month-as-letters' = 'month-as-digits'\n ): string {\n if (!time) {\n return '';\n }\n\n const date = typeof time === 'number' || typeof time === 'string' ? new Date(time) : time;\n\n const today = new Date();\n const sameDay =\n date.getFullYear() === today.getFullYear() &&\n date.getMonth() === today.getMonth() &&\n date.getDate() === today.getDate();\n\n let format = DateFormats.SHORT_DATE_FORMAT;\n\n if (formatMonth === 'month-as-letters') {\n format = DateFormats.MEDIUM_LETTER_DATE_FORMAT;\n }\n\n if (sameDay) {\n format = showSeconds ? DateFormats.MEDIUM_TIME_FORMAT : DateFormats.SHORT_TIME_FORMAT;\n }\n\n return this.format(date, format);\n }\n}\n","import { formatNumber } from '@angular/common';\nimport { Inject, Injectable, LOCALE_ID } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormatNumberService {\n constructor(@Inject(LOCALE_ID) private localeId: string) {}\n\n public formatNumber(value: number, digitsInfo: string) {\n if (value == null) {\n return '';\n }\n\n return formatNumber(value, this.localeId, digitsInfo);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { FormatNumberService } from './format-number.service';\n\n@Pipe({\n name: 'formatNumber',\n standalone: true,\n})\nexport class FormatNumberPipe implements PipeTransform {\n constructor(private formatNumberService: FormatNumberService) {}\n\n transform(value: number, digitsInfo = '1.2-2') {\n return this.formatNumberService.formatNumber(value, digitsInfo);\n }\n}\n","import { formatNumber } from '@angular/common';\nimport { KirbyExtensionsLocalizationToken } from '../di-tokens';\nimport { Amount } from './amount.model';\n\nexport function formatAmount(\n amount: Amount,\n locale: string,\n config: KirbyExtensionsLocalizationToken,\n amountServiceConfiguration?: AmountServiceConfiguration\n) {\n const amountConfig = deriveConfiguration(amountServiceConfiguration);\n\n let formattedAmount = formatNumber(amount && amount.amount, locale, amountConfig.digitsInfo);\n\n if (amountConfig.stripSign) {\n formattedAmount = formattedAmount.replace('-', '').trim();\n }\n\n const currencyCodeToAppend = deriveCurrencyCode(amountConfig, amount, config);\n\n if (!currencyCodeToAppend) {\n return formattedAmount;\n }\n if (amountConfig.currencyCodePosition === 'postfix') {\n return formattedAmount + ' ' + currencyCodeToAppend;\n } else {\n return currencyCodeToAppend + ' ' + formattedAmount;\n }\n}\n\nexport function deriveCurrencyCode(\n amountConfig: AmountServiceConfiguration,\n amount: Amount,\n config: KirbyExtensionsLocalizationToken\n) {\n let currencyCodeToAppend;\n\n if (amountConfig.showCurrencyCode) {\n if (amountConfig.showCurrencyCode === 'alwaysShowCurrency') {\n currencyCodeToAppend = amount.currencyCode;\n } else if (amountConfig.showCurrencyCode === 'showForeignCurrency') {\n currencyCodeToAppend =\n amount.currencyCode !== config.nativeCurrency ? amount.currencyCode : '';\n } else if (amountConfig.showCurrencyCode === 'useCurrencyMapping') {\n currencyCodeToAppend = config.currencyMappings?.[amount.currencyCode] || amount.currencyCode;\n }\n }\n\n return currencyCodeToAppend || '';\n}\n\nexport function deriveConfiguration(configuration: AmountServiceConfiguration = {}) {\n const config: AmountServiceConfiguration = {\n showCurrencyCode: '',\n digitsInfo: '1.2-2',\n stripSign: false,\n };\n\n return Object.assign({}, config, configuration);\n}\n\nexport type ShowCurrencyCode =\n | ''\n | 'alwaysShowCurrency'\n | 'showForeignCurrency'\n | 'useCurrencyMapping';\nexport type CurrencyCodePosition = '' | 'prefix' | 'postfix';\n\nexport interface AmountServiceConfiguration {\n /**\n * - '' - don't output CurrencyCode\n * - 'alwaysShowCurrency' - always shows CurrencyCode, regardless of presentation currency\n * - 'showForeignCurrency' - only show CurrencyCode if it differs from the presentation currency\n * - 'useCurrencyMapping' - Shows the currency symbol defined in KirbyExtensionsLocalizationToken.currencyMappings instead of the currency code. Fallback to currencyCode\n */\n showCurrencyCode?: ShowCurrencyCode;\n /**\n * The position of the currency code in the formatted amount\n * - 'postfix' - output CurrencyCode after the formatted amount, eg. 1.234,56 EUR\n * - 'prefix' - output CurrencyCode before the formatted amount, eg. DKK 1.234,56\n */\n currencyCodePosition?: CurrencyCodePosition;\n /**\n * A string that represents the format of the number. Learn more about the format here: https://angular.io/api/common/DecimalPipe#parameters\n */\n digitsInfo?: string;\n /**\n * Remove the minus sign from the formatted amount and trim any leading or trailing whitespace.\n */\n stripSign?: boolean;\n /**\n * The string to return if the amount is empty\n */\n returnValueOnEmptyAmount?: string;\n}\n","import { inject, Injectable, LOCALE_ID } from '@angular/core';\n\nimport { KIRBY_EXTENSIONS_LOCALIZATION_TOKEN } from '../di-tokens';\nimport { Amount } from './amount.model';\nimport {\n AmountServiceConfiguration,\n deriveConfiguration,\n formatAmount,\n} from './amount-service-formatter';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AmountService {\n private config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);\n private locale = inject(LOCALE_ID);\n /**\n * Applies the transformation logic, by taking the `amount`-argument, and a configuration object - {@link AmountServiceConfiguration}\n *\n * The number is always formatted according to Angular LOCALE_ID\n *\n * @param amount the {@link Amount} to configure\n * @param amountServiceConfiguration\n */\n\n formatAmount(amount: Amount, amountServiceConfiguration?: AmountServiceConfiguration) {\n if (amount == undefined) {\n const config = deriveConfiguration(amountServiceConfiguration);\n if (config.returnValueOnEmptyAmount) {\n return config.returnValueOnEmptyAmount;\n }\n amount = {\n amount: 0.0,\n currencyCode: '',\n };\n }\n\n return formatAmount(amount, this.locale, this.config, amountServiceConfiguration);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { Amount } from './amount.model';\nimport { AmountService } from './amount.service';\nimport { AmountServiceConfiguration } from './amount-service-formatter';\n\n/**\n * Configuration object for the amount-pipe. The configuration object can be used to control\n * the formatting of the amount, and can be passed as an argument to the amount-pipe when used on an {@link Amount}.\n * - `showCurrencyCode`: Controls whether the currency code should be displayed or not.\n * - `''`: Don't output currency code\n * - `alwaysShowCurrency`: Always show currency code, regardless of presentation currency\n * - `showForeignCurrency`: Only show currency code if it differs from the presentation currency\n * - `digitsInfo`: A string that represents the format of the number. Learn more about the format here: https://angular.io/api/common/DecimalPipe#parameters\n * - `stripSign`: Controls whether the minus sign should be stripped from a negative amount.\n * - `currencyCodePosition`: Controls the position of the currency code in the formatted amount.\n * - `postfix`: Output currency code after the formatted amount, e.g. 1.234,56 EUR\n * - `prefix`: Output currency code before the formatted amount, e.g. DKK 1.234,56\n */\n@Pipe({\n name: 'amount',\n standalone: true,\n})\nexport class AmountPipe implements PipeTransform {\n constructor(private amountService: AmountService) {}\n\n /**\n * Applies the transformation logic, by taking the `amount`-argument, and a configuration object - {@link AmountServiceConfiguration} (or a number of arguments, for backwards compatibility).\n *\n * @param amount the {@link Amount} to configure\n * @param amountServiceConfiguration\n */\n transform(amount: Amount, amountServiceConfiguration?: AmountServiceConfiguration) {\n return this.amountService.formatAmount(amount, amountServiceConfiguration);\n }\n}\n","import { AccountNumber } from './account-number.model';\n\nexport function formatAccountNumber(value: AccountNumber): string {\n return `${value.regNo.padStart(4, '0')} ${value.accountNo.replace(/^0+/, '')}`;\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { AccountNumber } from './account-number.model';\nimport { formatAccountNumber } from './account-number-service-formatter';\n\n/**\n * Pipe that formats a {@link AccountNumber}-object to a common format.\n */\n@Pipe({\n name: 'accountNumber',\n standalone: true,\n})\nexport class AccountNumberPipe implements PipeTransform {\n /**\n * Formats the {@link AccountNumber} to a common format.\n *\n * @param value the {@link AccountNumber} to format\n */\n transform(value: AccountNumber): string | undefined {\n return formatAccountNumber(value);\n }\n}\n","import { inject, Injectable, LOCALE_ID } from '@angular/core';\n\nimport { KIRBY_EXTENSIONS_LOCALIZATION_TOKEN } from '../di-tokens';\nimport { PhoneNumber } from './phone-number';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PhoneNumberService {\n private config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);\n private locale = inject(LOCALE_ID);\n\n private static chunkUpPhoneNumber(str: string, chunk: number): string {\n return str.match(new RegExp(`.{1,${chunk}}`, 'g'))?.join(' ') ?? '';\n }\n\n formatPhoneNumber(\n phoneNumber: PhoneNumber | string,\n chunk = 2,\n showCountryCode?: boolean\n ): string | undefined {\n const countryCode =\n typeof phoneNumber === 'string' ? this.config.countryCode : phoneNumber.countryCode;\n const number = typeof phoneNumber === 'string' ? phoneNumber : phoneNumber.number;\n\n if (!/^\\d+$/.test(number)) {\n return;\n }\n\n if (showCountryCode === undefined) {\n showCountryCode = !this.locale.match(`${this.config.defaultLang}.*`);\n }\n\n const formattedNumber = PhoneNumberService.chunkUpPhoneNumber(number, chunk);\n\n if (showCountryCode) {\n return `${countryCode} ${formattedNumber}`;\n } else {\n return formattedNumber;\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { PhoneNumber } from './phone-number';\nimport { PhoneNumberService } from './phone-number.service';\n\n@Pipe({\n name: 'phoneNumber',\n standalone: true,\n})\nexport class PhoneNumberPipe implements PipeTransform {\n constructor(private phoneNumberService: PhoneNumberService) {}\n\n /**\n * Transforms a phone number, chunked up with spaces between the chunks and the country code in front, if desired.\n *\n * @param phoneNumber A PhoneNumber or a string representation of a phone number\n * @param chunk The chunk size used to split up the phone number with spaces\n * @param showCountryCode Show the country code in front of the phone number. If a string representation is supplied, the KIRBY_EXTENSIONS_LOCALIZATION_TOKEN.countryCode is used.\n */\n transform(\n phoneNumber: PhoneNumber | string,\n chunk = 2,\n showCountryCode?: boolean\n ): string | undefined {\n return this.phoneNumberService.formatPhoneNumber(phoneNumber, chunk, showCountryCode);\n }\n}\n"],"mappings":";;;AAAA,IAAa,cAAb,MAAa,YAAW;CACN;EAAA,KAAA,oBAAoB;CAAa;CACjC;EAAA,KAAA,qBAAqB;CAAY;CACjC;EAAA,KAAA,4BAA4B;CAAe;CAC3C;EAAA,KAAA,oBAAoB;CAAQ;CAC5B;EAAA,KAAA,qBAAqB;CAAW;CAChC;EAAA,KAAA,gCAAgC,GAAG,YAAY,kBAAiB,GAAI,YAAY;CAAqB;;ACJvH,MAAa,sCACX,IAAI,eAAiD,qCAAqC;AAE5F,SAAgB,wCACd,SAA+C;CAE/C,OAAO;EACL,SAAS;EACT,YAAY;CACb;AACH;ACHA,IAAsB,mCAAtB,MAAsD;CAAtD,cAAA;EACU,KAAA,SAAS,OAAO,mCAAmC;EACnD,KAAA,SAAS,OAAO,SAAS;CAyEnC;CArEY,OAAO,MAA8B,eAAqB;EAClE,IAAI,CAAC,MACH,OAAO;EAGT,MAAM,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW,IAAI,KAAK,IAAI,IAAI;EAErF,MAAM,WAAW,KAAK,OAAO;EAC7B,MAAM,UAAU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