mn-angular-lib 0.0.95 → 0.0.96
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 +141 -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,6 +1932,9 @@ 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',
|
|
@@ -1939,6 +1942,140 @@ const mnDatetimeVariants = tv({
|
|
|
1939
1942
|
},
|
|
1940
1943
|
});
|
|
1941
1944
|
|
|
1945
|
+
class MnSectionDirective {
|
|
1946
|
+
/** Section name contributed by this DOM node to the section path */
|
|
1947
|
+
mnSection;
|
|
1948
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnSectionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1949
|
+
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: [
|
|
1950
|
+
{
|
|
1951
|
+
provide: MN_SECTION_PATH,
|
|
1952
|
+
// Read parent MN_SECTION_PATH from ancestor injector (skipSelf to avoid self-reference),
|
|
1953
|
+
// and read the attribute value using Attribute so it's available at provider creation time.
|
|
1954
|
+
deps: [[new Optional(), new SkipSelf(), MN_SECTION_PATH], new Attribute('mn-section')],
|
|
1955
|
+
useFactory: (parentPath, attr) => {
|
|
1956
|
+
const parent = Array.isArray(parentPath) ? parentPath : [];
|
|
1957
|
+
const name = (attr ?? '').trim();
|
|
1958
|
+
return name ? [...parent, name] : [...parent];
|
|
1959
|
+
},
|
|
1960
|
+
},
|
|
1961
|
+
], ngImport: i0 });
|
|
1962
|
+
}
|
|
1963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnSectionDirective, decorators: [{
|
|
1964
|
+
type: Directive,
|
|
1965
|
+
args: [{
|
|
1966
|
+
selector: '[mn-section]',
|
|
1967
|
+
standalone: true,
|
|
1968
|
+
providers: [
|
|
1969
|
+
{
|
|
1970
|
+
provide: MN_SECTION_PATH,
|
|
1971
|
+
// Read parent MN_SECTION_PATH from ancestor injector (skipSelf to avoid self-reference),
|
|
1972
|
+
// and read the attribute value using Attribute so it's available at provider creation time.
|
|
1973
|
+
deps: [[new Optional(), new SkipSelf(), MN_SECTION_PATH], new Attribute('mn-section')],
|
|
1974
|
+
useFactory: (parentPath, attr) => {
|
|
1975
|
+
const parent = Array.isArray(parentPath) ? parentPath : [];
|
|
1976
|
+
const name = (attr ?? '').trim();
|
|
1977
|
+
return name ? [...parent, name] : [...parent];
|
|
1978
|
+
},
|
|
1979
|
+
},
|
|
1980
|
+
],
|
|
1981
|
+
}]
|
|
1982
|
+
}], propDecorators: { mnSection: [{
|
|
1983
|
+
type: Input,
|
|
1984
|
+
args: ['mn-section']
|
|
1985
|
+
}] } });
|
|
1986
|
+
|
|
1987
|
+
class MnInstanceDirective {
|
|
1988
|
+
/** Instance id for targeting per-component instance overrides */
|
|
1989
|
+
mnInstance;
|
|
1990
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnInstanceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1991
|
+
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: [
|
|
1992
|
+
{
|
|
1993
|
+
provide: MN_INSTANCE_ID,
|
|
1994
|
+
// Read the attribute at provider creation time using Attribute token; Inputs may not be set yet.
|
|
1995
|
+
deps: [new Attribute('mn-instance')],
|
|
1996
|
+
useFactory: (attr) => (attr ?? '').trim() || null,
|
|
1997
|
+
},
|
|
1998
|
+
], ngImport: i0 });
|
|
1999
|
+
}
|
|
2000
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnInstanceDirective, decorators: [{
|
|
2001
|
+
type: Directive,
|
|
2002
|
+
args: [{
|
|
2003
|
+
selector: '[mn-instance]',
|
|
2004
|
+
standalone: true,
|
|
2005
|
+
providers: [
|
|
2006
|
+
{
|
|
2007
|
+
provide: MN_INSTANCE_ID,
|
|
2008
|
+
// Read the attribute at provider creation time using Attribute token; Inputs may not be set yet.
|
|
2009
|
+
deps: [new Attribute('mn-instance')],
|
|
2010
|
+
useFactory: (attr) => (attr ?? '').trim() || null,
|
|
2011
|
+
},
|
|
2012
|
+
],
|
|
2013
|
+
}]
|
|
2014
|
+
}], propDecorators: { mnInstance: [{
|
|
2015
|
+
type: Input,
|
|
2016
|
+
args: ['mn-instance']
|
|
2017
|
+
}] } });
|
|
2018
|
+
|
|
2019
|
+
/**
|
|
2020
|
+
* Provides an APP_INITIALIZER that configures the MnLanguageService and
|
|
2021
|
+
* preloads the requested locales during application bootstrap.
|
|
2022
|
+
*
|
|
2023
|
+
* Usage in app.config.ts:
|
|
2024
|
+
* ...provideMnLanguage({
|
|
2025
|
+
* urlPattern: 'assets/i18n/{locale}.json',
|
|
2026
|
+
* defaultLocale: 'en',
|
|
2027
|
+
* preload: ['en', 'nl'],
|
|
2028
|
+
* })
|
|
2029
|
+
*/
|
|
2030
|
+
function provideMnLanguage(config) {
|
|
2031
|
+
return [
|
|
2032
|
+
{
|
|
2033
|
+
provide: APP_INITIALIZER,
|
|
2034
|
+
multi: true,
|
|
2035
|
+
useFactory: (svc) => async () => {
|
|
2036
|
+
if (config.debug) {
|
|
2037
|
+
svc.setDebug(true);
|
|
2038
|
+
}
|
|
2039
|
+
svc.configure(config.urlPattern);
|
|
2040
|
+
const effectiveLocale = svc.resolveLocaleForDomain(config.domainLocaleMap, config.defaultLocale);
|
|
2041
|
+
const localesToLoad = config.preload ?? [effectiveLocale];
|
|
2042
|
+
await Promise.all(localesToLoad.map(l => svc.loadLocale(l)));
|
|
2043
|
+
await svc.setLocale(effectiveLocale);
|
|
2044
|
+
},
|
|
2045
|
+
deps: [MnLanguageService],
|
|
2046
|
+
},
|
|
2047
|
+
];
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
/**
|
|
2051
|
+
* Pipe that translates a key via MnLanguageService.
|
|
2052
|
+
*
|
|
2053
|
+
* Usage in templates:
|
|
2054
|
+
* {{ 'form.email.label' | mnTranslate }}
|
|
2055
|
+
* {{ 'greeting' | mnTranslate:{ name: 'World' } }}
|
|
2056
|
+
*
|
|
2057
|
+
* Note: This pipe is impure so it re-evaluates when the locale changes.
|
|
2058
|
+
*/
|
|
2059
|
+
class MnTranslatePipe {
|
|
2060
|
+
lang;
|
|
2061
|
+
constructor(lang) {
|
|
2062
|
+
this.lang = lang;
|
|
2063
|
+
}
|
|
2064
|
+
transform(key, params) {
|
|
2065
|
+
return this.lang.translate(key, params);
|
|
2066
|
+
}
|
|
2067
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, deps: [{ token: MnLanguageService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2068
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, isStandalone: true, name: "mnTranslate", pure: false });
|
|
2069
|
+
}
|
|
2070
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTranslatePipe, decorators: [{
|
|
2071
|
+
type: Pipe,
|
|
2072
|
+
args: [{
|
|
2073
|
+
name: 'mnTranslate',
|
|
2074
|
+
standalone: true,
|
|
2075
|
+
pure: false,
|
|
2076
|
+
}]
|
|
2077
|
+
}], ctorParameters: () => [{ type: MnLanguageService }] });
|
|
2078
|
+
|
|
1942
2079
|
const MN_DATETIME_CONFIG = new InjectionToken('MN_DATETIME_CONFIG');
|
|
1943
2080
|
class MnDatetime {
|
|
1944
2081
|
ngControl;
|
|
@@ -2080,14 +2217,15 @@ class MnDatetime {
|
|
|
2080
2217
|
borderRadius: this.props.borderRadius,
|
|
2081
2218
|
shadow: this.props.shadow,
|
|
2082
2219
|
fullWidth: this.props.fullWidth,
|
|
2220
|
+
hover: this.props.hover,
|
|
2083
2221
|
});
|
|
2084
2222
|
}
|
|
2085
2223
|
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
|
|
2224
|
+
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
2225
|
}
|
|
2088
2226
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnDatetime, decorators: [{
|
|
2089
2227
|
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
|
|
2228
|
+
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
2229
|
}], ctorParameters: () => [{ type: i1$2.NgControl, decorators: [{
|
|
2092
2230
|
type: Optional
|
|
2093
2231
|
}, {
|
|
@@ -6817,35 +6955,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
6817
6955
|
|
|
6818
6956
|
// Main component
|
|
6819
6957
|
|
|
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
6958
|
/**
|
|
6850
6959
|
* Tab component that renders a horizontal tab bar.
|
|
6851
6960
|
* Supports translation keys for labels via MnTranslatePipe.
|
|
@@ -6888,80 +6997,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
6888
6997
|
type: Output
|
|
6889
6998
|
}] } });
|
|
6890
6999
|
|
|
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
7000
|
/**
|
|
6966
7001
|
* Injection token for the base URL used by all CRUD service requests.
|
|
6967
7002
|
*
|
|
@@ -7320,37 +7355,6 @@ class CrudService {
|
|
|
7320
7355
|
}
|
|
7321
7356
|
}
|
|
7322
7357
|
|
|
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
7358
|
/**
|
|
7355
7359
|
* Enable live preview mode. Listens for postMessage events from
|
|
7356
7360
|
* Mn Web Manager and hot-swaps config/translations at runtime.
|