mn-angular-lib 0.0.95 → 0.0.97
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 +142 -137
- package/fesm2022/mn-angular-lib.mjs.map +1 -1
- package/package.json +1 -1
- package/types/mn-angular-lib.d.ts +11 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, Optional, Inject, HostBinding, Input, Component, inject, ChangeDetectionStrategy, signal, ElementRef, DestroyRef, Self, APP_INITIALIZER, HostListener, ViewChild, forwardRef,
|
|
2
|
+
import { InjectionToken, Injectable, Optional, Inject, HostBinding, Input, Component, inject, ChangeDetectionStrategy, signal, ElementRef, DestroyRef, Self, APP_INITIALIZER, SkipSelf, Attribute, Directive, Pipe, HostListener, ViewChild, forwardRef, Renderer2, EventEmitter, ChangeDetectorRef, TemplateRef, Output, ViewContainerRef, ViewChildren, ApplicationRef, EnvironmentInjector, createComponent } 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';
|
|
@@ -1932,13 +1932,151 @@ const mnDatetimeVariants = tv({
|
|
|
1932
1932
|
fullWidth: {
|
|
1933
1933
|
true: 'w-full',
|
|
1934
1934
|
},
|
|
1935
|
+
hover: {
|
|
1936
|
+
true: 'hover:cursor-pointer hover:bg-base-200',
|
|
1937
|
+
},
|
|
1935
1938
|
},
|
|
1936
1939
|
defaultVariants: {
|
|
1937
1940
|
size: 'md',
|
|
1938
1941
|
borderRadius: 'md',
|
|
1942
|
+
hover: true,
|
|
1939
1943
|
},
|
|
1940
1944
|
});
|
|
1941
1945
|
|
|
1946
|
+
class MnSectionDirective {
|
|
1947
|
+
/** Section name contributed by this DOM node to the section path */
|
|
1948
|
+
mnSection;
|
|
1949
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnSectionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1950
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: MnSectionDirective, isStandalone: true, selector: "[mn-section]", inputs: { mnSection: ["mn-section", "mnSection"] }, providers: [
|
|
1951
|
+
{
|
|
1952
|
+
provide: MN_SECTION_PATH,
|
|
1953
|
+
// Read parent MN_SECTION_PATH from ancestor injector (skipSelf to avoid self-reference),
|
|
1954
|
+
// and read the attribute value using Attribute so it's available at provider creation time.
|
|
1955
|
+
deps: [[new Optional(), new SkipSelf(), MN_SECTION_PATH], new Attribute('mn-section')],
|
|
1956
|
+
useFactory: (parentPath, attr) => {
|
|
1957
|
+
const parent = Array.isArray(parentPath) ? parentPath : [];
|
|
1958
|
+
const name = (attr ?? '').trim();
|
|
1959
|
+
return name ? [...parent, name] : [...parent];
|
|
1960
|
+
},
|
|
1961
|
+
},
|
|
1962
|
+
], ngImport: i0 });
|
|
1963
|
+
}
|
|
1964
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnSectionDirective, decorators: [{
|
|
1965
|
+
type: Directive,
|
|
1966
|
+
args: [{
|
|
1967
|
+
selector: '[mn-section]',
|
|
1968
|
+
standalone: true,
|
|
1969
|
+
providers: [
|
|
1970
|
+
{
|
|
1971
|
+
provide: MN_SECTION_PATH,
|
|
1972
|
+
// Read parent MN_SECTION_PATH from ancestor injector (skipSelf to avoid self-reference),
|
|
1973
|
+
// and read the attribute value using Attribute so it's available at provider creation time.
|
|
1974
|
+
deps: [[new Optional(), new SkipSelf(), MN_SECTION_PATH], new Attribute('mn-section')],
|
|
1975
|
+
useFactory: (parentPath, attr) => {
|
|
1976
|
+
const parent = Array.isArray(parentPath) ? parentPath : [];
|
|
1977
|
+
const name = (attr ?? '').trim();
|
|
1978
|
+
return name ? [...parent, name] : [...parent];
|
|
1979
|
+
},
|
|
1980
|
+
},
|
|
1981
|
+
],
|
|
1982
|
+
}]
|
|
1983
|
+
}], propDecorators: { mnSection: [{
|
|
1984
|
+
type: Input,
|
|
1985
|
+
args: ['mn-section']
|
|
1986
|
+
}] } });
|
|
1987
|
+
|
|
1988
|
+
class MnInstanceDirective {
|
|
1989
|
+
/** Instance id for targeting per-component instance overrides */
|
|
1990
|
+
mnInstance;
|
|
1991
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnInstanceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1992
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: MnInstanceDirective, isStandalone: true, selector: "[mn-instance]", inputs: { mnInstance: ["mn-instance", "mnInstance"] }, providers: [
|
|
1993
|
+
{
|
|
1994
|
+
provide: MN_INSTANCE_ID,
|
|
1995
|
+
// Read the attribute at provider creation time using Attribute token; Inputs may not be set yet.
|
|
1996
|
+
deps: [new Attribute('mn-instance')],
|
|
1997
|
+
useFactory: (attr) => (attr ?? '').trim() || null,
|
|
1998
|
+
},
|
|
1999
|
+
], ngImport: i0 });
|
|
2000
|
+
}
|
|
2001
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnInstanceDirective, decorators: [{
|
|
2002
|
+
type: Directive,
|
|
2003
|
+
args: [{
|
|
2004
|
+
selector: '[mn-instance]',
|
|
2005
|
+
standalone: true,
|
|
2006
|
+
providers: [
|
|
2007
|
+
{
|
|
2008
|
+
provide: MN_INSTANCE_ID,
|
|
2009
|
+
// Read the attribute at provider creation time using Attribute token; Inputs may not be set yet.
|
|
2010
|
+
deps: [new Attribute('mn-instance')],
|
|
2011
|
+
useFactory: (attr) => (attr ?? '').trim() || null,
|
|
2012
|
+
},
|
|
2013
|
+
],
|
|
2014
|
+
}]
|
|
2015
|
+
}], propDecorators: { mnInstance: [{
|
|
2016
|
+
type: Input,
|
|
2017
|
+
args: ['mn-instance']
|
|
2018
|
+
}] } });
|
|
2019
|
+
|
|
2020
|
+
/**
|
|
2021
|
+
* Provides an APP_INITIALIZER that configures the MnLanguageService and
|
|
2022
|
+
* preloads the requested locales during application bootstrap.
|
|
2023
|
+
*
|
|
2024
|
+
* Usage in app.config.ts:
|
|
2025
|
+
* ...provideMnLanguage({
|
|
2026
|
+
* urlPattern: 'assets/i18n/{locale}.json',
|
|
2027
|
+
* defaultLocale: 'en',
|
|
2028
|
+
* preload: ['en', 'nl'],
|
|
2029
|
+
* })
|
|
2030
|
+
*/
|
|
2031
|
+
function provideMnLanguage(config) {
|
|
2032
|
+
return [
|
|
2033
|
+
{
|
|
2034
|
+
provide: APP_INITIALIZER,
|
|
2035
|
+
multi: true,
|
|
2036
|
+
useFactory: (svc) => async () => {
|
|
2037
|
+
if (config.debug) {
|
|
2038
|
+
svc.setDebug(true);
|
|
2039
|
+
}
|
|
2040
|
+
svc.configure(config.urlPattern);
|
|
2041
|
+
const effectiveLocale = svc.resolveLocaleForDomain(config.domainLocaleMap, config.defaultLocale);
|
|
2042
|
+
const localesToLoad = config.preload ?? [effectiveLocale];
|
|
2043
|
+
await Promise.all(localesToLoad.map(l => svc.loadLocale(l)));
|
|
2044
|
+
await svc.setLocale(effectiveLocale);
|
|
2045
|
+
},
|
|
2046
|
+
deps: [MnLanguageService],
|
|
2047
|
+
},
|
|
2048
|
+
];
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
/**
|
|
2052
|
+
* Pipe that translates a key via MnLanguageService.
|
|
2053
|
+
*
|
|
2054
|
+
* Usage in templates:
|
|
2055
|
+
* {{ 'form.email.label' | mnTranslate }}
|
|
2056
|
+
* {{ 'greeting' | mnTranslate:{ name: 'World' } }}
|
|
2057
|
+
*
|
|
2058
|
+
* Note: This pipe is impure so it re-evaluates when the locale changes.
|
|
2059
|
+
*/
|
|
2060
|
+
class MnTranslatePipe {
|
|
2061
|
+
lang;
|
|
2062
|
+
constructor(lang) {
|
|
2063
|
+
this.lang = lang;
|
|
2064
|
+
}
|
|
2065
|
+
transform(key, params) {
|
|
2066
|
+
return this.lang.translate(key, params);
|
|
2067
|
+
}
|
|
2068
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, deps: [{ token: MnLanguageService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2069
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, isStandalone: true, name: "mnTranslate", pure: false });
|
|
2070
|
+
}
|
|
2071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, decorators: [{
|
|
2072
|
+
type: Pipe,
|
|
2073
|
+
args: [{
|
|
2074
|
+
name: 'mnTranslate',
|
|
2075
|
+
standalone: true,
|
|
2076
|
+
pure: false,
|
|
2077
|
+
}]
|
|
2078
|
+
}], ctorParameters: () => [{ type: MnLanguageService }] });
|
|
2079
|
+
|
|
1942
2080
|
const MN_DATETIME_CONFIG = new InjectionToken('MN_DATETIME_CONFIG');
|
|
1943
2081
|
class MnDatetime {
|
|
1944
2082
|
ngControl;
|
|
@@ -2080,14 +2218,15 @@ class MnDatetime {
|
|
|
2080
2218
|
borderRadius: this.props.borderRadius,
|
|
2081
2219
|
shadow: this.props.shadow,
|
|
2082
2220
|
fullWidth: this.props.fullWidth,
|
|
2221
|
+
hover: this.props.hover,
|
|
2083
2222
|
});
|
|
2084
2223
|
}
|
|
2085
2224
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnDatetime, deps: [{ token: i1$2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
2086
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnDatetime, isStandalone: true, selector: "mn-lib-datetime", inputs: { props: "props" }, ngImport: i0, template: "<div class=\"flex flex-col h-full\" [class.is-fullwidth]=\"props.fullWidth\">\n @if (uiConfig.label || props.label) {\n <label class=\"pl-2 pb-1 flex flex-row gap-x-0.5! text-base!\" [attr.for]=\"resolvedId\">\n <p>{{ uiConfig.label || props.label }}</p>\n @if (isRequired()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <input\n [id]=\"resolvedId\"\n [attr.name]=\"resolvedName\"\n [type]=\"resolvedMode\"\n [attr.placeholder]=\"uiConfig.placeholder || props.placeholder || null\"\n [attr.aria-label]=\"uiConfig.ariaLabel || uiConfig.label || props.label || null\"\n [attr.aria-invalid]=\"showError || null\"\n [attr.aria-describedby]=\"showError ? resolvedId + '-error' : null\"\n [disabled]=\"isDisabled\"\n [attr.min]=\"props.min || null\"\n [attr.max]=\"props.max || null\"\n [attr.step]=\"props.step || null\"\n [value]=\"value ?? ''\"\n [ngClass]=\"inputClasses\"\n (input)=\"handleInput(($any($event.target)).value)\"\n (blur)=\"handleBlur()\"\n
|
|
2225
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnDatetime, isStandalone: true, selector: "mn-lib-datetime", inputs: { props: "props" }, ngImport: i0, template: "<div class=\"flex flex-col h-full\" [class.is-fullwidth]=\"props.fullWidth\">\n @if (uiConfig.label || props.label) {\n <label class=\"pl-2 pb-1 flex flex-row gap-x-0.5! text-base!\" [attr.for]=\"resolvedId\">\n <p>{{ uiConfig.label || props.label }}</p>\n @if (isRequired()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <input\n [id]=\"resolvedId\"\n [attr.name]=\"resolvedName\"\n [type]=\"resolvedMode\"\n [attr.placeholder]=\"uiConfig.placeholder || props.placeholder || null\"\n [attr.aria-label]=\"uiConfig.ariaLabel || uiConfig.label || props.label || null\"\n [attr.aria-invalid]=\"showError || null\"\n [attr.aria-describedby]=\"showError ? resolvedId + '-error' : null\"\n [disabled]=\"isDisabled\"\n [attr.min]=\"props.min || null\"\n [attr.max]=\"props.max || null\"\n [attr.step]=\"props.step || null\"\n [value]=\"value ?? ''\"\n [ngClass]=\"inputClasses\"\n (input)=\"handleInput(($any($event.target)).value)\"\n (blur)=\"handleBlur()\"\n />\n\n @if (showError) {\n @if (props.showAllErrors) {\n <div class=\"flex flex-col gap-y-1\">\n @for (error of errorMessages; track $index) {\n <lib-mn-error-message [errorMessage]=\"error\" [id]=\"resolvedId + '-' + $index\"></lib-mn-error-message>\n }\n </div>\n } @else {\n @if (errorMessage != null) {\n <lib-mn-error-message [errorMessage]=\"errorMessage\" [id]=\"resolvedId\"></lib-mn-error-message>\n }\n }\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MnErrorMessage, selector: "lib-mn-error-message", inputs: ["errorMessage", "id"] }] });
|
|
2087
2226
|
}
|
|
2088
2227
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnDatetime, decorators: [{
|
|
2089
2228
|
type: Component,
|
|
2090
|
-
args: [{ selector: 'mn-lib-datetime', standalone: true, imports: [NgClass, MnErrorMessage], template: "<div class=\"flex flex-col h-full\" [class.is-fullwidth]=\"props.fullWidth\">\n @if (uiConfig.label || props.label) {\n <label class=\"pl-2 pb-1 flex flex-row gap-x-0.5! text-base!\" [attr.for]=\"resolvedId\">\n <p>{{ uiConfig.label || props.label }}</p>\n @if (isRequired()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <input\n [id]=\"resolvedId\"\n [attr.name]=\"resolvedName\"\n [type]=\"resolvedMode\"\n [attr.placeholder]=\"uiConfig.placeholder || props.placeholder || null\"\n [attr.aria-label]=\"uiConfig.ariaLabel || uiConfig.label || props.label || null\"\n [attr.aria-invalid]=\"showError || null\"\n [attr.aria-describedby]=\"showError ? resolvedId + '-error' : null\"\n [disabled]=\"isDisabled\"\n [attr.min]=\"props.min || null\"\n [attr.max]=\"props.max || null\"\n [attr.step]=\"props.step || null\"\n [value]=\"value ?? ''\"\n [ngClass]=\"inputClasses\"\n (input)=\"handleInput(($any($event.target)).value)\"\n (blur)=\"handleBlur()\"\n
|
|
2229
|
+
args: [{ selector: 'mn-lib-datetime', standalone: true, imports: [NgClass, MnErrorMessage], template: "<div class=\"flex flex-col h-full\" [class.is-fullwidth]=\"props.fullWidth\">\n @if (uiConfig.label || props.label) {\n <label class=\"pl-2 pb-1 flex flex-row gap-x-0.5! text-base!\" [attr.for]=\"resolvedId\">\n <p>{{ uiConfig.label || props.label }}</p>\n @if (isRequired()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <input\n [id]=\"resolvedId\"\n [attr.name]=\"resolvedName\"\n [type]=\"resolvedMode\"\n [attr.placeholder]=\"uiConfig.placeholder || props.placeholder || null\"\n [attr.aria-label]=\"uiConfig.ariaLabel || uiConfig.label || props.label || null\"\n [attr.aria-invalid]=\"showError || null\"\n [attr.aria-describedby]=\"showError ? resolvedId + '-error' : null\"\n [disabled]=\"isDisabled\"\n [attr.min]=\"props.min || null\"\n [attr.max]=\"props.max || null\"\n [attr.step]=\"props.step || null\"\n [value]=\"value ?? ''\"\n [ngClass]=\"inputClasses\"\n (input)=\"handleInput(($any($event.target)).value)\"\n (blur)=\"handleBlur()\"\n />\n\n @if (showError) {\n @if (props.showAllErrors) {\n <div class=\"flex flex-col gap-y-1\">\n @for (error of errorMessages; track $index) {\n <lib-mn-error-message [errorMessage]=\"error\" [id]=\"resolvedId + '-' + $index\"></lib-mn-error-message>\n }\n </div>\n } @else {\n @if (errorMessage != null) {\n <lib-mn-error-message [errorMessage]=\"errorMessage\" [id]=\"resolvedId\"></lib-mn-error-message>\n }\n }\n }\n</div>\n" }]
|
|
2091
2230
|
}], ctorParameters: () => [{ type: i1$2.NgControl, decorators: [{
|
|
2092
2231
|
type: Optional
|
|
2093
2232
|
}, {
|
|
@@ -6817,35 +6956,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
6817
6956
|
|
|
6818
6957
|
// Main component
|
|
6819
6958
|
|
|
6820
|
-
/**
|
|
6821
|
-
* Pipe that translates a key via MnLanguageService.
|
|
6822
|
-
*
|
|
6823
|
-
* Usage in templates:
|
|
6824
|
-
* {{ 'form.email.label' | mnTranslate }}
|
|
6825
|
-
* {{ 'greeting' | mnTranslate:{ name: 'World' } }}
|
|
6826
|
-
*
|
|
6827
|
-
* Note: This pipe is impure so it re-evaluates when the locale changes.
|
|
6828
|
-
*/
|
|
6829
|
-
class MnTranslatePipe {
|
|
6830
|
-
lang;
|
|
6831
|
-
constructor(lang) {
|
|
6832
|
-
this.lang = lang;
|
|
6833
|
-
}
|
|
6834
|
-
transform(key, params) {
|
|
6835
|
-
return this.lang.translate(key, params);
|
|
6836
|
-
}
|
|
6837
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, deps: [{ token: MnLanguageService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6838
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, isStandalone: true, name: "mnTranslate", pure: false });
|
|
6839
|
-
}
|
|
6840
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, decorators: [{
|
|
6841
|
-
type: Pipe,
|
|
6842
|
-
args: [{
|
|
6843
|
-
name: 'mnTranslate',
|
|
6844
|
-
standalone: true,
|
|
6845
|
-
pure: false,
|
|
6846
|
-
}]
|
|
6847
|
-
}], ctorParameters: () => [{ type: MnLanguageService }] });
|
|
6848
|
-
|
|
6849
6959
|
/**
|
|
6850
6960
|
* Tab component that renders a horizontal tab bar.
|
|
6851
6961
|
* Supports translation keys for labels via MnTranslatePipe.
|
|
@@ -6888,80 +6998,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
6888
6998
|
type: Output
|
|
6889
6999
|
}] } });
|
|
6890
7000
|
|
|
6891
|
-
class MnSectionDirective {
|
|
6892
|
-
/** Section name contributed by this DOM node to the section path */
|
|
6893
|
-
mnSection;
|
|
6894
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnSectionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6895
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: MnSectionDirective, isStandalone: true, selector: "[mn-section]", inputs: { mnSection: ["mn-section", "mnSection"] }, providers: [
|
|
6896
|
-
{
|
|
6897
|
-
provide: MN_SECTION_PATH,
|
|
6898
|
-
// Read parent MN_SECTION_PATH from ancestor injector (skipSelf to avoid self-reference),
|
|
6899
|
-
// and read the attribute value using Attribute so it's available at provider creation time.
|
|
6900
|
-
deps: [[new Optional(), new SkipSelf(), MN_SECTION_PATH], new Attribute('mn-section')],
|
|
6901
|
-
useFactory: (parentPath, attr) => {
|
|
6902
|
-
const parent = Array.isArray(parentPath) ? parentPath : [];
|
|
6903
|
-
const name = (attr ?? '').trim();
|
|
6904
|
-
return name ? [...parent, name] : [...parent];
|
|
6905
|
-
},
|
|
6906
|
-
},
|
|
6907
|
-
], ngImport: i0 });
|
|
6908
|
-
}
|
|
6909
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnSectionDirective, decorators: [{
|
|
6910
|
-
type: Directive,
|
|
6911
|
-
args: [{
|
|
6912
|
-
selector: '[mn-section]',
|
|
6913
|
-
standalone: true,
|
|
6914
|
-
providers: [
|
|
6915
|
-
{
|
|
6916
|
-
provide: MN_SECTION_PATH,
|
|
6917
|
-
// Read parent MN_SECTION_PATH from ancestor injector (skipSelf to avoid self-reference),
|
|
6918
|
-
// and read the attribute value using Attribute so it's available at provider creation time.
|
|
6919
|
-
deps: [[new Optional(), new SkipSelf(), MN_SECTION_PATH], new Attribute('mn-section')],
|
|
6920
|
-
useFactory: (parentPath, attr) => {
|
|
6921
|
-
const parent = Array.isArray(parentPath) ? parentPath : [];
|
|
6922
|
-
const name = (attr ?? '').trim();
|
|
6923
|
-
return name ? [...parent, name] : [...parent];
|
|
6924
|
-
},
|
|
6925
|
-
},
|
|
6926
|
-
],
|
|
6927
|
-
}]
|
|
6928
|
-
}], propDecorators: { mnSection: [{
|
|
6929
|
-
type: Input,
|
|
6930
|
-
args: ['mn-section']
|
|
6931
|
-
}] } });
|
|
6932
|
-
|
|
6933
|
-
class MnInstanceDirective {
|
|
6934
|
-
/** Instance id for targeting per-component instance overrides */
|
|
6935
|
-
mnInstance;
|
|
6936
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnInstanceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6937
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: MnInstanceDirective, isStandalone: true, selector: "[mn-instance]", inputs: { mnInstance: ["mn-instance", "mnInstance"] }, providers: [
|
|
6938
|
-
{
|
|
6939
|
-
provide: MN_INSTANCE_ID,
|
|
6940
|
-
// Read the attribute at provider creation time using Attribute token; Inputs may not be set yet.
|
|
6941
|
-
deps: [new Attribute('mn-instance')],
|
|
6942
|
-
useFactory: (attr) => (attr ?? '').trim() || null,
|
|
6943
|
-
},
|
|
6944
|
-
], ngImport: i0 });
|
|
6945
|
-
}
|
|
6946
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnInstanceDirective, decorators: [{
|
|
6947
|
-
type: Directive,
|
|
6948
|
-
args: [{
|
|
6949
|
-
selector: '[mn-instance]',
|
|
6950
|
-
standalone: true,
|
|
6951
|
-
providers: [
|
|
6952
|
-
{
|
|
6953
|
-
provide: MN_INSTANCE_ID,
|
|
6954
|
-
// Read the attribute at provider creation time using Attribute token; Inputs may not be set yet.
|
|
6955
|
-
deps: [new Attribute('mn-instance')],
|
|
6956
|
-
useFactory: (attr) => (attr ?? '').trim() || null,
|
|
6957
|
-
},
|
|
6958
|
-
],
|
|
6959
|
-
}]
|
|
6960
|
-
}], propDecorators: { mnInstance: [{
|
|
6961
|
-
type: Input,
|
|
6962
|
-
args: ['mn-instance']
|
|
6963
|
-
}] } });
|
|
6964
|
-
|
|
6965
7001
|
/**
|
|
6966
7002
|
* Injection token for the base URL used by all CRUD service requests.
|
|
6967
7003
|
*
|
|
@@ -7320,37 +7356,6 @@ class CrudService {
|
|
|
7320
7356
|
}
|
|
7321
7357
|
}
|
|
7322
7358
|
|
|
7323
|
-
/**
|
|
7324
|
-
* Provides an APP_INITIALIZER that configures the MnLanguageService and
|
|
7325
|
-
* preloads the requested locales during application bootstrap.
|
|
7326
|
-
*
|
|
7327
|
-
* Usage in app.config.ts:
|
|
7328
|
-
* ...provideMnLanguage({
|
|
7329
|
-
* urlPattern: 'assets/i18n/{locale}.json',
|
|
7330
|
-
* defaultLocale: 'en',
|
|
7331
|
-
* preload: ['en', 'nl'],
|
|
7332
|
-
* })
|
|
7333
|
-
*/
|
|
7334
|
-
function provideMnLanguage(config) {
|
|
7335
|
-
return [
|
|
7336
|
-
{
|
|
7337
|
-
provide: APP_INITIALIZER,
|
|
7338
|
-
multi: true,
|
|
7339
|
-
useFactory: (svc) => async () => {
|
|
7340
|
-
if (config.debug) {
|
|
7341
|
-
svc.setDebug(true);
|
|
7342
|
-
}
|
|
7343
|
-
svc.configure(config.urlPattern);
|
|
7344
|
-
const effectiveLocale = svc.resolveLocaleForDomain(config.domainLocaleMap, config.defaultLocale);
|
|
7345
|
-
const localesToLoad = config.preload ?? [effectiveLocale];
|
|
7346
|
-
await Promise.all(localesToLoad.map(l => svc.loadLocale(l)));
|
|
7347
|
-
await svc.setLocale(effectiveLocale);
|
|
7348
|
-
},
|
|
7349
|
-
deps: [MnLanguageService],
|
|
7350
|
-
},
|
|
7351
|
-
];
|
|
7352
|
-
}
|
|
7353
|
-
|
|
7354
7359
|
/**
|
|
7355
7360
|
* Enable live preview mode. Listens for postMessage events from
|
|
7356
7361
|
* Mn Web Manager and hot-swaps config/translations at runtime.
|