@kirbydesign/extensions-angular 5.1.0 → 6.0.0-dev-d045bb2
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 +897 -852
- package/fesm2022/kirbydesign-extensions-angular-combobox.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-image-banner.mjs +206 -128
- package/fesm2022/kirbydesign-extensions-angular-image-banner.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-localization.mjs +541 -411
- package/fesm2022/kirbydesign-extensions-angular-localization.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-sidebar-menu.mjs +1462 -603
- package/fesm2022/kirbydesign-extensions-angular-sidebar-menu.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-skeleton-loader.mjs +79 -40
- package/fesm2022/kirbydesign-extensions-angular-skeleton-loader.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-spot-illustration.mjs +164 -155
- package/fesm2022/kirbydesign-extensions-angular-spot-illustration.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular.mjs +1 -8
- package/fesm2022/kirbydesign-extensions-angular.mjs.map +1 -1
- package/package.json +13 -13
- package/types/kirbydesign-extensions-angular-combobox.d.ts +273 -216
- package/types/kirbydesign-extensions-angular-image-banner.d.ts +102 -66
- package/types/kirbydesign-extensions-angular-localization.d.ts +185 -204
- package/types/kirbydesign-extensions-angular-sidebar-menu.d.ts +137 -120
- package/types/kirbydesign-extensions-angular-skeleton-loader.d.ts +23 -17
- package/types/kirbydesign-extensions-angular-spot-illustration.d.ts +224 -212
- package/types/kirbydesign-extensions-angular.d.ts +2 -2
- package/combobox/package.json +0 -4
- package/image-banner/package.json +0 -4
- package/localization/package.json +0 -4
- package/sidebar-menu/package.json +0 -4
- package/skeleton-loader/package.json +0 -4
- package/spot-illustration/package.json +0 -4
|
@@ -1,422 +1,552 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { formatNumber } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Inject, Injectable, InjectionToken, LOCALE_ID, Pipe, inject } from "@angular/core";
|
|
3
|
+
import { formatNumber } from "@angular/common";
|
|
4
|
+
var DateFormats = class DateFormats {
|
|
5
|
+
static {
|
|
6
|
+
this.SHORT_DATE_FORMAT = "dd.MM.yyyy";
|
|
7
|
+
}
|
|
8
|
+
static {
|
|
9
|
+
this.MEDIUM_DATE_FORMAT = "d. MMMM y";
|
|
10
|
+
}
|
|
11
|
+
static {
|
|
12
|
+
this.MEDIUM_LETTER_DATE_FORMAT = "dd. MMM yyyy";
|
|
13
|
+
}
|
|
14
|
+
static {
|
|
15
|
+
this.SHORT_TIME_FORMAT = "HH:mm";
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.MEDIUM_TIME_FORMAT = "HH:mm:ss";
|
|
19
|
+
}
|
|
20
|
+
static {
|
|
21
|
+
this.SHORT_DATE_MEDIUM_TIME_FORMAT = `${DateFormats.SHORT_DATE_FORMAT} ${DateFormats.MEDIUM_TIME_FORMAT}`;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const KIRBY_EXTENSIONS_LOCALIZATION_TOKEN = new InjectionToken("KIRBY_EXTENSIONS_LOCALIZATION_TOKEN");
|
|
15
25
|
function provideKirbyExtensionsLocalizationToken(factory) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Abstract implementation of pipe that should format dates, and compensate for time-zone offset.
|
|
24
|
-
*
|
|
25
|
-
* This class provides tools for formatting dates (and timestamps) in a time zone
|
|
26
|
-
*/
|
|
27
|
-
class AbstractTimezoneCompensatingPipe {
|
|
28
|
-
constructor() {
|
|
29
|
-
this.config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);
|
|
30
|
-
this.locale = inject(LOCALE_ID);
|
|
31
|
-
}
|
|
32
|
-
format(time, formatPattern) {
|
|
33
|
-
if (!time) {
|
|
34
|
-
return '';
|
|
35
|
-
}
|
|
36
|
-
const date = typeof time === 'number' || typeof time === 'string' ? new Date(time) : time;
|
|
37
|
-
const timeZone = this.config.timeZone;
|
|
38
|
-
const options = this.getIntlOptions(formatPattern);
|
|
39
|
-
const formatter = new Intl.DateTimeFormat(this.locale, { ...options, timeZone });
|
|
40
|
-
let formattedDate = formatter.format(date);
|
|
41
|
-
// Capitalize month abbreviation and remove trailing period for `MEDIUM_LETTER_DATE_FORMAT`
|
|
42
|
-
if (formatPattern === DateFormats.MEDIUM_LETTER_DATE_FORMAT) {
|
|
43
|
-
formattedDate = formattedDate.replace(/(\d{2}\.\s)(\w+)\.(\s\d{4})/, (_, day, month, year) => {
|
|
44
|
-
return `${day}${month.charAt(0).toUpperCase()}${month.slice(1)}${year}`;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (formatPattern === DateFormats.SHORT_TIME_FORMAT ||
|
|
48
|
-
formatPattern === DateFormats.MEDIUM_TIME_FORMAT) {
|
|
49
|
-
formattedDate = formattedDate.replace(/\./g, ':');
|
|
50
|
-
}
|
|
51
|
-
return formattedDate;
|
|
52
|
-
}
|
|
53
|
-
getIntlOptions(formatPattern) {
|
|
54
|
-
switch (formatPattern) {
|
|
55
|
-
case DateFormats.SHORT_DATE_FORMAT:
|
|
56
|
-
return { year: 'numeric', month: '2-digit', day: '2-digit' };
|
|
57
|
-
case DateFormats.MEDIUM_DATE_FORMAT:
|
|
58
|
-
return { year: 'numeric', month: 'long', day: 'numeric' };
|
|
59
|
-
case DateFormats.MEDIUM_LETTER_DATE_FORMAT:
|
|
60
|
-
return {
|
|
61
|
-
year: 'numeric',
|
|
62
|
-
month: 'short',
|
|
63
|
-
day: '2-digit',
|
|
64
|
-
};
|
|
65
|
-
case DateFormats.SHORT_TIME_FORMAT:
|
|
66
|
-
return { hour: '2-digit', minute: '2-digit', hour12: false };
|
|
67
|
-
case DateFormats.MEDIUM_TIME_FORMAT:
|
|
68
|
-
return { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false };
|
|
69
|
-
case DateFormats.SHORT_DATE_MEDIUM_TIME_FORMAT:
|
|
70
|
-
return {
|
|
71
|
-
year: 'numeric',
|
|
72
|
-
month: '2-digit',
|
|
73
|
-
day: '2-digit',
|
|
74
|
-
hour: '2-digit',
|
|
75
|
-
minute: '2-digit',
|
|
76
|
-
second: '2-digit',
|
|
77
|
-
hour12: false,
|
|
78
|
-
};
|
|
79
|
-
default:
|
|
80
|
-
throw new Error(`Unsupported format pattern: ${formatPattern}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Formats a given timestamp as a date.
|
|
87
|
-
*/
|
|
88
|
-
class DateOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
89
|
-
transform(input) {
|
|
90
|
-
return this.format(input, DateFormats.SHORT_DATE_FORMAT);
|
|
91
|
-
}
|
|
92
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: DateOnlyPipe, deps: null, target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
93
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: DateOnlyPipe, isStandalone: true, name: "dateOnly" }); }
|
|
94
|
-
}
|
|
95
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: DateOnlyPipe, decorators: [{
|
|
96
|
-
type: Pipe,
|
|
97
|
-
args: [{
|
|
98
|
-
name: 'dateOnly',
|
|
99
|
-
standalone: true,
|
|
100
|
-
}]
|
|
101
|
-
}] });
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Formats a given timestamp as a time.
|
|
105
|
-
*
|
|
106
|
-
* Timestamps can be formatted as 2 variants:
|
|
107
|
-
* - 'short' being 'HH:mm' (hours and minutes)
|
|
108
|
-
* - 'medium' being 'HH:mm:ss' (as above, but with seconds appended)
|
|
109
|
-
*
|
|
110
|
-
*/
|
|
111
|
-
class TimeOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
112
|
-
transform(input, format = 'short') {
|
|
113
|
-
return this.format(input, this.getFormat(format));
|
|
114
|
-
}
|
|
115
|
-
getFormat(format) {
|
|
116
|
-
switch (format) {
|
|
117
|
-
case 'short':
|
|
118
|
-
return DateFormats.SHORT_TIME_FORMAT;
|
|
119
|
-
case 'medium':
|
|
120
|
-
return DateFormats.MEDIUM_TIME_FORMAT;
|
|
121
|
-
default:
|
|
122
|
-
throw new Error(`Unable to derive format from "${format}"`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TimeOnlyPipe, deps: null, target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
126
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: TimeOnlyPipe, isStandalone: true, name: "timeOnly" }); }
|
|
127
|
-
}
|
|
128
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TimeOnlyPipe, decorators: [{
|
|
129
|
-
type: Pipe,
|
|
130
|
-
args: [{
|
|
131
|
-
name: 'timeOnly',
|
|
132
|
-
standalone: true,
|
|
133
|
-
}]
|
|
134
|
-
}] });
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Formats a given timestamp so that:
|
|
138
|
-
* - If timestamp is of "today", it's formatted as time with hours and minutes (eg. 23:56)
|
|
139
|
-
* - If timestamp is different from "today", it's formatted as date with "day of month", month and year (eg. 28.02.2020)
|
|
140
|
-
*
|
|
141
|
-
* All formatting and parsing is expect to be handled in "Europe/Copenhagen" time zone and with
|
|
142
|
-
* the locale provided by `LOCALE_ID`.
|
|
143
|
-
*/
|
|
144
|
-
class TimeOrDatePipe extends AbstractTimezoneCompensatingPipe {
|
|
145
|
-
transform(time, showSeconds = false, formatMonth = 'month-as-digits') {
|
|
146
|
-
if (!time) {
|
|
147
|
-
return '';
|
|
148
|
-
}
|
|
149
|
-
const date = typeof time === 'number' || typeof time === 'string' ? new Date(time) : time;
|
|
150
|
-
const today = new Date();
|
|
151
|
-
const sameDay = date.getFullYear() === today.getFullYear() &&
|
|
152
|
-
date.getMonth() === today.getMonth() &&
|
|
153
|
-
date.getDate() === today.getDate();
|
|
154
|
-
let format = DateFormats.SHORT_DATE_FORMAT;
|
|
155
|
-
if (formatMonth === 'month-as-letters') {
|
|
156
|
-
format = DateFormats.MEDIUM_LETTER_DATE_FORMAT;
|
|
157
|
-
}
|
|
158
|
-
if (sameDay) {
|
|
159
|
-
format = showSeconds ? DateFormats.MEDIUM_TIME_FORMAT : DateFormats.SHORT_TIME_FORMAT;
|
|
160
|
-
}
|
|
161
|
-
return this.format(date, format);
|
|
162
|
-
}
|
|
163
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TimeOrDatePipe, deps: null, target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
164
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: TimeOrDatePipe, isStandalone: true, name: "timeOrDate" }); }
|
|
165
|
-
}
|
|
166
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TimeOrDatePipe, decorators: [{
|
|
167
|
-
type: Pipe,
|
|
168
|
-
args: [{
|
|
169
|
-
name: 'timeOrDate',
|
|
170
|
-
standalone: true,
|
|
171
|
-
}]
|
|
172
|
-
}] });
|
|
173
|
-
|
|
174
|
-
class FormatNumberService {
|
|
175
|
-
constructor(localeId) {
|
|
176
|
-
this.localeId = localeId;
|
|
177
|
-
}
|
|
178
|
-
formatNumber(value, digitsInfo) {
|
|
179
|
-
if (value == null) {
|
|
180
|
-
return '';
|
|
181
|
-
}
|
|
182
|
-
return formatNumber(value, this.localeId, digitsInfo);
|
|
183
|
-
}
|
|
184
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FormatNumberService, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
185
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FormatNumberService, providedIn: 'root' }); }
|
|
186
|
-
}
|
|
187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FormatNumberService, decorators: [{
|
|
188
|
-
type: Injectable,
|
|
189
|
-
args: [{
|
|
190
|
-
providedIn: 'root',
|
|
191
|
-
}]
|
|
192
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
193
|
-
type: Inject,
|
|
194
|
-
args: [LOCALE_ID]
|
|
195
|
-
}] }] });
|
|
196
|
-
|
|
197
|
-
class FormatNumberPipe {
|
|
198
|
-
constructor(formatNumberService) {
|
|
199
|
-
this.formatNumberService = formatNumberService;
|
|
200
|
-
}
|
|
201
|
-
transform(value, digitsInfo = '1.2-2') {
|
|
202
|
-
return this.formatNumberService.formatNumber(value, digitsInfo);
|
|
203
|
-
}
|
|
204
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FormatNumberPipe, deps: [{ token: FormatNumberService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
205
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: FormatNumberPipe, isStandalone: true, name: "formatNumber" }); }
|
|
26
|
+
return {
|
|
27
|
+
provide: KIRBY_EXTENSIONS_LOCALIZATION_TOKEN,
|
|
28
|
+
useFactory: factory
|
|
29
|
+
};
|
|
206
30
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
31
|
+
var AbstractTimezoneCompensatingPipe = class {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);
|
|
34
|
+
this.locale = inject(LOCALE_ID);
|
|
35
|
+
}
|
|
36
|
+
format(time, formatPattern) {
|
|
37
|
+
if (!time) return "";
|
|
38
|
+
const date = typeof time === "number" || typeof time === "string" ? new Date(time) : time;
|
|
39
|
+
const timeZone = this.config.timeZone;
|
|
40
|
+
const options = this.getIntlOptions(formatPattern);
|
|
41
|
+
let formattedDate = new Intl.DateTimeFormat(this.locale, {
|
|
42
|
+
...options,
|
|
43
|
+
timeZone
|
|
44
|
+
}).format(date);
|
|
45
|
+
if (formatPattern === DateFormats.MEDIUM_LETTER_DATE_FORMAT) formattedDate = formattedDate.replace(/(\d{2}\.\s)(\w+)\.(\s\d{4})/, (_, day, month, year) => {
|
|
46
|
+
return `${day}${month.charAt(0).toUpperCase()}${month.slice(1)}${year}`;
|
|
47
|
+
});
|
|
48
|
+
if (formatPattern === DateFormats.SHORT_TIME_FORMAT || formatPattern === DateFormats.MEDIUM_TIME_FORMAT) formattedDate = formattedDate.replace(/\./g, ":");
|
|
49
|
+
return formattedDate;
|
|
50
|
+
}
|
|
51
|
+
getIntlOptions(formatPattern) {
|
|
52
|
+
switch (formatPattern) {
|
|
53
|
+
case DateFormats.SHORT_DATE_FORMAT: return {
|
|
54
|
+
year: "numeric",
|
|
55
|
+
month: "2-digit",
|
|
56
|
+
day: "2-digit"
|
|
57
|
+
};
|
|
58
|
+
case DateFormats.MEDIUM_DATE_FORMAT: return {
|
|
59
|
+
year: "numeric",
|
|
60
|
+
month: "long",
|
|
61
|
+
day: "numeric"
|
|
62
|
+
};
|
|
63
|
+
case DateFormats.MEDIUM_LETTER_DATE_FORMAT: return {
|
|
64
|
+
year: "numeric",
|
|
65
|
+
month: "short",
|
|
66
|
+
day: "2-digit"
|
|
67
|
+
};
|
|
68
|
+
case DateFormats.SHORT_TIME_FORMAT: return {
|
|
69
|
+
hour: "2-digit",
|
|
70
|
+
minute: "2-digit",
|
|
71
|
+
hour12: false
|
|
72
|
+
};
|
|
73
|
+
case DateFormats.MEDIUM_TIME_FORMAT: return {
|
|
74
|
+
hour: "2-digit",
|
|
75
|
+
minute: "2-digit",
|
|
76
|
+
second: "2-digit",
|
|
77
|
+
hour12: false
|
|
78
|
+
};
|
|
79
|
+
case DateFormats.SHORT_DATE_MEDIUM_TIME_FORMAT: return {
|
|
80
|
+
year: "numeric",
|
|
81
|
+
month: "2-digit",
|
|
82
|
+
day: "2-digit",
|
|
83
|
+
hour: "2-digit",
|
|
84
|
+
minute: "2-digit",
|
|
85
|
+
second: "2-digit",
|
|
86
|
+
hour12: false
|
|
87
|
+
};
|
|
88
|
+
default: throw new Error(`Unsupported format pattern: ${formatPattern}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var DateOnlyPipe = class DateOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
93
|
+
transform(input) {
|
|
94
|
+
return this.format(input, DateFormats.SHORT_DATE_FORMAT);
|
|
95
|
+
}
|
|
96
|
+
static {
|
|
97
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
98
|
+
minVersion: "12.0.0",
|
|
99
|
+
version: "22.2.2",
|
|
100
|
+
ngImport: i0,
|
|
101
|
+
type: DateOnlyPipe,
|
|
102
|
+
deps: null,
|
|
103
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
static {
|
|
107
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
108
|
+
minVersion: "14.0.0",
|
|
109
|
+
version: "22.2.2",
|
|
110
|
+
ngImport: i0,
|
|
111
|
+
type: DateOnlyPipe,
|
|
112
|
+
isStandalone: true,
|
|
113
|
+
name: "dateOnly"
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
118
|
+
minVersion: "12.0.0",
|
|
119
|
+
version: "22.2.2",
|
|
120
|
+
ngImport: i0,
|
|
121
|
+
type: DateOnlyPipe,
|
|
122
|
+
decorators: [{
|
|
123
|
+
type: Pipe,
|
|
124
|
+
args: [{
|
|
125
|
+
name: "dateOnly",
|
|
126
|
+
standalone: true
|
|
127
|
+
}]
|
|
128
|
+
}]
|
|
129
|
+
});
|
|
130
|
+
var TimeOnlyPipe = class TimeOnlyPipe extends AbstractTimezoneCompensatingPipe {
|
|
131
|
+
transform(input, format = "short") {
|
|
132
|
+
return this.format(input, this.getFormat(format));
|
|
133
|
+
}
|
|
134
|
+
getFormat(format) {
|
|
135
|
+
switch (format) {
|
|
136
|
+
case "short": return DateFormats.SHORT_TIME_FORMAT;
|
|
137
|
+
case "medium": return DateFormats.MEDIUM_TIME_FORMAT;
|
|
138
|
+
default: throw new Error(`Unable to derive format from "${format}"`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
static {
|
|
142
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
143
|
+
minVersion: "12.0.0",
|
|
144
|
+
version: "22.2.2",
|
|
145
|
+
ngImport: i0,
|
|
146
|
+
type: TimeOnlyPipe,
|
|
147
|
+
deps: null,
|
|
148
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
static {
|
|
152
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
153
|
+
minVersion: "14.0.0",
|
|
154
|
+
version: "22.2.2",
|
|
155
|
+
ngImport: i0,
|
|
156
|
+
type: TimeOnlyPipe,
|
|
157
|
+
isStandalone: true,
|
|
158
|
+
name: "timeOnly"
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
163
|
+
minVersion: "12.0.0",
|
|
164
|
+
version: "22.2.2",
|
|
165
|
+
ngImport: i0,
|
|
166
|
+
type: TimeOnlyPipe,
|
|
167
|
+
decorators: [{
|
|
168
|
+
type: Pipe,
|
|
169
|
+
args: [{
|
|
170
|
+
name: "timeOnly",
|
|
171
|
+
standalone: true
|
|
172
|
+
}]
|
|
173
|
+
}]
|
|
174
|
+
});
|
|
175
|
+
var TimeOrDatePipe = class TimeOrDatePipe extends AbstractTimezoneCompensatingPipe {
|
|
176
|
+
transform(time, showSeconds = false, formatMonth = "month-as-digits") {
|
|
177
|
+
if (!time) return "";
|
|
178
|
+
const date = typeof time === "number" || typeof time === "string" ? new Date(time) : time;
|
|
179
|
+
const today = /* @__PURE__ */ new Date();
|
|
180
|
+
const sameDay = date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
|
|
181
|
+
let format = DateFormats.SHORT_DATE_FORMAT;
|
|
182
|
+
if (formatMonth === "month-as-letters") format = DateFormats.MEDIUM_LETTER_DATE_FORMAT;
|
|
183
|
+
if (sameDay) format = showSeconds ? DateFormats.MEDIUM_TIME_FORMAT : DateFormats.SHORT_TIME_FORMAT;
|
|
184
|
+
return this.format(date, format);
|
|
185
|
+
}
|
|
186
|
+
static {
|
|
187
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
188
|
+
minVersion: "12.0.0",
|
|
189
|
+
version: "22.2.2",
|
|
190
|
+
ngImport: i0,
|
|
191
|
+
type: TimeOrDatePipe,
|
|
192
|
+
deps: null,
|
|
193
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
static {
|
|
197
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
198
|
+
minVersion: "14.0.0",
|
|
199
|
+
version: "22.2.2",
|
|
200
|
+
ngImport: i0,
|
|
201
|
+
type: TimeOrDatePipe,
|
|
202
|
+
isStandalone: true,
|
|
203
|
+
name: "timeOrDate"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
208
|
+
minVersion: "12.0.0",
|
|
209
|
+
version: "22.2.2",
|
|
210
|
+
ngImport: i0,
|
|
211
|
+
type: TimeOrDatePipe,
|
|
212
|
+
decorators: [{
|
|
213
|
+
type: Pipe,
|
|
214
|
+
args: [{
|
|
215
|
+
name: "timeOrDate",
|
|
216
|
+
standalone: true
|
|
217
|
+
}]
|
|
218
|
+
}]
|
|
219
|
+
});
|
|
220
|
+
var FormatNumberService = class FormatNumberService {
|
|
221
|
+
constructor(localeId) {
|
|
222
|
+
this.localeId = localeId;
|
|
223
|
+
}
|
|
224
|
+
formatNumber(value, digitsInfo) {
|
|
225
|
+
if (value == null) return "";
|
|
226
|
+
return formatNumber(value, this.localeId, digitsInfo);
|
|
227
|
+
}
|
|
228
|
+
static {
|
|
229
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
230
|
+
minVersion: "12.0.0",
|
|
231
|
+
version: "22.2.2",
|
|
232
|
+
ngImport: i0,
|
|
233
|
+
type: FormatNumberService,
|
|
234
|
+
deps: [{ token: LOCALE_ID }],
|
|
235
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
static {
|
|
239
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
240
|
+
minVersion: "12.0.0",
|
|
241
|
+
version: "22.2.2",
|
|
242
|
+
ngImport: i0,
|
|
243
|
+
type: FormatNumberService,
|
|
244
|
+
providedIn: "root"
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
249
|
+
minVersion: "12.0.0",
|
|
250
|
+
version: "22.2.2",
|
|
251
|
+
ngImport: i0,
|
|
252
|
+
type: FormatNumberService,
|
|
253
|
+
decorators: [{
|
|
254
|
+
type: Injectable,
|
|
255
|
+
args: [{ providedIn: "root" }]
|
|
256
|
+
}],
|
|
257
|
+
ctorParameters: () => [{
|
|
258
|
+
type: void 0,
|
|
259
|
+
decorators: [{
|
|
260
|
+
type: Inject,
|
|
261
|
+
args: [LOCALE_ID]
|
|
262
|
+
}]
|
|
263
|
+
}]
|
|
264
|
+
});
|
|
265
|
+
var FormatNumberPipe = class FormatNumberPipe {
|
|
266
|
+
constructor(formatNumberService) {
|
|
267
|
+
this.formatNumberService = formatNumberService;
|
|
268
|
+
}
|
|
269
|
+
transform(value, digitsInfo = "1.2-2") {
|
|
270
|
+
return this.formatNumberService.formatNumber(value, digitsInfo);
|
|
271
|
+
}
|
|
272
|
+
static {
|
|
273
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
274
|
+
minVersion: "12.0.0",
|
|
275
|
+
version: "22.2.2",
|
|
276
|
+
ngImport: i0,
|
|
277
|
+
type: FormatNumberPipe,
|
|
278
|
+
deps: [{ token: FormatNumberService }],
|
|
279
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
static {
|
|
283
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
284
|
+
minVersion: "14.0.0",
|
|
285
|
+
version: "22.2.2",
|
|
286
|
+
ngImport: i0,
|
|
287
|
+
type: FormatNumberPipe,
|
|
288
|
+
isStandalone: true,
|
|
289
|
+
name: "formatNumber"
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
294
|
+
minVersion: "12.0.0",
|
|
295
|
+
version: "22.2.2",
|
|
296
|
+
ngImport: i0,
|
|
297
|
+
type: FormatNumberPipe,
|
|
298
|
+
decorators: [{
|
|
299
|
+
type: Pipe,
|
|
300
|
+
args: [{
|
|
301
|
+
name: "formatNumber",
|
|
302
|
+
standalone: true
|
|
303
|
+
}]
|
|
304
|
+
}],
|
|
305
|
+
ctorParameters: () => [{ type: FormatNumberService }]
|
|
306
|
+
});
|
|
215
307
|
function formatAmount(amount, locale, config, amountServiceConfiguration) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return formattedAmount;
|
|
224
|
-
}
|
|
225
|
-
if (amountConfig.currencyCodePosition === 'postfix') {
|
|
226
|
-
return formattedAmount + ' ' + currencyCodeToAppend;
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
return currencyCodeToAppend + ' ' + formattedAmount;
|
|
230
|
-
}
|
|
308
|
+
const amountConfig = deriveConfiguration(amountServiceConfiguration);
|
|
309
|
+
let formattedAmount = formatNumber(amount && amount.amount, locale, amountConfig.digitsInfo);
|
|
310
|
+
if (amountConfig.stripSign) formattedAmount = formattedAmount.replace("-", "").trim();
|
|
311
|
+
const currencyCodeToAppend = deriveCurrencyCode(amountConfig, amount, config);
|
|
312
|
+
if (!currencyCodeToAppend) return formattedAmount;
|
|
313
|
+
if (amountConfig.currencyCodePosition === "postfix") return formattedAmount + " " + currencyCodeToAppend;
|
|
314
|
+
else return currencyCodeToAppend + " " + formattedAmount;
|
|
231
315
|
}
|
|
232
316
|
function deriveCurrencyCode(amountConfig, amount, config) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
amount.currencyCode !== config.nativeCurrency ? amount.currencyCode : '';
|
|
241
|
-
}
|
|
242
|
-
else if (amountConfig.showCurrencyCode === 'useCurrencyMapping') {
|
|
243
|
-
currencyCodeToAppend = config.currencyMappings?.[amount.currencyCode] || amount.currencyCode;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return currencyCodeToAppend || '';
|
|
317
|
+
let currencyCodeToAppend;
|
|
318
|
+
if (amountConfig.showCurrencyCode) {
|
|
319
|
+
if (amountConfig.showCurrencyCode === "alwaysShowCurrency") currencyCodeToAppend = amount.currencyCode;
|
|
320
|
+
else if (amountConfig.showCurrencyCode === "showForeignCurrency") currencyCodeToAppend = amount.currencyCode !== config.nativeCurrency ? amount.currencyCode : "";
|
|
321
|
+
else if (amountConfig.showCurrencyCode === "useCurrencyMapping") currencyCodeToAppend = config.currencyMappings?.[amount.currencyCode] || amount.currencyCode;
|
|
322
|
+
}
|
|
323
|
+
return currencyCodeToAppend || "";
|
|
247
324
|
}
|
|
248
325
|
function deriveConfiguration(configuration = {}) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return Object.assign({}, config, configuration);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
class AmountService {
|
|
258
|
-
constructor() {
|
|
259
|
-
this.config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);
|
|
260
|
-
this.locale = inject(LOCALE_ID);
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Applies the transformation logic, by taking the `amount`-argument, and a configuration object - {@link AmountServiceConfiguration}
|
|
264
|
-
*
|
|
265
|
-
* The number is always formatted according to Angular LOCALE_ID
|
|
266
|
-
*
|
|
267
|
-
* @param amount the {@link Amount} to configure
|
|
268
|
-
* @param amountServiceConfiguration
|
|
269
|
-
*/
|
|
270
|
-
formatAmount(amount, amountServiceConfiguration) {
|
|
271
|
-
if (amount == undefined) {
|
|
272
|
-
const config = deriveConfiguration(amountServiceConfiguration);
|
|
273
|
-
if (config.returnValueOnEmptyAmount) {
|
|
274
|
-
return config.returnValueOnEmptyAmount;
|
|
275
|
-
}
|
|
276
|
-
amount = {
|
|
277
|
-
amount: 0.0,
|
|
278
|
-
currencyCode: '',
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
return formatAmount(amount, this.locale, this.config, amountServiceConfiguration);
|
|
282
|
-
}
|
|
283
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: AmountService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
284
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: AmountService, providedIn: 'root' }); }
|
|
285
|
-
}
|
|
286
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: AmountService, decorators: [{
|
|
287
|
-
type: Injectable,
|
|
288
|
-
args: [{
|
|
289
|
-
providedIn: 'root',
|
|
290
|
-
}]
|
|
291
|
-
}] });
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Configuration object for the amount-pipe. The configuration object can be used to control
|
|
295
|
-
* the formatting of the amount, and can be passed as an argument to the amount-pipe when used on an {@link Amount}.
|
|
296
|
-
* - `showCurrencyCode`: Controls whether the currency code should be displayed or not.
|
|
297
|
-
* - `''`: Don't output currency code
|
|
298
|
-
* - `alwaysShowCurrency`: Always show currency code, regardless of presentation currency
|
|
299
|
-
* - `showForeignCurrency`: Only show currency code if it differs from the presentation currency
|
|
300
|
-
* - `digitsInfo`: A string that represents the format of the number. Learn more about the format here: https://angular.io/api/common/DecimalPipe#parameters
|
|
301
|
-
* - `stripSign`: Controls whether the minus sign should be stripped from a negative amount.
|
|
302
|
-
* - `currencyCodePosition`: Controls the position of the currency code in the formatted amount.
|
|
303
|
-
* - `postfix`: Output currency code after the formatted amount, e.g. 1.234,56 EUR
|
|
304
|
-
* - `prefix`: Output currency code before the formatted amount, e.g. DKK 1.234,56
|
|
305
|
-
*/
|
|
306
|
-
class AmountPipe {
|
|
307
|
-
constructor(amountService) {
|
|
308
|
-
this.amountService = amountService;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Applies the transformation logic, by taking the `amount`-argument, and a configuration object - {@link AmountServiceConfiguration} (or a number of arguments, for backwards compatibility).
|
|
312
|
-
*
|
|
313
|
-
* @param amount the {@link Amount} to configure
|
|
314
|
-
* @param amountServiceConfiguration
|
|
315
|
-
*/
|
|
316
|
-
transform(amount, amountServiceConfiguration) {
|
|
317
|
-
return this.amountService.formatAmount(amount, amountServiceConfiguration);
|
|
318
|
-
}
|
|
319
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: AmountPipe, deps: [{ token: AmountService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
320
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: AmountPipe, isStandalone: true, name: "amount" }); }
|
|
326
|
+
return Object.assign({}, {
|
|
327
|
+
showCurrencyCode: "",
|
|
328
|
+
digitsInfo: "1.2-2",
|
|
329
|
+
stripSign: false
|
|
330
|
+
}, configuration);
|
|
321
331
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
332
|
+
var AmountService = class AmountService {
|
|
333
|
+
constructor() {
|
|
334
|
+
this.config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);
|
|
335
|
+
this.locale = inject(LOCALE_ID);
|
|
336
|
+
}
|
|
337
|
+
formatAmount(amount, amountServiceConfiguration) {
|
|
338
|
+
if (amount == void 0) {
|
|
339
|
+
const config = deriveConfiguration(amountServiceConfiguration);
|
|
340
|
+
if (config.returnValueOnEmptyAmount) return config.returnValueOnEmptyAmount;
|
|
341
|
+
amount = {
|
|
342
|
+
amount: 0,
|
|
343
|
+
currencyCode: ""
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
return formatAmount(amount, this.locale, this.config, amountServiceConfiguration);
|
|
347
|
+
}
|
|
348
|
+
static {
|
|
349
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
350
|
+
minVersion: "12.0.0",
|
|
351
|
+
version: "22.2.2",
|
|
352
|
+
ngImport: i0,
|
|
353
|
+
type: AmountService,
|
|
354
|
+
deps: [],
|
|
355
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
static {
|
|
359
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
360
|
+
minVersion: "12.0.0",
|
|
361
|
+
version: "22.2.2",
|
|
362
|
+
ngImport: i0,
|
|
363
|
+
type: AmountService,
|
|
364
|
+
providedIn: "root"
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
369
|
+
minVersion: "12.0.0",
|
|
370
|
+
version: "22.2.2",
|
|
371
|
+
ngImport: i0,
|
|
372
|
+
type: AmountService,
|
|
373
|
+
decorators: [{
|
|
374
|
+
type: Injectable,
|
|
375
|
+
args: [{ providedIn: "root" }]
|
|
376
|
+
}]
|
|
377
|
+
});
|
|
378
|
+
var AmountPipe = class AmountPipe {
|
|
379
|
+
constructor(amountService) {
|
|
380
|
+
this.amountService = amountService;
|
|
381
|
+
}
|
|
382
|
+
transform(amount, amountServiceConfiguration) {
|
|
383
|
+
return this.amountService.formatAmount(amount, amountServiceConfiguration);
|
|
384
|
+
}
|
|
385
|
+
static {
|
|
386
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
387
|
+
minVersion: "12.0.0",
|
|
388
|
+
version: "22.2.2",
|
|
389
|
+
ngImport: i0,
|
|
390
|
+
type: AmountPipe,
|
|
391
|
+
deps: [{ token: AmountService }],
|
|
392
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
static {
|
|
396
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
397
|
+
minVersion: "14.0.0",
|
|
398
|
+
version: "22.2.2",
|
|
399
|
+
ngImport: i0,
|
|
400
|
+
type: AmountPipe,
|
|
401
|
+
isStandalone: true,
|
|
402
|
+
name: "amount"
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
407
|
+
minVersion: "12.0.0",
|
|
408
|
+
version: "22.2.2",
|
|
409
|
+
ngImport: i0,
|
|
410
|
+
type: AmountPipe,
|
|
411
|
+
decorators: [{
|
|
412
|
+
type: Pipe,
|
|
413
|
+
args: [{
|
|
414
|
+
name: "amount",
|
|
415
|
+
standalone: true
|
|
416
|
+
}]
|
|
417
|
+
}],
|
|
418
|
+
ctorParameters: () => [{ type: AmountService }]
|
|
419
|
+
});
|
|
330
420
|
function formatAccountNumber(value) {
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Pipe that formats a {@link AccountNumber}-object to a common format.
|
|
336
|
-
*/
|
|
337
|
-
class AccountNumberPipe {
|
|
338
|
-
/**
|
|
339
|
-
* Formats the {@link AccountNumber} to a common format.
|
|
340
|
-
*
|
|
341
|
-
* @param value the {@link AccountNumber} to format
|
|
342
|
-
*/
|
|
343
|
-
transform(value) {
|
|
344
|
-
return formatAccountNumber(value);
|
|
345
|
-
}
|
|
346
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: AccountNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
347
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: AccountNumberPipe, isStandalone: true, name: "accountNumber" }); }
|
|
421
|
+
return `${value.regNo.padStart(4, "0")} ${value.accountNo.replace(/^0+/, "")}`;
|
|
348
422
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
423
|
+
var AccountNumberPipe = class AccountNumberPipe {
|
|
424
|
+
transform(value) {
|
|
425
|
+
return formatAccountNumber(value);
|
|
426
|
+
}
|
|
427
|
+
static {
|
|
428
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
429
|
+
minVersion: "12.0.0",
|
|
430
|
+
version: "22.2.2",
|
|
431
|
+
ngImport: i0,
|
|
432
|
+
type: AccountNumberPipe,
|
|
433
|
+
deps: [],
|
|
434
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
static {
|
|
438
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
439
|
+
minVersion: "14.0.0",
|
|
440
|
+
version: "22.2.2",
|
|
441
|
+
ngImport: i0,
|
|
442
|
+
type: AccountNumberPipe,
|
|
443
|
+
isStandalone: true,
|
|
444
|
+
name: "accountNumber"
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
449
|
+
minVersion: "12.0.0",
|
|
450
|
+
version: "22.2.2",
|
|
451
|
+
ngImport: i0,
|
|
452
|
+
type: AccountNumberPipe,
|
|
453
|
+
decorators: [{
|
|
454
|
+
type: Pipe,
|
|
455
|
+
args: [{
|
|
456
|
+
name: "accountNumber",
|
|
457
|
+
standalone: true
|
|
458
|
+
}]
|
|
459
|
+
}]
|
|
460
|
+
});
|
|
461
|
+
var PhoneNumberService = class PhoneNumberService {
|
|
462
|
+
constructor() {
|
|
463
|
+
this.config = inject(KIRBY_EXTENSIONS_LOCALIZATION_TOKEN);
|
|
464
|
+
this.locale = inject(LOCALE_ID);
|
|
465
|
+
}
|
|
466
|
+
static chunkUpPhoneNumber(str, chunk) {
|
|
467
|
+
return str.match(new RegExp(`.{1,${chunk}}`, "g"))?.join(" ") ?? "";
|
|
468
|
+
}
|
|
469
|
+
formatPhoneNumber(phoneNumber, chunk = 2, showCountryCode) {
|
|
470
|
+
const countryCode = typeof phoneNumber === "string" ? this.config.countryCode : phoneNumber.countryCode;
|
|
471
|
+
const number = typeof phoneNumber === "string" ? phoneNumber : phoneNumber.number;
|
|
472
|
+
if (!/^\d+$/.test(number)) return;
|
|
473
|
+
if (showCountryCode === void 0) showCountryCode = !this.locale.match(`${this.config.defaultLang}.*`);
|
|
474
|
+
const formattedNumber = PhoneNumberService.chunkUpPhoneNumber(number, chunk);
|
|
475
|
+
if (showCountryCode) return `${countryCode} ${formattedNumber}`;
|
|
476
|
+
else return formattedNumber;
|
|
477
|
+
}
|
|
478
|
+
static {
|
|
479
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
480
|
+
minVersion: "12.0.0",
|
|
481
|
+
version: "22.2.2",
|
|
482
|
+
ngImport: i0,
|
|
483
|
+
type: PhoneNumberService,
|
|
484
|
+
deps: [],
|
|
485
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
static {
|
|
489
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
490
|
+
minVersion: "12.0.0",
|
|
491
|
+
version: "22.2.2",
|
|
492
|
+
ngImport: i0,
|
|
493
|
+
type: PhoneNumberService,
|
|
494
|
+
providedIn: "root"
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
499
|
+
minVersion: "12.0.0",
|
|
500
|
+
version: "22.2.2",
|
|
501
|
+
ngImport: i0,
|
|
502
|
+
type: PhoneNumberService,
|
|
503
|
+
decorators: [{
|
|
504
|
+
type: Injectable,
|
|
505
|
+
args: [{ providedIn: "root" }]
|
|
506
|
+
}]
|
|
507
|
+
});
|
|
508
|
+
var PhoneNumberPipe = class PhoneNumberPipe {
|
|
509
|
+
constructor(phoneNumberService) {
|
|
510
|
+
this.phoneNumberService = phoneNumberService;
|
|
511
|
+
}
|
|
512
|
+
transform(phoneNumber, chunk = 2, showCountryCode) {
|
|
513
|
+
return this.phoneNumberService.formatPhoneNumber(phoneNumber, chunk, showCountryCode);
|
|
514
|
+
}
|
|
515
|
+
static {
|
|
516
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
517
|
+
minVersion: "12.0.0",
|
|
518
|
+
version: "22.2.2",
|
|
519
|
+
ngImport: i0,
|
|
520
|
+
type: PhoneNumberPipe,
|
|
521
|
+
deps: [{ token: PhoneNumberService }],
|
|
522
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
static {
|
|
526
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
527
|
+
minVersion: "14.0.0",
|
|
528
|
+
version: "22.2.2",
|
|
529
|
+
ngImport: i0,
|
|
530
|
+
type: PhoneNumberPipe,
|
|
531
|
+
isStandalone: true,
|
|
532
|
+
name: "phoneNumber"
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
537
|
+
minVersion: "12.0.0",
|
|
538
|
+
version: "22.2.2",
|
|
539
|
+
ngImport: i0,
|
|
540
|
+
type: PhoneNumberPipe,
|
|
541
|
+
decorators: [{
|
|
542
|
+
type: Pipe,
|
|
543
|
+
args: [{
|
|
544
|
+
name: "phoneNumber",
|
|
545
|
+
standalone: true
|
|
546
|
+
}]
|
|
547
|
+
}],
|
|
548
|
+
ctorParameters: () => [{ type: PhoneNumberService }]
|
|
549
|
+
});
|
|
421
550
|
export { AccountNumberPipe, AmountPipe, AmountService, DateFormats, DateOnlyPipe, FormatNumberPipe, FormatNumberService, KIRBY_EXTENSIONS_LOCALIZATION_TOKEN, PhoneNumberPipe, PhoneNumberService, TimeOnlyPipe, TimeOrDatePipe, formatAccountNumber, formatAmount, provideKirbyExtensionsLocalizationToken };
|
|
422
|
-
|
|
551
|
+
|
|
552
|
+
//# sourceMappingURL=kirbydesign-extensions-angular-localization.mjs.map
|