@mediusinc/mng-commons 6.0.0-rc.6 → 6.0.0-rc.7
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/README.md +6 -6
- package/core/data-list/data-list-params-helpers.d.ts +1 -0
- package/core/directives/component.directive.d.ts +11 -13
- package/core/directives/rerender.directive.d.ts +1 -1
- package/core/directives/template.directive.d.ts +3 -7
- package/core/i18n/i18n-common.d.ts +2 -2
- package/fesm2022/mediusinc-mng-commons-core.mjs +87 -108
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form.mjs +10 -11
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
- package/fesm2022/{mediusinc-mng-commons-table-column-toggle.component-DTSBP9WQ.mjs → mediusinc-mng-commons-table-column-toggle.component-a8KG1NIX.mjs} +5 -6
- package/fesm2022/mediusinc-mng-commons-table-column-toggle.component-a8KG1NIX.mjs.map +1 -0
- package/fesm2022/{mediusinc-mng-commons-table-mediusinc-mng-commons-table-JZpyiDIL.mjs → mediusinc-mng-commons-table-mediusinc-mng-commons-table-C2vrMoNL.mjs} +33 -21
- package/fesm2022/mediusinc-mng-commons-table-mediusinc-mng-commons-table-C2vrMoNL.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-table.mjs +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +39 -36
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/package.json +11 -11
- package/table/provide.d.ts +7 -0
- package/tableview/api/action/descriptors/action.descriptor.d.ts +3 -3
- package/tableview/api/action/models/action-confirmation.model.d.ts +4 -2
- package/version-info.json +3 -3
- package/fesm2022/mediusinc-mng-commons-table-column-toggle.component-DTSBP9WQ.mjs.map +0 -1
- package/fesm2022/mediusinc-mng-commons-table-mediusinc-mng-commons-table-JZpyiDIL.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ export function i18nHttpLoaderFactory(http: HttpBackend ) {
|
|
|
50
50
|
- Konfiguracija v `main.ts` (v primeru uporabe modulov: `AppModule`):
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
|
-
|
|
53
|
+
provideTranslateService({
|
|
54
54
|
loader: {
|
|
55
55
|
provide: TranslateLoader,
|
|
56
56
|
useFactory: i18nHttpLoaderFactory,
|
|
@@ -59,12 +59,12 @@ TranslateModule.forRoot({
|
|
|
59
59
|
})
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
- Definicijo jezikov podamo preko konfiguracije `
|
|
62
|
+
- Definicijo jezikov podamo preko konfiguracije `provideCommons()`:
|
|
63
63
|
```ts
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
provideCommons({
|
|
65
|
+
app: {
|
|
66
|
+
locales: ['en', 'sl']
|
|
67
|
+
}
|
|
68
68
|
})
|
|
69
69
|
```
|
|
70
70
|
|
|
@@ -21,6 +21,7 @@ export declare function fromTableLoadToDataListParams(event: TableLazyLoadEvent)
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function dataListParamsToUrlQuery(params: DataListParams<any, any>, defaults?: DataListParams<any, any> | null, opts?: {
|
|
23
23
|
prependFilterName?: string;
|
|
24
|
+
skipPresetDefaultsLimit?: boolean;
|
|
24
25
|
}): Params;
|
|
25
26
|
/**
|
|
26
27
|
* Merges the provided parameters with default values and returns the merged object.
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { ComponentRef, InjectionToken, Injector,
|
|
1
|
+
import { ComponentRef, InjectionToken, Injector, Type } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class ComponentDirective<C>
|
|
3
|
+
export declare class ComponentDirective<C> {
|
|
4
4
|
private readonly injector;
|
|
5
5
|
private readonly elementRef;
|
|
6
6
|
private readonly applicationRef;
|
|
7
7
|
private readonly viewContainerRef;
|
|
8
|
-
component
|
|
9
|
-
componentIt
|
|
10
|
-
inputs
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
componentRef: ComponentRef<C>;
|
|
17
|
-
ngOnInit(): void;
|
|
8
|
+
readonly component: import("@angular/core").InputSignal<Type<C> | undefined>;
|
|
9
|
+
readonly componentIt: import("@angular/core").InputSignal<InjectionToken<Type<C>> | undefined>;
|
|
10
|
+
readonly inputs: import("@angular/core").InputSignal<Record<string, any> | undefined>;
|
|
11
|
+
readonly attachToHost: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
12
|
+
readonly parentInjector: import("@angular/core").InputSignal<Injector | undefined>;
|
|
13
|
+
readonly instanceCreated: import("@angular/core").OutputEmitterRef<C>;
|
|
14
|
+
componentRef?: ComponentRef<C>;
|
|
15
|
+
constructor();
|
|
18
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComponentDirective<any>, never>;
|
|
19
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ComponentDirective<any>, "[mngComponent]", never, { "component": { "alias": "mngComponent"; "required": false; }; "componentIt": { "alias": "injectionToken"; "required": false; }; "inputs": { "alias": "inputs"; "required": false; }; "attachToHost": { "alias": "attachToHost"; "required": false; }; "parentInjector": { "alias": "parentInjector"; "required": false; }; }, { "
|
|
17
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComponentDirective<any>, "[mngComponent]", never, { "component": { "alias": "mngComponent"; "required": false; "isSignal": true; }; "componentIt": { "alias": "injectionToken"; "required": false; "isSignal": true; }; "inputs": { "alias": "inputs"; "required": false; "isSignal": true; }; "attachToHost": { "alias": "attachToHost"; "required": false; "isSignal": true; }; "parentInjector": { "alias": "parentInjector"; "required": false; "isSignal": true; }; }, { "instanceCreated": "instanceCreated"; }, never, never, true, never>;
|
|
20
18
|
}
|
|
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
export declare class RerenderDirective {
|
|
3
3
|
private readonly templateRef;
|
|
4
4
|
private readonly viewContainerRef;
|
|
5
|
-
mngRerender: import("@angular/core").InputSignal<unknown>;
|
|
5
|
+
readonly mngRerender: import("@angular/core").InputSignal<unknown>;
|
|
6
6
|
constructor();
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<RerenderDirective, never>;
|
|
8
8
|
static ɵdir: i0.ɵɵDirectiveDeclaration<RerenderDirective, "[mngRerender]", never, { "mngRerender": { "alias": "mngRerender"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { TemplateRef
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class TemplateDirective {
|
|
4
4
|
readonly template: TemplateRef<any>;
|
|
5
|
-
|
|
6
|
-
type: string;
|
|
7
|
-
name: string;
|
|
8
|
-
getType(): string;
|
|
9
|
-
getViewContainerRef(): ViewContainerRef;
|
|
5
|
+
readonly name: import("@angular/core").InputSignal<string>;
|
|
10
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<TemplateDirective, never>;
|
|
11
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<TemplateDirective, "[mngTemplate]", never, { "
|
|
7
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TemplateDirective, "[mngTemplate]", never, { "name": { "alias": "mngTemplate"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
12
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
1
|
+
import { TranslateService, TranslationObject } from '@ngx-translate/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
export declare function getI18nAsync(translate: TranslateService, params?: any, ...keys: Array<string>): Observable<string | null>;
|
|
4
4
|
export declare function getI18n(translate: TranslateService, params?: any, ...keys: Array<string>): string | null;
|
|
5
5
|
export declare function populateI18nParams(item?: any, params?: any): any;
|
|
6
|
-
export declare function selectI18n(keys: string[], i18n:
|
|
6
|
+
export declare function selectI18n(keys: string[], i18n: TranslationObject): string | null;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { computed, signal, Component, ChangeDetectionStrategy, inject, Injector, ElementRef, ApplicationRef, ViewContainerRef,
|
|
3
|
-
import
|
|
4
|
-
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
2
|
+
import { computed, signal, Component, ChangeDetectionStrategy, effect, untracked, inject, Injector, ElementRef, ApplicationRef, ViewContainerRef, input, booleanAttribute, output, EnvironmentInjector, createComponent, Directive, TemplateRef, numberAttribute, Pipe, InjectionToken, DestroyRef, Injectable, provideAppInitializer, ErrorHandler } from '@angular/core';
|
|
3
|
+
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
|
5
4
|
import { ConfirmDialog } from 'primeng/confirmdialog';
|
|
6
5
|
import { Dialog } from 'primeng/dialog';
|
|
7
6
|
import { Toast } from 'primeng/toast';
|
|
@@ -49,11 +48,11 @@ class NotificationWrapperComponent {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NotificationWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
52
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.7", type: NotificationWrapperComponent, isStandalone: true, selector: "mng-notification-wrapper", ngImport: i0, template: "<ng-content></ng-content>\n<p-confirmDialog appendTo=\"body\" [baseZIndex]=\"50\"></p-confirmDialog>\n\n<p-toast [baseZIndex]=\"50\">\n <ng-template #message let-message>\n <span [class]=\"'p-toast-message-icon pi ' + getMessageIcon(message)\"></span>\n <div class=\"p-toast-message-text\">\n <div class=\"p-toast-summary\">{{ message.summary }}</div>\n @if (message.detail) {\n <div class=\"p-toast-detail\">{{ message.detail.slice(0, notificationCutoff) + (message.detail.length > notificationCutoff ? '...' : '') }}</div>\n @if (message.detail.length > notificationCutoff) {\n <div (click)=\"onShowNotificationInDialog(message)\" class=\"font-semibold text-sm mt-2 flex items-center\">\n <i class=\"pi pi-chevron-down mr-1\"></i>{{ 'notification.details' | translate }}\n </div>\n }\n }\n </div>\n </ng-template>\n</p-toast>\n\n<p-dialog\n [visible]=\"isDialogNotificationVisible()\"\n (visibleChange)=\"onDialogNotificationVisibilityChange($event)\"\n [styleClass]=\"'mng-dialog mng-dialog-xs mng-message-detail-dialog mng-message-detail-dialog-' + (dialogNotification()?.severity ?? '')\"\n appendTo=\"body\"\n draggable=\"false\"\n modal=\"true\">\n <ng-template #header>\n <span class=\"p-dialog-title font-bold mng-dialog-success\">\n <span [class]=\"'mr-2 pi ' + dialogNotificationIconClass()\"></span>\n {{ dialogNotification()?.summary ?? '' }}\n </span>\n </ng-template>\n <div class=\"mng-notification-details\">\n {{ dialogNotification()?.detail ?? '' }}\n </div>\n</p-dialog>\n", styles: [".mng-notification-details{white-space:pre-wrap;word-wrap:break-word}\n"], dependencies: [{ kind: "component", type: ConfirmDialog, selector: "p-confirmDialog, p-confirmdialog, p-confirm-dialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "closeAriaLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }, { kind: "
|
|
51
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.7", type: NotificationWrapperComponent, isStandalone: true, selector: "mng-notification-wrapper", ngImport: i0, template: "<ng-content></ng-content>\n<p-confirmDialog appendTo=\"body\" [baseZIndex]=\"50\"></p-confirmDialog>\n\n<p-toast [baseZIndex]=\"50\">\n <ng-template #message let-message>\n <span [class]=\"'p-toast-message-icon pi ' + getMessageIcon(message)\"></span>\n <div class=\"p-toast-message-text\">\n <div class=\"p-toast-summary\">{{ message.summary }}</div>\n @if (message.detail) {\n <div class=\"p-toast-detail\">{{ message.detail.slice(0, notificationCutoff) + (message.detail.length > notificationCutoff ? '...' : '') }}</div>\n @if (message.detail.length > notificationCutoff) {\n <div (click)=\"onShowNotificationInDialog(message)\" class=\"font-semibold text-sm mt-2 flex items-center\">\n <i class=\"pi pi-chevron-down mr-1\"></i>{{ 'notification.details' | translate }}\n </div>\n }\n }\n </div>\n </ng-template>\n</p-toast>\n\n<p-dialog\n [visible]=\"isDialogNotificationVisible()\"\n (visibleChange)=\"onDialogNotificationVisibilityChange($event)\"\n [styleClass]=\"'mng-dialog mng-dialog-xs mng-message-detail-dialog mng-message-detail-dialog-' + (dialogNotification()?.severity ?? '')\"\n appendTo=\"body\"\n draggable=\"false\"\n modal=\"true\">\n <ng-template #header>\n <span class=\"p-dialog-title font-bold mng-dialog-success\">\n <span [class]=\"'mr-2 pi ' + dialogNotificationIconClass()\"></span>\n {{ dialogNotification()?.summary ?? '' }}\n </span>\n </ng-template>\n <div class=\"mng-notification-details\">\n {{ dialogNotification()?.detail ?? '' }}\n </div>\n</p-dialog>\n", styles: [".mng-notification-details{white-space:pre-wrap;word-wrap:break-word}\n"], dependencies: [{ kind: "component", type: ConfirmDialog, selector: "p-confirmDialog, p-confirmdialog, p-confirm-dialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "closeAriaLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "component", type: Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "component", type: Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
53
52
|
}
|
|
54
53
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NotificationWrapperComponent, decorators: [{
|
|
55
54
|
type: Component,
|
|
56
|
-
args: [{ selector: 'mng-notification-wrapper', imports: [ConfirmDialog,
|
|
55
|
+
args: [{ selector: 'mng-notification-wrapper', imports: [ConfirmDialog, TranslatePipe, Dialog, Toast], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>\n<p-confirmDialog appendTo=\"body\" [baseZIndex]=\"50\"></p-confirmDialog>\n\n<p-toast [baseZIndex]=\"50\">\n <ng-template #message let-message>\n <span [class]=\"'p-toast-message-icon pi ' + getMessageIcon(message)\"></span>\n <div class=\"p-toast-message-text\">\n <div class=\"p-toast-summary\">{{ message.summary }}</div>\n @if (message.detail) {\n <div class=\"p-toast-detail\">{{ message.detail.slice(0, notificationCutoff) + (message.detail.length > notificationCutoff ? '...' : '') }}</div>\n @if (message.detail.length > notificationCutoff) {\n <div (click)=\"onShowNotificationInDialog(message)\" class=\"font-semibold text-sm mt-2 flex items-center\">\n <i class=\"pi pi-chevron-down mr-1\"></i>{{ 'notification.details' | translate }}\n </div>\n }\n }\n </div>\n </ng-template>\n</p-toast>\n\n<p-dialog\n [visible]=\"isDialogNotificationVisible()\"\n (visibleChange)=\"onDialogNotificationVisibilityChange($event)\"\n [styleClass]=\"'mng-dialog mng-dialog-xs mng-message-detail-dialog mng-message-detail-dialog-' + (dialogNotification()?.severity ?? '')\"\n appendTo=\"body\"\n draggable=\"false\"\n modal=\"true\">\n <ng-template #header>\n <span class=\"p-dialog-title font-bold mng-dialog-success\">\n <span [class]=\"'mr-2 pi ' + dialogNotificationIconClass()\"></span>\n {{ dialogNotification()?.summary ?? '' }}\n </span>\n </ng-template>\n <div class=\"mng-notification-details\">\n {{ dialogNotification()?.detail ?? '' }}\n </div>\n</p-dialog>\n", styles: [".mng-notification-details{white-space:pre-wrap;word-wrap:break-word}\n"] }]
|
|
57
56
|
}] });
|
|
58
57
|
|
|
59
58
|
class ACommonsErrorBase extends Error {
|
|
@@ -379,6 +378,9 @@ function dataListParamsToUrlQuery(params, defaults = {
|
|
|
379
378
|
if (params.limit && params.limit !== defaults?.limit) {
|
|
380
379
|
urlParams['limit'] = params.limit;
|
|
381
380
|
}
|
|
381
|
+
else if (!opts?.skipPresetDefaultsLimit) {
|
|
382
|
+
urlParams['limit'] = defaults?.limit;
|
|
383
|
+
}
|
|
382
384
|
if (params.offset && params.offset !== defaults?.offset) {
|
|
383
385
|
urlParams['offset'] = params.offset;
|
|
384
386
|
}
|
|
@@ -791,85 +793,99 @@ class DataProviderInst {
|
|
|
791
793
|
}
|
|
792
794
|
}
|
|
793
795
|
|
|
796
|
+
/**
|
|
797
|
+
* Effect function with explicit declaration of dependencies. Dependencies will be tracked, whereas the main execution will not be.
|
|
798
|
+
*
|
|
799
|
+
* @param deps Array of dependencies to be tracked.
|
|
800
|
+
* @param fn Function where dependencies will no longer be tracked.
|
|
801
|
+
* @param opts Additional options:
|
|
802
|
+
* - firstOnly Executes effect only once, then destroy it.
|
|
803
|
+
*/
|
|
804
|
+
function effectWithDeps(deps, fn, opts) {
|
|
805
|
+
let execCnt = 0;
|
|
806
|
+
const ref = effect(() => {
|
|
807
|
+
if (opts?.firstOnly) {
|
|
808
|
+
if (execCnt > 0) {
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
ref.destroy();
|
|
812
|
+
}
|
|
813
|
+
const depsValues = deps.map(s => s());
|
|
814
|
+
execCnt++;
|
|
815
|
+
untracked(() => {
|
|
816
|
+
fn(depsValues);
|
|
817
|
+
});
|
|
818
|
+
});
|
|
819
|
+
return ref;
|
|
820
|
+
}
|
|
821
|
+
|
|
794
822
|
class ComponentDirective {
|
|
795
823
|
constructor() {
|
|
796
824
|
this.injector = inject(Injector);
|
|
797
825
|
this.elementRef = inject(ElementRef);
|
|
798
826
|
this.applicationRef = inject(ApplicationRef);
|
|
799
827
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
800
|
-
this.
|
|
801
|
-
this.
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
component
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
this.
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
else {
|
|
824
|
-
this.viewContainerRef.clear();
|
|
825
|
-
this.componentRef = this.viewContainerRef.createComponent(component, {
|
|
826
|
-
environmentInjector: environmentInjector,
|
|
827
|
-
injector: elementInjector
|
|
828
|
-
});
|
|
829
|
-
}
|
|
830
|
-
if (this.inputs) {
|
|
831
|
-
for (const input in this.inputs) {
|
|
832
|
-
this.componentRef.setInput(input, this.inputs[input]);
|
|
828
|
+
this.component = input(undefined, { alias: 'mngComponent' });
|
|
829
|
+
this.componentIt = input(undefined, { alias: 'injectionToken' });
|
|
830
|
+
this.inputs = input();
|
|
831
|
+
this.attachToHost = input(false, { transform: booleanAttribute });
|
|
832
|
+
this.parentInjector = input();
|
|
833
|
+
this.instanceCreated = output();
|
|
834
|
+
effectWithDeps([this.component, this.componentIt], ([componentInput, componentItInput]) => {
|
|
835
|
+
let component = componentInput;
|
|
836
|
+
const componentIt = componentItInput;
|
|
837
|
+
if (!component && componentIt) {
|
|
838
|
+
component = this.injector.get(componentIt, null, { optional: true }) ?? undefined;
|
|
839
|
+
}
|
|
840
|
+
if (!component) {
|
|
841
|
+
throw new CommonsInternalError(`Component cannot be created, no component (${component}) or no or invalid injection token provided (${componentIt}).`);
|
|
842
|
+
}
|
|
843
|
+
const elementInjector = this.parentInjector() ?? this.injector;
|
|
844
|
+
const environmentInjector = elementInjector.get(EnvironmentInjector, null, { optional: true }) ?? this.applicationRef.injector;
|
|
845
|
+
if (this.attachToHost()) {
|
|
846
|
+
this.componentRef = createComponent(component, {
|
|
847
|
+
hostElement: this.elementRef.nativeElement,
|
|
848
|
+
environmentInjector: environmentInjector,
|
|
849
|
+
elementInjector: elementInjector
|
|
850
|
+
});
|
|
833
851
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
852
|
+
else {
|
|
853
|
+
this.viewContainerRef.clear();
|
|
854
|
+
this.componentRef = this.viewContainerRef.createComponent(component, {
|
|
855
|
+
environmentInjector: environmentInjector,
|
|
856
|
+
injector: elementInjector
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
const inputs = this.inputs();
|
|
860
|
+
if (inputs) {
|
|
861
|
+
for (const input in inputs) {
|
|
862
|
+
this.componentRef.setInput(input, inputs[input]);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
if (this.attachToHost()) {
|
|
866
|
+
this.applicationRef.attachView(this.componentRef.hostView);
|
|
867
|
+
}
|
|
868
|
+
if (this.componentRef) {
|
|
869
|
+
this.instanceCreated.emit(this.componentRef.instance);
|
|
870
|
+
}
|
|
871
|
+
});
|
|
839
872
|
}
|
|
840
873
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ComponentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
841
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
874
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: ComponentDirective, isStandalone: true, selector: "[mngComponent]", inputs: { component: { classPropertyName: "component", publicName: "mngComponent", isSignal: true, isRequired: false, transformFunction: null }, componentIt: { classPropertyName: "componentIt", publicName: "injectionToken", isSignal: true, isRequired: false, transformFunction: null }, inputs: { classPropertyName: "inputs", publicName: "inputs", isSignal: true, isRequired: false, transformFunction: null }, attachToHost: { classPropertyName: "attachToHost", publicName: "attachToHost", isSignal: true, isRequired: false, transformFunction: null }, parentInjector: { classPropertyName: "parentInjector", publicName: "parentInjector", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { instanceCreated: "instanceCreated" }, ngImport: i0 }); }
|
|
842
875
|
}
|
|
843
876
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ComponentDirective, decorators: [{
|
|
844
877
|
type: Directive,
|
|
845
878
|
args: [{
|
|
846
879
|
selector: '[mngComponent]'
|
|
847
880
|
}]
|
|
848
|
-
}],
|
|
849
|
-
type: Input,
|
|
850
|
-
args: [{ alias: 'mngComponent' }]
|
|
851
|
-
}], componentIt: [{
|
|
852
|
-
type: Input,
|
|
853
|
-
args: [{ alias: 'injectionToken' }]
|
|
854
|
-
}], inputs: [{
|
|
855
|
-
type: Input
|
|
856
|
-
}], attachToHost: [{
|
|
857
|
-
type: Input
|
|
858
|
-
}], parentInjector: [{
|
|
859
|
-
type: Input
|
|
860
|
-
}], componentInstanceEventEmitter: [{
|
|
861
|
-
type: Output,
|
|
862
|
-
args: ['instanceCreated']
|
|
863
|
-
}] } });
|
|
881
|
+
}], ctorParameters: () => [] });
|
|
864
882
|
|
|
865
883
|
class RerenderDirective {
|
|
866
884
|
constructor() {
|
|
867
885
|
this.templateRef = inject((TemplateRef));
|
|
868
886
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
869
887
|
this.mngRerender = input.required();
|
|
870
|
-
|
|
871
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
872
|
-
const doRerender = this.mngRerender();
|
|
888
|
+
effectWithDeps([this.mngRerender], () => {
|
|
873
889
|
this.viewContainerRef.clear();
|
|
874
890
|
this.viewContainerRef.createEmbeddedView(this.templateRef);
|
|
875
891
|
});
|
|
@@ -887,28 +903,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
887
903
|
class TemplateDirective {
|
|
888
904
|
constructor() {
|
|
889
905
|
this.template = inject((TemplateRef));
|
|
890
|
-
this.
|
|
891
|
-
}
|
|
892
|
-
getType() {
|
|
893
|
-
return this.name;
|
|
894
|
-
}
|
|
895
|
-
getViewContainerRef() {
|
|
896
|
-
return this.viewContainerRef;
|
|
906
|
+
this.name = input.required({ alias: 'mngTemplate' });
|
|
897
907
|
}
|
|
898
908
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: TemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
899
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
909
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: TemplateDirective, isStandalone: true, selector: "[mngTemplate]", inputs: { name: { classPropertyName: "name", publicName: "mngTemplate", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
900
910
|
}
|
|
901
911
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: TemplateDirective, decorators: [{
|
|
902
912
|
type: Directive,
|
|
903
913
|
args: [{
|
|
904
914
|
selector: '[mngTemplate]'
|
|
905
915
|
}]
|
|
906
|
-
}]
|
|
907
|
-
type: Input
|
|
908
|
-
}], name: [{
|
|
909
|
-
type: Input,
|
|
910
|
-
args: [{ required: true, alias: 'mngTemplate' }]
|
|
911
|
-
}] } });
|
|
916
|
+
}] });
|
|
912
917
|
|
|
913
918
|
/**
|
|
914
919
|
* Returns array of names for constants in enum.
|
|
@@ -1779,11 +1784,11 @@ function adjustRouteMenuLazyChildrenRouterLinks(rootMenuItem, lazyChildren) {
|
|
|
1779
1784
|
}
|
|
1780
1785
|
|
|
1781
1786
|
function findTemplateByName(templates, name) {
|
|
1782
|
-
return templates.find(t => t.
|
|
1787
|
+
return templates.find(t => t.name() === name)?.template ?? null;
|
|
1783
1788
|
}
|
|
1784
1789
|
|
|
1785
1790
|
function getI18nAsync(translate, params, ...keys) {
|
|
1786
|
-
return translate.stream(keys, params).pipe(map(i18n => selectI18n(keys, i18n)));
|
|
1791
|
+
return translate.stream(keys, params).pipe(map((i18n) => selectI18n(keys, i18n)));
|
|
1787
1792
|
}
|
|
1788
1793
|
function getI18n(translate, params, ...keys) {
|
|
1789
1794
|
const i18n = translate.instant(keys, params);
|
|
@@ -2286,32 +2291,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
2286
2291
|
}]
|
|
2287
2292
|
}] });
|
|
2288
2293
|
|
|
2289
|
-
/**
|
|
2290
|
-
* Effect function with explicit declaration of dependencies. Dependencies will be tracked, whereas the main execution will not be.
|
|
2291
|
-
*
|
|
2292
|
-
* @param deps Array of dependencies to be tracked.
|
|
2293
|
-
* @param fn Function where dependencies will no longer be tracked.
|
|
2294
|
-
* @param opts Additional options:
|
|
2295
|
-
* - firstOnly Executes effect only once, then destroy it.
|
|
2296
|
-
*/
|
|
2297
|
-
function effectWithDeps(deps, fn, opts) {
|
|
2298
|
-
let execCnt = 0;
|
|
2299
|
-
const ref = effect(() => {
|
|
2300
|
-
if (opts?.firstOnly) {
|
|
2301
|
-
if (execCnt > 0) {
|
|
2302
|
-
return;
|
|
2303
|
-
}
|
|
2304
|
-
ref.destroy();
|
|
2305
|
-
}
|
|
2306
|
-
const depsValues = deps.map(s => s());
|
|
2307
|
-
execCnt++;
|
|
2308
|
-
untracked(() => {
|
|
2309
|
-
fn(depsValues);
|
|
2310
|
-
});
|
|
2311
|
-
});
|
|
2312
|
-
return ref;
|
|
2313
|
-
}
|
|
2314
|
-
|
|
2315
2294
|
function TypeName(typeName) {
|
|
2316
2295
|
return function (target) {
|
|
2317
2296
|
defineReflectTypeName(target, typeName);
|
|
@@ -2533,7 +2512,7 @@ class CommonsService {
|
|
|
2533
2512
|
this.translate
|
|
2534
2513
|
.stream('mngPrime')
|
|
2535
2514
|
.pipe(takeUntilDestroyed())
|
|
2536
|
-
.subscribe(value => this.primengConfig.setTranslation(value));
|
|
2515
|
+
.subscribe((value) => this.primengConfig.setTranslation(value));
|
|
2537
2516
|
}
|
|
2538
2517
|
initialize() {
|
|
2539
2518
|
this.logger.debug('Initialize');
|
|
@@ -2605,7 +2584,7 @@ class CommonsService {
|
|
|
2605
2584
|
this.breadcrumbHomeTranslateSubscription = this.translate
|
|
2606
2585
|
.get(homeBreadcrumb.label)
|
|
2607
2586
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2608
|
-
.subscribe(i18n => {
|
|
2587
|
+
.subscribe((i18n) => {
|
|
2609
2588
|
homeBreadcrumb.label = i18n;
|
|
2610
2589
|
this.breadcrumbHome.set(homeBreadcrumb);
|
|
2611
2590
|
});
|
|
@@ -2624,7 +2603,7 @@ class CommonsService {
|
|
|
2624
2603
|
this.breadcrumbsTranslateSubscription = this.translate
|
|
2625
2604
|
.get(i18nKeys)
|
|
2626
2605
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2627
|
-
.subscribe(i18n => {
|
|
2606
|
+
.subscribe((i18n) => {
|
|
2628
2607
|
// Construct the breadcrumb hierarchy
|
|
2629
2608
|
breadcrumbs.forEach(b => {
|
|
2630
2609
|
if (b.label && i18n[b.label]) {
|