@mediusinc/mng-commons 0.2.19 → 0.2.20

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 (46) hide show
  1. package/assets/i18n/en.json +3 -3
  2. package/assets/i18n/sl.json +5 -5
  3. package/esm2020/lib/api/services/crud-api.abstract.service.mjs +6 -6
  4. package/esm2020/lib/components/action/action.component.mjs +26 -13
  5. package/esm2020/lib/components/action/editor/action-editor.component.mjs +78 -21
  6. package/esm2020/lib/components/action/route/action-route.component.mjs +6 -30
  7. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +1 -1
  8. package/esm2020/lib/components/tableview/table/table.component.mjs +2 -2
  9. package/esm2020/lib/components/tableview/tableview.component.mjs +12 -12
  10. package/esm2020/lib/config/models/mng-config.model.mjs +1 -1
  11. package/esm2020/lib/descriptors/action.descriptor.mjs +35 -2
  12. package/esm2020/lib/mng-commons.module.mjs +6 -3
  13. package/esm2020/lib/models/error.model.mjs +2 -0
  14. package/esm2020/lib/models/index.mjs +2 -1
  15. package/esm2020/lib/services/action-executor.service.mjs +62 -10
  16. package/esm2020/lib/services/error-mapper.service.mjs +14 -0
  17. package/esm2020/lib/services/index.mjs +3 -1
  18. package/esm2020/lib/services/view-container.component.service.mjs +35 -0
  19. package/esm2020/lib/utils/i18n.util.mjs +29 -1
  20. package/esm2020/lib/utils/toast.util.mjs +5 -9
  21. package/fesm2015/mediusinc-mng-commons.mjs +319 -145
  22. package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
  23. package/fesm2020/mediusinc-mng-commons.mjs +316 -144
  24. package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
  25. package/lib/components/action/action.component.d.ts +9 -7
  26. package/lib/components/action/editor/action-editor.component.d.ts +19 -13
  27. package/lib/components/action/route/action-route.component.d.ts +1 -2
  28. package/lib/components/tableview/table/table.component.d.ts +1 -1
  29. package/lib/components/tableview/tableview.component.d.ts +1 -2
  30. package/lib/descriptors/action.descriptor.d.ts +30 -11
  31. package/lib/models/error.model.d.ts +12 -0
  32. package/lib/models/index.d.ts +1 -0
  33. package/lib/services/action-executor.service.d.ts +8 -2
  34. package/lib/services/error-mapper.service.d.ts +7 -0
  35. package/lib/services/index.d.ts +2 -0
  36. package/lib/services/{mng-view-container-component.service.d.ts → view-container.component.service.d.ts} +0 -0
  37. package/lib/utils/i18n.util.d.ts +3 -0
  38. package/lib/utils/toast.util.d.ts +2 -2
  39. package/package.json +1 -1
  40. package/scss/mng-overrides/_theme_button.scss +0 -1
  41. package/scss/mng-overrides/_theme_styles.scss +1 -0
  42. package/scss/mng-overrides/_theme_toolbar.scss +5 -0
  43. package/scss/theme/default/_mng-variables-theme-dark.scss +3 -0
  44. package/scss/theme/default/_mng-variables-theme-light.scss +3 -0
  45. package/esm2020/lib/services/mng-view-container-component.service.mjs +0 -35
  46. package/scss/mng-overrides/_variables.scss +0 -2
@@ -1,15 +1,14 @@
1
- import { OnInit } from '@angular/core';
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
2
  import { ActivatedRoute } from '@angular/router';
3
3
  import { TranslateService } from '@ngx-translate/core';
4
4
  import { ConfirmationService } from 'primeng/api';
5
5
  import { Observable } from 'rxjs';
6
- import { DataProvider } from '../../data-providers';
6
+ import { IDataProvider } from '../../data-providers';
7
7
  import { ActionDescriptor } from '../../descriptors';
8
8
  import { IViewContainer } from '../../models';
9
- import { MngActionExecutorService } from '../../services';
10
- import { MngViewContainerComponentService } from '../../services/mng-view-container-component.service';
9
+ import { MngActionExecutorService, MngViewContainerComponentService } from '../../services';
11
10
  import { IdType } from '../../types';
12
- import { ActionData, IActionConfirmationService } from './models';
11
+ import { ActionData, ActionTriggerResult, IActionConfirmationService } from './models';
13
12
  import * as i0 from "@angular/core";
14
13
  export declare class MngActionComponent<T, S> implements OnInit, IActionConfirmationService {
15
14
  private route;
@@ -21,8 +20,11 @@ export declare class MngActionComponent<T, S> implements OnInit, IActionConfirma
21
20
  item?: T;
22
21
  itemId?: IdType;
23
22
  actionData?: ActionData;
24
- dataProvider?: DataProvider<T, S>;
23
+ dataProvider?: IDataProvider<T, S>;
24
+ inputDisabled: Observable<boolean>;
25
+ inputLoading: Observable<boolean>;
25
26
  viewContainerInit?: IViewContainer<T, S>;
27
+ triggerEventEmitter: EventEmitter<ActionTriggerResult<T, S, IDataProvider<T, S>>>;
26
28
  private loadingSubject;
27
29
  $loading: Observable<boolean>;
28
30
  cmpId: string;
@@ -37,5 +39,5 @@ export declare class MngActionComponent<T, S> implements OnInit, IActionConfirma
37
39
  getConfirmationService(): ConfirmationService;
38
40
  getConfirmationServiceInstanceKey(action: ActionDescriptor<any>): string;
39
41
  static ɵfac: i0.ɵɵFactoryDeclaration<MngActionComponent<any, any>, [null, null, null, null, { optional: true; }]>;
40
- static ɵcmp: i0.ɵɵComponentDeclaration<MngActionComponent<any, any>, "mng-action", never, { "action": "action"; "item": "item"; "itemId": "itemId"; "actionData": "actionData"; "dataProvider": "dataProvider"; "viewContainerInit": "viewContainer"; }, {}, never, never>;
42
+ static ɵcmp: i0.ɵɵComponentDeclaration<MngActionComponent<any, any>, "mng-action", never, { "action": "action"; "item": "item"; "itemId": "itemId"; "actionData": "actionData"; "dataProvider": "dataProvider"; "inputDisabled": "disabled"; "inputLoading": "loading"; "viewContainerInit": "viewContainer"; }, { "triggerEventEmitter": "trigger"; }, never, never>;
41
43
  }
@@ -1,14 +1,14 @@
1
- import { Injector, OnDestroy, OnInit, QueryList } from '@angular/core';
1
+ import { ElementRef, EventEmitter, Injector, OnDestroy, OnInit, QueryList } from '@angular/core';
2
2
  import { TranslateService } from '@ngx-translate/core';
3
3
  import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
4
4
  import { Observable } from 'rxjs';
5
- import { IEditorDataProvider } from '../../../data-providers';
6
- import { ActionEditorDescriptor } from '../../../descriptors';
5
+ import { IDataProvider, IEditorDataProvider } from '../../../data-providers';
6
+ import { ActionDescriptor, ActionEditorDescriptor } from '../../../descriptors';
7
7
  import { MngTemplateDirective } from '../../../directives';
8
8
  import { IViewContainer } from '../../../models';
9
- import { MngActionExecutorService, MngCommonsService } from '../../../services';
10
- import { MngViewContainerComponentService } from '../../../services/mng-view-container-component.service';
9
+ import { MngActionExecutorService, MngCommonsService, MngNavigationService, MngViewContainerComponentService } from '../../../services';
11
10
  import { IdType } from '../../../types';
11
+ import { MngFormEditorComponent } from '../../form';
12
12
  import { MngFormEditorSubmitEvent } from '../../form/models';
13
13
  import { ActionData, ActionRunResult } from '../models';
14
14
  import * as i0 from "@angular/core";
@@ -17,6 +17,7 @@ export declare class MngActionEditorComponent<T, S> implements OnInit, OnDestroy
17
17
  private translate;
18
18
  private actionExecutor;
19
19
  private mngCommonsService;
20
+ private navigationService;
20
21
  private dialogRef;
21
22
  private dialogConfig;
22
23
  private viewContainerService;
@@ -26,28 +27,33 @@ export declare class MngActionEditorComponent<T, S> implements OnInit, OnDestroy
26
27
  actionData?: ActionData;
27
28
  dataProvider?: IEditorDataProvider<T, S>;
28
29
  viewContainerInit?: IViewContainer<T, S>;
30
+ actionRunEventEmitter: EventEmitter<ActionRunResult<T, S, IDataProvider<T, S>>>;
29
31
  templates: QueryList<MngTemplateDirective>;
30
- private submitButtonElementRef;
31
- private editorComponent;
32
+ submitButtonElementRef: ElementRef;
33
+ editorComponent: MngFormEditorComponent<T>;
32
34
  cmpId: string;
33
35
  title?: string;
34
36
  isDialog: boolean;
35
37
  isSaveButton: boolean;
38
+ toolbarLeftActions: ActionDescriptor<T>[];
39
+ toolbarRightActions: ActionDescriptor<T>[];
40
+ footerLeftActions: ActionDescriptor<T>[];
41
+ footerRightActions: ActionDescriptor<T>[];
36
42
  private loadingSubject;
37
43
  loading$: Observable<boolean>;
38
44
  private submitLoadingSubject;
39
45
  submitLoading$: Observable<boolean>;
40
- private viewContainer?;
46
+ viewContainer?: IViewContainer<T, S>;
41
47
  private sourceComponent;
42
48
  private subscriptions;
43
- constructor(injector: Injector, translate: TranslateService, actionExecutor: MngActionExecutorService, mngCommonsService: MngCommonsService, dialogRef: DynamicDialogRef | null, dialogConfig: DynamicDialogConfig | null, viewContainerService: MngViewContainerComponentService<T, S> | null);
49
+ constructor(injector: Injector, translate: TranslateService, actionExecutor: MngActionExecutorService, mngCommonsService: MngCommonsService, navigationService: MngNavigationService, dialogRef: DynamicDialogRef | null, dialogConfig: DynamicDialogConfig | null, viewContainerService: MngViewContainerComponentService<T, S> | null);
44
50
  ngOnInit(): void;
45
51
  ngOnDestroy(): void;
46
52
  onSubmit(event: MngFormEditorSubmitEvent<T>): void;
47
- closeDialog(result?: ActionRunResult<T, any, any>): void;
48
- saveItem(): void;
53
+ cancel(result?: ActionRunResult<T, S, IDataProvider<T, S>>): void;
54
+ triggerSubmit(): void;
49
55
  private loadItemWithDataProvider;
50
56
  private setTitle;
51
- static ɵfac: i0.ɵɵFactoryDeclaration<MngActionEditorComponent<any, any>, [null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
52
- static ɵcmp: i0.ɵɵComponentDeclaration<MngActionEditorComponent<any, any>, "mng-action-editor", never, { "action": "action"; "itemId": "itemId"; "item": "item"; "actionData": "actionData"; "dataProvider": "dataProvider"; "viewContainerInit": "viewContainer"; }, {}, ["templates"], never>;
57
+ static ɵfac: i0.ɵɵFactoryDeclaration<MngActionEditorComponent<any, any>, [null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
58
+ static ɵcmp: i0.ɵɵComponentDeclaration<MngActionEditorComponent<any, any>, "mng-action-editor", never, { "action": "action"; "itemId": "itemId"; "item": "item"; "actionData": "actionData"; "dataProvider": "dataProvider"; "viewContainerInit": "viewContainer"; }, { "actionRunEventEmitter": "actionSubmit"; }, ["templates"], never>;
53
59
  }
@@ -2,8 +2,7 @@ import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { ActivatedRoute, Router } from '@angular/router';
3
3
  import { ConfirmationService } from 'primeng/api';
4
4
  import { ActionDescriptor } from '../../../descriptors';
5
- import { MngActionExecutorService, MngNavigationService } from '../../../services';
6
- import { MngViewContainerComponentService } from '../../../services/mng-view-container-component.service';
5
+ import { MngActionExecutorService, MngNavigationService, MngViewContainerComponentService } from '../../../services';
7
6
  import { IActionConfirmationService } from '../models';
8
7
  import * as i0 from "@angular/core";
9
8
  export declare class MngActionRouteComponent<T, S> implements OnInit, OnDestroy, IActionConfirmationService {
@@ -9,7 +9,7 @@ import { MediusQueryResult } from '../../../api/models';
9
9
  import { ITableDataProvider } from '../../../data-providers';
10
10
  import { ColumnDescriptor, TableDescriptor } from '../../../descriptors';
11
11
  import { MngComponentDirective, MngTemplateDirective } from '../../../directives';
12
- import { MngViewContainerComponentService } from '../../../services/mng-view-container-component.service';
12
+ import { MngViewContainerComponentService } from '../../../services';
13
13
  import { MngTableCellClickEvent, MngTableLoadEvent } from '../models';
14
14
  import * as i0 from "@angular/core";
15
15
  export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit, OnDestroy {
@@ -6,8 +6,7 @@ import { DialogService } from 'primeng/dynamicdialog';
6
6
  import { IDataProvider, ITableviewDataProvider } from '../../data-providers';
7
7
  import { ActionDescriptor, TableviewDescriptor } from '../../descriptors';
8
8
  import { IViewContainer } from '../../models';
9
- import { MngActionExecutorService } from '../../services';
10
- import { MngViewContainerComponentService } from '../../services/mng-view-container-component.service';
9
+ import { MngActionExecutorService, MngViewContainerComponentService } from '../../services';
11
10
  import { MngTableCellClickEvent } from './models';
12
11
  import { MngTableComponent } from './table/table.component';
13
12
  import * as i0 from "@angular/core";
@@ -17,12 +17,12 @@ export declare class ActionDescriptor<T> {
17
17
  protected _level: ActionLevelEnum;
18
18
  protected _routeUrl: string | null;
19
19
  protected _title?: string | null;
20
- protected _icon?: string;
20
+ protected _icon?: string | null;
21
21
  protected _className: string;
22
22
  protected _size: ActionDescriptor.SizeEnum;
23
23
  protected _tooltip?: string | null;
24
24
  protected _dataProvider?: IDataProvider<T, any>;
25
- protected _runFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T>;
25
+ protected _runFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T | undefined>;
26
26
  protected _isVisibleFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>;
27
27
  protected _isEnabledFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>;
28
28
  private _hasRunConfirmation;
@@ -48,10 +48,11 @@ export declare class ActionDescriptor<T> {
48
48
  get level(): ActionLevelEnum;
49
49
  get routeUrl(): string | null;
50
50
  get title(): string | null | undefined;
51
- get icon(): string | undefined;
51
+ get icon(): string | null | undefined;
52
52
  get tooltip(): string | null | undefined;
53
53
  get dataProvider(): IDataProvider<T, any> | undefined;
54
- get runFunction(): (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T>;
54
+ get hasRunFunction(): boolean;
55
+ get runFunction(): (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T | undefined>;
55
56
  get isVisibleFunction(): ((ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>) | undefined;
56
57
  get isEnabledFunction(): ((ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>) | undefined;
57
58
  get actionName(): string;
@@ -75,7 +76,7 @@ export declare class ActionDescriptor<T> {
75
76
  get runNotificationErrorMessage(): string | undefined;
76
77
  withDataProvider(dataProvider: IDataProvider<T, any>): this;
77
78
  withServiceType<S>(serviceType: Type<S>): this;
78
- withRunFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<T>): this;
79
+ withRunFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<T | undefined>): this;
79
80
  withIsVisibleFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<boolean>): this;
80
81
  withIsEnabledFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<boolean>): this;
81
82
  withRouteTrigger(routeUrl: string): this;
@@ -89,7 +90,7 @@ export declare class ActionDescriptor<T> {
89
90
  * @param title Title i18n key or title.
90
91
  */
91
92
  withTitle(title: string | null): this;
92
- withIcon(icon: string): this;
93
+ withIcon(icon: string | null): this;
93
94
  withTooltip(tooltip: string | null): this;
94
95
  withClassName(className: string): this;
95
96
  withSize(size?: ActionDescriptor.SizeEnum): this;
@@ -109,7 +110,8 @@ export declare namespace ActionDescriptor {
109
110
  }
110
111
  export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
111
112
  private readonly _editorDescriptor;
112
- protected _editorTitle?: string;
113
+ private readonly _editorActions;
114
+ protected _editorTitle?: string | null;
113
115
  protected _hasFetchNotificationSuccess: boolean;
114
116
  protected _fetchNotificationSuccessTitle?: string;
115
117
  protected _fetchNotificationSuccessMessage?: string;
@@ -118,7 +120,7 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
118
120
  protected _submitFunction?: (ctx: ActionExecContext<T, any, IEditorDataProvider<T, any>>) => Observable<T>;
119
121
  protected _editorComponent?: Type<any>;
120
122
  constructor(editorDescriptor: EditorDescriptor<T>, actionName: string, parentType?: ClassType<any>, parentProperty?: string);
121
- get editorTitle(): string | undefined;
123
+ get editorTitle(): string | null | undefined;
122
124
  get editorDescriptor(): EditorDescriptor<T>;
123
125
  get hasFetchNotificationSuccess(): boolean;
124
126
  get fetchNotificationSuccessTitle(): string | undefined;
@@ -127,16 +129,30 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
127
129
  get runFunction(): (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T>;
128
130
  get fetchFunction(): (ctx: ActionExecContext<T, any, IEditorDataProvider<T, any>>) => Observable<T>;
129
131
  get submitFunction(): ((ctx: ActionExecContext<T, any, IEditorDataProvider<T, any>>) => Observable<T>) | undefined;
132
+ get editorActions(): ActionDescriptor<T>[];
130
133
  get editorComponent(): Type<any> | undefined;
131
- withEditorTitle(title: string): this;
134
+ withEditorTitle(title: string | null): this;
132
135
  withDataProvider(dataProvider: IEditorDataProvider<T, any>): this;
133
136
  withServiceType<S>(serviceType: Type<S>): this;
134
137
  withRunFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<T>): this;
135
138
  withFetchFunction<S>(fn: (ctx: ActionExecContext<T, S, IEditorDataProvider<T, S>>) => Observable<T>): this;
136
139
  withSubmitFunction<S>(fn: (ctx: ActionExecContext<T, S, IEditorDataProvider<T, S>>) => Observable<T>): this;
137
140
  withFetchNotificationError(title?: string, message?: string, hasNotification?: boolean): this;
141
+ withEditorAction(action: ActionDescriptor<T>): this;
138
142
  withEditorComponent(editorComponent: Type<any>): this;
139
143
  }
144
+ export declare class ActionEditorSubmitDescriptor<T> extends ActionDescriptor<T> {
145
+ private readonly _editorAction;
146
+ private readonly _submitType;
147
+ constructor(editorAction: ActionEditorDescriptor<T>, submitType?: ActionEditorSubmitDescriptor.TypeEnum);
148
+ get submitType(): ActionEditorSubmitDescriptor.TypeEnum;
149
+ }
150
+ export declare namespace ActionEditorSubmitDescriptor {
151
+ enum TypeEnum {
152
+ Submit = 0,
153
+ Cancel = 1
154
+ }
155
+ }
140
156
  export declare class ActionEditorDetailsDescriptor<T> extends ActionEditorDescriptor<T> {
141
157
  constructor(editorDescriptor: EditorDescriptor<T>);
142
158
  withServiceType<S>(serviceType: Type<S>): this;
@@ -162,7 +178,9 @@ export declare enum ActionPositionEnum {
162
178
  ToolbarRight = 1,
163
179
  TableHeader = 2,
164
180
  RowInline = 3,
165
- RowClick = 4
181
+ RowClick = 4,
182
+ FooterLeft = 5,
183
+ FooterRight = 6
166
184
  }
167
185
  export declare enum ActionActivationTriggerEnum {
168
186
  OnClick = 0,
@@ -170,7 +188,8 @@ export declare enum ActionActivationTriggerEnum {
170
188
  }
171
189
  export declare enum ActionTypeEnum {
172
190
  Direct = 0,
173
- Editor = 1
191
+ Event = 1,
192
+ Editor = 2
174
193
  }
175
194
  export declare enum ActionLevelEnum {
176
195
  Default = 0,
@@ -0,0 +1,12 @@
1
+ import { IdType } from '../types';
2
+ export interface MngError extends Error {
3
+ id?: IdType;
4
+ messageCode?: number | string;
5
+ message: string;
6
+ details?: any;
7
+ status?: number;
8
+ statusDescription?: string;
9
+ stack?: string;
10
+ url?: string;
11
+ cause?: Error;
12
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './enum.model';
2
+ export * from './error.model';
2
3
  export * from './menu.model';
3
4
  export * from './user.model';
4
5
  export * from './view-container.model';
@@ -8,8 +8,10 @@ import { ActionActivationResult, ActionData, ActionExecContext, ActionRunResult,
8
8
  import { MngTableCellClickEvent } from '../components/tableview/models';
9
9
  import { IDataProvider, IEditorDataProvider } from '../data-providers';
10
10
  import { ActionDescriptor, ActionEditorDescriptor } from '../descriptors';
11
- import { IViewContainer } from '../models/view-container.model';
11
+ import { IViewContainer } from '../models';
12
12
  import { IdType } from '../types';
13
+ import { MngErrorMapperService } from './error-mapper.service';
14
+ import { MngNavigationService } from './navigation.service';
13
15
  import * as i0 from "@angular/core";
14
16
  export declare class MngActionExecutorService {
15
17
  private injector;
@@ -17,8 +19,10 @@ export declare class MngActionExecutorService {
17
19
  private dialogService;
18
20
  private confirmationService;
19
21
  private translate;
22
+ private navigationService;
23
+ private errorMapper;
20
24
  private defaultEditorDialogComponent;
21
- constructor(injector: Injector, router: Router, dialogService: DialogService, confirmationService: ConfirmationService, translate: TranslateService, defaultEditorDialogComponent: Type<any>);
25
+ constructor(injector: Injector, router: Router, dialogService: DialogService, confirmationService: ConfirmationService, translate: TranslateService, navigationService: MngNavigationService, errorMapper: MngErrorMapperService, defaultEditorDialogComponent: Type<any>);
22
26
  prepareActionExecContext<T, S>(action: ActionDescriptor<T>, itemId?: IdType, item?: T, dataProvider?: IDataProvider<T, S>, viewContainer?: IViewContainer<T, S>, sourceComponent?: any, actionData?: ActionData): ActionExecContext<T, S, IDataProvider<T, S>>;
23
27
  runAction<T, S>(action: ActionDescriptor<T>, itemId?: IdType, item?: T, dataProvider?: IDataProvider<T, S>, sourceComponent?: any, viewContainer?: IViewContainer<T, S>, actionData?: ActionData): Observable<ActionRunResult<T, S, IDataProvider<T, S>>>;
24
28
  /**
@@ -88,6 +92,8 @@ export declare class MngActionExecutorService {
88
92
  * @param route Optional activated route.
89
93
  */
90
94
  triggerAction<T, S>(action: ActionDescriptor<T>, itemId?: IdType, item?: T, actionData?: ActionData, route?: ActivatedRoute, viewContainer?: IViewContainer<T, S>, sourceComponent?: any): Observable<ActionTriggerResult<T, S, IDataProvider<T, S>>>;
95
+ deactivateAction<T>(action: ActionDescriptor<T>): void;
96
+ private toMngActionError;
91
97
  static ɵfac: i0.ɵɵFactoryDeclaration<MngActionExecutorService, never>;
92
98
  static ɵprov: i0.ɵɵInjectableDeclaration<MngActionExecutorService>;
93
99
  }
@@ -0,0 +1,7 @@
1
+ import { MngError } from '../models';
2
+ export declare abstract class MngErrorMapperService {
3
+ abstract toMngError(error?: any, mngError?: MngError): MngError;
4
+ }
5
+ export declare class DefaultMngErrorMapperService extends MngErrorMapperService {
6
+ toMngError(error?: any, mngError?: MngError): MngError;
7
+ }
@@ -1,4 +1,6 @@
1
1
  export * from './action-executor.service';
2
2
  export * from './configuration.service';
3
3
  export * from './commons.service';
4
+ export * from './error-mapper.service';
4
5
  export * from './navigation.service';
6
+ export * from './view-container.component.service';
@@ -1,6 +1,7 @@
1
1
  import { TranslateService } from '@ngx-translate/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import { ActionDescriptor, ModelDescriptor } from '../descriptors';
4
+ import { MngError } from '../models';
4
5
  export declare class I18nUtil {
5
6
  static instantModelTranslation(translate: TranslateService, model: ModelDescriptor<any>, keyPath: string, customKey?: string, item?: any, fallbackKey?: string, i18nParams?: any): string | null;
6
7
  static getModelTabKey(model: ModelDescriptor<any>, tab: string): string;
@@ -11,6 +12,8 @@ export declare class I18nUtil {
11
12
  static getActionTranslation(translate: TranslateService, action: ActionDescriptor<any>, keyPath: string, customKey?: string, item?: any, fallbackKey?: string, oneTime?: boolean): Observable<string | null>;
12
13
  static getModelI18nParams(model: ModelDescriptor<any>, item: any, i18nModelName?: string, i18nParameters?: any): any;
13
14
  static getActionI18nParams(action: ActionDescriptor<any>, item: any, i18nModelName?: string, i18nParameters?: any, functionTitle?: string): any;
15
+ static instantErrorI18nTranslation(translate: TranslateService, error: MngError, i18nParameters?: any): string | null;
16
+ static getErrorI18nParams(error: MngError, i18nParameters?: any): any;
14
17
  static instantModelName(translate: TranslateService, model: ModelDescriptor<any>, singular?: boolean): string | null;
15
18
  static getModelName(translate: TranslateService, model: ModelDescriptor<any>, oneTime?: boolean, singular?: boolean): Observable<string | null>;
16
19
  static getModelNameKeys(model: ModelDescriptor<any>, singular?: boolean): string[];
@@ -1,11 +1,11 @@
1
1
  import { TranslateService } from '@ngx-translate/core';
2
2
  import { ActionDescriptor, TableDescriptor } from '../descriptors';
3
- import { IViewContainer } from '../models';
3
+ import { IViewContainer, MngError } from '../models';
4
4
  export declare class ToastUtil {
5
5
  static notification(viewContainer?: IViewContainer<any, any>, title?: string, message?: string, severity?: 'success' | 'warn' | 'error'): void;
6
6
  static tableNotificationError(translationService: TranslateService, table: TableDescriptor<any>, error: any, viewContainer?: IViewContainer<any, any>): void;
7
7
  static actionNotificationSuccess(translationService: TranslateService, action: ActionDescriptor<any>, functionName: string, customTitleKey?: string, customMessageKey?: string, viewContainer?: IViewContainer<any, any>, item?: any): void;
8
- static actionNotificationError(translationService: TranslateService, action: ActionDescriptor<any>, error: any, functionName: string, viewContainer?: IViewContainer<any, any>, item?: any): void;
8
+ static actionNotificationError(translationService: TranslateService, action: ActionDescriptor<any>, error: MngError, functionName: string, viewContainer?: IViewContainer<any, any>, item?: any): void;
9
9
  static getFormEditorWarningMessage(translationService: TranslateService, title: string, message: string): {
10
10
  severity: string;
11
11
  summary: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediusinc/mng-commons",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^13.1.0",
6
6
  "@angular/core": "^13.1.0",
@@ -1,5 +1,4 @@
1
1
  @import 'mixins';
2
- @import 'variables';
3
2
 
4
3
  .p-button {
5
4
  &.p-button-icon-only {
@@ -5,6 +5,7 @@
5
5
  @import './_theme_tableview';
6
6
  @import './_theme_dialog';
7
7
  @import './_theme_datepicker';
8
+ @import './_theme_toolbar';
8
9
 
9
10
  .p-tabview-title-error {
10
11
  color: $errorColor !important;
@@ -0,0 +1,5 @@
1
+ .p-toolbar {
2
+ &.mng-action-editor-toolbar {
3
+ border: none;
4
+ }
5
+ }
@@ -7,3 +7,6 @@ $primaryTextColor: #ffffff;
7
7
  $highlightBg: $primaryColor;
8
8
  $highlightTextColor: $primaryTextColor;
9
9
  $calendarHeaderTextColor: #ffffff; // white in light theme, black in dark theme
10
+
11
+ $scaleXS: 0.8 !default;
12
+ $scaleLG: 1.4 !default;
@@ -7,3 +7,6 @@ $primaryTextColor: #ffffff !default;
7
7
  $highlightBg: $primaryColor !default;
8
8
  $highlightTextColor: $primaryTextColor !default;
9
9
  $calendarHeaderTextColor: #000000; // black in light theme, white in dark theme
10
+
11
+ $scaleXS: 0.8 !default;
12
+ $scaleLG: 1.4 !default;
@@ -1,35 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { Subject } from 'rxjs';
3
- import * as i0 from "@angular/core";
4
- import * as i1 from "primeng/api";
5
- /**
6
- * Should be used with providers defined within component.
7
- */
8
- export class MngViewContainerComponentService {
9
- constructor(messageService) {
10
- this.messageService = messageService;
11
- this.actions = [];
12
- this._reloadTableSubject = new Subject();
13
- }
14
- set dataProvider(dataProvider) {
15
- this._dataProvider = dataProvider;
16
- }
17
- get reloadTable$() {
18
- return this._reloadTableSubject.asObservable();
19
- }
20
- triggerTableReload(event) {
21
- this._reloadTableSubject.next(event);
22
- }
23
- getMessageService() {
24
- return this.messageService;
25
- }
26
- getDataProvider() {
27
- return this._dataProvider;
28
- }
29
- }
30
- MngViewContainerComponentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngViewContainerComponentService, deps: [{ token: i1.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
31
- MngViewContainerComponentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngViewContainerComponentService });
32
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngViewContainerComponentService, decorators: [{
33
- type: Injectable
34
- }], ctorParameters: function () { return [{ type: i1.MessageService }]; } });
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW5nLXZpZXctY29udGFpbmVyLWNvbXBvbmVudC5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi9zZXJ2aWNlcy9tbmctdmlldy1jb250YWluZXItY29tcG9uZW50LnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFVBQVUsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUd6QyxPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sTUFBTSxDQUFDOzs7QUFNN0I7O0dBRUc7QUFFSCxNQUFNLE9BQU8sZ0NBQWdDO0lBTXpDLFlBQW9CLGNBQThCO1FBQTlCLG1CQUFjLEdBQWQsY0FBYyxDQUFnQjtRQUozQyxZQUFPLEdBQStCLEVBQUUsQ0FBQztRQUV4Qyx3QkFBbUIsR0FBaUIsSUFBSSxPQUFPLEVBQUUsQ0FBQztJQUVMLENBQUM7SUFFdEQsSUFBVyxZQUFZLENBQUMsWUFBaUM7UUFDckQsSUFBSSxDQUFDLGFBQWEsR0FBRyxZQUFZLENBQUM7SUFDdEMsQ0FBQztJQUVELElBQVcsWUF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