@mediusinc/mng-commons 3.0.0-rc.8 → 3.0.0

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 (84) hide show
  1. package/dev-scripts/version-info.js +13 -6
  2. package/esm2022/lib/components/action/models/action-execution.model.mjs +1 -1
  3. package/esm2022/lib/components/form/autocomplete/autocomplete.component.mjs +13 -2
  4. package/esm2022/lib/components/form/dropdown/dropdown.component.mjs +16 -5
  5. package/esm2022/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.mjs +22 -4
  6. package/esm2022/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +10 -3
  7. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +7 -5
  8. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +17 -8
  9. package/esm2022/lib/components/form/models/field-action-context.model.mjs +1 -1
  10. package/esm2022/lib/components/form/models/index.mjs +2 -1
  11. package/esm2022/lib/components/tableview/table/table.component.mjs +55 -53
  12. package/esm2022/lib/descriptors/action/action.descriptor.mjs +6 -6
  13. package/esm2022/lib/descriptors/editor/editor.descriptor.mjs +2 -2
  14. package/esm2022/lib/descriptors/editor/field.descriptor.mjs +13 -4
  15. package/esm2022/lib/descriptors/filter/filter.descriptor.mjs +4 -4
  16. package/esm2022/lib/descriptors/table/column.descriptor.mjs +2 -2
  17. package/esm2022/lib/descriptors/tableview/tableview.descriptor.mjs +2 -2
  18. package/esm2022/lib/error/error.handler.mjs +7 -10
  19. package/esm2022/lib/models/error.model.mjs +44 -2
  20. package/esm2022/lib/models/index.mjs +1 -2
  21. package/esm2022/lib/models/log.model.mjs +1 -1
  22. package/esm2022/lib/models/version.model.mjs +1 -1
  23. package/esm2022/lib/pipes/json-path.pipe.mjs +3 -62
  24. package/esm2022/lib/provide-commons.mjs +8 -3
  25. package/esm2022/lib/router/route-builder.mjs +3 -3
  26. package/esm2022/lib/router/routes-builder.mjs +2 -2
  27. package/esm2022/lib/services/action-error-mapper.service.mjs +3 -2
  28. package/esm2022/lib/services/action-executor.service.mjs +61 -36
  29. package/esm2022/lib/services/configuration.service.mjs +7 -13
  30. package/esm2022/lib/services/index.mjs +2 -1
  31. package/esm2022/lib/services/internal/commons-init.service.mjs +4 -3
  32. package/esm2022/lib/services/log-publisher-console.service.mjs +40 -0
  33. package/esm2022/lib/services/logger.service.mjs +57 -50
  34. package/esm2022/lib/services/tokens/index.mjs +2 -1
  35. package/esm2022/lib/services/tokens/log-publisher.token.mjs +3 -0
  36. package/esm2022/lib/services/version.service.mjs +7 -2
  37. package/esm2022/lib/utils/action-data-provider.util.mjs +7 -7
  38. package/esm2022/lib/utils/editor-formly.util.mjs +2 -1
  39. package/esm2022/lib/utils/error.util.mjs +247 -0
  40. package/esm2022/lib/utils/i18n.util.mjs +7 -9
  41. package/esm2022/lib/utils/index.mjs +2 -1
  42. package/esm2022/lib/utils/notification.util.mjs +1 -1
  43. package/esm2022/lib/utils/object.util.mjs +50 -1
  44. package/esm2022/lib/utils/route.util.mjs +2 -2
  45. package/esm2022/lib/utils/string.util.mjs +32 -1
  46. package/esm2022/lib/utils/tableview.util.mjs +2 -2
  47. package/esm2022/lib/utils/type.util.mjs +2 -2
  48. package/fesm2022/mediusinc-mng-commons.mjs +867 -457
  49. package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
  50. package/lib/components/action/models/action-execution.model.d.ts +2 -2
  51. package/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.d.ts +3 -0
  52. package/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +1 -0
  53. package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +1 -0
  54. package/lib/components/form/models/field-action-context.model.d.ts +7 -0
  55. package/lib/components/form/models/index.d.ts +1 -0
  56. package/lib/components/tableview/table/table.component.d.ts +2 -0
  57. package/lib/descriptors/editor/field.descriptor.d.ts +8 -6
  58. package/lib/descriptors/table/column.descriptor.d.ts +1 -1
  59. package/lib/models/error.model.d.ts +44 -9
  60. package/lib/models/index.d.ts +0 -1
  61. package/lib/models/log.model.d.ts +14 -8
  62. package/lib/models/version.model.d.ts +1 -1
  63. package/lib/pipes/json-path.pipe.d.ts +0 -1
  64. package/lib/services/action-error-mapper.service.d.ts +10 -3
  65. package/lib/services/action-executor.service.d.ts +3 -2
  66. package/lib/services/index.d.ts +1 -0
  67. package/lib/services/internal/commons-init.service.d.ts +1 -0
  68. package/lib/services/log-publisher-console.service.d.ts +4 -0
  69. package/lib/services/logger.service.d.ts +11 -8
  70. package/lib/services/tokens/index.d.ts +1 -0
  71. package/lib/services/tokens/log-publisher.token.d.ts +3 -0
  72. package/lib/services/version.service.d.ts +1 -0
  73. package/lib/utils/error.util.d.ts +116 -0
  74. package/lib/utils/i18n.util.d.ts +3 -3
  75. package/lib/utils/index.d.ts +1 -0
  76. package/lib/utils/notification.util.d.ts +2 -2
  77. package/lib/utils/object.util.d.ts +1 -0
  78. package/lib/utils/string.util.d.ts +5 -0
  79. package/package.json +4 -1
  80. package/scss/common/theme/designer/_components.scss +1 -1
  81. package/scss/mng-overrides/_theme_dialog.scss +7 -0
  82. package/scss/mng-overrides/_theme_tableview.scss +3 -0
  83. package/esm2022/lib/models/internal-error.model.mjs +0 -30
  84. package/lib/models/internal-error.model.d.ts +0 -26
@@ -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 { IActionEditorComponent, IViewContainer, MngError } from '../../../models';
8
+ import { IActionEditorComponent, IMngError, IViewContainer } from '../../../models';
9
9
  import { IdType } from '../../../types';
10
10
  export declare class ActionError {
11
11
  readonly error: any;
@@ -86,7 +86,7 @@ export declare class ActionContext<T, S> {
86
86
  executionStart(): void;
87
87
  executionNext(next: T | null | undefined, finish?: boolean): void;
88
88
  executionComplete(): void;
89
- executionError(err: MngError): void;
89
+ executionError(err: IMngError): void;
90
90
  finish(): void;
91
91
  isClosed(): boolean;
92
92
  }
@@ -1,13 +1,16 @@
1
1
  import { OnInit } from '@angular/core';
2
2
  import { FieldType } from '@ngx-formly/core';
3
3
  import { FieldActionDescriptor } from '../../../../../descriptors/editor';
4
+ import { FieldActionResultMessage } from '../../../models';
4
5
  import { MngFormlyFieldConfig } from '../../models';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class MngFormlyFieldActionComponent<ET> extends FieldType<MngFormlyFieldConfig> implements OnInit {
7
8
  descriptor: FieldActionDescriptor<ET>;
8
9
  buttonClass: string;
10
+ actionMessage?: FieldActionResultMessage;
9
11
  ngOnInit(): void;
10
12
  onClick(): void;
13
+ private processResult;
11
14
  static ɵfac: i0.ɵɵFactoryDeclaration<MngFormlyFieldActionComponent<any>, never>;
12
15
  static ɵcmp: i0.ɵɵComponentDeclaration<MngFormlyFieldActionComponent<any>, "mng-formly-field-action", never, {}, {}, never, never, true, never>;
13
16
  }
@@ -13,6 +13,7 @@ import * as i0 from "@angular/core";
13
13
  export declare class MngFormlyFieldLookupDialogComponent<T, ET> extends FieldType<MngFormlyFieldConfig> implements OnInit, AfterViewInit, OnDestroy {
14
14
  private injector;
15
15
  mngTable?: MngTableComponent<any, any>;
16
+ private readonly logger;
16
17
  descriptor: FieldLookupDescriptor<T, ET>;
17
18
  config: FieldLookupConfig;
18
19
  fieldLabelFormControl: FormControl;
@@ -9,6 +9,7 @@ import { MngFormlyFieldConfig } from '../../models';
9
9
  import * as i0 from "@angular/core";
10
10
  export declare class MngFormlyFieldTableDialogMultiselectComponent<T, ET> extends FieldType<MngFormlyFieldConfig> implements OnInit, AfterViewInit, OnDestroy {
11
11
  private injector;
12
+ private readonly logger;
12
13
  descriptor: FieldManyToManyEditorDescriptor<T, ET>;
13
14
  itemsSubject: Subject<Array<T>>;
14
15
  itemsAsync: Observable<Array<T>>;
@@ -15,3 +15,10 @@ export interface FieldActionContext<ET> {
15
15
  formState: any;
16
16
  };
17
17
  }
18
+ export interface FieldActionResult {
19
+ message?: FieldActionResultMessage;
20
+ }
21
+ export interface FieldActionResultMessage {
22
+ content: string;
23
+ severity?: 'success' | 'warn' | 'error';
24
+ }
@@ -1,2 +1,3 @@
1
+ export * from './field-action-context.model';
1
2
  export * from './form-editor.event';
2
3
  export * from './form-editor.interface';
@@ -27,6 +27,7 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
27
27
  private localStorageService;
28
28
  readonly filterDisplayRow: TableFilterDisplayEnum;
29
29
  readonly cmpTypeName = "MngTableComponent";
30
+ private readonly logger;
30
31
  initialDescriptor: TableDescriptor<T>;
31
32
  descriptor?: TableDescriptor<T>;
32
33
  items?: Observable<Array<T>> | Array<T>;
@@ -122,6 +123,7 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
122
123
  onTableColumnResize({ element }: any): void;
123
124
  private loadTableWithDataProvider;
124
125
  private loadTableFromRouteUpdate;
126
+ private setMainAndRelatedDescriptors;
125
127
  private updatePrimeSortAndFilter;
126
128
  private createFilterMeta;
127
129
  private createSortMeta;
@@ -5,8 +5,7 @@ import { Observable, Subject } from 'rxjs';
5
5
  import { MediusQueryParam, MediusQueryResult } from '../../api/models';
6
6
  import { AMngFormlyCustomFieldComponent } from '../../components/form/formly/fields/';
7
7
  import { MngFormlyFieldConfig, MngFormlyHookFn } from '../../components/form/formly/models';
8
- import { MngFormFieldEvent, MngFormFieldEventData, MngFormFieldEventTypeEnum } from '../../components/form/models';
9
- import { FieldActionContext } from '../../components/form/models/field-action-context.model';
8
+ import { FieldActionContext, FieldActionResult, MngFormFieldEvent, MngFormFieldEventData, MngFormFieldEventTypeEnum } from '../../components/form/models';
10
9
  import { ILookupDataProvider, ITableDataProvider } from '../../data-providers';
11
10
  import { EnumValue } from '../../models';
12
11
  import { StyleLevelEnum } from '../../styles/models';
@@ -201,7 +200,7 @@ export declare class FieldInputDescriptor<ET> extends AFieldDescriptor<string |
201
200
  get locale(): string | undefined;
202
201
  get currency(): string | undefined;
203
202
  get currencyFromProperty(): string | undefined;
204
- get currencyDisplay(): "symbol" | "code" | "name";
203
+ get currencyDisplay(): "symbol" | "name" | "code";
205
204
  asHidden(): this;
206
205
  asLabel(): this;
207
206
  asText(): this;
@@ -216,7 +215,7 @@ export declare class FieldInputDescriptor<ET> extends AFieldDescriptor<string |
216
215
  asFile(multiple?: boolean, maxFileSize?: number, accept?: string): this;
217
216
  asImageFile(multiple?: boolean, maxFileSize?: number, accept?: string): this;
218
217
  asImageUrl(multiple?: boolean, preview?: boolean, inputVisibleOnDisabled?: boolean): this;
219
- asCustomComponent(customComponent: string | Type<AMngFormlyCustomFieldComponent>, useWrappers?: string[], componentInputs?: Record<string, any>): this;
218
+ asCustomComponent(customComponent: string | Type<AMngFormlyCustomFieldComponent>, wrappers?: string[], componentInputs?: Record<string, any>): this;
220
219
  withNumberValidation(min?: number, max?: number, step?: number, autoCorrect?: boolean): this;
221
220
  withLocale(locale: string): this;
222
221
  withNumberFractions(min?: number, max?: number): this;
@@ -230,13 +229,16 @@ export declare class FieldActionDescriptor<ET> extends AFieldDescriptor<void, ET
230
229
  protected readonly _fieldActionName: string;
231
230
  protected readonly _fieldActionNameLong: string;
232
231
  protected _button: ActionButtonDescriptor;
233
- protected _runFunction?: (ctx: FieldActionContext<ET>) => void;
232
+ protected _runFunction?: (ctx: FieldActionContext<ET>) => void | FieldActionResult | Observable<FieldActionResult>;
233
+ private _wrappers;
234
234
  constructor(editor: EditorDescriptor<ET>, property: string);
235
235
  get button(): ActionButtonDescriptor;
236
- get runFunction(): ((ctx: FieldActionContext<ET>) => void) | undefined;
236
+ get runFunction(): ((ctx: FieldActionContext<ET>) => void | FieldActionResult | Observable<FieldActionResult>) | undefined;
237
+ get wrappers(): string[];
237
238
  withButtonDescriptor(button: ActionButtonDescriptor): this;
238
239
  withButton(label?: string | null, icon?: string | null, styleLevel?: StyleLevelEnum, styleText?: boolean): this;
239
240
  withRunFunction(fn: (ctx: FieldActionContext<ET>) => void): this;
241
+ withWrappers(wrappers: string[]): this;
240
242
  copy(): FieldActionDescriptor<ET>;
241
243
  }
242
244
  export declare class FieldLookupDescriptor<T, ET> extends AFieldDescriptor<T, ET> implements ILookupDescriptor<T> {
@@ -70,7 +70,7 @@ export declare class ColumnDescriptor<T, TT> {
70
70
  get customComponentType(): Type<IColumnValueComponent<TT>> | undefined;
71
71
  get locale(): string | undefined;
72
72
  get currencyCode(): string | undefined;
73
- get currencyDisplay(): "symbol" | "code" | "name" | undefined;
73
+ get currencyDisplay(): "symbol" | "name" | "code" | undefined;
74
74
  get currencyFromProperty(): string | undefined;
75
75
  get hasCopyToClipboard(): boolean;
76
76
  get template(): string | undefined;
@@ -1,15 +1,50 @@
1
- import { Message } from 'primeng/api';
2
- import { IdType } from '../types';
3
- export interface MngError extends Error {
4
- type: 'MngInternalError' | 'MngActionError';
5
- id?: IdType;
1
+ import { HttpErrorResponse } from '@angular/common/http';
2
+ import { ActionContext } from '../components/action/models';
3
+ export type MngErrorTypes = 'MngInternalError' | 'MngActionError' | 'MngHttpError';
4
+ /**
5
+ * Main use for mng error from action execution.
6
+ * If http error is thrown, add it in cause.
7
+ */
8
+ export interface IMngError extends Error {
9
+ type: MngErrorTypes;
6
10
  messageCode?: number | string;
7
11
  message: string;
8
- notification?: Message;
9
12
  details?: any;
10
- status?: number;
11
- statusDescription?: string;
12
13
  stack?: string;
13
- url?: string;
14
14
  cause?: Error | unknown;
15
15
  }
16
+ export interface MngErrorBaseOptions {
17
+ name?: string;
18
+ messageCode?: number | string;
19
+ details?: any;
20
+ cause?: Error;
21
+ stack?: string;
22
+ location?: string;
23
+ }
24
+ export declare abstract class AMngErrorBase extends Error implements IMngError {
25
+ abstract readonly type: MngErrorTypes;
26
+ readonly messageCode?: number | string;
27
+ readonly location?: string;
28
+ readonly details?: any;
29
+ protected constructor(message: string, options?: MngErrorBaseOptions);
30
+ }
31
+ export declare class MngInternalError extends AMngErrorBase implements IMngError {
32
+ readonly type = "MngInternalError";
33
+ constructor(message: string, options?: MngErrorBaseOptions);
34
+ }
35
+ export declare class MngHttpError extends AMngErrorBase implements IMngError {
36
+ readonly type = "MngHttpError";
37
+ readonly httpError: HttpErrorResponse;
38
+ constructor(message: string, httpError: HttpErrorResponse, options?: MngErrorBaseOptions);
39
+ }
40
+ export interface MngActionErrorOptions extends MngErrorBaseOptions {
41
+ actionContext?: ActionContext<any, any>;
42
+ httpError?: HttpErrorResponse;
43
+ }
44
+ export declare class MngActionError extends AMngErrorBase implements IMngError {
45
+ readonly type = "MngActionError";
46
+ readonly actionId: string;
47
+ readonly actionContext?: ActionContext<any, any>;
48
+ readonly httpError?: HttpErrorResponse;
49
+ constructor(message: string, actionName: string, options?: MngActionErrorOptions);
50
+ }
@@ -2,7 +2,6 @@ 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
5
  export * from './log.model';
7
6
  export * from './menu.model';
8
7
  export * from './user.model';
@@ -9,10 +9,12 @@ export declare enum LogLevelEnum {
9
9
  export interface MngLogEntry {
10
10
  level: LogLevelEnum;
11
11
  message: string;
12
- data: any[];
13
- category?: string;
12
+ messageDetails?: string;
14
13
  timestamp: Date;
15
14
  timestampFormatted?: string;
15
+ category?: string;
16
+ error?: Error;
17
+ data?: any[];
16
18
  }
17
19
  export interface MngLogConfig {
18
20
  level?: LogLevelEnum;
@@ -25,10 +27,14 @@ export interface MngLogConfig {
25
27
  }
26
28
  export interface IMngLoggerService {
27
29
  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;
30
+ trace(msgOrError: string | Error, ...data: any[]): void;
31
+ debug(msgOrError: string | Error, ...data: any[]): void;
32
+ log(msgOrError: string | Error, logLevel: LogLevelEnum, category: string | undefined, ...data: any[]): void;
33
+ logEntry(logEntry: Partial<MngLogEntry>): void;
34
+ info(msgOrError: string | Error, ...data: any[]): void;
35
+ warn(msgOrError: string | Error, ...data: any[]): void;
36
+ error(msgOrError: string | Error, ...data: any[]): void;
37
+ }
38
+ export interface IMngLogPublisher {
39
+ addEntry(entry: MngLogEntry): void;
34
40
  }
@@ -15,5 +15,5 @@ export interface VersionInfo {
15
15
  dirty: boolean;
16
16
  semver: string | null;
17
17
  raw: string;
18
- buildTimestamp: number;
18
+ buildTimestamp: number | null;
19
19
  }
@@ -7,7 +7,6 @@ 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;
11
10
  transform(value: any, path?: string): any;
12
11
  static ɵfac: i0.ɵɵFactoryDeclaration<JsonPathPipe, never>;
13
12
  static ɵpipe: i0.ɵɵPipeDeclaration<JsonPathPipe, "jsonPath", true>;
@@ -1,11 +1,18 @@
1
- import { MngError } from '../models';
1
+ import { IMngError } from '../models';
2
2
  /**
3
3
  * Service for transforming errors in action execution.
4
4
  * Can be used to transform errors to Commons MngError interface for correct error message display.
5
5
  */
6
6
  export declare abstract class MngActionErrorMapperService {
7
- abstract toMngError(error?: any, mngError?: MngError): MngError;
7
+ /**
8
+ * Can be used to enrich data from error and make it more "stable". Most use cases cover extracting message or message code of an
9
+ * error out of http response body/headers.
10
+ *
11
+ * @param error Original error (cause).
12
+ * @param mngError Commons mng error that wraps original error.
13
+ */
14
+ abstract toMngError(error?: any, mngError?: IMngError): IMngError;
8
15
  }
9
16
  export declare class DefaultActionMngErrorMapperService extends MngActionErrorMapperService {
10
- toMngError(error?: any, mngError?: MngError): MngError;
17
+ toMngError(error?: any, mngError?: IMngError): IMngError;
11
18
  }
@@ -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 { IActionEditorComponent, MngError } from '../models';
8
+ import { IActionEditorComponent, IMngError } from '../models';
9
9
  import { MngParametrizePipe } from '../pipes';
10
10
  import { MngActionErrorMapperService } from './action-error-mapper.service';
11
11
  import { MngCommonsService } from './commons.service';
@@ -158,10 +158,11 @@ export declare class MngActionExecutorService {
158
158
  /**
159
159
  * Transform error of any type to mng error by using error mapper that could be provided by final project.
160
160
  * @param error error of any type.
161
+ * @param context Action context.
161
162
  *
162
163
  * @return mapped MngError.
163
164
  */
164
- toMngActionError(error?: any): MngError;
165
+ toMngActionError(error?: any, context?: ActionContext<any, any>): IMngError;
165
166
  /**
166
167
  * Creates or gets existing action instance.
167
168
  * @param instance Action instance.
@@ -7,4 +7,5 @@ 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 './log-publisher-console.service';
10
11
  export * from './logger.service';
@@ -3,6 +3,7 @@ import * as i0 from "@angular/core";
3
3
  export declare class MngCommonsInitService {
4
4
  private readonly httpClient;
5
5
  private readonly logger;
6
+ private readonly logPublishers;
6
7
  private readonly config;
7
8
  private readonly mngCommons;
8
9
  private readonly mngRouter;
@@ -0,0 +1,4 @@
1
+ import { IMngLogPublisher, MngLogEntry } from '../models';
2
+ export declare class MngLogPublisherConsoleService implements IMngLogPublisher {
3
+ addEntry(entry: MngLogEntry): void;
4
+ }
@@ -1,9 +1,10 @@
1
- import { IMngLoggerService, LogLevelEnum } from '../models';
1
+ import { IMngLogPublisher, IMngLoggerService, LogLevelEnum, MngLogEntry } from '../models';
2
2
  import { MngConfigurationService } from './configuration.service';
3
3
  export declare class MngLoggerService implements IMngLoggerService {
4
4
  private static _instance;
5
5
  private static _isInit;
6
6
  private static _configurationService?;
7
+ private static _publishers;
7
8
  private static _entriesBuffer;
8
9
  private static _categoryInstances;
9
10
  private static _timestampFormat;
@@ -15,16 +16,18 @@ export declare class MngLoggerService implements IMngLoggerService {
15
16
  static configure(config: {
16
17
  timestampFormat?: string;
17
18
  }): void;
18
- static init(configurationService: MngConfigurationService): void;
19
+ static init(configurationService: MngConfigurationService, publishers: IMngLogPublisher[]): void;
19
20
  private static _flushBuffer;
20
21
  static create(category: string): MngLoggerService;
21
22
  create(category: string): MngLoggerService;
22
23
  private _processLog;
24
+ private _getTimestamps;
23
25
  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;
26
+ trace(msgOrError: string | Error, ...data: any[]): void;
27
+ debug(msgOrError: string | Error, ...data: any[]): void;
28
+ log(msgOrError: string | Error, logLevel?: LogLevelEnum, category?: string | undefined, ...data: any[]): void;
29
+ logEntry<E extends Partial<MngLogEntry>>(logEntry: E): void;
30
+ info(msgOrError: string | Error, ...data: any[]): void;
31
+ warn(msgOrError: string | Error, ...data: any[]): void;
32
+ error(msgOrError: string | Error, ...data: any[]): void;
30
33
  }
@@ -1,4 +1,5 @@
1
1
  export * from './browser-storage.token';
2
2
  export * from './commons-init.token';
3
3
  export * from './default-setting.token';
4
+ export * from './log-publisher.token';
4
5
  export * from './module-config.token';
@@ -0,0 +1,3 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { IMngLogPublisher } from '../../models';
3
+ export declare const MNG_LOG_PUBLISHERS: InjectionToken<IMngLogPublisher[]>;
@@ -5,6 +5,7 @@ import * as i0 from "@angular/core";
5
5
  export declare class MngVersionService {
6
6
  private http;
7
7
  private configurationService;
8
+ private readonly logger;
8
9
  private cache;
9
10
  constructor(http: HttpClient, configurationService: MngConfigurationService);
10
11
  loadVersion(path: string, baseConfigKey?: string, jsonPath?: string): Observable<unknown>;
@@ -0,0 +1,116 @@
1
+ import { HttpErrorResponse } from '@angular/common/http';
2
+ import { AMngErrorBase, LogLevelEnum, MngActionError } from '../models';
3
+ export declare class ErrorUtil {
4
+ /**
5
+ * Converts RxJS subscription error to MngError.
6
+ * @param error Error.
7
+ * @param name Optional name to write in mngError.
8
+ * @param details Optional details of error.
9
+ */
10
+ static fromSubscribeError(error: any, name?: string, details?: any): AMngErrorBase;
11
+ /**
12
+ * Checks if error is Http error (Angular or Mng).
13
+ * @param error
14
+ */
15
+ static isHttpErrorResponse(error: any): boolean | HttpErrorResponse | undefined;
16
+ /**
17
+ * Gets HttpErrorResponse from error (Angular or Mng).
18
+ * @param error Error.
19
+ */
20
+ static getHttpErrorResponse(error: any): HttpErrorResponse | null;
21
+ /**
22
+ * Gets HttpErrorResponse status from error (Angular or Mng).
23
+ * @param error Error.
24
+ */
25
+ static getHttpErrorResponseStatus(error: any): number | null;
26
+ /**
27
+ * Get error log level. All is error, except if error is http error with status >=400 and <500.
28
+ * @param error Error.
29
+ */
30
+ static getErrorLogLevel(error: any): LogLevelEnum;
31
+ /**
32
+ * Get error name (prototype name or type from mng error if name is not provided).
33
+ * @param error Error.
34
+ */
35
+ static getErrorName(error: any): string;
36
+ /**
37
+ * Writes http error to string with all headers and body.
38
+ * @param error Http response error.
39
+ * @param opts Options for hiding parts of error:
40
+ * - hideMessage Hides message of error (message include url, status and status text!).
41
+ * - hideHeaders Hides headers.
42
+ * - hideBody Hides JSON representation of body.
43
+ */
44
+ static httpErrorResponseToString(error: HttpErrorResponse, opts?: HttpErrorResponseToStringOptions): string;
45
+ /**
46
+ * Error to string.
47
+ * @param error Error.
48
+ * @param opts Options for hiding parts of error:
49
+ * - hideMessage Hides message of error.
50
+ * - hideName Hides error name.
51
+ * - hideCause Hides cause of an error (if present, see @link(errorCauseToString) for other options).
52
+ * - hideStack Hides stack of an error (if present).
53
+ * - hideDetails Hides JSON detail's representation of error (if present).
54
+ * - hideLocation Hides location (URL) where error was thrown.
55
+ * - hideHttp Hides http error portion of error if http error response (see @link(httpErrorResponseToString) for other options).
56
+ */
57
+ static errorToString(error: Error, opts?: ErrorToStringOptions): string;
58
+ /**
59
+ * Mng error to string.
60
+ * @param error Mng error.
61
+ * @param opts Options for hiding parts of error:
62
+ * - hideMessage Hides message of error.
63
+ * - hideName Hides error name.
64
+ * - hideCause Hides cause of an error (if present, see @link(errorCauseToString) for other options).
65
+ * - hideStack Hides stack of an error (if present).
66
+ * - hideDetails Hides JSON detail's representation of error (if present).
67
+ * - hideLocation Hides location (URL) where error was thrown.
68
+ * - hideHttp Hides http error portion of error if http error response (see @link(httpErrorResponseToString) for other options).
69
+ * - hideItems Hides all item information (http body, action context data).
70
+ * - hideActionData See @link(mngActionErrorContextToString) for additional info.
71
+ * - hideQueryParams See @link(mngActionErrorContextToString) for additional info.
72
+ */
73
+ static mngErrorToString(error: AMngErrorBase, opts?: MngErrorToStringOptions): string;
74
+ /**
75
+ * Writes Mng action error info from context as string.
76
+ * @param error Mng action error.
77
+ * @param opts Options for hiding parts of error:
78
+ * - hideItems Hides all item related information (item, form item, submit item, ...).
79
+ * - hideActionData Hides action data.
80
+ * - hideQueryParams Hides query params.
81
+ */
82
+ static mngActionErrorContextToString(error: MngActionError, opts?: MngActionErrorContextToStringOptions): string;
83
+ /**
84
+ * Writes cause of an error as string.
85
+ * @param error Error.
86
+ * @param opts Options for hiding parts of error:
87
+ * - causeOnErrorOnly Prints only if cause is instance of error.
88
+ * - causeAsJson Print error cause as a JSON (by default, if error only message and name will be printed).
89
+ */
90
+ static errorCauseToString(error: Error, opts?: ErrorCauseToStringOptions): string;
91
+ }
92
+ export type ErrorToStringOptions = MngErrorToStringOptions;
93
+ export type MngErrorToStringOptions = ErrorToStringOptionsBase & HttpErrorResponseToStringOptions & MngActionErrorContextToStringOptions & ErrorCauseToStringOptions & {
94
+ hideDetails?: boolean;
95
+ hideLocation?: boolean;
96
+ };
97
+ export interface ErrorToStringOptionsBase {
98
+ hideName?: boolean;
99
+ hideStack?: boolean;
100
+ hideCause?: boolean;
101
+ hideHttp?: boolean;
102
+ }
103
+ export interface HttpErrorResponseToStringOptions {
104
+ hideMessage?: boolean;
105
+ hideHeaders?: boolean;
106
+ hideBody?: boolean;
107
+ }
108
+ export interface MngActionErrorContextToStringOptions {
109
+ hideItems?: boolean;
110
+ hideActionData?: boolean;
111
+ hideQueryParams?: boolean;
112
+ }
113
+ export interface ErrorCauseToStringOptions {
114
+ causeOnErrorOnly?: boolean;
115
+ causeAsJson?: boolean;
116
+ }
@@ -2,7 +2,7 @@ import { TranslateService } from '@ngx-translate/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import { ModelDescriptor } from '../descriptors';
4
4
  import { ActionDescriptor, ActionEditorDescriptor } from '../descriptors/action';
5
- import { MngError } from '../models';
5
+ import { IMngError } from '../models';
6
6
  import { ClassType } from '../types';
7
7
  import { I18nType } from '../types/i18n.type';
8
8
  export declare namespace I18nUtils {
@@ -80,7 +80,7 @@ export declare namespace I18nUtils {
80
80
  private static getKeysByPriority;
81
81
  }
82
82
  class Error {
83
- static get(translate: TranslateService, error: MngError, params?: any): string | null;
84
- static getParams(error: MngError, params?: any): any;
83
+ static get(translate: TranslateService, error: IMngError, params?: any): string | null;
84
+ static getParams(error: IMngError, params?: any): any;
85
85
  }
86
86
  }
@@ -10,3 +10,4 @@ export * from './string.util';
10
10
  export * from './type.util';
11
11
  export * from './export.util';
12
12
  export * from './file.util';
13
+ export * from './error.util';
@@ -2,12 +2,12 @@ import { TranslateService } from '@ngx-translate/core';
2
2
  import { Message } from 'primeng/api';
3
3
  import { ActionDescriptor } from '../descriptors/action';
4
4
  import { TableDescriptor } from '../descriptors/table';
5
- import { IViewContainer, MngError } from '../models';
5
+ import { IMngError, IViewContainer } from '../models';
6
6
  export declare class NotificationUtil {
7
7
  static notification(viewContainer?: IViewContainer<any, any>, title?: string, message?: string, severity?: 'success' | 'warn' | 'error', icon?: string): Message;
8
8
  static tableNotificationError(translate: TranslateService, table: TableDescriptor<any>, error: any, viewContainer?: IViewContainer<any, any>): Message;
9
9
  static actionNotificationSuccess(translate: TranslateService, action: ActionDescriptor<any>, functionName: string, customTitleKey?: string, customMessageKey?: string, viewContainer?: IViewContainer<any, any>, item?: any): Message;
10
- static actionNotificationError(translate: TranslateService, action: ActionDescriptor<any>, error: MngError, functionName: string, viewContainer?: IViewContainer<any, any>, item?: any, severity?: 'warn' | 'error'): Message;
10
+ static actionNotificationError(translate: TranslateService, action: ActionDescriptor<any>, error: IMngError, functionName: string, viewContainer?: IViewContainer<any, any>, item?: any, severity?: 'warn' | 'error'): Message;
11
11
  static getFormEditorInfoMessage(translate: TranslateService, title: string, message: string, params?: any): Message;
12
12
  static getFormEditorWarningMessage(translate: TranslateService, title: string, message: string): Message;
13
13
  }
@@ -25,5 +25,6 @@ export declare class ObjectUtil {
25
25
  private static handleProp;
26
26
  static getProperties(obj: object): string[];
27
27
  static getGetters(obj: any): string[];
28
+ static getPropertyByPath(value: any, path: string): any | undefined;
28
29
  }
29
30
  export {};
@@ -1,4 +1,9 @@
1
1
  export declare class StringUtil {
2
2
  static escapeHtml(value: string): any;
3
3
  static escapeHtmlAny(value?: any): any;
4
+ /**
5
+ * Stringifies a value - primitives with toString, dates with dateUtil, objects with JSON.stringify.
6
+ * @param value Any value.
7
+ */
8
+ static stringify(value: any): string;
4
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediusinc/mng-commons",
3
- "version": "3.0.0-rc.8",
3
+ "version": "3.0.0",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.0.0",
6
6
  "@angular/common": "^16.0.0",
@@ -16,6 +16,9 @@
16
16
  "reflect-metadata": "^0.1.13",
17
17
  "tslib": "^2.5.0"
18
18
  },
19
+ "publishConfig": {
20
+ "directory": "dist"
21
+ },
19
22
  "sideEffects": false,
20
23
  "module": "fesm2022/mediusinc-mng-commons.mjs",
21
24
  "typings": "index.d.ts",
@@ -81,7 +81,7 @@
81
81
  //@import './components/menu/_tieredmenu';
82
82
 
83
83
  //Messages
84
- // @import './components/messages/_inlinemessage';
84
+ @import './components/messages/_inlinemessage';
85
85
  @import './components/messages/_message';
86
86
  @import 'components/messages/toast';
87
87
 
@@ -99,3 +99,10 @@
99
99
  }
100
100
  }
101
101
  }
102
+
103
+ .p-confirm-dialog {
104
+ .p-confirm-dialog-accept i,
105
+ .p-confirm-dialog-reject i {
106
+ margin-right: 0.5rem;
107
+ }
108
+ }
@@ -23,6 +23,9 @@
23
23
  .p-datatable-scrollable-table > .p-datatable-thead {
24
24
  z-index: 2;
25
25
  }
26
+ .p-datatable-loading-overlay {
27
+ z-index: 3;
28
+ }
26
29
 
27
30
  .p-datatable-header {
28
31
  text-align: left;