@mediusinc/mng-commons 3.0.0-rc.1 → 3.0.0-rc.4
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 +8 -7
- package/assets/i18n/en.json +5 -1
- package/assets/i18n/sl.json +5 -1
- package/esm2022/lib/components/action/action.component.mjs +18 -6
- package/esm2022/lib/components/action/editor/action-editor.component.mjs +77 -13
- package/esm2022/lib/components/action/models/action-execution.model.mjs +1 -1
- package/esm2022/lib/components/action/route/action-route.component.mjs +9 -2
- package/esm2022/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +43 -15
- package/esm2022/lib/components/tableview/table/table.component.mjs +3 -3
- package/esm2022/lib/descriptors/action/action-button.descriptor.mjs +10 -2
- package/esm2022/lib/descriptors/action/action.descriptor.mjs +11 -1
- package/esm2022/lib/descriptors/table/table.descriptor.mjs +17 -4
- package/esm2022/lib/guards/index.mjs +2 -0
- package/esm2022/lib/guards/unsaved-changes.guard.mjs +4 -0
- package/esm2022/lib/models/action-editor.model.mjs +2 -0
- package/esm2022/lib/models/can-component-deactivate.model.mjs +2 -0
- package/esm2022/lib/models/index.mjs +3 -1
- package/esm2022/lib/router/tableview-route-builder.mjs +4 -1
- package/esm2022/lib/services/action-executor.service.mjs +21 -2
- package/fesm2022/mediusinc-mng-commons.mjs +218 -58
- package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/action/action.component.d.ts +1 -0
- package/lib/components/action/editor/action-editor.component.d.ts +16 -6
- package/lib/components/action/models/action-execution.model.d.ts +2 -1
- package/lib/components/action/route/action-route.component.d.ts +4 -1
- package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +2 -0
- package/lib/descriptors/action/action-button.descriptor.d.ts +4 -1
- package/lib/descriptors/action/action.descriptor.d.ts +3 -0
- package/lib/descriptors/table/table.descriptor.d.ts +16 -3
- package/lib/guards/index.d.ts +1 -0
- package/lib/guards/unsaved-changes.guard.d.ts +3 -0
- package/lib/models/action-editor.model.d.ts +4 -0
- package/lib/models/can-component-deactivate.model.d.ts +4 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/services/action-executor.service.d.ts +7 -2
- package/package.json +1 -1
- package/scss/mng-overrides/_theme_tableview.scss +8 -0
|
@@ -64,6 +64,7 @@ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDe
|
|
|
64
64
|
subactions: MenuItem[];
|
|
65
65
|
private subactionSubscriptions;
|
|
66
66
|
actionOrSubactionHasRunConfirmation: boolean;
|
|
67
|
+
private instance?;
|
|
67
68
|
constructor(routeService: ActivatedRoute, translate: TranslateService, authorization: MngAuthorizationService, actionExecutor: MngActionExecutorService, confirmationService: ConfirmationService, viewContainerService: MngViewContainerComponentService<T, S> | null);
|
|
68
69
|
ngOnInit(): void;
|
|
69
70
|
ngOnChanges(changes: SimpleChanges): void;
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, SimpleChanges } from '@angular/core';
|
|
2
2
|
import { ActivatedRoute } from '@angular/router';
|
|
3
3
|
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
-
import {
|
|
4
|
+
import { ConfirmationService } from 'primeng/api';
|
|
5
|
+
import { DialogService, DynamicDialogConfig } from 'primeng/dynamicdialog';
|
|
5
6
|
import { Observable } from 'rxjs';
|
|
6
7
|
import { IEditorDataProvider } from '../../../data-providers';
|
|
7
8
|
import { ActionDescriptor, ActionEditorDescriptor } from '../../../descriptors/action';
|
|
8
|
-
import { ActionEditorSubmitTypeEnum } from '../../../descriptors/types';
|
|
9
|
+
import { ActionActivationTriggerEnum, ActionEditorSubmitTypeEnum } from '../../../descriptors/types';
|
|
9
10
|
import { MngTemplateDirective } from '../../../directives';
|
|
10
|
-
import { IViewContainer } from '../../../models';
|
|
11
|
+
import { IActionEditorComponent, IViewContainer } from '../../../models';
|
|
11
12
|
import { MngActionExecutorService, MngCommonsService, MngViewContainerComponentService } from '../../../services';
|
|
12
13
|
import { IdType } from '../../../types';
|
|
13
14
|
import { MngFormEditorComponent } from '../../form';
|
|
14
15
|
import { MngFormEditorSubmitEvent } from '../../form/models';
|
|
15
16
|
import { ActionData } from '../models';
|
|
16
17
|
import * as i0 from "@angular/core";
|
|
17
|
-
export declare class MngActionEditorComponent<T, S> implements OnInit, OnChanges, OnDestroy {
|
|
18
|
+
export declare class MngActionEditorComponent<T, S> implements OnInit, OnChanges, OnDestroy, IActionEditorComponent {
|
|
18
19
|
private translate;
|
|
19
20
|
private actionExecutor;
|
|
20
21
|
private mngCommonsService;
|
|
22
|
+
private confirmationService;
|
|
23
|
+
private dialogService;
|
|
21
24
|
private dialogConfig;
|
|
22
25
|
private viewContainerService;
|
|
26
|
+
protected readonly ActionActivationTriggerEnum: typeof ActionActivationTriggerEnum;
|
|
27
|
+
readonly cmpId: string;
|
|
28
|
+
readonly confirmDialogKey: string;
|
|
23
29
|
readonly actionEditorSubmitTypeSubmit = ActionEditorSubmitTypeEnum.Submit;
|
|
24
30
|
readonly actionDefaultLoadingInput: Observable<boolean>;
|
|
25
31
|
action: ActionEditorDescriptor<T>;
|
|
@@ -59,7 +65,7 @@ export declare class MngActionEditorComponent<T, S> implements OnInit, OnChanges
|
|
|
59
65
|
dialogRoute?: ActivatedRoute;
|
|
60
66
|
private sourceComponent;
|
|
61
67
|
private subscriptions;
|
|
62
|
-
constructor(translate: TranslateService, actionExecutor: MngActionExecutorService, mngCommonsService: MngCommonsService, dialogConfig: DynamicDialogConfig | null, viewContainerService: MngViewContainerComponentService<T, S> | null);
|
|
68
|
+
constructor(translate: TranslateService, actionExecutor: MngActionExecutorService, mngCommonsService: MngCommonsService, confirmationService: ConfirmationService, dialogService: DialogService, dialogConfig: DynamicDialogConfig | null, viewContainerService: MngViewContainerComponentService<T, S> | null);
|
|
63
69
|
ngOnInit(): void;
|
|
64
70
|
ngOnChanges(changes: SimpleChanges): void;
|
|
65
71
|
ngOnDestroy(): void;
|
|
@@ -75,7 +81,11 @@ export declare class MngActionEditorComponent<T, S> implements OnInit, OnChanges
|
|
|
75
81
|
private initializeViewContainer;
|
|
76
82
|
private setEditorEnabled;
|
|
77
83
|
private processActionInstance;
|
|
84
|
+
private beforeWindowUnload;
|
|
85
|
+
private onEscapePressed;
|
|
86
|
+
private showUnsavedChangesConfirmationDialog;
|
|
87
|
+
closeWithUnsavedChangesConfirmation(callFromGuard?: boolean): Observable<boolean>;
|
|
78
88
|
private unsetInstance;
|
|
79
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MngActionEditorComponent<any, any>, [null, null, null, { optional: true; }, { optional: true; }]>;
|
|
89
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MngActionEditorComponent<any, any>, [null, null, null, null, null, { optional: true; }, { optional: true; }]>;
|
|
80
90
|
static ɵcmp: i0.ɵɵComponentDeclaration<MngActionEditorComponent<any, any>, "mng-action-editor", never, { "action": { "alias": "action"; "required": true; }; "itemIdInit": { "alias": "itemId"; "required": false; }; "itemInit": { "alias": "item"; "required": false; }; "actionData": { "alias": "actionData"; "required": false; }; "dataProvider": { "alias": "dataProvider"; "required": false; }; "viewContainerInit": { "alias": "viewContainer"; "required": false; }; }, { "actionRunEventEmitter": "actionSubmit"; "actionCancelEventEmitter": "actionCancel"; }, ["templates"], never, true, never>;
|
|
81
91
|
}
|
|
@@ -5,7 +5,7 @@ import { BehaviorSubject, Observable, ReplaySubject, Subscription } from 'rxjs';
|
|
|
5
5
|
import { MediusQueryParam } from '../../../api/models';
|
|
6
6
|
import { IDataProvider } from '../../../data-providers';
|
|
7
7
|
import { ActionDescriptor } from '../../../descriptors/action';
|
|
8
|
-
import { IViewContainer, MngError } from '../../../models';
|
|
8
|
+
import { IActionEditorComponent, IViewContainer, MngError } from '../../../models';
|
|
9
9
|
import { IdType } from '../../../types';
|
|
10
10
|
export declare class ActionError {
|
|
11
11
|
readonly error: any;
|
|
@@ -35,6 +35,7 @@ export declare class ActionInstance<T, S> {
|
|
|
35
35
|
private _result?;
|
|
36
36
|
private _error?;
|
|
37
37
|
activationDialogRef?: DynamicDialogRef;
|
|
38
|
+
activationEditorComponentRef?: IActionEditorComponent;
|
|
38
39
|
private _reactivationInstanceSubject;
|
|
39
40
|
previousInstance?: ActionInstance<T, S>;
|
|
40
41
|
nextActionInstance?: ActionInstance<unknown, unknown>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
3
|
import { ConfirmationService } from 'primeng/api';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
4
5
|
import { ActionDescriptor } from '../../../descriptors/action';
|
|
6
|
+
import { CanComponentDeactivate } from '../../../models';
|
|
5
7
|
import { MngActionExecutorService, MngNavigationService, MngViewContainerComponentService } from '../../../services';
|
|
6
8
|
import { IActionConfirmationService } from '../models';
|
|
7
9
|
import * as i0 from "@angular/core";
|
|
8
|
-
export declare class MngActionRouteComponent<T, S> implements OnInit, OnDestroy, IActionConfirmationService {
|
|
10
|
+
export declare class MngActionRouteComponent<T, S> implements OnInit, OnDestroy, CanComponentDeactivate, IActionConfirmationService {
|
|
9
11
|
private router;
|
|
10
12
|
private route;
|
|
11
13
|
private confirmationService;
|
|
@@ -28,6 +30,7 @@ export declare class MngActionRouteComponent<T, S> implements OnInit, OnDestroy,
|
|
|
28
30
|
private untriggerAction;
|
|
29
31
|
private findActionForRoute;
|
|
30
32
|
private processActionInstance;
|
|
33
|
+
canDeactivate(): Observable<boolean>;
|
|
31
34
|
private unsetInstance;
|
|
32
35
|
static ɵfac: i0.ɵɵFactoryDeclaration<MngActionRouteComponent<any, any>, [null, null, null, null, null, { optional: true; }]>;
|
|
33
36
|
static ɵcmp: i0.ɵɵComponentDeclaration<MngActionRouteComponent<any, any>, "mng-action-route", never, {}, {}, never, never, true, never>;
|
package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export declare class MngFormlyFieldInputComponent<ET> extends FieldType<MngForml
|
|
|
28
28
|
removeImageUrlAt(idx: number): void;
|
|
29
29
|
onImageUrlLoadError(): void;
|
|
30
30
|
private updateFileFormControl;
|
|
31
|
+
isFileImageSvg(file: File): boolean;
|
|
32
|
+
getFileDocumentTypeIcon(file: File): "pi-video" | "pi-volume-up" | "pi-file-pdf" | "pi-file-word" | "pi-file-excel" | "pi-file";
|
|
31
33
|
static ɵfac: i0.ɵɵFactoryDeclaration<MngFormlyFieldInputComponent<any>, never>;
|
|
32
34
|
static ɵcmp: i0.ɵɵComponentDeclaration<MngFormlyFieldInputComponent<any>, "mng-formly-field-input", never, {}, {}, never, never, true, never>;
|
|
33
35
|
}
|
|
@@ -6,17 +6,20 @@ export declare class ActionButtonDescriptor {
|
|
|
6
6
|
private _styleClass;
|
|
7
7
|
private _badge?;
|
|
8
8
|
private _tooltip?;
|
|
9
|
+
private _tooltipPosition?;
|
|
9
10
|
withLabel(label?: string | null): this;
|
|
10
11
|
withIcon(icon: string | null): this;
|
|
11
12
|
withIconPosition(iconPosition: 'left' | 'right'): this;
|
|
12
13
|
withStyleClass(style: ButtonStyleBuilder): this;
|
|
13
14
|
withBadge(badge: string): this;
|
|
14
|
-
withTooltip(tooltip: string): this;
|
|
15
|
+
withTooltip(tooltip: string, position?: 'top' | 'bottom' | 'left' | 'right'): this;
|
|
16
|
+
withTooltipPosition(position: 'top' | 'bottom' | 'left' | 'right'): this;
|
|
15
17
|
get label(): string | null | undefined;
|
|
16
18
|
get icon(): string | null | undefined;
|
|
17
19
|
get iconPosition(): "left" | "right";
|
|
18
20
|
get styleClass(): ButtonStyleBuilder;
|
|
19
21
|
get badge(): string | undefined;
|
|
20
22
|
get tooltip(): string | undefined;
|
|
23
|
+
get tooltipPosition(): "top" | "bottom" | "left" | "right" | undefined;
|
|
21
24
|
copy(): ActionButtonDescriptor;
|
|
22
25
|
}
|
|
@@ -133,6 +133,7 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
|
|
|
133
133
|
protected _editorComponent?: Type<any>;
|
|
134
134
|
protected _resubmitEnabled?: boolean;
|
|
135
135
|
protected _resubmitRefetch: boolean;
|
|
136
|
+
protected _unsavedChangesConfirmation: boolean;
|
|
136
137
|
constructor(editorDescriptor: EditorDescriptor<T>, actionName: string, parentType?: ClassType<unknown>, parentProperty?: string);
|
|
137
138
|
get editorTitle(): string | null | undefined;
|
|
138
139
|
get editorTitleParams(): any;
|
|
@@ -150,6 +151,7 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
|
|
|
150
151
|
get editorComponent(): Type<any> | undefined;
|
|
151
152
|
get resubmitEnabled(): boolean | undefined;
|
|
152
153
|
get resubmitRefetch(): boolean;
|
|
154
|
+
get unsavedChangesConfirmation(): boolean;
|
|
153
155
|
withEditorTitle(title: string | null, params?: any): this;
|
|
154
156
|
withDataProvider(dataProvider: IEditorDataProvider<T, any>): this;
|
|
155
157
|
withServiceType<S>(serviceType: Type<S>): this;
|
|
@@ -163,6 +165,7 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
|
|
|
163
165
|
withEditorActions(actions: ActionDescriptor<T>[]): this;
|
|
164
166
|
withEditorComponent(editorComponent: Type<any>): this;
|
|
165
167
|
withResubmit(enabled?: boolean, refetch?: boolean): this;
|
|
168
|
+
withUnsavedChangesConfirmation(unsavedChangesConfirmation?: boolean): this;
|
|
166
169
|
}
|
|
167
170
|
export declare class ActionEditorSubmitDescriptor<T> extends ActionDescriptor<T> {
|
|
168
171
|
private readonly _editorAction;
|
|
@@ -103,8 +103,16 @@ export declare class TableDescriptor<T> {
|
|
|
103
103
|
withHideHeader(hideHeader?: boolean): this;
|
|
104
104
|
withDataKeyProperty(property: string): this;
|
|
105
105
|
withLoading(text?: string, icon?: string | null): this;
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Helper method that enables/disables reorderable property on all columns currently in the descriptor.
|
|
108
|
+
* @param columnsReorderable: boolean
|
|
109
|
+
*/
|
|
110
|
+
withCurrentColumnsReorderable(columnsReorderable?: boolean): this;
|
|
111
|
+
/**
|
|
112
|
+
* Helper method that enables/disables toggleable property on all columns currently in the descriptor.
|
|
113
|
+
* @param columnsToggleable: boolean
|
|
114
|
+
*/
|
|
115
|
+
withCurrentColumnsToggleable(columnsToggleable?: boolean): this;
|
|
108
116
|
withDefaultSort(property: string, asc?: boolean): this;
|
|
109
117
|
withClassName(className: string): this;
|
|
110
118
|
withSize(size?: TableSizeEnum): this;
|
|
@@ -112,7 +120,12 @@ export declare class TableDescriptor<T> {
|
|
|
112
120
|
withRowHeight(rowHeight: number): this;
|
|
113
121
|
withHover(hover: boolean): this;
|
|
114
122
|
withGridlines(gridlines: boolean): this;
|
|
115
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Method that enables/disabled column resize feature with columnResizeMode on all columns.
|
|
125
|
+
* @param resizableColumns: boolean
|
|
126
|
+
* @param columnResizeMode: 'fit' | 'expand' = 'fit'
|
|
127
|
+
*/
|
|
128
|
+
withColumnsResizable(resizableColumns?: boolean, columnResizeMode?: 'fit' | 'expand'): this;
|
|
116
129
|
withRowClassName(rowClassName?: string, classNameMapFn?: (className?: string, item?: T) => string): this;
|
|
117
130
|
withHeaderClassName(headerClassName: string): this;
|
|
118
131
|
withLocalized(): this;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './unsaved-changes.guard';
|
package/lib/models/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { DialogService } from 'primeng/dynamicdialog';
|
|
|
5
5
|
import { ActionContext, ActionContextValidation, ActionInstance, ActionParameters } from '../components/action/models';
|
|
6
6
|
import { IDataProvider, IEditorDataProvider } from '../data-providers';
|
|
7
7
|
import { ActionDescriptor, ActionEditorDescriptor } from '../descriptors/action';
|
|
8
|
-
import { MngError } from '../models';
|
|
8
|
+
import { IActionEditorComponent, MngError } from '../models';
|
|
9
9
|
import { MngParametrizePipe } from '../pipes';
|
|
10
10
|
import { MngCommonsService } from './commons.service';
|
|
11
11
|
import { MngErrorMapperService } from './error-mapper.service';
|
|
@@ -117,7 +117,12 @@ export declare class MngActionExecutorService {
|
|
|
117
117
|
* @param action Action descriptor.
|
|
118
118
|
* @param instance Action instance (if available).
|
|
119
119
|
*/
|
|
120
|
-
onActionEditorInit<T, S>(action: ActionDescriptor<T>, instance?: ActionInstance<T, S
|
|
120
|
+
onActionEditorInit<T, S>(action: ActionDescriptor<T>, instance?: ActionInstance<T, S>, componentRef?: IActionEditorComponent): ActionInstance<T, S>;
|
|
121
|
+
/**
|
|
122
|
+
* To be called when action editor cmp is being destroyed to correctly finish action.
|
|
123
|
+
* @param instance Action instance.
|
|
124
|
+
*/
|
|
125
|
+
onActionDestroy<T, S>(instance?: ActionInstance<T, S>): void;
|
|
121
126
|
/**
|
|
122
127
|
* To be called when action editor cmp is being destroyed to correctly finish action.
|
|
123
128
|
* @param instance Action instance.
|
package/package.json
CHANGED