@mediusinc/mng-commons 3.0.0-rc.3 → 3.0.0-rc.6

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.
Files changed (95) hide show
  1. package/assets/i18n/en.json +5 -1
  2. package/assets/i18n/sl.json +5 -1
  3. package/esm2022/index.mjs +3 -1
  4. package/esm2022/lib/api/utils/object-serializer.util.mjs +11 -4
  5. package/esm2022/lib/components/action/action.component.mjs +16 -4
  6. package/esm2022/lib/components/action/editor/action-editor.component.mjs +83 -18
  7. package/esm2022/lib/components/action/models/action-execution.model.mjs +14 -37
  8. package/esm2022/lib/components/action/route/action-route.component.mjs +9 -2
  9. package/esm2022/lib/components/form/autocomplete/autocomplete.component.mjs +7 -5
  10. package/esm2022/lib/components/form/dropdown/dropdown.component.mjs +7 -5
  11. package/esm2022/lib/components/form/editor/form-editor.component.mjs +9 -8
  12. package/esm2022/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +43 -15
  13. package/esm2022/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +3 -3
  14. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +6 -6
  15. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +3 -3
  16. package/esm2022/lib/descriptors/action/action.descriptor.mjs +19 -8
  17. package/esm2022/lib/descriptors/editor/editor.descriptor.mjs +3 -3
  18. package/esm2022/lib/descriptors/filter/filter.descriptor.mjs +7 -6
  19. package/esm2022/lib/descriptors/table/column.descriptor.mjs +3 -3
  20. package/esm2022/lib/descriptors/tableview/tableview.descriptor.mjs +3 -3
  21. package/esm2022/lib/error/error.handler.mjs +23 -0
  22. package/esm2022/lib/error/index.mjs +2 -0
  23. package/esm2022/lib/guards/index.mjs +2 -0
  24. package/esm2022/lib/guards/unsaved-changes.guard.mjs +4 -0
  25. package/esm2022/lib/models/action-editor.model.mjs +2 -0
  26. package/esm2022/lib/models/can-component-deactivate.model.mjs +2 -0
  27. package/esm2022/lib/models/config.model.mjs +1 -1
  28. package/esm2022/lib/models/error.model.mjs +1 -1
  29. package/esm2022/lib/models/index.mjs +5 -2
  30. package/esm2022/lib/models/internal-error.model.mjs +30 -0
  31. package/esm2022/lib/models/log.model.mjs +10 -0
  32. package/esm2022/lib/pipes/json-path.pipe.mjs +8 -4
  33. package/esm2022/lib/provide-commons.mjs +16 -15
  34. package/esm2022/lib/router/route-builder.mjs +4 -4
  35. package/esm2022/lib/router/routes-builder.mjs +3 -3
  36. package/esm2022/lib/router/tableview-route-builder.mjs +4 -1
  37. package/esm2022/lib/security/authorization.service.mjs +5 -4
  38. package/esm2022/lib/security/authorization.util.mjs +3 -3
  39. package/esm2022/lib/services/action-error-mapper.service.mjs +19 -0
  40. package/esm2022/lib/services/action-executor.service.mjs +43 -28
  41. package/esm2022/lib/services/commons.service.mjs +16 -25
  42. package/esm2022/lib/services/configuration.service.mjs +60 -30
  43. package/esm2022/lib/services/index.mjs +3 -2
  44. package/esm2022/lib/services/internal/commons-init.service.mjs +48 -23
  45. package/esm2022/lib/services/logger.service.mjs +123 -0
  46. package/esm2022/lib/services/providers/index.mjs +1 -2
  47. package/esm2022/lib/utils/action-data-provider.util.mjs +7 -7
  48. package/esm2022/lib/utils/notification.util.mjs +3 -2
  49. package/esm2022/lib/utils/object.util.mjs +32 -5
  50. package/esm2022/lib/utils/route.util.mjs +3 -3
  51. package/esm2022/lib/utils/string.util.mjs +2 -2
  52. package/esm2022/lib/utils/tableview.util.mjs +3 -3
  53. package/esm2022/lib/utils/type.util.mjs +5 -5
  54. package/fesm2022/mediusinc-mng-commons.mjs +2587 -2258
  55. package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
  56. package/index.d.ts +1 -0
  57. package/lib/api/utils/object-serializer.util.d.ts +1 -0
  58. package/lib/components/action/action.component.d.ts +1 -0
  59. package/lib/components/action/editor/action-editor.component.d.ts +17 -6
  60. package/lib/components/action/models/action-execution.model.d.ts +5 -3
  61. package/lib/components/action/route/action-route.component.d.ts +4 -1
  62. package/lib/components/form/autocomplete/autocomplete.component.d.ts +1 -0
  63. package/lib/components/form/dropdown/dropdown.component.d.ts +1 -0
  64. package/lib/components/form/editor/form-editor.component.d.ts +1 -0
  65. package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +2 -0
  66. package/lib/descriptors/action/action.descriptor.d.ts +3 -0
  67. package/lib/descriptors/editor/field.descriptor.d.ts +2 -2
  68. package/lib/error/error.handler.d.ts +6 -0
  69. package/lib/error/index.d.ts +1 -0
  70. package/lib/guards/index.d.ts +1 -0
  71. package/lib/guards/unsaved-changes.guard.d.ts +3 -0
  72. package/lib/models/action-editor.model.d.ts +4 -0
  73. package/lib/models/can-component-deactivate.model.d.ts +4 -0
  74. package/lib/models/config.model.d.ts +2 -1
  75. package/lib/models/error.model.d.ts +2 -1
  76. package/lib/models/index.d.ts +4 -1
  77. package/lib/models/{error-internal.model.d.ts → internal-error.model.d.ts} +3 -6
  78. package/lib/models/log.model.d.ts +34 -0
  79. package/lib/pipes/json-path.pipe.d.ts +1 -0
  80. package/lib/security/authorization.service.d.ts +1 -0
  81. package/lib/services/action-error-mapper.service.d.ts +11 -0
  82. package/lib/services/action-executor.service.d.ts +10 -5
  83. package/lib/services/commons.service.d.ts +9 -14
  84. package/lib/services/configuration.service.d.ts +13 -5
  85. package/lib/services/index.d.ts +2 -1
  86. package/lib/services/internal/commons-init.service.d.ts +7 -8
  87. package/lib/services/logger.service.d.ts +30 -0
  88. package/lib/services/providers/index.d.ts +0 -1
  89. package/lib/utils/object.util.d.ts +6 -4
  90. package/package.json +1 -1
  91. package/esm2022/lib/models/error-internal.model.mjs +0 -27
  92. package/esm2022/lib/services/error-mapper.service.mjs +0 -14
  93. package/esm2022/lib/services/providers/config-service.provider.mjs +0 -31
  94. package/lib/services/error-mapper.service.d.ts +0 -7
  95. package/lib/services/providers/config-service.provider.d.ts +0 -6
package/index.d.ts CHANGED
@@ -39,3 +39,4 @@ export * from './lib/security/model';
39
39
  export * from './lib/types';
40
40
  export * from './lib/styles';
41
41
  export * from './lib/styles/models';
42
+ export * from './lib/error';
@@ -2,6 +2,7 @@ import { ClassType } from '../../types';
2
2
  import { AttributeDef, SerializableTypeMap } from '../models';
3
3
  export declare class ObjectSerializer {
4
4
  private static _instance;
5
+ private readonly _logCategory;
5
6
  private readonly _primitives;
6
7
  private readonly _typeMap;
7
8
  private readonly _enumMap;
@@ -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,27 +1,34 @@
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 { DynamicDialogConfig } from 'primeng/dynamicdialog';
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>;
31
+ private readonly logger;
25
32
  action: ActionEditorDescriptor<T>;
26
33
  itemIdInit?: IdType;
27
34
  itemInit?: T;
@@ -59,7 +66,7 @@ export declare class MngActionEditorComponent<T, S> implements OnInit, OnChanges
59
66
  dialogRoute?: ActivatedRoute;
60
67
  private sourceComponent;
61
68
  private subscriptions;
62
- constructor(translate: TranslateService, actionExecutor: MngActionExecutorService, mngCommonsService: MngCommonsService, dialogConfig: DynamicDialogConfig | null, viewContainerService: MngViewContainerComponentService<T, S> | null);
69
+ constructor(translate: TranslateService, actionExecutor: MngActionExecutorService, mngCommonsService: MngCommonsService, confirmationService: ConfirmationService, dialogService: DialogService, dialogConfig: DynamicDialogConfig | null, viewContainerService: MngViewContainerComponentService<T, S> | null);
63
70
  ngOnInit(): void;
64
71
  ngOnChanges(changes: SimpleChanges): void;
65
72
  ngOnDestroy(): void;
@@ -75,7 +82,11 @@ export declare class MngActionEditorComponent<T, S> implements OnInit, OnChanges
75
82
  private initializeViewContainer;
76
83
  private setEditorEnabled;
77
84
  private processActionInstance;
85
+ private beforeWindowUnload;
86
+ private onEscapePressed;
87
+ private showUnsavedChangesConfirmationDialog;
88
+ closeWithUnsavedChangesConfirmation(callFromGuard?: boolean): Observable<boolean>;
78
89
  private unsetInstance;
79
- static ɵfac: i0.ɵɵFactoryDeclaration<MngActionEditorComponent<any, any>, [null, null, null, { optional: true; }, { optional: true; }]>;
90
+ static ɵfac: i0.ɵɵFactoryDeclaration<MngActionEditorComponent<any, any>, [null, null, null, null, null, { optional: true; }, { optional: true; }]>;
80
91
  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
92
  }
@@ -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;
@@ -17,11 +17,11 @@ export declare class ActionError {
17
17
  * Action execution instance containing data about execution state of action
18
18
  */
19
19
  export declare class ActionInstance<T, S> {
20
- debug: boolean;
21
20
  readonly instanceId: string;
22
21
  readonly instanceLongName: string;
23
22
  readonly action: ActionDescriptor<T>;
24
23
  readonly createdDate: Date;
24
+ private readonly logger;
25
25
  readonly isRunLoadingSubject: BehaviorSubject<boolean>;
26
26
  triggerParameters?: ActionParameters<T>;
27
27
  activationParameters?: ActionParameters<T>;
@@ -35,11 +35,12 @@ 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>;
41
42
  errorActionInstance?: ActionInstance<T, S>;
42
- constructor(action: ActionDescriptor<T>, state?: ActionInstanceStateEnum, debug?: boolean);
43
+ constructor(action: ActionDescriptor<T>, state?: ActionInstanceStateEnum);
43
44
  get isRunLoading$(): Observable<boolean>;
44
45
  get context(): ActionContext<T, S> | undefined;
45
46
  get execution$(): Observable<T | null | undefined>;
@@ -73,6 +74,7 @@ export declare class ActionContext<T, S> {
73
74
  readonly serviceInstance?: S | undefined;
74
75
  private readonly executionSubject;
75
76
  private readonly executionIsRunningSubject;
77
+ private readonly logger;
76
78
  readonly contextLongName: string;
77
79
  previousActionInstance?: ActionInstance<unknown, unknown>;
78
80
  confirmation?: Confirmation;
@@ -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>;
@@ -11,6 +11,7 @@ export declare class MngAutocompleteComponent implements OnInit, OnDestroy, Cont
11
11
  private injector;
12
12
  private translate;
13
13
  private formlyWrapper;
14
+ private readonly logger;
14
15
  dataProvider?: ILookupDataProvider<any, any>;
15
16
  dataKeyProperty?: string;
16
17
  itemsValuePropertyInit?: string;
@@ -11,6 +11,7 @@ export declare class MngDropdownComponent implements OnInit, OnDestroy, ControlV
11
11
  private injector;
12
12
  private translate;
13
13
  private formlyWrapper;
14
+ private readonly logger;
14
15
  dataProvider?: ILookupDataProvider<any, any>;
15
16
  dataKeyProperty?: string;
16
17
  itemsLabelPropertyInit?: string;
@@ -13,6 +13,7 @@ import * as i0 from "@angular/core";
13
13
  export declare class MngFormEditorComponent<T> implements IFormEditorComponent<T>, OnInit, OnChanges, OnDestroy {
14
14
  private mngCommonsService;
15
15
  private translateService;
16
+ private readonly logger;
16
17
  descriptor?: EditorDescriptor<T>;
17
18
  submitLoading: Observable<boolean> | boolean;
18
19
  item?: T;
@@ -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
  }
@@ -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;
@@ -70,9 +70,9 @@ export declare abstract class AFieldDescriptor<T, ET, VT = T> extends AGenericFi
70
70
  get setter(): ((item: ET, value: VT) => void) | undefined;
71
71
  get validations(): FieldValidationDescriptor[];
72
72
  get asyncValidations(): FieldValidationDescriptor[];
73
- get requiredExpression(): string | ((field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
73
+ get requiredExpression(): string | Observable<boolean> | ((field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
74
74
  [additionalProperties: string]: any;
75
- }> | undefined) => boolean) | Observable<boolean> | undefined;
75
+ }> | undefined) => boolean) | undefined;
76
76
  get disabledExpression(): string | Observable<boolean> | ((field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
77
77
  [additionalProperties: string]: any;
78
78
  }> | undefined) => boolean) | undefined;
@@ -0,0 +1,6 @@
1
+ import { ErrorHandler } from '@angular/core';
2
+ export declare class MngErrorHandler implements ErrorHandler {
3
+ private static readonly logCategory;
4
+ private readonly logger;
5
+ handleError(error: any): void;
6
+ }
@@ -0,0 +1 @@
1
+ export * from './error.handler';
@@ -0,0 +1 @@
1
+ export * from './unsaved-changes.guard';
@@ -0,0 +1,3 @@
1
+ import { CanDeactivateFn } from '@angular/router';
2
+ import { CanComponentDeactivate } from '../models';
3
+ export declare const unsavedChangesGuard: CanDeactivateFn<CanComponentDeactivate>;
@@ -0,0 +1,4 @@
1
+ import { Observable } from 'rxjs';
2
+ export interface IActionEditorComponent {
3
+ closeWithUnsavedChangesConfirmation(callFromGuard: boolean): Observable<boolean>;
4
+ }
@@ -0,0 +1,4 @@
1
+ import { Observable } from 'rxjs';
2
+ export interface CanComponentDeactivate {
3
+ canDeactivate: () => Observable<boolean>;
4
+ }
@@ -3,6 +3,7 @@ import { ValidatorOption, WrapperOption } from '@ngx-formly/core/lib/models/conf
3
3
  import { TranslateService } from '@ngx-translate/core';
4
4
  import { MenuItem } from 'primeng/api';
5
5
  import { MngFormlyTypeConfig } from '../components/form/formly/models';
6
+ import { MngLogConfig } from './log.model';
6
7
  import { VersionConfigType } from './version.model';
7
8
  export interface MngModuleConfig {
8
9
  app?: {
@@ -55,7 +56,7 @@ export interface MngModuleConfig {
55
56
  filtersDateOnlyDisabled?: boolean;
56
57
  };
57
58
  actions?: {
58
- debugLog?: boolean;
59
59
  debugInstances?: boolean;
60
60
  };
61
+ log?: MngLogConfig;
61
62
  }
@@ -1,6 +1,7 @@
1
1
  import { Message } from 'primeng/api';
2
2
  import { IdType } from '../types';
3
3
  export interface MngError extends Error {
4
+ type: 'MngInternalError' | 'MngActionError';
4
5
  id?: IdType;
5
6
  messageCode?: number | string;
6
7
  message: string;
@@ -10,5 +11,5 @@ export interface MngError extends Error {
10
11
  statusDescription?: string;
11
12
  stack?: string;
12
13
  url?: string;
13
- cause?: Error;
14
+ cause?: Error | unknown;
14
15
  }
@@ -2,9 +2,12 @@ export * from './column-value.model';
2
2
  export * from './config.model';
3
3
  export * from './enum.model';
4
4
  export * from './error.model';
5
+ export * from './internal-error.model';
6
+ export * from './log.model';
5
7
  export * from './menu.model';
6
8
  export * from './user.model';
7
9
  export * from './version.model';
8
10
  export * from './view-container.model';
9
11
  export * from './tableview-attr.model';
10
- export * from './error-internal.model';
12
+ export * from './can-component-deactivate.model';
13
+ export * from './action-editor.model';
@@ -1,7 +1,8 @@
1
1
  import { Message } from 'primeng/api';
2
2
  import { IdType } from '../types';
3
3
  import { MngError } from './index';
4
- export declare class MngErrorInternal implements MngError {
4
+ export declare class MngInternalError extends Error implements MngError {
5
+ readonly type = "MngInternalError";
5
6
  id?: IdType;
6
7
  messageCode?: number | string;
7
8
  notification?: Message;
@@ -9,10 +10,6 @@ export declare class MngErrorInternal implements MngError {
9
10
  status?: number;
10
11
  statusDescription?: string;
11
12
  url?: string;
12
- cause?: Error;
13
- stack?: string;
14
- name: string;
15
- message: string;
16
13
  constructor(message: string, name?: string, options?: {
17
14
  id?: IdType;
18
15
  messageCode?: number | string;
@@ -24,6 +21,6 @@ export declare class MngErrorInternal implements MngError {
24
21
  cause?: Error;
25
22
  stack?: string;
26
23
  });
27
- consoleError(): this;
24
+ get messageLog(): string;
28
25
  private generateNotification;
29
26
  }
@@ -0,0 +1,34 @@
1
+ export declare enum LogLevelEnum {
2
+ Trace = 0,
3
+ Debug = 1,
4
+ Log = 2,
5
+ Info = 3,
6
+ Warning = 4,
7
+ Error = 5
8
+ }
9
+ export interface MngLogEntry {
10
+ level: LogLevelEnum;
11
+ message: string;
12
+ data: any[];
13
+ category?: string;
14
+ timestamp: Date;
15
+ timestampFormatted?: string;
16
+ }
17
+ export interface MngLogConfig {
18
+ level?: LogLevelEnum;
19
+ timestampFormat?: string;
20
+ category?: {
21
+ [category: string]: {
22
+ level?: LogLevelEnum;
23
+ };
24
+ };
25
+ }
26
+ export interface IMngLoggerService {
27
+ create(context: string): IMngLoggerService;
28
+ trace(msg: string, ...data: any[]): void;
29
+ debug(msg: string, ...data: any[]): void;
30
+ log(msg: string, logLevel: LogLevelEnum, category: string | undefined, ...data: any[]): void;
31
+ info(msg: string, ...data: any[]): void;
32
+ warn(msg: string, ...data: any[]): void;
33
+ error(msg: string, ...data: any[]): void;
34
+ }
@@ -7,6 +7,7 @@ import * as i0 from "@angular/core";
7
7
  * - Array notation (e.g.: [0])
8
8
  */
9
9
  export declare class JsonPathPipe implements PipeTransform {
10
+ private readonly logger;
10
11
  transform(value: any, path?: string): any;
11
12
  static ɵfac: i0.ɵɵFactoryDeclaration<JsonPathPipe, never>;
12
13
  static ɵpipe: i0.ɵɵPipeDeclaration<JsonPathPipe, "jsonPath", true>;
@@ -9,6 +9,7 @@ export declare class MngAuthorizationService {
9
9
  private injector;
10
10
  private router;
11
11
  private commons;
12
+ private readonly logger;
12
13
  constructor(injector: Injector, router: Router, commons: MngCommonsService);
13
14
  isPermitted(permissions: APermissions, route?: ActivatedRouteSnapshot, actionCtx?: ActionContextValidation<unknown, unknown>): Observable<boolean>;
14
15
  private isPermittedAll;
@@ -0,0 +1,11 @@
1
+ import { MngError } from '../models';
2
+ /**
3
+ * Service for transforming errors in action execution.
4
+ * Can be used to transform errors to Commons MngError interface for correct error message display.
5
+ */
6
+ export declare abstract class MngActionErrorMapperService {
7
+ abstract toMngError(error?: any, mngError?: MngError): MngError;
8
+ }
9
+ export declare class DefaultActionMngErrorMapperService extends MngActionErrorMapperService {
10
+ toMngError(error?: any, mngError?: MngError): MngError;
11
+ }
@@ -5,10 +5,10 @@ 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
+ import { MngActionErrorMapperService } from './action-error-mapper.service';
10
11
  import { MngCommonsService } from './commons.service';
11
- import { MngErrorMapperService } from './error-mapper.service';
12
12
  import { MngNavigationService } from './navigation.service';
13
13
  import * as i0 from "@angular/core";
14
14
  export declare class MngActionExecutorService {
@@ -21,10 +21,10 @@ export declare class MngActionExecutorService {
21
21
  private errorMapper;
22
22
  private parametrize;
23
23
  private defaultEditorDialogComponent;
24
- private readonly debugLog;
25
24
  private readonly instancesBufferMax;
26
25
  private readonly _instances;
27
- constructor(injector: Injector, router: Router, dialogService: DialogService, translate: TranslateService, mngCommons: MngCommonsService, navigationService: MngNavigationService, errorMapper: MngErrorMapperService, parametrize: MngParametrizePipe, defaultEditorDialogComponent: Type<any>);
26
+ private logger;
27
+ constructor(injector: Injector, router: Router, dialogService: DialogService, translate: TranslateService, mngCommons: MngCommonsService, navigationService: MngNavigationService, errorMapper: MngActionErrorMapperService, parametrize: MngParametrizePipe, defaultEditorDialogComponent: Type<any>);
28
28
  get instances(): ActionInstance<any, any>[];
29
29
  /**
30
30
  * Prepares action context for usage in validation.
@@ -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>): 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.
@@ -1,18 +1,15 @@
1
- import { Title } from '@angular/platform-browser';
2
- import { Router } from '@angular/router';
3
- import { TranslateService } from '@ngx-translate/core';
4
- import { FilterService, PrimeNGConfig } from 'primeng/api';
5
1
  import { Observable } from 'rxjs';
6
- import { IUser, MngMenuItem, MngModuleConfig } from '../models';
2
+ import { IUser, MngMenuItem } from '../models';
7
3
  import * as i0 from "@angular/core";
8
4
  export declare class MngCommonsService {
9
- private router;
10
- private primengConfig;
11
- private translate;
12
- private titleService;
13
- private filterService;
14
- private moduleConfig;
15
- private localStorage;
5
+ private readonly logger;
6
+ private readonly router;
7
+ private readonly primengConfig;
8
+ private readonly translate;
9
+ private readonly titleService;
10
+ private readonly filterService;
11
+ private readonly moduleConfig;
12
+ private readonly localStorage;
16
13
  private routerEventsSubscription?;
17
14
  private translateLangChangeSubscription?;
18
15
  private _menuMode;
@@ -33,7 +30,6 @@ export declare class MngCommonsService {
33
30
  private userRolesSubject;
34
31
  private languageSubject;
35
32
  private dataLanguageSubject;
36
- constructor(router: Router, primengConfig: PrimeNGConfig, translate: TranslateService, titleService: Title, filterService: FilterService, moduleConfig: MngModuleConfig, localStorage: Storage);
37
33
  get appName(): string;
38
34
  get appOwner(): string;
39
35
  get appLogoLight(): string;
@@ -77,7 +73,6 @@ export declare class MngCommonsService {
77
73
  get userRoles(): Array<string>;
78
74
  set userRoles(roles: Array<string>);
79
75
  get userRoles$(): Observable<string[]>;
80
- get actionsDebugLog(): boolean;
81
76
  get actionsDebugInstances(): boolean;
82
77
  reset(): void;
83
78
  menuChangeActiveKey(key: string): void;
@@ -1,23 +1,31 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { Observable } from 'rxjs';
3
+ import { IMngLoggerService, MngModuleConfig } from '../models';
3
4
  export declare class MngConfigurationService {
4
- private http;
5
5
  private static _instance;
6
- static init(httpClient: HttpClient): MngConfigurationService;
7
6
  static get(): MngConfigurationService;
7
+ private logger?;
8
+ private http?;
9
+ private moduleConfig?;
8
10
  private projectEnvironment?;
9
11
  private jsonSources;
10
12
  private objectSources;
11
13
  private configuration;
12
14
  private constructor();
15
+ init(httpClient: HttpClient, logger?: IMngLoggerService): this;
16
+ /**
17
+ * Add mng commons module config.
18
+ * @param config Module config.
19
+ */
20
+ addModuleConfigSource(config?: MngModuleConfig): void;
13
21
  /**
14
22
  * Add project environment source.
15
- * @param environemnt Environment.
23
+ * @param environment Environment.
16
24
  */
17
25
  addEnvironmentSource(environment: any): void;
18
26
  /**
19
27
  * Adds new config source from JSON file loaded from HTTP.
20
- * @param url Url to JSON file.
28
+ * @param config Config for JSON file.
21
29
  * @param loadImmediately Load is by default triggered on app initialization. If immediate load is required, pass true.
22
30
  */
23
31
  addJsonSource(config?: {
@@ -47,7 +55,7 @@ export declare class MngConfigurationService {
47
55
  * Get configuration value for key.
48
56
  * @param key Configuration key.
49
57
  */
50
- getConfigValue(key: string): any;
58
+ getConfigValue<T = any>(key: string): T | null;
51
59
  /**
52
60
  * Has configuration for key.
53
61
  * @param key Configuration key.
@@ -1,9 +1,10 @@
1
1
  export * from './action-executor.service';
2
+ export * from './action-error-mapper.service';
2
3
  export * from './configuration.service';
3
4
  export * from './commons.service';
4
- export * from './error-mapper.service';
5
5
  export * from './navigation.service';
6
6
  export * from './router.service';
7
7
  export * from './version.service';
8
8
  export * from './view-container.component.service';
9
9
  export * from './mng-localstorage-config.service';
10
+ export * from './logger.service';
@@ -1,16 +1,15 @@
1
- import { TranslateService } from '@ngx-translate/core';
2
1
  import { Observable } from 'rxjs';
3
- import { MngCommonsService, MngConfigurationService, MngRouterService } from '../';
4
2
  import * as i0 from "@angular/core";
5
3
  export declare class MngCommonsInitService {
6
- private translate;
7
- private configurationService;
8
- private mngCommons;
9
- private mngRouter;
4
+ private readonly httpClient;
5
+ private readonly logger;
6
+ private readonly config;
7
+ private readonly mngCommons;
8
+ private readonly mngRouter;
9
+ private readonly moduleConfig;
10
10
  private readonly commonsInitializers;
11
11
  private isInitialized;
12
- constructor(translate: TranslateService, configurationService: MngConfigurationService, mngCommons: MngCommonsService, mngRouter: MngRouterService, commonsInitializers: ReadonlyArray<() => Observable<unknown>>);
13
12
  initialize(): Observable<void>;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<MngCommonsInitService, [null, null, null, null, { optional: true; }]>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<MngCommonsInitService, never>;
15
14
  static ɵprov: i0.ɵɵInjectableDeclaration<MngCommonsInitService>;
16
15
  }
@@ -0,0 +1,30 @@
1
+ import { IMngLoggerService, LogLevelEnum } from '../models';
2
+ import { MngConfigurationService } from './configuration.service';
3
+ export declare class MngLoggerService implements IMngLoggerService {
4
+ private static _instance;
5
+ private static _isInit;
6
+ private static _configurationService?;
7
+ private static _entriesBuffer;
8
+ private static _categoryInstances;
9
+ private static _timestampFormat;
10
+ private category?;
11
+ private readonly defaultLogLevel;
12
+ private datePipe;
13
+ private constructor();
14
+ static get(): MngLoggerService;
15
+ static configure(config: {
16
+ timestampFormat?: string;
17
+ }): void;
18
+ static init(configurationService: MngConfigurationService): void;
19
+ private static _flushBuffer;
20
+ static create(category: string): MngLoggerService;
21
+ create(category: string): MngLoggerService;
22
+ private _processLog;
23
+ private _log;
24
+ trace(msg: string, ...data: any[]): void;
25
+ debug(msg: string, ...data: any[]): void;
26
+ log(msg: string, logLevel?: LogLevelEnum, category?: string | undefined, ...data: any[]): void;
27
+ info(msg: string, ...data: any[]): void;
28
+ warn(msg: string, ...data: any[]): void;
29
+ error(msg: string, ...data: any[]): void;
30
+ }
@@ -1,2 +1 @@
1
- export * from './config-service.provider';
2
1
  export * from './formly-config.provider';
@@ -6,20 +6,22 @@ export interface DeepCopyOptions<P = object> extends DeepCopyPropsOptions {
6
6
  objectPrototype?: ClassType<P>;
7
7
  }
8
8
  export declare class ObjectUtil {
9
- static deepCopyObject<T = object, P = object>(obj: T, options: DeepCopyOptions<P> & {
9
+ static deepCopy<T = object, P = object>(obj: T, options: DeepCopyOptions<P> & {
10
10
  mapGettersToProperties: true;
11
11
  }): T | Record<string, any>;
12
- static deepCopyObject<T = object, P = object>(obj: T, options: DeepCopyOptions<P> & {
12
+ static deepCopy<T = object, P = object>(obj: T, options: DeepCopyOptions<P> & {
13
13
  objectPrototype: ClassType<P>;
14
14
  } & {
15
15
  mapGettersToProperties?: false;
16
16
  }): P;
17
- static deepCopyObject<T = object, P = object>(obj: T, options: DeepCopyOptions<P> & {
17
+ static deepCopy<T = object, P = object>(obj: T, options: DeepCopyOptions<P> & {
18
18
  objectPrototype: ClassType<P>;
19
19
  } & {
20
20
  mapGettersToProperties: true;
21
21
  }): P | Record<string, any>;
22
- static deepCopyObject<T = object, P = object>(obj: T, options?: DeepCopyOptions<P>): T;
22
+ static deepCopy<T = object, P = object>(obj: T, options?: DeepCopyOptions<P>): T;
23
+ static deepMerge(target: Record<string, any>, source: Record<string, any>): Record<string, any>;
24
+ private static isObject;
23
25
  private static handleProp;
24
26
  static getProperties(obj: object): string[];
25
27
  static getGetters(obj: any): string[];