@kirbydesign/extensions-angular 2.0.0 → 3.1.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-image-banner.mjs +12 -2
- package/fesm2022/kirbydesign-extensions-angular-image-banner.mjs.map +1 -1
- package/fesm2022/kirbydesign-extensions-angular-localization.mjs +16 -13
- package/fesm2022/kirbydesign-extensions-angular-localization.mjs.map +1 -1
- package/image-banner/image-banner.component.d.ts +6 -2
- package/localization/amount/amount-service-formatter.d.ts +5 -3
- package/localization/di-tokens.d.ts +8 -2
- package/package.json +1 -1
|
@@ -53,6 +53,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
53
53
|
class ImageBannerComponent {
|
|
54
54
|
constructor(translations) {
|
|
55
55
|
this.translations = translations;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the button should be shown in narrow view or not.
|
|
58
|
+
*/
|
|
59
|
+
this.showButtonInNarrowView = false;
|
|
60
|
+
/**
|
|
61
|
+
* The text of the button in the content area of the image banner. If left empty, will default to 'Read more' (or equivalent translation for [supported locales](https://cookbook.kirby.design/#/home/localization)).
|
|
62
|
+
*/
|
|
63
|
+
this.actionButtonText = this.translations.get('readMore');
|
|
56
64
|
/**
|
|
57
65
|
* The blur-effect used for the background.
|
|
58
66
|
*/
|
|
@@ -84,17 +92,19 @@ class ImageBannerComponent {
|
|
|
84
92
|
this.imageError.emit($event);
|
|
85
93
|
}
|
|
86
94
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ImageBannerComponent, deps: [{ token: i1.TranslationService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
87
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.4", type: ImageBannerComponent, isStandalone: true, selector: "kirby-x-image-banner", inputs: { title: "title", imagePath: "imagePath", bodyText: "bodyText", actionButtonText: "actionButtonText", externalLink: "externalLink", backgroundBlur: "backgroundBlur" }, outputs: { bannerClick: "bannerClick", dismissClick: "dismissClick", imageError: "imageError" }, host: { properties: { "class": "this.backgroundBlur" } }, hostDirectives: [{ directive: ImageBannerHeightDirective }], ngImport: i0, template: "<kirby-card
|
|
95
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.4", type: ImageBannerComponent, isStandalone: true, selector: "kirby-x-image-banner", inputs: { title: "title", imagePath: "imagePath", bodyText: "bodyText", showButtonInNarrowView: "showButtonInNarrowView", actionButtonText: "actionButtonText", externalLink: "externalLink", backgroundBlur: "backgroundBlur" }, outputs: { bannerClick: "bannerClick", dismissClick: "dismissClick", imageError: "imageError" }, host: { properties: { "class": "this.backgroundBlur" } }, hostDirectives: [{ directive: ImageBannerHeightDirective }], ngImport: i0, template: "@if (externalLink) {\n <kirby-card [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n@if (!externalLink) {\n <kirby-card\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\"\n (click)=\"bannerClicked($event)\"\n >\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n @if (externalLink) {\n <a class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n }\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"text-content-layout\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <p class=\"main-content-body-text kirby-text-small\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </p>\n\n @if (!showButtonInNarrowView && externalLink) {\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n }\n </div>\n </div>\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n @if (externalLink) {\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [class.visible]=\"showButtonInNarrowView\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n }\n\n @if (!externalLink) {\n <button\n [class.visible]=\"showButtonInNarrowView\"\n class=\"main-content-body-action-text\"\n kirby-button\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n </button>\n }\n </div>\n </div>\n\n @if (dismissClick.observed) {\n <div class=\"dismiss\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n }\n</ng-template>\n", styles: [":host{display:block}:host(.none) .blur-image{display:none}@container banner (width < 600px){:host(.none) .dismiss{--kirby-inputs-background-color: var(--kirby-white);--kirby-inputs-background-color-hover: var(--kirby-dark-overlay-10);--kirby-inputs-background-color-active: var(--kirby-dark-overlay-20);--kirby-inputs-color: var(--kirby-black)}}:host(.none) .main-content-body-action-link{color:var(--kirby-semi-dark)}:host(.dark) .blur-image{filter:blur(110px)}:host(.light) .blur-image{filter:blur(110px)}:host(.dark) .blur-image-wrapper:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#00000052;z-index:1}:host(.light) .blur-image-wrapper:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff73;z-index:1}.blur-image-wrapper{position:absolute;inset:-330px;z-index:-1}.blur-image{display:block;width:100%;height:100%;object-fit:cover;object-position:center}kirby-card{container-name:banner;container-type:inline-size;height:100%}.main-content-wrapper{width:100%;padding:8px;box-sizing:border-box;display:flex;flex-direction:column}@container banner (width >= 600px){.main-content-wrapper{gap:16px;flex-direction:initial}}.main-content-image-wrapper{display:flex;overflow:hidden;border-radius:8px}@container banner (width >= 600px){.main-content-image-wrapper{flex:1}}.main-content{display:flex;flex-direction:column;justify-content:space-between;min-height:var(--kirby-x-image-banner-min-height, 84px);box-sizing:border-box;padding:12px 0 8px 8px;overflow:hidden}@container banner (width < 600px){.main-content{flex-direction:row}}.main-content .main-content-header{padding-inline-end:8px}@container banner (width >= 600px){.main-content .main-content-header{padding-inline-end:40px}}.main-content:has(.main-content-body-action-link) .main-content-header{padding-inline-end:40px}@container banner (width >= 600px){.main-content{flex:1;gap:12px;padding:8px 8px 8px 0}}.main-content-anchor{position:absolute;inset:0}.main-content-header p{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;margin:0;padding:0}.main-content-image{width:100%;height:132px;object-fit:cover;object-position:center}@container banner (width >= 600px){.main-content-image{height:164px}}.main-content-body{display:flex;flex:1;justify-content:space-between;height:100%}.main-content-body p{text-wrap-mode:wrap;margin-bottom:0}@container banner (width >= 600px){.main-content-body{flex-direction:column;max-width:324px}}@container banner (width >= 600px){.main-content-body .main-content-body-action-link{display:none}}.main-content-body-text{display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;padding-inline-end:8px}@container banner (width >= 600px){.main-content-body-text{padding-inline-end:48px}}@container banner (width < 600px){.main-content-body-text{-webkit-line-clamp:2;line-clamp:2;max-height:3em}}.main-content-body-action-text{display:none}@container banner (width >= 600px){.main-content-body-action-text{align-self:start;display:inline-flex;margin:0}}.dismiss{position:absolute;top:16px;right:16px;height:fit-content}.dismiss button{margin:0}.visible{display:inline-flex}@container banner (width < 600px){button.visible,a.visible{align-self:center}}.text-content-layout{display:flex;flex:1;flex-direction:column;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@container banner (width >= 600px){.text-content-layout{gap:12px}}\n"], dependencies: [{ kind: "ngmodule", type: CardModule }, { kind: "component", type: i3.CardComponent, selector: "kirby-card", inputs: ["title", "subtitle", "backgroundImageUrl", "hasPadding", "sizes", "variant"] }, { kind: "directive", type: i3.CardAsButtonDirective, selector: "kirby-card[click]" }, { kind: "directive", type: i1.ThemeColorDirective, selector: "kirby-avatar[themeColor], kirby-card[themeColor], kirby-icon[themeColor], kirby-progress-circle-ring[themeColor], kirby-modal-footer[themeColor], kirby-empty-state[themeColor]", inputs: ["themeColor"] }, { kind: "component", type: ButtonComponent, selector: "button[kirby-button],Button[kirby-button],a[kirby-button]", inputs: ["attentionLevel", "noDecoration", "themeColor", "expand", "isFloating", "size", "showIconOnly"] }, { kind: "ngmodule", type: IconModule }, { kind: "component", type: i4.IconComponent, selector: "kirby-icon", inputs: ["size", "name"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
88
96
|
}
|
|
89
97
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ImageBannerComponent, decorators: [{
|
|
90
98
|
type: Component,
|
|
91
|
-
args: [{ selector: 'kirby-x-image-banner', imports: [CardModule, ButtonComponent, IconModule, CommonModule], hostDirectives: [ImageBannerHeightDirective], template: "<kirby-card
|
|
99
|
+
args: [{ selector: 'kirby-x-image-banner', imports: [CardModule, ButtonComponent, IconModule, CommonModule], hostDirectives: [ImageBannerHeightDirective], template: "@if (externalLink) {\n <kirby-card [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n@if (!externalLink) {\n <kirby-card\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\"\n (click)=\"bannerClicked($event)\"\n >\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n @if (externalLink) {\n <a class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n }\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"text-content-layout\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <p class=\"main-content-body-text kirby-text-small\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </p>\n\n @if (!showButtonInNarrowView && externalLink) {\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n }\n </div>\n </div>\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n @if (externalLink) {\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [class.visible]=\"showButtonInNarrowView\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n }\n\n @if (!externalLink) {\n <button\n [class.visible]=\"showButtonInNarrowView\"\n class=\"main-content-body-action-text\"\n kirby-button\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n </button>\n }\n </div>\n </div>\n\n @if (dismissClick.observed) {\n <div class=\"dismiss\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n }\n</ng-template>\n", styles: [":host{display:block}:host(.none) .blur-image{display:none}@container banner (width < 600px){:host(.none) .dismiss{--kirby-inputs-background-color: var(--kirby-white);--kirby-inputs-background-color-hover: var(--kirby-dark-overlay-10);--kirby-inputs-background-color-active: var(--kirby-dark-overlay-20);--kirby-inputs-color: var(--kirby-black)}}:host(.none) .main-content-body-action-link{color:var(--kirby-semi-dark)}:host(.dark) .blur-image{filter:blur(110px)}:host(.light) .blur-image{filter:blur(110px)}:host(.dark) .blur-image-wrapper:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#00000052;z-index:1}:host(.light) .blur-image-wrapper:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff73;z-index:1}.blur-image-wrapper{position:absolute;inset:-330px;z-index:-1}.blur-image{display:block;width:100%;height:100%;object-fit:cover;object-position:center}kirby-card{container-name:banner;container-type:inline-size;height:100%}.main-content-wrapper{width:100%;padding:8px;box-sizing:border-box;display:flex;flex-direction:column}@container banner (width >= 600px){.main-content-wrapper{gap:16px;flex-direction:initial}}.main-content-image-wrapper{display:flex;overflow:hidden;border-radius:8px}@container banner (width >= 600px){.main-content-image-wrapper{flex:1}}.main-content{display:flex;flex-direction:column;justify-content:space-between;min-height:var(--kirby-x-image-banner-min-height, 84px);box-sizing:border-box;padding:12px 0 8px 8px;overflow:hidden}@container banner (width < 600px){.main-content{flex-direction:row}}.main-content .main-content-header{padding-inline-end:8px}@container banner (width >= 600px){.main-content .main-content-header{padding-inline-end:40px}}.main-content:has(.main-content-body-action-link) .main-content-header{padding-inline-end:40px}@container banner (width >= 600px){.main-content{flex:1;gap:12px;padding:8px 8px 8px 0}}.main-content-anchor{position:absolute;inset:0}.main-content-header p{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;margin:0;padding:0}.main-content-image{width:100%;height:132px;object-fit:cover;object-position:center}@container banner (width >= 600px){.main-content-image{height:164px}}.main-content-body{display:flex;flex:1;justify-content:space-between;height:100%}.main-content-body p{text-wrap-mode:wrap;margin-bottom:0}@container banner (width >= 600px){.main-content-body{flex-direction:column;max-width:324px}}@container banner (width >= 600px){.main-content-body .main-content-body-action-link{display:none}}.main-content-body-text{display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;padding-inline-end:8px}@container banner (width >= 600px){.main-content-body-text{padding-inline-end:48px}}@container banner (width < 600px){.main-content-body-text{-webkit-line-clamp:2;line-clamp:2;max-height:3em}}.main-content-body-action-text{display:none}@container banner (width >= 600px){.main-content-body-action-text{align-self:start;display:inline-flex;margin:0}}.dismiss{position:absolute;top:16px;right:16px;height:fit-content}.dismiss button{margin:0}.visible{display:inline-flex}@container banner (width < 600px){button.visible,a.visible{align-self:center}}.text-content-layout{display:flex;flex:1;flex-direction:column;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@container banner (width >= 600px){.text-content-layout{gap:12px}}\n"] }]
|
|
92
100
|
}], ctorParameters: () => [{ type: i1.TranslationService }], propDecorators: { title: [{
|
|
93
101
|
type: Input
|
|
94
102
|
}], imagePath: [{
|
|
95
103
|
type: Input
|
|
96
104
|
}], bodyText: [{
|
|
97
105
|
type: Input
|
|
106
|
+
}], showButtonInNarrowView: [{
|
|
107
|
+
type: Input
|
|
98
108
|
}], actionButtonText: [{
|
|
99
109
|
type: Input
|
|
100
110
|
}], externalLink: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kirbydesign-extensions-angular-image-banner.mjs","sources":["../../image-banner/src/image-banner-height.directive.ts","../../image-banner/src/image-banner.component.ts","../../image-banner/src/image-banner.component.html","../../image-banner/src/kirbydesign-extensions-angular-image-banner.ts"],"sourcesContent":["import { Directive, ElementRef, inject, OnDestroy, OnInit, Renderer2 } from '@angular/core';\nimport { ResizeObserverService } from '@kirbydesign/designsystem/shared';\n\n/**\n * @Description Temporary directive to ensure correct scroll position behavior on Safari.\n *\n * When navigating between stacked pages, scroll position is not correctly restored on Safari,\n * when the nested kirby-card element uses containment and the host element does not have an explicit height.\n */\n@Directive({\n selector: `[kirbyImageBannerResize]`,\n})\nexport class ImageBannerHeightDirective implements OnInit, OnDestroy {\n private currentHeight: number = 0;\n private host = inject(ElementRef);\n private resizeObserverService = inject(ResizeObserverService);\n private renderer = inject(Renderer2);\n\n ngOnInit() {\n this.resizeObserverService.observe(this.host, (entry) => this.setCardHeightOnHost(entry));\n }\n\n ngOnDestroy() {\n this.resizeObserverService.unobserve(this.host);\n }\n\n private setCardHeightOnHost(entry: ResizeObserverEntry) {\n const hostElement = entry.target as HTMLElement;\n const card = hostElement.querySelector('kirby-card');\n const cardHeight = card?.getBoundingClientRect().height;\n\n if (!hostElement || !cardHeight) return;\n if (cardHeight === this.currentHeight) return;\n\n this.currentHeight = cardHeight;\n this.renderer.setStyle(hostElement, 'min-height', `${cardHeight}px`);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';\nimport { CardModule } from '@kirbydesign/designsystem/card';\nimport { ButtonComponent } from '@kirbydesign/designsystem/button';\nimport { IconModule } from '@kirbydesign/designsystem/icon';\nimport { TranslationService } from '@kirbydesign/designsystem/shared';\nimport { ImageBannerHeightDirective } from './image-banner-height.directive';\n\n@Component({\n selector: 'kirby-x-image-banner',\n imports: [CardModule, ButtonComponent, IconModule, CommonModule],\n hostDirectives: [ImageBannerHeightDirective],\n templateUrl: './image-banner.component.html',\n styleUrl: './image-banner.component.scss',\n})\nexport class ImageBannerComponent {\n /**\n * The title placed inside the image banners header.\n */\n @Input() title: string | undefined;\n\n /**\n * The image shown on the banner, and used for the background blur effect.\n */\n @Input() imagePath: string | undefined;\n\n /**\n * The body text placed below the title.\n */\n @Input() bodyText: string | undefined;\n\n /**\n * The text of the button in the content area of the image banner.\n */\n @Input() actionButtonText: string | undefined;\n\n /**\n * When an external link is supplied the entire banner will be an anchor-tag and navigate when activated.\n */\n @Input() externalLink: string | undefined;\n\n /**\n * The blur-effect used for the background.\n */\n @HostBinding('class')\n @Input()\n backgroundBlur: 'dark' | 'light' | 'none' = 'dark';\n\n /**\n * Emitted every time the banner is activated. The entire banner is interactive, and will be activated by click and keyboard interaction.\n */\n @Output() bannerClick = new EventEmitter<Event>();\n\n /**\n * If subscribed to, a dismiss button will be shown. Emitted every time the dismiss button is activated by click and keyboard interaction.\n */\n @Output() dismissClick = new EventEmitter<Event>();\n\n /**\n * If the input imagePath results in an error, it will be reflected in this output.\n */\n @Output()\n imageError = new EventEmitter<ErrorEvent>();\n\n constructor(public translations: TranslationService) {}\n\n public bannerClicked(event: Event) {\n const eventTarget = event.target as HTMLElement;\n const dismissButtonClicked = eventTarget.closest('.dismiss');\n if (dismissButtonClicked) return;\n this.bannerClick.emit(event);\n }\n\n public dismissClicked(event: Event) {\n this.dismissClick.emit(event);\n }\n\n public onImageError($event: ErrorEvent) {\n this.imageError.emit($event);\n }\n}\n","<kirby-card *ngIf=\"externalLink\" [themeColor]=\"backgroundBlur === 'none' ? 'white' : 'dark'\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n</kirby-card>\n\n<kirby-card\n *ngIf=\"!externalLink\"\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : 'dark'\"\n (click)=\"bannerClicked($event)\"\n>\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n</kirby-card>\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n <a *ngIf=\"externalLink\" class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold header-text\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <div class=\"main-content-body-text\">\n <span class=\"kirby-text-small body-text\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </span>\n </div>\n\n <ng-container *ngIf=\"externalLink\">\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"!actionButtonText\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n {{ actionButtonText }}\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n </ng-container>\n\n <button\n class=\"main-content-body-action-text\"\n kirby-button\n *ngIf=\"actionButtonText && !externalLink\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n {{ actionButtonText }}\n </button>\n </div>\n </div>\n </div>\n\n <div class=\"dismiss\" *ngIf=\"dismissClick.observed\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.ImageBannerHeightDirective"],"mappings":";;;;;;;;;;;;AAGA;;;;;AAKG;MAIU,0BAA0B,CAAA;AAHvC,IAAA,WAAA,GAAA;QAIU,IAAa,CAAA,aAAA,GAAW,CAAC;AACzB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,QAAA,IAAA,CAAA,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACrD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;AAqBrC;IAnBC,QAAQ,GAAA;QACN,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;;IAG3F,WAAW,GAAA;QACT,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;AAGzC,IAAA,mBAAmB,CAAC,KAA0B,EAAA;AACpD,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAqB;QAC/C,MAAM,IAAI,GAAG,WAAW,CAAC,aAAa,CAAC,YAAY,CAAC;QACpD,MAAM,UAAU,GAAG,IAAI,EAAE,qBAAqB,EAAE,CAAC,MA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","sources":["../../image-banner/src/image-banner-height.directive.ts","../../image-banner/src/image-banner.component.ts","../../image-banner/src/image-banner.component.html","../../image-banner/src/kirbydesign-extensions-angular-image-banner.ts"],"sourcesContent":["import { Directive, ElementRef, inject, OnDestroy, OnInit, Renderer2 } from '@angular/core';\nimport { ResizeObserverService } from '@kirbydesign/designsystem/shared';\n\n/**\n * @Description Temporary directive to ensure correct scroll position behavior on Safari.\n *\n * When navigating between stacked pages, scroll position is not correctly restored on Safari,\n * when the nested kirby-card element uses containment and the host element does not have an explicit height.\n */\n@Directive({\n selector: `[kirbyImageBannerResize]`,\n})\nexport class ImageBannerHeightDirective implements OnInit, OnDestroy {\n private currentHeight: number = 0;\n private host = inject(ElementRef);\n private resizeObserverService = inject(ResizeObserverService);\n private renderer = inject(Renderer2);\n\n ngOnInit() {\n this.resizeObserverService.observe(this.host, (entry) => this.setCardHeightOnHost(entry));\n }\n\n ngOnDestroy() {\n this.resizeObserverService.unobserve(this.host);\n }\n\n private setCardHeightOnHost(entry: ResizeObserverEntry) {\n const hostElement = entry.target as HTMLElement;\n const card = hostElement.querySelector('kirby-card');\n const cardHeight = card?.getBoundingClientRect().height;\n\n if (!hostElement || !cardHeight) return;\n if (cardHeight === this.currentHeight) return;\n\n this.currentHeight = cardHeight;\n this.renderer.setStyle(hostElement, 'min-height', `${cardHeight}px`);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';\nimport { CardModule } from '@kirbydesign/designsystem/card';\nimport { ButtonComponent } from '@kirbydesign/designsystem/button';\nimport { IconModule } from '@kirbydesign/designsystem/icon';\nimport { TranslationService } from '@kirbydesign/designsystem/shared';\nimport { ImageBannerHeightDirective } from './image-banner-height.directive';\n\n@Component({\n selector: 'kirby-x-image-banner',\n imports: [CardModule, ButtonComponent, IconModule, CommonModule],\n hostDirectives: [ImageBannerHeightDirective],\n templateUrl: './image-banner.component.html',\n styleUrl: './image-banner.component.scss',\n})\nexport class ImageBannerComponent {\n /**\n * The title placed inside the image banners header.\n */\n @Input() title: string | undefined;\n\n /**\n * The image shown on the banner, and used for the background blur effect.\n */\n @Input() imagePath: string | undefined;\n\n /**\n * The body text placed below the title.\n */\n @Input() bodyText: string | undefined;\n\n /**\n * Whether the button should be shown in narrow view or not.\n */\n @Input() showButtonInNarrowView: boolean = false;\n\n /**\n * The text of the button in the content area of the image banner. If left empty, will default to 'Read more' (or equivalent translation for [supported locales](https://cookbook.kirby.design/#/home/localization)).\n */\n @Input() actionButtonText: string | undefined = this.translations.get('readMore');\n\n /**\n * When an external link is supplied the entire banner will be an anchor-tag and navigate when activated.\n */\n @Input() externalLink: string | undefined;\n\n /**\n * The blur-effect used for the background.\n */\n @HostBinding('class')\n @Input()\n backgroundBlur: 'dark' | 'light' | 'none' = 'dark';\n\n /**\n * Emitted every time the banner is activated. The entire banner is interactive, and will be activated by click and keyboard interaction.\n */\n @Output() bannerClick = new EventEmitter<Event>();\n\n /**\n * If subscribed to, a dismiss button will be shown. Emitted every time the dismiss button is activated by click and keyboard interaction.\n */\n @Output() dismissClick = new EventEmitter<Event>();\n\n /**\n * If the input imagePath results in an error, it will be reflected in this output.\n */\n @Output()\n imageError = new EventEmitter<ErrorEvent>();\n\n constructor(public translations: TranslationService) {}\n\n public bannerClicked(event: Event) {\n const eventTarget = event.target as HTMLElement;\n const dismissButtonClicked = eventTarget.closest('.dismiss');\n if (dismissButtonClicked) return;\n this.bannerClick.emit(event);\n }\n\n public dismissClicked(event: Event) {\n this.dismissClick.emit(event);\n }\n\n public onImageError($event: ErrorEvent) {\n this.imageError.emit($event);\n }\n}\n","@if (externalLink) {\n <kirby-card [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n@if (!externalLink) {\n <kirby-card\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\"\n (click)=\"bannerClicked($event)\"\n >\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n @if (externalLink) {\n <a class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n }\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"text-content-layout\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <p class=\"main-content-body-text kirby-text-small\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </p>\n\n @if (!showButtonInNarrowView && externalLink) {\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n }\n </div>\n </div>\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n @if (externalLink) {\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [class.visible]=\"showButtonInNarrowView\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n }\n\n @if (!externalLink) {\n <button\n [class.visible]=\"showButtonInNarrowView\"\n class=\"main-content-body-action-text\"\n kirby-button\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n </button>\n }\n </div>\n </div>\n\n @if (dismissClick.observed) {\n <div class=\"dismiss\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.ImageBannerHeightDirective"],"mappings":";;;;;;;;;;;;AAGA;;;;;AAKG;MAIU,0BAA0B,CAAA;AAHvC,IAAA,WAAA,GAAA;QAIU,IAAa,CAAA,aAAA,GAAW,CAAC;AACzB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,QAAA,IAAA,CAAA,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACrD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;AAqBrC;IAnBC,QAAQ,GAAA;QACN,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;;IAG3F,WAAW,GAAA;QACT,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;AAGzC,IAAA,mBAAmB,CAAC,KAA0B,EAAA;AACpD,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAqB;QAC/C,MAAM,IAAI,GAAG,WAAW,CAAC,aAAa,CAAC,YAAY,CAAC;QACpD,MAAM,UAAU,GAAG,IAAI,EAAE,qBAAqB,EAAE,CAAC,MAAM;AAEvD,QAAA,IAAI,CAAC,WAAW,IAAI,CAAC,UAAU;YAAE;AACjC,QAAA,IAAI,UAAU,KAAK,IAAI,CAA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|
|
213
213
|
}], ctorParameters: () => [{ type: FormatNumberService }] });
|
|
214
214
|
|
|
215
|
-
function formatAmount(amount, locale,
|
|
216
|
-
const
|
|
217
|
-
let formattedAmount = formatNumber(amount && amount.amount, locale,
|
|
218
|
-
if (
|
|
215
|
+
function formatAmount(amount, locale, config, amountServiceConfiguration) {
|
|
216
|
+
const amountConfig = deriveConfiguration(amountServiceConfiguration);
|
|
217
|
+
let formattedAmount = formatNumber(amount && amount.amount, locale, amountConfig.digitsInfo);
|
|
218
|
+
if (amountConfig.stripSign) {
|
|
219
219
|
formattedAmount = formattedAmount.replace('-', '').trim();
|
|
220
220
|
}
|
|
221
|
-
const currencyCodeToAppend = deriveCurrencyCode(
|
|
221
|
+
const currencyCodeToAppend = deriveCurrencyCode(amountConfig, amount, config);
|
|
222
222
|
if (!currencyCodeToAppend) {
|
|
223
223
|
return formattedAmount;
|
|
224
224
|
}
|
|
225
|
-
if (
|
|
225
|
+
if (amountConfig.currencyCodePosition === 'postfix') {
|
|
226
226
|
return formattedAmount + ' ' + currencyCodeToAppend;
|
|
227
227
|
}
|
|
228
228
|
else {
|
|
229
229
|
return currencyCodeToAppend + ' ' + formattedAmount;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
function deriveCurrencyCode(
|
|
232
|
+
function deriveCurrencyCode(amountConfig, amount, config) {
|
|
233
233
|
let currencyCodeToAppend;
|
|
234
|
-
if (
|
|
235
|
-
if (
|
|
236
|
-
currencyCodeToAppend = amount
|
|
234
|
+
if (amountConfig.showCurrencyCode) {
|
|
235
|
+
if (amountConfig.showCurrencyCode === 'alwaysShowCurrency') {
|
|
236
|
+
currencyCodeToAppend = amount.currencyCode;
|
|
237
237
|
}
|
|
238
|
-
else if (
|
|
238
|
+
else if (amountConfig.showCurrencyCode === 'showForeignCurrency') {
|
|
239
239
|
currencyCodeToAppend =
|
|
240
|
-
amount
|
|
240
|
+
amount.currencyCode !== config.nativeCurrency ? amount.currencyCode : '';
|
|
241
|
+
}
|
|
242
|
+
else if (amountConfig.showCurrencyCode === 'useCurrencyMapping') {
|
|
243
|
+
currencyCodeToAppend = config.currencyMappings?.[amount.currencyCode] || amount.currencyCode;
|
|
241
244
|
}
|
|
242
245
|
}
|
|
243
246
|
return currencyCodeToAppend || '';
|
|
@@ -275,7 +278,7 @@ class AmountService {
|
|
|
275
278
|
currencyCode: '',
|
|
276
279
|
};
|
|
277
280
|
}
|
|
278
|
-
return formatAmount(amount, this.locale, this.config
|
|
281
|
+
return formatAmount(amount, this.locale, this.config, amountServiceConfiguration);
|
|
279
282
|
}
|
|
280
283
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: AmountService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
281
284
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: AmountService, providedIn: 'root' }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kirbydesign-extensions-angular-localization.mjs","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","../../localization/src/kirbydesign-extensions-angular-localization.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\ninterface KirbyExtensionsLocalizationToken {\n /**\n * @example 'DKK | kr. | 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","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';\n\nimport { Amount } from './amount.model';\n\nexport function formatAmount(\n amount: Amount,\n locale: string,\n nativeCurrency: string,\n amountServiceConfiguration?: AmountServiceConfiguration\n) {\n const config = deriveConfiguration(amountServiceConfiguration);\n\n let formattedAmount = formatNumber(amount && amount.amount, locale, config.digitsInfo);\n\n if (config.stripSign) {\n formattedAmount = formattedAmount.replace('-', '').trim();\n }\n\n const currencyCodeToAppend = deriveCurrencyCode(config, amount, nativeCurrency);\n\n if (!currencyCodeToAppend) {\n return formattedAmount;\n }\n if (config.currencyCodePosition === 'postfix') {\n return formattedAmount + ' ' + currencyCodeToAppend;\n } else {\n return currencyCodeToAppend + ' ' + formattedAmount;\n }\n}\n\nexport function deriveCurrencyCode(\n config: AmountServiceConfiguration,\n amount: Amount,\n nativeCurrency: string\n) {\n let currencyCodeToAppend;\n\n if (config.showCurrencyCode) {\n if (config.showCurrencyCode === 'alwaysShowCurrency') {\n currencyCodeToAppend = amount && amount.currencyCode;\n } else if (config.showCurrencyCode === 'showForeignCurrency') {\n currencyCodeToAppend =\n amount && amount.currencyCode !== nativeCurrency ? 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 = '' | 'alwaysShowCurrency' | 'showForeignCurrency';\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 */\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(\n amount,\n this.locale,\n this.config.nativeCurrency,\n amountServiceConfiguration\n );\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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.FormatNumberService","i1.AmountService","i1.PhoneNumberService"],"mappings":";;;;MAAa,WAAW,CAAA;aACN,IAAiB,CAAA,iBAAA,GAAG,YAAY,CAAC;aACjC,IAAkB,CAAA,kBAAA,GAAG,WAAW,CAAC;aACjC,IAAyB,CAAA,yBAAA,GAAG,cAAc,CAAC;aAC3C,IAAiB,CAAA,iBAAA,GAAG,OAAO,CAAC;aAC5B,IAAkB,CAAA,kBAAA,GAAG,UAAU,CAAC;aAChC,IAA6B,CAAA,6BAAA,GAAG,CAAG,EAAA,WAAW,CAAC,iBAAiB,IAAI,WAAW,CAAC,kBAAkB,CAAA,CAAE,CAAC;;;MCJ1G,mCAAmC,GAC9C,IAAI,cAAc,CAAmC,qCAAqC;AAEtF,SAAU,uCAAuC,CACrD,OAA+C,EAAA;IAE/C,OAAO;AACL,QAAA,OAAO,EAAE,mCAAmC;AAC5C,QAAA,UAAU,EAAE,OAAO;KACpB;AACH;;ACRA;;;;AAIG;MACmB,gCAAgC,CAAA;AAAtD,IAAA,WAAA,GAAA;AACU,QAAA,IAAA,CAAA,MAAM,G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,EAAA,UAAA,EAAA,CAAA;kBAJ3B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,aAAa;AACnB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"kirbydesign-extensions-angular-localization.mjs","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","../../localization/src/kirbydesign-extensions-angular-localization.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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.FormatNumberService","i1.AmountService","i1.PhoneNumberService"],"mappings":";;;;MAAa,WAAW,CAAA;aACN,IAAiB,CAAA,iBAAA,GAAG,YAAY,CAAC;aACjC,IAAkB,CAAA,kBAAA,GAAG,WAAW,CAAC;aACjC,IAAyB,CAAA,yBAAA,GAAG,cAAc,CAAC;aAC3C,IAAiB,CAAA,iBAAA,GAAG,OAAO,CAAC;aAC5B,IAAkB,CAAA,kBAAA,GAAG,UAAU,CAAC;aAChC,IAA6B,CAAA,6BAAA,GAAG,CAAG,EAAA,WAAW,CAAC,iBAAiB,IAAI,WAAW,CAAC,kBAAkB,CAAA,CAAE,CAAC;;;MCJ1G,mCAAmC,GAC9C,IAAI,cAAc,CAAmC,qCAAqC;AAEtF,SAAU,uCAAuC,CACrD,OAA+C,EAAA;IAE/C,OAAO;AACL,QAAA,OAAO,EAAE,mCAAmC;AAC5C,QAAA,UAAU,EAAE,OAAO;KACpB;AACH;;ACRA;;;;AAIG;MACmB,gCAAgC,CAAA;AAAtD,IAAA,WAAA,GAAA;AACU,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,mCAAmC,CAAC;AACpD,QAAA,I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Af,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,aAAA,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,aAAa;AACnB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
@@ -17,7 +17,11 @@ export declare class ImageBannerComponent {
|
|
|
17
17
|
*/
|
|
18
18
|
bodyText: string | undefined;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Whether the button should be shown in narrow view or not.
|
|
21
|
+
*/
|
|
22
|
+
showButtonInNarrowView: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The text of the button in the content area of the image banner. If left empty, will default to 'Read more' (or equivalent translation for [supported locales](https://cookbook.kirby.design/#/home/localization)).
|
|
21
25
|
*/
|
|
22
26
|
actionButtonText: string | undefined;
|
|
23
27
|
/**
|
|
@@ -45,5 +49,5 @@ export declare class ImageBannerComponent {
|
|
|
45
49
|
dismissClicked(event: Event): void;
|
|
46
50
|
onImageError($event: ErrorEvent): void;
|
|
47
51
|
static ɵfac: i0.ɵɵFactoryDeclaration<ImageBannerComponent, never>;
|
|
48
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ImageBannerComponent, "kirby-x-image-banner", never, { "title": { "alias": "title"; "required": false; }; "imagePath": { "alias": "imagePath"; "required": false; }; "bodyText": { "alias": "bodyText"; "required": false; }; "actionButtonText": { "alias": "actionButtonText"; "required": false; }; "externalLink": { "alias": "externalLink"; "required": false; }; "backgroundBlur": { "alias": "backgroundBlur"; "required": false; }; }, { "bannerClick": "bannerClick"; "dismissClick": "dismissClick"; "imageError": "imageError"; }, never, ["[title]", "[bodyText]"], true, [{ directive: typeof i1.ImageBannerHeightDirective; inputs: {}; outputs: {}; }]>;
|
|
52
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ImageBannerComponent, "kirby-x-image-banner", never, { "title": { "alias": "title"; "required": false; }; "imagePath": { "alias": "imagePath"; "required": false; }; "bodyText": { "alias": "bodyText"; "required": false; }; "showButtonInNarrowView": { "alias": "showButtonInNarrowView"; "required": false; }; "actionButtonText": { "alias": "actionButtonText"; "required": false; }; "externalLink": { "alias": "externalLink"; "required": false; }; "backgroundBlur": { "alias": "backgroundBlur"; "required": false; }; }, { "bannerClick": "bannerClick"; "dismissClick": "dismissClick"; "imageError": "imageError"; }, never, ["[title]", "[bodyText]"], true, [{ directive: typeof i1.ImageBannerHeightDirective; inputs: {}; outputs: {}; }]>;
|
|
49
53
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { KirbyExtensionsLocalizationToken } from '../di-tokens';
|
|
1
2
|
import { Amount } from './amount.model';
|
|
2
|
-
export declare function formatAmount(amount: Amount, locale: string,
|
|
3
|
-
export declare function deriveCurrencyCode(
|
|
3
|
+
export declare function formatAmount(amount: Amount, locale: string, config: KirbyExtensionsLocalizationToken, amountServiceConfiguration?: AmountServiceConfiguration): string;
|
|
4
|
+
export declare function deriveCurrencyCode(amountConfig: AmountServiceConfiguration, amount: Amount, config: KirbyExtensionsLocalizationToken): string;
|
|
4
5
|
export declare function deriveConfiguration(configuration?: AmountServiceConfiguration): AmountServiceConfiguration;
|
|
5
|
-
export type ShowCurrencyCode = '' | 'alwaysShowCurrency' | 'showForeignCurrency';
|
|
6
|
+
export type ShowCurrencyCode = '' | 'alwaysShowCurrency' | 'showForeignCurrency' | 'useCurrencyMapping';
|
|
6
7
|
export type CurrencyCodePosition = '' | 'prefix' | 'postfix';
|
|
7
8
|
export interface AmountServiceConfiguration {
|
|
8
9
|
/**
|
|
9
10
|
* - '' - don't output CurrencyCode
|
|
10
11
|
* - 'alwaysShowCurrency' - always shows CurrencyCode, regardless of presentation currency
|
|
11
12
|
* - 'showForeignCurrency' - only show CurrencyCode if it differs from the presentation currency
|
|
13
|
+
* - 'useCurrencyMapping' - Shows the currency symbol defined in KirbyExtensionsLocalizationToken.currencyMappings instead of the currency code. Fallback to currencyCode
|
|
12
14
|
*/
|
|
13
15
|
showCurrencyCode?: ShowCurrencyCode;
|
|
14
16
|
/**
|
|
@@ -4,9 +4,11 @@ export declare function provideKirbyExtensionsLocalizationToken(factory: () => K
|
|
|
4
4
|
provide: InjectionToken<KirbyExtensionsLocalizationToken>;
|
|
5
5
|
useFactory: () => KirbyExtensionsLocalizationToken;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type DkkMapping = Record<'DKK', 'kr.'>;
|
|
8
|
+
type CurrencyMappings = DkkMapping & Record<string, string>;
|
|
9
|
+
export interface KirbyExtensionsLocalizationToken {
|
|
8
10
|
/**
|
|
9
|
-
* @example 'DKK |
|
|
11
|
+
* @example 'DKK | EUR'
|
|
10
12
|
*/
|
|
11
13
|
nativeCurrency: string;
|
|
12
14
|
/**
|
|
@@ -24,5 +26,9 @@ interface KirbyExtensionsLocalizationToken {
|
|
|
24
26
|
* @example 'Europe/Copenhagen'
|
|
25
27
|
*/
|
|
26
28
|
timeZone: string;
|
|
29
|
+
/**
|
|
30
|
+
* @example { DKK: 'kr.', EUR: '€' }
|
|
31
|
+
*/
|
|
32
|
+
currencyMappings?: CurrencyMappings;
|
|
27
33
|
}
|
|
28
34
|
export {};
|