mn-angular-lib 0.0.69 → 0.0.70
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/mn-angular-lib.mjs +130 -49
- package/fesm2022/mn-angular-lib.mjs.map +1 -1
- package/package.json +1 -1
- package/types/mn-angular-lib.d.ts +69 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, Optional, Inject, inject, Input, ChangeDetectionStrategy, Component, HostBinding, signal, ElementRef, DestroyRef, Self, APP_INITIALIZER, HostListener, forwardRef, Directive, EventEmitter, ChangeDetectorRef, TemplateRef, Output, ViewContainerRef, ViewChild, ViewChildren, ApplicationRef, EnvironmentInjector, createComponent, SkipSelf, Attribute
|
|
2
|
+
import { InjectionToken, Injectable, Optional, Inject, inject, Input, ChangeDetectionStrategy, Component, HostBinding, signal, ElementRef, DestroyRef, Self, APP_INITIALIZER, HostListener, forwardRef, Directive, EventEmitter, ChangeDetectorRef, TemplateRef, Output, ViewContainerRef, ViewChild, ViewChildren, ApplicationRef, EnvironmentInjector, createComponent, Pipe, SkipSelf, Attribute } from '@angular/core';
|
|
3
3
|
export { TemplateRef, Type } from '@angular/core';
|
|
4
4
|
import { BehaviorSubject, firstValueFrom, skip, Subject, debounceTime, of, takeUntil, map, catchError } from 'rxjs';
|
|
5
5
|
import * as i1 from '@angular/common';
|
|
@@ -3705,17 +3705,32 @@ class MnFormBodyComponent {
|
|
|
3705
3705
|
}
|
|
3706
3706
|
/** Store table data sources keyed by field key for template access */
|
|
3707
3707
|
tableDataSources = {};
|
|
3708
|
-
|
|
3708
|
+
languageService = inject(MnLanguageService);
|
|
3709
|
+
static DEFAULT_LABELS = {
|
|
3710
|
+
submit: 'Submit',
|
|
3711
|
+
cancel: 'Cancel',
|
|
3712
|
+
submitting: 'Submitting...',
|
|
3713
|
+
selectPlaceholder: 'Select...',
|
|
3714
|
+
loading: 'Loading...',
|
|
3715
|
+
fileUploadPrompt: 'Click or drag files here',
|
|
3716
|
+
};
|
|
3717
|
+
resolveLabel(i18nValue, key) {
|
|
3718
|
+
if (i18nValue)
|
|
3719
|
+
return i18nValue;
|
|
3720
|
+
const translated = this.languageService.translate(`common.${key}`);
|
|
3721
|
+
return translated === `common.${key}` ? MnFormBodyComponent.DEFAULT_LABELS[key] : translated;
|
|
3722
|
+
}
|
|
3723
|
+
/** Resolved i18n labels with defaults, falling back to translated keys */
|
|
3709
3724
|
get labels() {
|
|
3710
3725
|
const i = this.config;
|
|
3711
3726
|
const i18n = i.i18n || {};
|
|
3712
3727
|
return {
|
|
3713
|
-
submit: i18n.submit
|
|
3714
|
-
cancel: i18n.cancel
|
|
3715
|
-
submitting: i18n.submitting
|
|
3716
|
-
selectPlaceholder: i18n.selectPlaceholder
|
|
3717
|
-
loading: i18n.loading
|
|
3718
|
-
fileUploadPrompt: i18n.fileUploadPrompt
|
|
3728
|
+
submit: this.resolveLabel(i18n.submit, 'submit'),
|
|
3729
|
+
cancel: this.resolveLabel(i18n.cancel, 'cancel'),
|
|
3730
|
+
submitting: this.resolveLabel(i18n.submitting, 'submitting'),
|
|
3731
|
+
selectPlaceholder: this.resolveLabel(i18n.selectPlaceholder, 'selectPlaceholder'),
|
|
3732
|
+
loading: this.resolveLabel(i18n.loading, 'loading'),
|
|
3733
|
+
fileUploadPrompt: this.resolveLabel(i18n.fileUploadPrompt, 'fileUploadPrompt'),
|
|
3719
3734
|
};
|
|
3720
3735
|
}
|
|
3721
3736
|
ngOnInit() {
|
|
@@ -4266,15 +4281,29 @@ class MnWizardBodyComponent {
|
|
|
4266
4281
|
isCurrentStepValid = true;
|
|
4267
4282
|
isCompleting = false;
|
|
4268
4283
|
wizardErrors = {};
|
|
4269
|
-
|
|
4284
|
+
languageService = inject(MnLanguageService);
|
|
4285
|
+
static DEFAULT_LABELS = {
|
|
4286
|
+
next: 'Next',
|
|
4287
|
+
back: 'Back',
|
|
4288
|
+
close: 'Close',
|
|
4289
|
+
complete: 'Complete',
|
|
4290
|
+
completing: 'Completing...',
|
|
4291
|
+
};
|
|
4292
|
+
resolveLabel(i18nValue, key) {
|
|
4293
|
+
if (i18nValue)
|
|
4294
|
+
return i18nValue;
|
|
4295
|
+
const translated = this.languageService.translate(`common.${key}`);
|
|
4296
|
+
return translated === `common.${key}` ? MnWizardBodyComponent.DEFAULT_LABELS[key] : translated;
|
|
4297
|
+
}
|
|
4298
|
+
/** Resolved i18n labels with defaults, falling back to translated keys */
|
|
4270
4299
|
get labels() {
|
|
4271
4300
|
const i18n = this.config.i18n || {};
|
|
4272
4301
|
return {
|
|
4273
|
-
next: i18n.next
|
|
4274
|
-
back: i18n.back
|
|
4275
|
-
close: i18n.close
|
|
4276
|
-
complete: i18n.complete
|
|
4277
|
-
completing: i18n.completing
|
|
4302
|
+
next: this.resolveLabel(i18n.next, 'next'),
|
|
4303
|
+
back: this.resolveLabel(i18n.back, 'back'),
|
|
4304
|
+
close: this.resolveLabel(i18n.close, 'close'),
|
|
4305
|
+
complete: this.resolveLabel(i18n.complete, 'complete'),
|
|
4306
|
+
completing: this.resolveLabel(i18n.completing, 'completing'),
|
|
4278
4307
|
};
|
|
4279
4308
|
}
|
|
4280
4309
|
/** Pre-built form configs keyed by step id — only for steps that have fields */
|
|
@@ -4565,6 +4594,7 @@ class MnConfirmationBodyComponent {
|
|
|
4565
4594
|
formBody;
|
|
4566
4595
|
confirmButtonStatus = 'VALID';
|
|
4567
4596
|
hasFormFields = false;
|
|
4597
|
+
languageService = inject(MnLanguageService);
|
|
4568
4598
|
constructor(cdr) {
|
|
4569
4599
|
this.cdr = cdr;
|
|
4570
4600
|
}
|
|
@@ -4593,11 +4623,17 @@ class MnConfirmationBodyComponent {
|
|
|
4593
4623
|
const reason = this.config.cancel?.reason || ModalCloseReason.CANCELLED;
|
|
4594
4624
|
this.modalRef.dismiss(reason);
|
|
4595
4625
|
}
|
|
4626
|
+
resolveLabel(value, key, fallback) {
|
|
4627
|
+
if (value)
|
|
4628
|
+
return value;
|
|
4629
|
+
const translated = this.languageService.translate(`common.${key}`);
|
|
4630
|
+
return translated === `common.${key}` ? fallback : translated;
|
|
4631
|
+
}
|
|
4596
4632
|
get confirmLabel() {
|
|
4597
|
-
return this.config.confirm?.label
|
|
4633
|
+
return this.resolveLabel(this.config.confirm?.label, 'confirm', 'Confirm');
|
|
4598
4634
|
}
|
|
4599
4635
|
get cancelLabel() {
|
|
4600
|
-
return this.config.cancel?.label
|
|
4636
|
+
return this.resolveLabel(this.config.cancel?.label, 'cancel', 'Cancel');
|
|
4601
4637
|
}
|
|
4602
4638
|
get confirmStyle() {
|
|
4603
4639
|
return this.config.confirm?.style || ActionStyle.PRIMARY;
|
|
@@ -4667,6 +4703,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
4667
4703
|
|
|
4668
4704
|
class MnModalShellComponent {
|
|
4669
4705
|
el;
|
|
4706
|
+
cdr;
|
|
4670
4707
|
config;
|
|
4671
4708
|
modalRef;
|
|
4672
4709
|
isClosing = false;
|
|
@@ -4676,8 +4713,9 @@ class MnModalShellComponent {
|
|
|
4676
4713
|
focusTrapListener = null;
|
|
4677
4714
|
pollingTimer = null;
|
|
4678
4715
|
pollAttempts = 0;
|
|
4679
|
-
constructor(el) {
|
|
4716
|
+
constructor(el, cdr) {
|
|
4680
4717
|
this.el = el;
|
|
4718
|
+
this.cdr = cdr;
|
|
4681
4719
|
}
|
|
4682
4720
|
ngOnInit() {
|
|
4683
4721
|
this.startPollingIfConfigured();
|
|
@@ -4756,6 +4794,7 @@ class MnModalShellComponent {
|
|
|
4756
4794
|
}
|
|
4757
4795
|
startClosing() {
|
|
4758
4796
|
this.isClosing = true;
|
|
4797
|
+
this.cdr.detectChanges();
|
|
4759
4798
|
return new Promise(resolve => setTimeout(resolve, 150));
|
|
4760
4799
|
}
|
|
4761
4800
|
onEscapeKey(event) {
|
|
@@ -4894,7 +4933,7 @@ class MnModalShellComponent {
|
|
|
4894
4933
|
this.pollingTimer = null;
|
|
4895
4934
|
}
|
|
4896
4935
|
}
|
|
4897
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnModalShellComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4936
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnModalShellComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4898
4937
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnModalShellComponent, isStandalone: true, selector: "mn-modal-shell", inputs: { config: "config", modalRef: "modalRef" }, host: { listeners: { "document:keydown.escape": "onEscapeKey($event)" }, properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "@if (showBackdrop) {\n <div class=\"modal-backdrop absolute inset-0 bg-black/50 animate-[fadeIn_0.2s_ease-in-out]\" (click)=\"onBackdropClick()\"></div>\n}\n\n<div\n class=\"modal-container relative bg-base-100 rounded-lg shadow-xl max-h-[90vh] overflow-hidden flex flex-col\"\n [ngClass]=\"[containerSizeClass, animationClass]\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"config.title ? 'mn-modal-title' : null\"\n [attr.aria-describedby]=\"config.description ? 'mn-modal-description' : null\"\n tabindex=\"-1\"\n (click)=\"$event.stopPropagation()\"\n>\n <div class=\"flex items-center justify-between p-6 border-b border-base-300\">\n <div class=\"flex flex-col gap-0.5\">\n @if (config.title) {\n <h2 class=\"m-0 text-xl font-semibold text-base-content\" id=\"mn-modal-title\">{{ config.title }}</h2>\n }\n @if (config.subtitle) {\n <p class=\"m-0 text-sm text-base-content/60 font-normal\">{{ config.subtitle }}</p>\n }\n </div>\n @if (showCloseButton) {\n <button\n class=\"bg-transparent border-none text-2xl cursor-pointer text-base-content/50 p-0 w-8 h-8 flex items-center justify-center rounded transition-colors hover:bg-base-200 hover:text-base-content\"\n (click)=\"onCloseButtonClick()\"\n aria-label=\"Close modal\"\n >\n \u00D7\n </button>\n }\n </div>\n @if (config.description) {\n <p class=\"m-0 px-6 text-sm text-base-content/60 leading-relaxed\" id=\"mn-modal-description\">{{ config.description }}</p>\n }\n\n <div class=\"flex-1 overflow-y-auto p-6\">\n @if (config.kind === ModalKind.WIZARD) {\n <mn-wizard-body\n [config]=\"asWizard(config)\"\n [modalRef]=\"asAny(modalRef)\"\n ></mn-wizard-body>\n }\n\n @if (config.kind === ModalKind.FORM) {\n <mn-form-body\n [config]=\"asForm(config)\"\n [modalRef]=\"asAny(modalRef)\"\n ></mn-form-body>\n }\n\n @if (config.kind === ModalKind.CONFIRMATION) {\n <mn-confirmation-body\n [config]=\"asConfirmation(config)\"\n [modalRef]=\"asAny(modalRef)\"\n ></mn-confirmation-body>\n }\n\n @if (config.kind === ModalKind.CUSTOM) {\n <mn-custom-body-host\n [config]=\"asCustom(config)\"\n [modalRef]=\"asAny(modalRef)\"\n ></mn-custom-body-host>\n }\n </div>\n\n <!-- Custom Footer Actions -->\n @if (hasCustomFooterActions) {\n <div class=\"flex gap-3 p-6 border-t border-base-300\">\n @for (action of leftFooterActions; track action.label) {\n <button\n mnButton\n [data]=\"{\n variant: getActionButtonVariant(action.style),\n color: getActionButtonColor(action.style),\n disabled: action.disabled\n }\"\n [disabled]=\"action.disabled\"\n (click)=\"onFooterAction(action)\"\n >\n {{ action.label }}\n </button>\n }\n\n <div class=\"flex-1\"></div>\n\n @for (action of rightFooterActions; track action.label) {\n <button\n mnButton\n [data]=\"{\n variant: getActionButtonVariant(action.style),\n color: getActionButtonColor(action.style),\n disabled: action.disabled\n }\"\n [disabled]=\"action.disabled\"\n (click)=\"onFooterAction(action)\"\n >\n {{ action.label }}\n </button>\n }\n </div>\n }\n</div>\n", styles: [":host{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;transition:transform .3s ease-in-out,filter .3s ease-in-out,opacity .3s ease-in-out}:host(.is-stacked){transform:scale(.96) translateY(-1rem);filter:brightness(.9) blur(1px);pointer-events:none;opacity:.8}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes slideIn{0%{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}@keyframes zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes slideOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(1rem)}}@keyframes zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}:host(.closing) .modal-backdrop{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-slide .modal-container{animation:slideOut .15s ease-in-out forwards}:host(.closing).anim-fade .modal-container{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-zoom .modal-container{animation:zoomOut .15s ease-in-out forwards}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MnWizardBodyComponent, selector: "mn-wizard-body", inputs: ["config", "modalRef"] }, { kind: "component", type: MnFormBodyComponent, selector: "mn-form-body", inputs: ["config", "modalRef", "hideFooter", "hideCustomBody"], outputs: ["formStatusChange"] }, { kind: "component", type: MnConfirmationBodyComponent, selector: "mn-confirmation-body", inputs: ["config", "modalRef"] }, { kind: "component", type: MnCustomBodyHostComponent, selector: "mn-custom-body-host", inputs: ["config", "modalRef"] }, { kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }] });
|
|
4899
4938
|
}
|
|
4900
4939
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnModalShellComponent, decorators: [{
|
|
@@ -4907,7 +4946,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
4907
4946
|
MnCustomBodyHostComponent,
|
|
4908
4947
|
MnButton,
|
|
4909
4948
|
], template: "@if (showBackdrop) {\n <div class=\"modal-backdrop absolute inset-0 bg-black/50 animate-[fadeIn_0.2s_ease-in-out]\" (click)=\"onBackdropClick()\"></div>\n}\n\n<div\n class=\"modal-container relative bg-base-100 rounded-lg shadow-xl max-h-[90vh] overflow-hidden flex flex-col\"\n [ngClass]=\"[containerSizeClass, animationClass]\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"config.title ? 'mn-modal-title' : null\"\n [attr.aria-describedby]=\"config.description ? 'mn-modal-description' : null\"\n tabindex=\"-1\"\n (click)=\"$event.stopPropagation()\"\n>\n <div class=\"flex items-center justify-between p-6 border-b border-base-300\">\n <div class=\"flex flex-col gap-0.5\">\n @if (config.title) {\n <h2 class=\"m-0 text-xl font-semibold text-base-content\" id=\"mn-modal-title\">{{ config.title }}</h2>\n }\n @if (config.subtitle) {\n <p class=\"m-0 text-sm text-base-content/60 font-normal\">{{ config.subtitle }}</p>\n }\n </div>\n @if (showCloseButton) {\n <button\n class=\"bg-transparent border-none text-2xl cursor-pointer text-base-content/50 p-0 w-8 h-8 flex items-center justify-center rounded transition-colors hover:bg-base-200 hover:text-base-content\"\n (click)=\"onCloseButtonClick()\"\n aria-label=\"Close modal\"\n >\n \u00D7\n </button>\n }\n </div>\n @if (config.description) {\n <p class=\"m-0 px-6 text-sm text-base-content/60 leading-relaxed\" id=\"mn-modal-description\">{{ config.description }}</p>\n }\n\n <div class=\"flex-1 overflow-y-auto p-6\">\n @if (config.kind === ModalKind.WIZARD) {\n <mn-wizard-body\n [config]=\"asWizard(config)\"\n [modalRef]=\"asAny(modalRef)\"\n ></mn-wizard-body>\n }\n\n @if (config.kind === ModalKind.FORM) {\n <mn-form-body\n [config]=\"asForm(config)\"\n [modalRef]=\"asAny(modalRef)\"\n ></mn-form-body>\n }\n\n @if (config.kind === ModalKind.CONFIRMATION) {\n <mn-confirmation-body\n [config]=\"asConfirmation(config)\"\n [modalRef]=\"asAny(modalRef)\"\n ></mn-confirmation-body>\n }\n\n @if (config.kind === ModalKind.CUSTOM) {\n <mn-custom-body-host\n [config]=\"asCustom(config)\"\n [modalRef]=\"asAny(modalRef)\"\n ></mn-custom-body-host>\n }\n </div>\n\n <!-- Custom Footer Actions -->\n @if (hasCustomFooterActions) {\n <div class=\"flex gap-3 p-6 border-t border-base-300\">\n @for (action of leftFooterActions; track action.label) {\n <button\n mnButton\n [data]=\"{\n variant: getActionButtonVariant(action.style),\n color: getActionButtonColor(action.style),\n disabled: action.disabled\n }\"\n [disabled]=\"action.disabled\"\n (click)=\"onFooterAction(action)\"\n >\n {{ action.label }}\n </button>\n }\n\n <div class=\"flex-1\"></div>\n\n @for (action of rightFooterActions; track action.label) {\n <button\n mnButton\n [data]=\"{\n variant: getActionButtonVariant(action.style),\n color: getActionButtonColor(action.style),\n disabled: action.disabled\n }\"\n [disabled]=\"action.disabled\"\n (click)=\"onFooterAction(action)\"\n >\n {{ action.label }}\n </button>\n }\n </div>\n }\n</div>\n", styles: [":host{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;transition:transform .3s ease-in-out,filter .3s ease-in-out,opacity .3s ease-in-out}:host(.is-stacked){transform:scale(.96) translateY(-1rem);filter:brightness(.9) blur(1px);pointer-events:none;opacity:.8}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes slideIn{0%{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}@keyframes zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes slideOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(1rem)}}@keyframes zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}:host(.closing) .modal-backdrop{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-slide .modal-container{animation:slideOut .15s ease-in-out forwards}:host(.closing).anim-fade .modal-container{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-zoom .modal-container{animation:zoomOut .15s ease-in-out forwards}\n"] }]
|
|
4910
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { config: [{
|
|
4949
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { config: [{
|
|
4911
4950
|
type: Input
|
|
4912
4951
|
}], modalRef: [{
|
|
4913
4952
|
type: Input
|
|
@@ -6239,6 +6278,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
6239
6278
|
|
|
6240
6279
|
// Main component
|
|
6241
6280
|
|
|
6281
|
+
/**
|
|
6282
|
+
* Pipe that translates a key via MnLanguageService.
|
|
6283
|
+
*
|
|
6284
|
+
* Usage in templates:
|
|
6285
|
+
* {{ 'form.email.label' | mnTranslate }}
|
|
6286
|
+
* {{ 'greeting' | mnTranslate:{ name: 'World' } }}
|
|
6287
|
+
*
|
|
6288
|
+
* Note: This pipe is impure so it re-evaluates when the locale changes.
|
|
6289
|
+
*/
|
|
6290
|
+
class MnTranslatePipe {
|
|
6291
|
+
lang;
|
|
6292
|
+
constructor(lang) {
|
|
6293
|
+
this.lang = lang;
|
|
6294
|
+
}
|
|
6295
|
+
transform(key, params) {
|
|
6296
|
+
return this.lang.translate(key, params);
|
|
6297
|
+
}
|
|
6298
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, deps: [{ token: MnLanguageService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6299
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, isStandalone: true, name: "mnTranslate", pure: false });
|
|
6300
|
+
}
|
|
6301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, decorators: [{
|
|
6302
|
+
type: Pipe,
|
|
6303
|
+
args: [{
|
|
6304
|
+
name: 'mnTranslate',
|
|
6305
|
+
standalone: true,
|
|
6306
|
+
pure: false,
|
|
6307
|
+
}]
|
|
6308
|
+
}], ctorParameters: () => [{ type: MnLanguageService }] });
|
|
6309
|
+
|
|
6310
|
+
/**
|
|
6311
|
+
* Tab component that renders a horizontal tab bar.
|
|
6312
|
+
* Supports translation keys for labels via MnTranslatePipe.
|
|
6313
|
+
*/
|
|
6314
|
+
class MnTabComponent {
|
|
6315
|
+
/** Data source containing tab items and default active index. */
|
|
6316
|
+
dataSource;
|
|
6317
|
+
/** Emits the newly activated tab item whenever the active tab changes. */
|
|
6318
|
+
activeChange = new EventEmitter();
|
|
6319
|
+
/** The currently active tab item. */
|
|
6320
|
+
currentActive;
|
|
6321
|
+
/** Initializes the default active tab based on the data source configuration. */
|
|
6322
|
+
ngOnInit() {
|
|
6323
|
+
if (this.dataSource &&
|
|
6324
|
+
this.dataSource.items.length > this.dataSource.defaultActive) {
|
|
6325
|
+
this.currentActive = this.dataSource.items[this.dataSource.defaultActive];
|
|
6326
|
+
}
|
|
6327
|
+
}
|
|
6328
|
+
/**
|
|
6329
|
+
* Sets the given tab item as active, invoking deactivate/activate callbacks.
|
|
6330
|
+
* @param item - The tab item to activate.
|
|
6331
|
+
*/
|
|
6332
|
+
setActive(item) {
|
|
6333
|
+
if (this.currentActive && this.currentActive !== item) {
|
|
6334
|
+
this.currentActive.onDeactivate?.();
|
|
6335
|
+
item.onClick?.();
|
|
6336
|
+
this.currentActive = item;
|
|
6337
|
+
this.activeChange.emit(item);
|
|
6338
|
+
}
|
|
6339
|
+
}
|
|
6340
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6341
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnTabComponent, isStandalone: true, selector: "mn-tab", inputs: { dataSource: "dataSource" }, outputs: { activeChange: "activeChange" }, ngImport: i0, template: "<div class=\"w-full mb-10 flex justify-center\">\n <div class=\"inline-flex rounded-lg p-2 bg-base-100 shadow-md\">\n <div role=\"tablist\" class=\"tabs flex\">\n @for (item of dataSource.items; track item.label) {\n <div\n role=\"tab\"\n class=\"tab px-4 min-w-36 py-2 border-b-2 cursor-pointer select-none transition-colors\"\n [class.text-brand-500]=\"currentActive === item\"\n [class.font-bold]=\"currentActive === item\"\n [class.border-brand-500]=\"currentActive === item\"\n [class.border-base-300]=\"currentActive !== item\"\n [class.text-base-content]=\"currentActive !== item\"\n [attr.aria-selected]=\"currentActive === item\"\n (click)=\"setActive(item)\"\n >\n {{ item.label | mnTranslate }}\n </div>\n }\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
|
|
6342
|
+
}
|
|
6343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTabComponent, decorators: [{
|
|
6344
|
+
type: Component,
|
|
6345
|
+
args: [{ selector: 'mn-tab', standalone: true, imports: [MnTranslatePipe], template: "<div class=\"w-full mb-10 flex justify-center\">\n <div class=\"inline-flex rounded-lg p-2 bg-base-100 shadow-md\">\n <div role=\"tablist\" class=\"tabs flex\">\n @for (item of dataSource.items; track item.label) {\n <div\n role=\"tab\"\n class=\"tab px-4 min-w-36 py-2 border-b-2 cursor-pointer select-none transition-colors\"\n [class.text-brand-500]=\"currentActive === item\"\n [class.font-bold]=\"currentActive === item\"\n [class.border-brand-500]=\"currentActive === item\"\n [class.border-base-300]=\"currentActive !== item\"\n [class.text-base-content]=\"currentActive !== item\"\n [attr.aria-selected]=\"currentActive === item\"\n (click)=\"setActive(item)\"\n >\n {{ item.label | mnTranslate }}\n </div>\n }\n </div>\n </div>\n</div>\n" }]
|
|
6346
|
+
}], propDecorators: { dataSource: [{
|
|
6347
|
+
type: Input
|
|
6348
|
+
}], activeChange: [{
|
|
6349
|
+
type: Output
|
|
6350
|
+
}] } });
|
|
6351
|
+
|
|
6242
6352
|
class MnSectionDirective {
|
|
6243
6353
|
/** Section name contributed by this DOM node to the section path */
|
|
6244
6354
|
mnSection;
|
|
@@ -6702,35 +6812,6 @@ function provideMnLanguage(config) {
|
|
|
6702
6812
|
];
|
|
6703
6813
|
}
|
|
6704
6814
|
|
|
6705
|
-
/**
|
|
6706
|
-
* Pipe that translates a key via MnLanguageService.
|
|
6707
|
-
*
|
|
6708
|
-
* Usage in templates:
|
|
6709
|
-
* {{ 'form.email.label' | mnTranslate }}
|
|
6710
|
-
* {{ 'greeting' | mnTranslate:{ name: 'World' } }}
|
|
6711
|
-
*
|
|
6712
|
-
* Note: This pipe is impure so it re-evaluates when the locale changes.
|
|
6713
|
-
*/
|
|
6714
|
-
class MnTranslatePipe {
|
|
6715
|
-
lang;
|
|
6716
|
-
constructor(lang) {
|
|
6717
|
-
this.lang = lang;
|
|
6718
|
-
}
|
|
6719
|
-
transform(key, params) {
|
|
6720
|
-
return this.lang.translate(key, params);
|
|
6721
|
-
}
|
|
6722
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, deps: [{ token: MnLanguageService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6723
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, isStandalone: true, name: "mnTranslate", pure: false });
|
|
6724
|
-
}
|
|
6725
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, decorators: [{
|
|
6726
|
-
type: Pipe,
|
|
6727
|
-
args: [{
|
|
6728
|
-
name: 'mnTranslate',
|
|
6729
|
-
standalone: true,
|
|
6730
|
-
pure: false,
|
|
6731
|
-
}]
|
|
6732
|
-
}], ctorParameters: () => [{ type: MnLanguageService }] });
|
|
6733
|
-
|
|
6734
6815
|
/**
|
|
6735
6816
|
* Enable live preview mode. Listens for postMessage events from
|
|
6736
6817
|
* Mn Web Manager and hot-swaps config/translations at runtime.
|
|
@@ -6775,5 +6856,5 @@ function enableMnPreviewMode(configService, langService, allowedOrigins) {
|
|
|
6775
6856
|
* Generated bundle index. Do not edit.
|
|
6776
6857
|
*/
|
|
6777
6858
|
|
|
6778
|
-
export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_TEST_COMPONENT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnButton, MnCheckbox, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFormBodyComponent, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnTable, MnTestComponent, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, Test, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnButtonVariants, mnCheckboxVariants, mnDatetimeVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
|
|
6859
|
+
export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_TEST_COMPONENT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnButton, MnCheckbox, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFormBodyComponent, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnTabComponent, MnTable, MnTestComponent, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, Test, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnButtonVariants, mnCheckboxVariants, mnDatetimeVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
|
|
6779
6860
|
//# sourceMappingURL=mn-angular-lib.mjs.map
|