@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.
- package/dev-scripts/version-info.js +13 -6
- package/esm2022/lib/components/action/models/action-execution.model.mjs +1 -1
- package/esm2022/lib/components/form/autocomplete/autocomplete.component.mjs +13 -2
- package/esm2022/lib/components/form/dropdown/dropdown.component.mjs +16 -5
- package/esm2022/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.mjs +22 -4
- package/esm2022/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +10 -3
- package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +7 -5
- package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +17 -8
- package/esm2022/lib/components/form/models/field-action-context.model.mjs +1 -1
- package/esm2022/lib/components/form/models/index.mjs +2 -1
- package/esm2022/lib/components/tableview/table/table.component.mjs +55 -53
- package/esm2022/lib/descriptors/action/action.descriptor.mjs +6 -6
- package/esm2022/lib/descriptors/editor/editor.descriptor.mjs +2 -2
- package/esm2022/lib/descriptors/editor/field.descriptor.mjs +13 -4
- package/esm2022/lib/descriptors/filter/filter.descriptor.mjs +4 -4
- package/esm2022/lib/descriptors/table/column.descriptor.mjs +2 -2
- package/esm2022/lib/descriptors/tableview/tableview.descriptor.mjs +2 -2
- package/esm2022/lib/error/error.handler.mjs +7 -10
- package/esm2022/lib/models/error.model.mjs +44 -2
- package/esm2022/lib/models/index.mjs +1 -2
- package/esm2022/lib/models/log.model.mjs +1 -1
- package/esm2022/lib/models/version.model.mjs +1 -1
- package/esm2022/lib/pipes/json-path.pipe.mjs +3 -62
- package/esm2022/lib/provide-commons.mjs +8 -3
- package/esm2022/lib/router/route-builder.mjs +3 -3
- package/esm2022/lib/router/routes-builder.mjs +2 -2
- package/esm2022/lib/services/action-error-mapper.service.mjs +3 -2
- package/esm2022/lib/services/action-executor.service.mjs +61 -36
- package/esm2022/lib/services/configuration.service.mjs +7 -13
- package/esm2022/lib/services/index.mjs +2 -1
- package/esm2022/lib/services/internal/commons-init.service.mjs +4 -3
- package/esm2022/lib/services/log-publisher-console.service.mjs +40 -0
- package/esm2022/lib/services/logger.service.mjs +57 -50
- package/esm2022/lib/services/tokens/index.mjs +2 -1
- package/esm2022/lib/services/tokens/log-publisher.token.mjs +3 -0
- package/esm2022/lib/services/version.service.mjs +7 -2
- package/esm2022/lib/utils/action-data-provider.util.mjs +7 -7
- package/esm2022/lib/utils/editor-formly.util.mjs +2 -1
- package/esm2022/lib/utils/error.util.mjs +247 -0
- package/esm2022/lib/utils/i18n.util.mjs +7 -9
- package/esm2022/lib/utils/index.mjs +2 -1
- package/esm2022/lib/utils/notification.util.mjs +1 -1
- package/esm2022/lib/utils/object.util.mjs +50 -1
- package/esm2022/lib/utils/route.util.mjs +2 -2
- package/esm2022/lib/utils/string.util.mjs +32 -1
- package/esm2022/lib/utils/tableview.util.mjs +2 -2
- package/esm2022/lib/utils/type.util.mjs +2 -2
- package/fesm2022/mediusinc-mng-commons.mjs +867 -457
- package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/action/models/action-execution.model.d.ts +2 -2
- package/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.d.ts +3 -0
- package/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +1 -0
- package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +1 -0
- package/lib/components/form/models/field-action-context.model.d.ts +7 -0
- package/lib/components/form/models/index.d.ts +1 -0
- package/lib/components/tableview/table/table.component.d.ts +2 -0
- package/lib/descriptors/editor/field.descriptor.d.ts +8 -6
- package/lib/descriptors/table/column.descriptor.d.ts +1 -1
- package/lib/models/error.model.d.ts +44 -9
- package/lib/models/index.d.ts +0 -1
- package/lib/models/log.model.d.ts +14 -8
- package/lib/models/version.model.d.ts +1 -1
- package/lib/pipes/json-path.pipe.d.ts +0 -1
- package/lib/services/action-error-mapper.service.d.ts +10 -3
- package/lib/services/action-executor.service.d.ts +3 -2
- package/lib/services/index.d.ts +1 -0
- package/lib/services/internal/commons-init.service.d.ts +1 -0
- package/lib/services/log-publisher-console.service.d.ts +4 -0
- package/lib/services/logger.service.d.ts +11 -8
- package/lib/services/tokens/index.d.ts +1 -0
- package/lib/services/tokens/log-publisher.token.d.ts +3 -0
- package/lib/services/version.service.d.ts +1 -0
- package/lib/utils/error.util.d.ts +116 -0
- package/lib/utils/i18n.util.d.ts +3 -3
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/notification.util.d.ts +2 -2
- package/lib/utils/object.util.d.ts +1 -0
- package/lib/utils/string.util.d.ts +5 -0
- package/package.json +4 -1
- package/scss/common/theme/designer/_components.scss +1 -1
- package/scss/mng-overrides/_theme_dialog.scss +7 -0
- package/scss/mng-overrides/_theme_tableview.scss +3 -0
- package/esm2022/lib/models/internal-error.model.mjs +0 -30
- package/lib/models/internal-error.model.d.ts +0 -26
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i2$1 from '@angular/common';
|
|
2
|
-
import { DatePipe, AsyncPipe, NgIf, NgForOf, NgSwitch, NgSwitchCase, NgSwitchDefault, DecimalPipe, CurrencyPipe, NgClass, NgStyle, NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
2
|
+
import { DatePipe, AsyncPipe, NgIf, NgForOf, NgSwitch, NgSwitchCase, NgSwitchDefault, DecimalPipe, CurrencyPipe, NgClass, NgStyle, NgTemplateOutlet, JsonPipe, CommonModule } from '@angular/common';
|
|
3
3
|
import * as i1$1 from '@angular/common/http';
|
|
4
4
|
import { HttpErrorResponse, HttpClient, HttpClientModule, HttpParams } from '@angular/common/http';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
@@ -82,11 +82,14 @@ import { PrimeNGConfig, FilterService, FilterMatchMode, ConfirmationService, Mes
|
|
|
82
82
|
import * as i11 from 'primeng/menu';
|
|
83
83
|
import { MenuModule } from 'primeng/menu';
|
|
84
84
|
import { isObservable, throwError, BehaviorSubject, Subject, ReplaySubject, distinctUntilChanged, take, mergeMap, of, combineLatest, switchMap, from, timeout, tap, Observable, debounceTime, merge } from 'rxjs';
|
|
85
|
-
import { filter, map, catchError, first, mergeMap as mergeMap$1, take as take$1
|
|
85
|
+
import { filter, map, startWith, catchError, first, mergeMap as mergeMap$1, take as take$1 } from 'rxjs/operators';
|
|
86
|
+
import { logger } from 'nx/src/utils/logger';
|
|
86
87
|
import 'reflect-metadata';
|
|
87
88
|
import { Title, DomSanitizer } from '@angular/platform-browser';
|
|
88
89
|
import { ZIndexUtils } from 'primeng/utils';
|
|
89
90
|
import { TimesIcon } from 'primeng/icons/times';
|
|
91
|
+
import * as i5$2 from 'primeng/message';
|
|
92
|
+
import { MessageModule } from 'primeng/message';
|
|
90
93
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
91
94
|
|
|
92
95
|
/**
|
|
@@ -324,33 +327,47 @@ const typeMapBase = {
|
|
|
324
327
|
QueryParam: MediusQueryParam
|
|
325
328
|
};
|
|
326
329
|
|
|
327
|
-
class
|
|
328
|
-
constructor(message,
|
|
330
|
+
class AMngErrorBase extends Error {
|
|
331
|
+
constructor(message, options) {
|
|
329
332
|
super(message);
|
|
330
|
-
this.
|
|
331
|
-
this.name = name;
|
|
332
|
-
this.id = options?.id;
|
|
333
|
+
this.name = options?.name ?? 'MngError';
|
|
333
334
|
this.messageCode = options?.messageCode;
|
|
334
|
-
this.
|
|
335
|
-
this.details = options?.details;
|
|
336
|
-
this.status = options?.status;
|
|
337
|
-
this.statusDescription = options?.statusDescription;
|
|
338
|
-
this.url = options?.url;
|
|
335
|
+
this.location = options?.location ?? window?.location?.href;
|
|
339
336
|
this.cause = options?.cause;
|
|
340
337
|
this.stack = options?.stack ?? (options?.cause ? options.cause.stack : new Error(message).stack);
|
|
338
|
+
this.details = options?.details;
|
|
341
339
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
return message;
|
|
340
|
+
}
|
|
341
|
+
class MngInternalError extends AMngErrorBase {
|
|
342
|
+
constructor(message, options) {
|
|
343
|
+
super(message, {
|
|
344
|
+
name: 'MngInternalError',
|
|
345
|
+
...options
|
|
346
|
+
});
|
|
347
|
+
this.type = 'MngInternalError';
|
|
351
348
|
}
|
|
352
|
-
|
|
353
|
-
|
|
349
|
+
}
|
|
350
|
+
class MngHttpError extends AMngErrorBase {
|
|
351
|
+
constructor(message, httpError, options) {
|
|
352
|
+
super(message, {
|
|
353
|
+
name: 'MngHttpError_' + httpError.url,
|
|
354
|
+
cause: httpError,
|
|
355
|
+
...options
|
|
356
|
+
});
|
|
357
|
+
this.type = 'MngHttpError';
|
|
358
|
+
this.httpError = httpError;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
class MngActionError extends AMngErrorBase {
|
|
362
|
+
constructor(message, actionName, options) {
|
|
363
|
+
super(message, {
|
|
364
|
+
name: 'MngActionError_' + actionName,
|
|
365
|
+
...options
|
|
366
|
+
});
|
|
367
|
+
this.type = 'MngActionError';
|
|
368
|
+
this.actionId = actionName;
|
|
369
|
+
this.actionContext = options?.actionContext;
|
|
370
|
+
this.httpError = options?.httpError;
|
|
354
371
|
}
|
|
355
372
|
}
|
|
356
373
|
|
|
@@ -373,11 +390,11 @@ class ActionDataProviderUtil {
|
|
|
373
390
|
const serviceExec = ActionDataProviderUtil.runGetAllService(ctx);
|
|
374
391
|
return isObservable(serviceExec)
|
|
375
392
|
? serviceExec
|
|
376
|
-
: throwError(() => new
|
|
393
|
+
: throwError(() => new MngActionError(`Data provider and service instance could not extract fetch function to execute in action ${ctx.instance.action.actionNameLong} (${ctx.instance.action.model?.typeName}) for item id ${ctx.parameters?.itemId}.`, ctx.contextLongName, { actionContext: ctx }));
|
|
377
394
|
}
|
|
378
395
|
static runFetchOrFail(ctx) {
|
|
379
396
|
return (ActionDataProviderUtil.runFetch(ctx) ??
|
|
380
|
-
throwError(() => new
|
|
397
|
+
throwError(() => new MngActionError(`Data provider and service instance could not extract fetch function to execute in action ${ctx.instance.action.actionNameLong} (${ctx.instance.action.model?.typeName}) for item id ${ctx.parameters?.itemId}.`, ctx.contextLongName, { actionContext: ctx })));
|
|
381
398
|
}
|
|
382
399
|
static runFetch(ctx, fallback) {
|
|
383
400
|
const dataProviderExec = ActionDataProviderUtil.runFetchDataProvider(ctx);
|
|
@@ -389,7 +406,7 @@ class ActionDataProviderUtil {
|
|
|
389
406
|
}
|
|
390
407
|
static runCreateOrFail(ctx) {
|
|
391
408
|
return (ActionDataProviderUtil.runCreate(ctx) ??
|
|
392
|
-
throwError(() => new
|
|
409
|
+
throwError(() => new MngActionError(`Data provider and service instance could not extract create function to execute in action ${ctx.instance.action.actionNameLong} (${ctx.instance.action.model?.typeName}) for item ${ctx.parameters?.item}.`, ctx.contextLongName, { actionContext: ctx })));
|
|
393
410
|
}
|
|
394
411
|
static runCreate(ctx, fallback) {
|
|
395
412
|
const dataProviderExec = ActionDataProviderUtil.runCreateDataProvider(ctx);
|
|
@@ -401,7 +418,7 @@ class ActionDataProviderUtil {
|
|
|
401
418
|
}
|
|
402
419
|
static runUpdateOrFail(ctx) {
|
|
403
420
|
return (ActionDataProviderUtil.runUpdate(ctx) ??
|
|
404
|
-
throwError(() => new
|
|
421
|
+
throwError(() => new MngActionError(`Data provider and service instance could not extract update function to execute in action ${ctx.instance.action.actionNameLong} (${ctx.instance.action.model?.typeName}) for item id ${ctx.parameters?.itemId}.`, ctx.contextLongName, { actionContext: ctx })));
|
|
405
422
|
}
|
|
406
423
|
static runUpdate(ctx, fallback) {
|
|
407
424
|
const dataProviderExec = ActionDataProviderUtil.runUpdateDataProvider(ctx);
|
|
@@ -419,7 +436,7 @@ class ActionDataProviderUtil {
|
|
|
419
436
|
const serviceExec = ActionDataProviderUtil.runDeleteService(ctx);
|
|
420
437
|
return isObservable(serviceExec)
|
|
421
438
|
? serviceExec
|
|
422
|
-
: throwError(() => new
|
|
439
|
+
: throwError(() => new MngActionError(`Data provider and service instance could not extract delete function to execute in action ${ctx.instance.action.actionNameLong} (${ctx.instance.action.model?.typeName}) for item id ${ctx.parameters?.itemId}.`, ctx.contextLongName, { actionContext: ctx }));
|
|
423
440
|
}
|
|
424
441
|
static runGetAllService(ctx) {
|
|
425
442
|
if (typeof ctx.serviceInstance !== 'undefined') {
|
|
@@ -1200,67 +1217,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
1200
1217
|
* - Array notation (e.g.: [0])
|
|
1201
1218
|
*/
|
|
1202
1219
|
class JsonPathPipe {
|
|
1203
|
-
constructor() {
|
|
1204
|
-
this.logger = MngLoggerService.get().create('JsonPathPipe');
|
|
1205
|
-
}
|
|
1206
1220
|
transform(value, path = '') {
|
|
1207
|
-
|
|
1208
|
-
// only return the root
|
|
1209
|
-
return value;
|
|
1210
|
-
}
|
|
1211
|
-
// Check for leading root object notation
|
|
1212
|
-
if (path.startsWith('$')) {
|
|
1213
|
-
path = path.substring(1);
|
|
1214
|
-
}
|
|
1215
|
-
// Check for leading .
|
|
1216
|
-
if (path.startsWith('.')) {
|
|
1217
|
-
path = path.substring(1);
|
|
1218
|
-
}
|
|
1219
|
-
if (path.indexOf('.') >= 0) {
|
|
1220
|
-
const pathSplit = path.split('.');
|
|
1221
|
-
let currValue = value;
|
|
1222
|
-
for (const p of pathSplit) {
|
|
1223
|
-
if (typeof currValue === 'undefined' || currValue === null) {
|
|
1224
|
-
return currValue;
|
|
1225
|
-
}
|
|
1226
|
-
if (!p.length) {
|
|
1227
|
-
// empty path, return current value
|
|
1228
|
-
return currValue;
|
|
1229
|
-
}
|
|
1230
|
-
const leftBracketIdx = p.indexOf('[');
|
|
1231
|
-
if (leftBracketIdx >= 0 && p.endsWith(']')) {
|
|
1232
|
-
// should be reference to array
|
|
1233
|
-
const arrayPath = p.substring(0, leftBracketIdx);
|
|
1234
|
-
const arrayIdx = +p.substring(leftBracketIdx + 1, p.length - 1);
|
|
1235
|
-
const array = currValue[arrayPath];
|
|
1236
|
-
if (Array.isArray(array)) {
|
|
1237
|
-
if (arrayIdx >= 0 && arrayIdx < array.length) {
|
|
1238
|
-
// valid index, continue on the path
|
|
1239
|
-
currValue = array[arrayIdx];
|
|
1240
|
-
continue;
|
|
1241
|
-
}
|
|
1242
|
-
else {
|
|
1243
|
-
this.logger?.warn(`Path ${path} array index at ${p} is not within valid array range`, value);
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
else {
|
|
1247
|
-
this.logger?.warn(`Path ${path} array at ${p} is not a valid array`, value);
|
|
1248
|
-
}
|
|
1249
|
-
return undefined;
|
|
1250
|
-
}
|
|
1251
|
-
else if (typeof currValue === 'object') {
|
|
1252
|
-
currValue = currValue[p];
|
|
1253
|
-
}
|
|
1254
|
-
else {
|
|
1255
|
-
this.logger?.warn(`Path ${path} is not valid for object`, value);
|
|
1256
|
-
return currValue;
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
return currValue;
|
|
1260
|
-
}
|
|
1261
|
-
else {
|
|
1262
|
-
return value[path];
|
|
1263
|
-
}
|
|
1221
|
+
return ObjectUtil.getPropertyByPath(value, path);
|
|
1264
1222
|
}
|
|
1265
1223
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: JsonPathPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1266
1224
|
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: JsonPathPipe, isStandalone: true, name: "jsonPath" }); }
|
|
@@ -1575,17 +1533,18 @@ class DefaultActionMngErrorMapperService extends MngActionErrorMapperService {
|
|
|
1575
1533
|
mngError = {
|
|
1576
1534
|
type: 'MngActionError',
|
|
1577
1535
|
name: error?.name ?? 'UnknownError',
|
|
1578
|
-
message: error.message ?? 'Unknown error'
|
|
1536
|
+
message: error.message ?? 'Unknown error',
|
|
1537
|
+
cause: error
|
|
1579
1538
|
};
|
|
1580
1539
|
}
|
|
1581
1540
|
return mngError;
|
|
1582
1541
|
}
|
|
1583
1542
|
}
|
|
1584
1543
|
|
|
1585
|
-
/* eslint-disable no-console */
|
|
1586
1544
|
class MngLoggerService {
|
|
1587
1545
|
static { this._instance = new MngLoggerService(); }
|
|
1588
1546
|
static { this._isInit = false; }
|
|
1547
|
+
static { this._publishers = []; }
|
|
1589
1548
|
static { this._entriesBuffer = []; }
|
|
1590
1549
|
static { this._categoryInstances = {}; }
|
|
1591
1550
|
static { this._timestampFormat = 'yyyy-MM-dd HH:mm:ss.SSS'; }
|
|
@@ -1603,15 +1562,19 @@ class MngLoggerService {
|
|
|
1603
1562
|
MngLoggerService._timestampFormat = config.timestampFormat;
|
|
1604
1563
|
}
|
|
1605
1564
|
}
|
|
1606
|
-
static init(configurationService) {
|
|
1565
|
+
static init(configurationService, publishers) {
|
|
1607
1566
|
if (MngLoggerService._isInit) {
|
|
1608
1567
|
return;
|
|
1609
1568
|
}
|
|
1610
1569
|
MngLoggerService._configurationService = configurationService;
|
|
1570
|
+
MngLoggerService._publishers = publishers;
|
|
1611
1571
|
MngLoggerService._isInit = true;
|
|
1612
1572
|
MngLoggerService._flushBuffer();
|
|
1613
1573
|
}
|
|
1614
1574
|
static _flushBuffer() {
|
|
1575
|
+
if (!MngLoggerService._isInit) {
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1615
1578
|
MngLoggerService._entriesBuffer.forEach(e => this._instance._log(e));
|
|
1616
1579
|
MngLoggerService._entriesBuffer = [];
|
|
1617
1580
|
}
|
|
@@ -1630,26 +1593,38 @@ class MngLoggerService {
|
|
|
1630
1593
|
MngLoggerService._categoryInstances[category] = logger;
|
|
1631
1594
|
return logger;
|
|
1632
1595
|
}
|
|
1633
|
-
_processLog(
|
|
1634
|
-
const timestamp =
|
|
1635
|
-
const
|
|
1636
|
-
const log = {
|
|
1596
|
+
_processLog(msgOrError, logLevel, category = undefined, data) {
|
|
1597
|
+
const [timestamp, timestampFormatted] = [...this._getTimestamps()];
|
|
1598
|
+
const logEntry = {
|
|
1637
1599
|
level: logLevel,
|
|
1638
|
-
message:
|
|
1600
|
+
message: typeof msgOrError === 'string' ? msgOrError : msgOrError.message,
|
|
1639
1601
|
data: data,
|
|
1640
|
-
category: category,
|
|
1602
|
+
category: this.category ?? category,
|
|
1641
1603
|
timestamp: timestamp,
|
|
1642
1604
|
timestampFormatted: timestampFormatted ?? undefined
|
|
1643
1605
|
};
|
|
1644
|
-
if (
|
|
1645
|
-
//
|
|
1646
|
-
|
|
1606
|
+
if (msgOrError instanceof Error) {
|
|
1607
|
+
// set error from message param
|
|
1608
|
+
logEntry.error = msgOrError;
|
|
1647
1609
|
}
|
|
1648
|
-
else {
|
|
1649
|
-
|
|
1610
|
+
else if (data?.length && data[0] instanceof Error) {
|
|
1611
|
+
// if first data is error, also consider as error
|
|
1612
|
+
logEntry.error = data[0];
|
|
1613
|
+
logEntry.data = data.splice(1);
|
|
1650
1614
|
}
|
|
1615
|
+
this._log(logEntry);
|
|
1616
|
+
}
|
|
1617
|
+
_getTimestamps() {
|
|
1618
|
+
const timestamp = new Date();
|
|
1619
|
+
const timestampFormatted = this.datePipe.transform(timestamp, MngLoggerService._timestampFormat) ?? DateUtil.toIsoString(timestamp, false, true, true);
|
|
1620
|
+
return [timestamp, timestampFormatted];
|
|
1651
1621
|
}
|
|
1652
1622
|
_log(log) {
|
|
1623
|
+
if (!MngLoggerService._isInit) {
|
|
1624
|
+
// add to buffer
|
|
1625
|
+
MngLoggerService._entriesBuffer.push(log);
|
|
1626
|
+
return;
|
|
1627
|
+
}
|
|
1653
1628
|
const logConfig = (MngLoggerService._configurationService?.getConfigValue)?.('log');
|
|
1654
1629
|
if ((this.category && log.level < (logConfig?.category?.[this.category]?.level ?? logConfig?.level ?? this.defaultLogLevel)) ||
|
|
1655
1630
|
(!this.category && log.level < (logConfig?.level ?? this.defaultLogLevel))) {
|
|
@@ -1658,48 +1633,38 @@ class MngLoggerService {
|
|
|
1658
1633
|
if (logConfig?.timestampFormat) {
|
|
1659
1634
|
log.timestampFormatted = this.datePipe.transform(log.timestamp, logConfig.timestampFormat) ?? undefined;
|
|
1660
1635
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
switch (log.level) {
|
|
1666
|
-
case LogLevelEnum.Trace:
|
|
1667
|
-
console.trace(prefix, log.message, ...log.data);
|
|
1668
|
-
break;
|
|
1669
|
-
case LogLevelEnum.Debug:
|
|
1670
|
-
console.debug(prefix, log.message, ...log.data);
|
|
1671
|
-
break;
|
|
1672
|
-
case LogLevelEnum.Log:
|
|
1673
|
-
console.log(prefix, log.message, ...log.data);
|
|
1674
|
-
break;
|
|
1675
|
-
case LogLevelEnum.Info:
|
|
1676
|
-
console.info(prefix, log.message, ...log.data);
|
|
1677
|
-
break;
|
|
1678
|
-
case LogLevelEnum.Warning:
|
|
1679
|
-
console.warn(prefix, log.message, ...log.data);
|
|
1680
|
-
break;
|
|
1681
|
-
case LogLevelEnum.Error:
|
|
1682
|
-
console.error(prefix, log.message, ...log.data);
|
|
1683
|
-
break;
|
|
1684
|
-
}
|
|
1636
|
+
MngLoggerService._publishers.forEach(p => p.addEntry(log));
|
|
1637
|
+
}
|
|
1638
|
+
trace(msgOrError, ...data) {
|
|
1639
|
+
this._processLog(msgOrError, LogLevelEnum.Trace, undefined, data);
|
|
1685
1640
|
}
|
|
1686
|
-
|
|
1687
|
-
this._processLog(
|
|
1641
|
+
debug(msgOrError, ...data) {
|
|
1642
|
+
this._processLog(msgOrError, LogLevelEnum.Debug, undefined, data);
|
|
1688
1643
|
}
|
|
1689
|
-
|
|
1690
|
-
this._processLog(
|
|
1644
|
+
log(msgOrError, logLevel = LogLevelEnum.Log, category = undefined, ...data) {
|
|
1645
|
+
this._processLog(msgOrError, logLevel, category, data);
|
|
1691
1646
|
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1647
|
+
logEntry(logEntry) {
|
|
1648
|
+
const [timestamp, timestampFormatted] = [...this._getTimestamps()];
|
|
1649
|
+
const logEntryFinal = {
|
|
1650
|
+
timestamp: timestamp,
|
|
1651
|
+
timestampFormatted: timestampFormatted ?? undefined,
|
|
1652
|
+
category: this.category ?? logEntry.category,
|
|
1653
|
+
message: '',
|
|
1654
|
+
messageDetails: logEntry.messageDetails,
|
|
1655
|
+
level: LogLevelEnum.Log,
|
|
1656
|
+
...logEntry
|
|
1657
|
+
};
|
|
1658
|
+
this._log(logEntryFinal);
|
|
1694
1659
|
}
|
|
1695
|
-
info(
|
|
1696
|
-
this._processLog(
|
|
1660
|
+
info(msgOrError, ...data) {
|
|
1661
|
+
this._processLog(msgOrError, LogLevelEnum.Info, undefined, data);
|
|
1697
1662
|
}
|
|
1698
|
-
warn(
|
|
1699
|
-
this._processLog(
|
|
1663
|
+
warn(msgOrError, ...data) {
|
|
1664
|
+
this._processLog(msgOrError, LogLevelEnum.Warning, undefined, data);
|
|
1700
1665
|
}
|
|
1701
|
-
error(
|
|
1702
|
-
this._processLog(
|
|
1666
|
+
error(msgOrError, ...data) {
|
|
1667
|
+
this._processLog(msgOrError, LogLevelEnum.Error, undefined, data);
|
|
1703
1668
|
}
|
|
1704
1669
|
}
|
|
1705
1670
|
|
|
@@ -1712,6 +1677,8 @@ const MNG_COMMONS_INITIALIZER_IT = new InjectionToken('MNG Commons Initializer')
|
|
|
1712
1677
|
|
|
1713
1678
|
const ACTION_EDITOR_DIALOG_COMPONENT_SETTING = new InjectionToken('ACTION_EDITOR_DIALOG_COMPONENT_SETTING');
|
|
1714
1679
|
|
|
1680
|
+
const MNG_LOG_PUBLISHERS = new InjectionToken('MNG_LOG_PUBLISHERS');
|
|
1681
|
+
|
|
1715
1682
|
const MNG_MODULE_CONFIG_IT = new InjectionToken('MngModuleConfig');
|
|
1716
1683
|
|
|
1717
1684
|
class MngCommonsService {
|
|
@@ -2419,10 +2386,11 @@ class MngActionExecutorService {
|
|
|
2419
2386
|
.withActionData(ctx.parameters.actionData)
|
|
2420
2387
|
.withRoute(ctx.parameters.route)
|
|
2421
2388
|
.withSourceComponent(ctx.parameters.sourceComponent)
|
|
2422
|
-
.withViewContainer(ctx.parameters.viewContainer), undefined, ctx.instance);
|
|
2389
|
+
.withViewContainer(ctx.parameters.viewContainer), undefined, ctx.instance, true);
|
|
2423
2390
|
ctx.instance.nextActionInstance = nextActionInstance;
|
|
2424
2391
|
// finish current action when next action finishes
|
|
2425
|
-
return nextActionInstance.state$.pipe(
|
|
2392
|
+
return nextActionInstance.state$.pipe(startWith(nextActionInstance.state), // provide first state cause it might be finished already
|
|
2393
|
+
filter(state => state >= ActionInstanceStateEnum.FinishSuccessFinal), take(1), map(() => {
|
|
2426
2394
|
ctx.instance.state = ActionInstanceStateEnum.NextActionEnd;
|
|
2427
2395
|
return runResult;
|
|
2428
2396
|
}));
|
|
@@ -2442,19 +2410,18 @@ class MngActionExecutorService {
|
|
|
2442
2410
|
return runResult;
|
|
2443
2411
|
}), catchError(err => {
|
|
2444
2412
|
// transform error to mng action error
|
|
2445
|
-
const actionError = this.toMngActionError(err);
|
|
2413
|
+
const actionError = this.toMngActionError(err, ctx);
|
|
2446
2414
|
// set instance state to error
|
|
2447
2415
|
ctx.instance.state = isMainRunFn ? ActionInstanceStateEnum.RunError : ActionInstanceStateEnum.FetchError;
|
|
2448
2416
|
// mark execution error on context
|
|
2449
2417
|
ctx.executionError(actionError);
|
|
2418
|
+
if (ctx.instance.action.hasRunNotificationError) {
|
|
2419
|
+
NotificationUtil.actionNotificationError(this.translate, ctx.instance.action, actionError, 'fetch', ctx.parameters.viewContainer, ctx.parameters.item);
|
|
2420
|
+
}
|
|
2450
2421
|
let errorObs = of(void 0);
|
|
2451
2422
|
if (isMainRunFn) {
|
|
2452
2423
|
ctx.instance.error = err;
|
|
2453
2424
|
ctx.instance.isRunLoadingSubject.next(false);
|
|
2454
|
-
// handle error notification
|
|
2455
|
-
if (ctx.instance.action.hasRunNotificationError) {
|
|
2456
|
-
actionError.notification = NotificationUtil.actionNotificationError(this.translate, ctx.instance.action, actionError, ctx.functionName, ctx.parameters.viewContainer ?? undefined, ctx.parameters.item);
|
|
2457
|
-
}
|
|
2458
2425
|
// handle possible error action if run
|
|
2459
2426
|
if (isMainRunFn && ctx.instance.action.onRunErrorAction) {
|
|
2460
2427
|
// cannot start with trigger, because routing might be problematic (lousing previous results etc.)
|
|
@@ -2462,23 +2429,19 @@ class MngActionExecutorService {
|
|
|
2462
2429
|
.withActionData(ctx.parameters.actionData)
|
|
2463
2430
|
.withRoute(ctx.parameters.route)
|
|
2464
2431
|
.withSourceComponent(ctx.parameters.sourceComponent)
|
|
2465
|
-
.withViewContainer(ctx.parameters.viewContainer));
|
|
2432
|
+
.withViewContainer(ctx.parameters.viewContainer), undefined, undefined, true);
|
|
2466
2433
|
ctx.instance.errorActionInstance = errorActionInstance;
|
|
2467
|
-
errorObs = errorActionInstance.state$.pipe(
|
|
2468
|
-
|
|
2469
|
-
}
|
|
2470
|
-
else {
|
|
2471
|
-
if (ctx.instance.action.hasRunNotificationError) {
|
|
2472
|
-
NotificationUtil.actionNotificationError(this.translate, ctx.instance.action, actionError, 'fetch', ctx.parameters.viewContainer, ctx.parameters.item);
|
|
2434
|
+
errorObs = errorActionInstance.state$.pipe(startWith(errorActionInstance.state), // provide first state cause it might be finished already
|
|
2435
|
+
filter(state => state >= ActionInstanceStateEnum.FinishSuccessFinal), take(1), map(() => void 0));
|
|
2473
2436
|
}
|
|
2474
2437
|
}
|
|
2475
|
-
//
|
|
2438
|
+
// list and map only to mark instance state as finished error state
|
|
2476
2439
|
return errorObs.pipe(map(() => {
|
|
2477
2440
|
// deactivate action only if critical (fetch on editor or run on button actions)
|
|
2478
2441
|
if (isErrorCriticalRunFn) {
|
|
2479
2442
|
this.finishAction(ctx.instance);
|
|
2480
2443
|
}
|
|
2481
|
-
// rethrow error to propagate
|
|
2444
|
+
// rethrow error to propagate further
|
|
2482
2445
|
throw actionError;
|
|
2483
2446
|
}));
|
|
2484
2447
|
}));
|
|
@@ -2487,9 +2450,11 @@ class MngActionExecutorService {
|
|
|
2487
2450
|
this.logger.debug(`ActionContext ${ctx.contextLongName} execution next event`, res);
|
|
2488
2451
|
},
|
|
2489
2452
|
error: err => {
|
|
2490
|
-
this.logger.debug(`ActionContext ${ctx.contextLongName} execution error event`, err);
|
|
2491
2453
|
if (err?.type !== 'MngActionError') {
|
|
2492
|
-
this.logger.error(`Non
|
|
2454
|
+
this.logger.error(`Non action error occurred`, err);
|
|
2455
|
+
}
|
|
2456
|
+
else {
|
|
2457
|
+
this.logger.debug(`Action context ${ctx.contextLongName} execution error event`, err);
|
|
2493
2458
|
}
|
|
2494
2459
|
}
|
|
2495
2460
|
});
|
|
@@ -2721,7 +2686,7 @@ class MngActionExecutorService {
|
|
|
2721
2686
|
finishAction(instance, onDestroy = false) {
|
|
2722
2687
|
instance = this.getOrCreateInstance(instance);
|
|
2723
2688
|
if (instance.state >= ActionInstanceStateEnum.FinishSuccessFinal) {
|
|
2724
|
-
this.logger.
|
|
2689
|
+
this.logger.trace(`ActionInstance ${instance.instanceLongName} already finished`);
|
|
2725
2690
|
return;
|
|
2726
2691
|
}
|
|
2727
2692
|
let finalState;
|
|
@@ -2768,6 +2733,15 @@ class MngActionExecutorService {
|
|
|
2768
2733
|
instance.context?.parameters.viewContainer?.setActionRouteTriggeredInstance?.(newInstance);
|
|
2769
2734
|
instance.reactivationInstance = newInstance;
|
|
2770
2735
|
}
|
|
2736
|
+
// finish related actions
|
|
2737
|
+
if (instance.nextActionInstance) {
|
|
2738
|
+
logger.debug(`Finishing instance ${instance.instanceLongName} related next action instance: ${instance.nextActionInstance.instanceLongName}`);
|
|
2739
|
+
this.finishAction(instance.nextActionInstance, onDestroy);
|
|
2740
|
+
}
|
|
2741
|
+
if (instance.errorActionInstance) {
|
|
2742
|
+
logger.debug(`Finishing instance ${instance.instanceLongName} related error action instance: ${instance.errorActionInstance.instanceLongName}`);
|
|
2743
|
+
this.finishAction(instance.errorActionInstance, onDestroy);
|
|
2744
|
+
}
|
|
2771
2745
|
}
|
|
2772
2746
|
/**
|
|
2773
2747
|
* Triggers action with parameters.
|
|
@@ -2852,22 +2826,39 @@ class MngActionExecutorService {
|
|
|
2852
2826
|
/**
|
|
2853
2827
|
* Transform error of any type to mng error by using error mapper that could be provided by final project.
|
|
2854
2828
|
* @param error error of any type.
|
|
2829
|
+
* @param context Action context.
|
|
2855
2830
|
*
|
|
2856
2831
|
* @return mapped MngError.
|
|
2857
2832
|
*/
|
|
2858
|
-
toMngActionError(error) {
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2833
|
+
toMngActionError(error, context) {
|
|
2834
|
+
let mngError;
|
|
2835
|
+
if (context) {
|
|
2836
|
+
const options = {
|
|
2837
|
+
cause: error,
|
|
2838
|
+
location: this.router.url
|
|
2839
|
+
};
|
|
2840
|
+
if (error instanceof HttpErrorResponse) {
|
|
2841
|
+
options.httpError = error;
|
|
2842
|
+
}
|
|
2843
|
+
mngError = new MngActionError(error?.message ?? 'Unknown error', context.contextLongName);
|
|
2844
|
+
}
|
|
2845
|
+
else if (error instanceof HttpErrorResponse) {
|
|
2846
|
+
// should not really happen (should always be wrapped in MngActionError), just in case
|
|
2847
|
+
mngError = new MngHttpError(`Http Error occurred in action`, error, {
|
|
2848
|
+
location: this.router.url
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
else {
|
|
2852
|
+
// not from action, so unknown source of error
|
|
2853
|
+
mngError = new MngInternalError(error?.message ?? 'Unknown error', {
|
|
2854
|
+
name: error?.name ?? 'UnknownError',
|
|
2855
|
+
location: this.router.url,
|
|
2856
|
+
cause: error
|
|
2857
|
+
});
|
|
2869
2858
|
}
|
|
2870
|
-
|
|
2859
|
+
// just trace it, allow user to set if this is error or not
|
|
2860
|
+
this.logger.trace(mngError);
|
|
2861
|
+
return this.errorMapper.toMngError(error, mngError);
|
|
2871
2862
|
}
|
|
2872
2863
|
/**
|
|
2873
2864
|
* Creates or gets existing action instance.
|
|
@@ -2884,7 +2875,7 @@ class MngActionExecutorService {
|
|
|
2884
2875
|
}
|
|
2885
2876
|
if (!instance) {
|
|
2886
2877
|
if (!action) {
|
|
2887
|
-
throw new MngInternalError('Action descriptor is not provided, instance cannot be created.', '
|
|
2878
|
+
throw new MngInternalError('Action descriptor is not provided, instance cannot be created.', { name: 'ActionExecutorServiceError' });
|
|
2888
2879
|
}
|
|
2889
2880
|
// create new instance if non provided
|
|
2890
2881
|
instance = new ActionInstance(action, instanceInitialStatus);
|
|
@@ -3020,18 +3011,13 @@ class MngConfigurationService {
|
|
|
3020
3011
|
return httpClient.get(noEnvUrl);
|
|
3021
3012
|
}
|
|
3022
3013
|
else {
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
return throwError(() => {
|
|
3026
|
-
return new MngInternalError(message, 'ConfigurationService', {
|
|
3027
|
-
cause: err,
|
|
3028
|
-
status: err.status,
|
|
3029
|
-
statusDescription: err.statusText,
|
|
3030
|
-
url: err.url ?? undefined
|
|
3031
|
-
});
|
|
3032
|
-
});
|
|
3014
|
+
this.logger?.warn(`Configuration file ${url} not loaded`, err);
|
|
3015
|
+
return of(false);
|
|
3033
3016
|
}
|
|
3034
3017
|
}), map(configuration => {
|
|
3018
|
+
if (typeof configuration !== 'object') {
|
|
3019
|
+
return false;
|
|
3020
|
+
}
|
|
3035
3021
|
sourceInfo.configuration = configuration;
|
|
3036
3022
|
sourceInfo.isLoaded = true;
|
|
3037
3023
|
return true;
|
|
@@ -3265,6 +3251,7 @@ class MngVersionService {
|
|
|
3265
3251
|
constructor(http, configurationService) {
|
|
3266
3252
|
this.http = http;
|
|
3267
3253
|
this.configurationService = configurationService;
|
|
3254
|
+
this.logger = inject(MngLoggerService).create('MngVersionService');
|
|
3268
3255
|
this.cache = {};
|
|
3269
3256
|
}
|
|
3270
3257
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -3283,6 +3270,9 @@ class MngVersionService {
|
|
|
3283
3270
|
this.http.get(urlSegments.join('')).subscribe({
|
|
3284
3271
|
next: res => {
|
|
3285
3272
|
this.cache[url].next(res);
|
|
3273
|
+
},
|
|
3274
|
+
error: err => {
|
|
3275
|
+
this.logger.error('Version could not be retreived', err);
|
|
3286
3276
|
}
|
|
3287
3277
|
});
|
|
3288
3278
|
}
|
|
@@ -3386,6 +3376,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
3386
3376
|
args: [{ providedIn: 'root' }]
|
|
3387
3377
|
}] });
|
|
3388
3378
|
|
|
3379
|
+
/* eslint-disable no-console */
|
|
3380
|
+
class MngLogPublisherConsoleService {
|
|
3381
|
+
addEntry(entry) {
|
|
3382
|
+
let prefix = `${entry.timestampFormatted}`;
|
|
3383
|
+
if (entry.category)
|
|
3384
|
+
prefix += ` [${entry.category}]`;
|
|
3385
|
+
prefix += ':';
|
|
3386
|
+
const message = `${entry.message}${entry.messageDetails ? `\n${entry.messageDetails}` : ''}`;
|
|
3387
|
+
const logParams = [prefix, message];
|
|
3388
|
+
if (entry.error) {
|
|
3389
|
+
logParams.push(`\n${ErrorUtil.getErrorName(entry.error)}:`, entry.error);
|
|
3390
|
+
}
|
|
3391
|
+
if (entry.data?.length) {
|
|
3392
|
+
logParams.push(`\nData:\n`, ...entry.data);
|
|
3393
|
+
}
|
|
3394
|
+
switch (entry.level) {
|
|
3395
|
+
case LogLevelEnum.Trace:
|
|
3396
|
+
console.trace(...logParams);
|
|
3397
|
+
break;
|
|
3398
|
+
case LogLevelEnum.Debug:
|
|
3399
|
+
console.debug(...logParams);
|
|
3400
|
+
break;
|
|
3401
|
+
case LogLevelEnum.Log:
|
|
3402
|
+
console.log(...logParams);
|
|
3403
|
+
break;
|
|
3404
|
+
case LogLevelEnum.Info:
|
|
3405
|
+
console.info(...logParams);
|
|
3406
|
+
break;
|
|
3407
|
+
case LogLevelEnum.Warning:
|
|
3408
|
+
console.warn(...logParams);
|
|
3409
|
+
break;
|
|
3410
|
+
case LogLevelEnum.Error:
|
|
3411
|
+
console.error(...logParams);
|
|
3412
|
+
break;
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3389
3417
|
class ObjectSerializer {
|
|
3390
3418
|
constructor() {
|
|
3391
3419
|
this._logCategory = 'ObjectSerializer';
|
|
@@ -3963,7 +3991,7 @@ class TableviewUtil {
|
|
|
3963
3991
|
*/
|
|
3964
3992
|
static expandAttributeDefWithTableviewTypes(attributes) {
|
|
3965
3993
|
if (attributes == null) {
|
|
3966
|
-
throw new MngInternalError('AttributeDef is null, problem with ObjectSerializer::findAttributesDefinitionByClassType?', '
|
|
3994
|
+
throw new MngInternalError('AttributeDef is null, problem with ObjectSerializer::findAttributesDefinitionByClassType?', { name: 'TableViewUtilsError' });
|
|
3967
3995
|
}
|
|
3968
3996
|
const objectSerializer = ObjectSerializer.get();
|
|
3969
3997
|
const tableviewAttributeDef = [];
|
|
@@ -4810,14 +4838,14 @@ class FilterLookupDescriptor extends FilterDescriptor {
|
|
|
4810
4838
|
this._defaultValueTo = filterValueTo;
|
|
4811
4839
|
this._defaultFilterMatchMode = filterMatchMode;
|
|
4812
4840
|
if (Array.isArray(filterValue) && !this.multiselect) {
|
|
4813
|
-
throw new MngInternalError('Array default filter can only be used with a multiselect filter.', '
|
|
4841
|
+
throw new MngInternalError('Array default filter can only be used with a multiselect filter.', { name: 'FilterDescriptorError' });
|
|
4814
4842
|
}
|
|
4815
4843
|
if (filterMatchMode && this._matchModes && this._matchModes.indexOf(filterMatchMode) < 0) {
|
|
4816
4844
|
this._defaultFilterMatchMode = undefined;
|
|
4817
4845
|
MngLoggerService.get().debug(`WARNING: Default filter match mode '${filterMatchMode}' could not be assigned for property ${this._property}.`);
|
|
4818
4846
|
}
|
|
4819
4847
|
if ((Array.isArray(filterValue) && !this.multiselect) || (this.multiselect && !Array.isArray(filterValue))) {
|
|
4820
|
-
throw new MngInternalError(`Default value not in correct format for property ${this._property}.`, '
|
|
4848
|
+
throw new MngInternalError(`Default value not in correct format for property ${this._property}.`, { name: 'FilterDescriptorError' });
|
|
4821
4849
|
}
|
|
4822
4850
|
return this;
|
|
4823
4851
|
}
|
|
@@ -4873,7 +4901,7 @@ class FilterLookupEnumDescriptor extends FilterLookupDescriptor {
|
|
|
4873
4901
|
return super.withMultiselect(multiselect);
|
|
4874
4902
|
}
|
|
4875
4903
|
withDefaultFilter() {
|
|
4876
|
-
throw new MngInternalError(`withDefaultFilter on FilterLookupEnumDescriptor should not be used. Use withDefaultFilterEnum instead.`, '
|
|
4904
|
+
throw new MngInternalError(`withDefaultFilter on FilterLookupEnumDescriptor should not be used. Use withDefaultFilterEnum instead.`, { name: 'FilterDescriptorError' });
|
|
4877
4905
|
}
|
|
4878
4906
|
withDefaultFilterEnum(filterValue, filterValueTo, filterMatchMode) {
|
|
4879
4907
|
let defaultOptionValue;
|
|
@@ -5214,7 +5242,7 @@ class ColumnDescriptor {
|
|
|
5214
5242
|
}
|
|
5215
5243
|
withFilterLookupEnum(options) {
|
|
5216
5244
|
if (this._columnType !== ColumnTypeEnum.Enum || !this._enumType) {
|
|
5217
|
-
throw new MngInternalError(`Column ${this._property} is not of type enum or enum type is undefined.`, '
|
|
5245
|
+
throw new MngInternalError(`Column ${this._property} is not of type enum or enum type is undefined.`, { name: 'ColumnDescriptorError' });
|
|
5218
5246
|
}
|
|
5219
5247
|
const filterDescriptor = new FilterLookupEnumDescriptor(this._property, this._enumType, options, this._enumNameAsValue, this._enumTitlePath);
|
|
5220
5248
|
this._filterDescriptor = filterDescriptor;
|
|
@@ -6159,7 +6187,7 @@ class TableviewDescriptor {
|
|
|
6159
6187
|
*/
|
|
6160
6188
|
withModifiedType(property, columnType, fieldType, columnDisplayType) {
|
|
6161
6189
|
if (columnType === ColumnTypeEnum.Enum) {
|
|
6162
|
-
throw new MngInternalError('Do not use with types where args are required', '
|
|
6190
|
+
throw new MngInternalError('Do not use with types where args are required', { name: 'TableViewDescriptorError' });
|
|
6163
6191
|
}
|
|
6164
6192
|
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
6165
6193
|
if (attributeDef != null) {
|
|
@@ -6828,7 +6856,7 @@ class FieldInputDescriptor extends AFieldDescriptor {
|
|
|
6828
6856
|
this._imageUrlInputHiddenOnDisabled = inputVisibleOnDisabled;
|
|
6829
6857
|
return this;
|
|
6830
6858
|
}
|
|
6831
|
-
asCustomComponent(customComponent,
|
|
6859
|
+
asCustomComponent(customComponent, wrappers = ['field'], componentInputs) {
|
|
6832
6860
|
this._fieldType = FieldInputTypeEnum.Custom;
|
|
6833
6861
|
if (typeof customComponent === 'string') {
|
|
6834
6862
|
this._customComponentName = customComponent;
|
|
@@ -6837,8 +6865,8 @@ class FieldInputDescriptor extends AFieldDescriptor {
|
|
|
6837
6865
|
this._customComponentType = customComponent;
|
|
6838
6866
|
this._customComponentInputs = componentInputs;
|
|
6839
6867
|
}
|
|
6840
|
-
if (
|
|
6841
|
-
this._customComponentWrappers =
|
|
6868
|
+
if (wrappers) {
|
|
6869
|
+
this._customComponentWrappers = wrappers;
|
|
6842
6870
|
}
|
|
6843
6871
|
return this;
|
|
6844
6872
|
}
|
|
@@ -6921,6 +6949,7 @@ class FieldActionDescriptor extends AFieldDescriptor {
|
|
|
6921
6949
|
constructor(editor, property) {
|
|
6922
6950
|
super(editor, property);
|
|
6923
6951
|
this._button = new ActionButtonDescriptor();
|
|
6952
|
+
this._wrappers = ['field'];
|
|
6924
6953
|
this._fieldActionName = property;
|
|
6925
6954
|
let displayName = property;
|
|
6926
6955
|
if (this._editor.model)
|
|
@@ -6933,6 +6962,9 @@ class FieldActionDescriptor extends AFieldDescriptor {
|
|
|
6933
6962
|
get runFunction() {
|
|
6934
6963
|
return this._runFunction;
|
|
6935
6964
|
}
|
|
6965
|
+
get wrappers() {
|
|
6966
|
+
return this._wrappers;
|
|
6967
|
+
}
|
|
6936
6968
|
withButtonDescriptor(button) {
|
|
6937
6969
|
this._button = button;
|
|
6938
6970
|
return this;
|
|
@@ -6945,11 +6977,16 @@ class FieldActionDescriptor extends AFieldDescriptor {
|
|
|
6945
6977
|
this._runFunction = fn;
|
|
6946
6978
|
return this;
|
|
6947
6979
|
}
|
|
6980
|
+
withWrappers(wrappers) {
|
|
6981
|
+
this._wrappers = wrappers;
|
|
6982
|
+
return this;
|
|
6983
|
+
}
|
|
6948
6984
|
copy() {
|
|
6949
6985
|
const field = new FieldActionDescriptor(this._editor, this._property);
|
|
6950
6986
|
this.copyFieldsTo(field);
|
|
6951
6987
|
field._button = this._button.copy();
|
|
6952
6988
|
field._runFunction = this._runFunction?.bind(field);
|
|
6989
|
+
field._wrappers = [...this._wrappers];
|
|
6953
6990
|
return field;
|
|
6954
6991
|
}
|
|
6955
6992
|
}
|
|
@@ -7483,7 +7520,7 @@ class EditorDescriptor {
|
|
|
7483
7520
|
removeField(property) {
|
|
7484
7521
|
const fieldIdx = this._fields.findIndex(f => f.property === property);
|
|
7485
7522
|
if (fieldIdx < 0) {
|
|
7486
|
-
throw new MngInternalError(`Field ${property} does not exist.`, '
|
|
7523
|
+
throw new MngInternalError(`Field ${property} does not exist.`, { name: 'EditorDescriptorError' });
|
|
7487
7524
|
}
|
|
7488
7525
|
for (const group of this._groups) {
|
|
7489
7526
|
const groupFieldIdx = group.fields.findIndex(f => f instanceof AFieldDescriptor && f.property === property);
|
|
@@ -7853,6 +7890,7 @@ class EditorFormlyUtil {
|
|
|
7853
7890
|
}
|
|
7854
7891
|
else if (descriptor instanceof FieldActionDescriptor) {
|
|
7855
7892
|
field.type = 'action';
|
|
7893
|
+
field.wrappers = descriptor.wrappers;
|
|
7856
7894
|
delete field.key;
|
|
7857
7895
|
}
|
|
7858
7896
|
else if (descriptor instanceof FieldLookupEnumDescriptor) {
|
|
@@ -8056,72 +8094,508 @@ class EnumUtil {
|
|
|
8056
8094
|
}
|
|
8057
8095
|
}
|
|
8058
8096
|
|
|
8059
|
-
class
|
|
8060
|
-
static
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
static { this.reflectEnumNameKey = 'enumName'; }
|
|
8064
|
-
/**
|
|
8065
|
-
* Defines type name decorator.
|
|
8066
|
-
* @param targetType class.
|
|
8067
|
-
* @param typeName Name of the type.
|
|
8068
|
-
*/
|
|
8069
|
-
static defineReflectTypeName(targetType, typeName) {
|
|
8070
|
-
if (!Reflect.hasOwnMetadata(TypeUtil.reflectTypeNameKey, targetType)) {
|
|
8071
|
-
Reflect.defineMetadata(TypeUtil.reflectTypeNameKey, typeName, targetType);
|
|
8097
|
+
class ObjectUtil {
|
|
8098
|
+
static deepCopy(obj, options) {
|
|
8099
|
+
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
|
8100
|
+
return obj;
|
|
8072
8101
|
}
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
* Defines enum name decorator.
|
|
8076
|
-
* @param targetType enum object.
|
|
8077
|
-
* @param enumName Name of the enum.
|
|
8078
|
-
*/
|
|
8079
|
-
static defineReflectEnumName(targetType, enumName) {
|
|
8080
|
-
if (!Reflect.hasOwnMetadata(TypeUtil.reflectEnumNameKey, targetType)) {
|
|
8081
|
-
Reflect.defineMetadata(TypeUtil.reflectEnumNameKey, enumName, targetType);
|
|
8102
|
+
if (obj instanceof Date) {
|
|
8103
|
+
return new Date(+obj);
|
|
8082
8104
|
}
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
* @param targetType class.
|
|
8087
|
-
* @param idProperty Id property
|
|
8088
|
-
*/
|
|
8089
|
-
static defineReflectTypeIdProperty(targetType, idProperty) {
|
|
8090
|
-
if (!Reflect.hasOwnMetadata(TypeUtil.reflectTypeIdPropertyKey, targetType)) {
|
|
8091
|
-
Reflect.defineMetadata(TypeUtil.reflectTypeIdPropertyKey, idProperty, targetType);
|
|
8105
|
+
let copy;
|
|
8106
|
+
if (options?.mapGettersToProperties) {
|
|
8107
|
+
copy = {};
|
|
8092
8108
|
}
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8109
|
+
else {
|
|
8110
|
+
copy = options?.objectPrototype ? Object.create(options.objectPrototype['prototype']) : Object.create(Object.getPrototypeOf(obj));
|
|
8111
|
+
Object.assign(copy, obj);
|
|
8112
|
+
}
|
|
8113
|
+
for (const key of ObjectUtil.getProperties(obj)) {
|
|
8114
|
+
const prop = obj[key];
|
|
8115
|
+
copy[key] = ObjectUtil.handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
8116
|
+
}
|
|
8117
|
+
if (options?.mapGettersToProperties) {
|
|
8118
|
+
for (const getterKey of ObjectUtil.getGetters(obj)) {
|
|
8119
|
+
const prop = obj[getterKey];
|
|
8120
|
+
copy[getterKey] = ObjectUtil.handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
8121
|
+
}
|
|
8102
8122
|
}
|
|
8123
|
+
return copy;
|
|
8103
8124
|
}
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
*/
|
|
8108
|
-
static findTypeName(type) {
|
|
8109
|
-
const typeName = Reflect.getMetadata(TypeUtil.reflectTypeNameKey, type);
|
|
8110
|
-
if (typeName) {
|
|
8111
|
-
return typeName;
|
|
8125
|
+
static deepMerge(target, source) {
|
|
8126
|
+
if (!ObjectUtil.isObject(source)) {
|
|
8127
|
+
return target;
|
|
8112
8128
|
}
|
|
8113
|
-
|
|
8114
|
-
|
|
8129
|
+
for (const key of ObjectUtil.getProperties(source)) {
|
|
8130
|
+
if (ObjectUtil.isObject(source[key])) {
|
|
8131
|
+
if (ObjectUtil.isObject(target[key])) {
|
|
8132
|
+
target[key] = ObjectUtil.deepMerge(target[key], source[key]);
|
|
8133
|
+
}
|
|
8134
|
+
else {
|
|
8135
|
+
target[key] = ObjectUtil.deepCopy(source[key]);
|
|
8136
|
+
}
|
|
8137
|
+
}
|
|
8138
|
+
else if (Array.isArray(source[key])) {
|
|
8139
|
+
if (!Array.isArray(target[key])) {
|
|
8140
|
+
target[key] = source[key].map(i => (ObjectUtil.isObject(i) ? ObjectUtil.deepMerge({}, i) : i));
|
|
8141
|
+
}
|
|
8142
|
+
}
|
|
8143
|
+
else if (typeof target[key] === 'undefined') {
|
|
8144
|
+
target[key] = source[key];
|
|
8145
|
+
}
|
|
8146
|
+
}
|
|
8147
|
+
return target;
|
|
8115
8148
|
}
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
* @param type Class.
|
|
8119
|
-
*/
|
|
8120
|
-
static typeNameExists(type) {
|
|
8121
|
-
return Reflect.hasOwnMetadata(TypeUtil.reflectTypeNameKey, type);
|
|
8149
|
+
static isObject(obj) {
|
|
8150
|
+
return typeof obj === 'object' && obj !== null && !Array.isArray(obj);
|
|
8122
8151
|
}
|
|
8123
|
-
|
|
8124
|
-
|
|
8152
|
+
static handleProp(prop, options) {
|
|
8153
|
+
if (Array.isArray(prop)) {
|
|
8154
|
+
return prop.map(i => ObjectUtil.deepCopy(i, options));
|
|
8155
|
+
}
|
|
8156
|
+
else if (typeof prop === 'object' && prop !== null) {
|
|
8157
|
+
return ObjectUtil.deepCopy(prop, options);
|
|
8158
|
+
}
|
|
8159
|
+
else {
|
|
8160
|
+
return prop;
|
|
8161
|
+
}
|
|
8162
|
+
}
|
|
8163
|
+
static getProperties(obj) {
|
|
8164
|
+
return Object.keys(obj);
|
|
8165
|
+
}
|
|
8166
|
+
static getGetters(obj) {
|
|
8167
|
+
const getterSet = new Set();
|
|
8168
|
+
let currObj = obj;
|
|
8169
|
+
while (currObj) {
|
|
8170
|
+
const getters = Object.entries(Object.getOwnPropertyDescriptors(currObj))
|
|
8171
|
+
.filter(([, descriptor]) => typeof descriptor.get === 'function')
|
|
8172
|
+
.filter(([key]) => key !== '__proto__')
|
|
8173
|
+
.map(([key]) => key);
|
|
8174
|
+
for (const getter of getters) {
|
|
8175
|
+
getterSet.add(getter);
|
|
8176
|
+
}
|
|
8177
|
+
currObj = Object.getPrototypeOf(currObj);
|
|
8178
|
+
}
|
|
8179
|
+
return Array.from(getterSet);
|
|
8180
|
+
}
|
|
8181
|
+
static getPropertyByPath(value, path) {
|
|
8182
|
+
if (path === '$') {
|
|
8183
|
+
// only return the root
|
|
8184
|
+
return value;
|
|
8185
|
+
}
|
|
8186
|
+
// Check for leading root object notation
|
|
8187
|
+
if (path.startsWith('$')) {
|
|
8188
|
+
path = path.substring(1);
|
|
8189
|
+
}
|
|
8190
|
+
// Check for leading .
|
|
8191
|
+
if (path.startsWith('.')) {
|
|
8192
|
+
path = path.substring(1);
|
|
8193
|
+
}
|
|
8194
|
+
if (path.indexOf('.') >= 0) {
|
|
8195
|
+
const pathSplit = path.split('.');
|
|
8196
|
+
let currValue = value;
|
|
8197
|
+
for (const p of pathSplit) {
|
|
8198
|
+
if (typeof currValue === 'undefined' || currValue === null) {
|
|
8199
|
+
return currValue;
|
|
8200
|
+
}
|
|
8201
|
+
if (!p.length) {
|
|
8202
|
+
// empty path, return current value
|
|
8203
|
+
return currValue;
|
|
8204
|
+
}
|
|
8205
|
+
const leftBracketIdx = p.indexOf('[');
|
|
8206
|
+
if (leftBracketIdx >= 0 && p.endsWith(']')) {
|
|
8207
|
+
// should be reference to array
|
|
8208
|
+
const arrayPath = p.substring(0, leftBracketIdx);
|
|
8209
|
+
const arrayIdx = +p.substring(leftBracketIdx + 1, p.length - 1);
|
|
8210
|
+
const array = currValue[arrayPath];
|
|
8211
|
+
if (Array.isArray(array)) {
|
|
8212
|
+
if (arrayIdx >= 0 && arrayIdx < array.length) {
|
|
8213
|
+
// valid index, continue on the path
|
|
8214
|
+
currValue = array[arrayIdx];
|
|
8215
|
+
continue;
|
|
8216
|
+
}
|
|
8217
|
+
}
|
|
8218
|
+
return undefined;
|
|
8219
|
+
}
|
|
8220
|
+
else if (typeof currValue === 'object') {
|
|
8221
|
+
currValue = currValue[p];
|
|
8222
|
+
}
|
|
8223
|
+
}
|
|
8224
|
+
return currValue;
|
|
8225
|
+
}
|
|
8226
|
+
else {
|
|
8227
|
+
return value[path];
|
|
8228
|
+
}
|
|
8229
|
+
}
|
|
8230
|
+
}
|
|
8231
|
+
|
|
8232
|
+
class StringUtil {
|
|
8233
|
+
static escapeHtml(value) {
|
|
8234
|
+
return value.replace(/</g, '<').replace(/>/g, '>');
|
|
8235
|
+
}
|
|
8236
|
+
static escapeHtmlAny(value) {
|
|
8237
|
+
if (typeof value === 'string') {
|
|
8238
|
+
return StringUtil.escapeHtml(value);
|
|
8239
|
+
}
|
|
8240
|
+
else if (typeof value === 'object') {
|
|
8241
|
+
const escapedValue = ObjectUtil.deepCopy(value, { mapGettersToProperties: true });
|
|
8242
|
+
for (const key in value) {
|
|
8243
|
+
if (typeof value[key] === 'string') {
|
|
8244
|
+
escapedValue[key] = StringUtil.escapeHtml(value[key]);
|
|
8245
|
+
}
|
|
8246
|
+
else if (typeof value[key] === 'object') {
|
|
8247
|
+
escapedValue[key] = StringUtil.escapeHtmlAny(value[key]);
|
|
8248
|
+
}
|
|
8249
|
+
else {
|
|
8250
|
+
escapedValue[key] = value[key];
|
|
8251
|
+
}
|
|
8252
|
+
}
|
|
8253
|
+
return escapedValue;
|
|
8254
|
+
}
|
|
8255
|
+
return value;
|
|
8256
|
+
}
|
|
8257
|
+
/**
|
|
8258
|
+
* Stringifies a value - primitives with toString, dates with dateUtil, objects with JSON.stringify.
|
|
8259
|
+
* @param value Any value.
|
|
8260
|
+
*/
|
|
8261
|
+
static stringify(value) {
|
|
8262
|
+
if (value === null) {
|
|
8263
|
+
return 'null';
|
|
8264
|
+
}
|
|
8265
|
+
if (typeof value === 'undefined') {
|
|
8266
|
+
return 'undefined';
|
|
8267
|
+
}
|
|
8268
|
+
// eliminate functions, cause they could fall into objects
|
|
8269
|
+
if (typeof value === 'function') {
|
|
8270
|
+
return `Function ${value.name ?? 'anonymous'}()`;
|
|
8271
|
+
}
|
|
8272
|
+
if (typeof value === 'object') {
|
|
8273
|
+
// date is object, but would like it in ISO string representation
|
|
8274
|
+
if (value instanceof Date) {
|
|
8275
|
+
return DateUtil.toIsoString(value, false, true, true) ?? 'null';
|
|
8276
|
+
}
|
|
8277
|
+
try {
|
|
8278
|
+
return JSON.stringify(value);
|
|
8279
|
+
}
|
|
8280
|
+
catch (e) {
|
|
8281
|
+
return value.toString();
|
|
8282
|
+
}
|
|
8283
|
+
}
|
|
8284
|
+
// only primitives should be left to be printed like this (string, number, boolean)
|
|
8285
|
+
return value.toString();
|
|
8286
|
+
}
|
|
8287
|
+
}
|
|
8288
|
+
|
|
8289
|
+
class ErrorUtil {
|
|
8290
|
+
/**
|
|
8291
|
+
* Converts RxJS subscription error to MngError.
|
|
8292
|
+
* @param error Error.
|
|
8293
|
+
* @param name Optional name to write in mngError.
|
|
8294
|
+
* @param details Optional details of error.
|
|
8295
|
+
*/
|
|
8296
|
+
static fromSubscribeError(error, name, details) {
|
|
8297
|
+
const opts = {
|
|
8298
|
+
name,
|
|
8299
|
+
details,
|
|
8300
|
+
location: window?.location?.href
|
|
8301
|
+
};
|
|
8302
|
+
if (error instanceof HttpErrorResponse) {
|
|
8303
|
+
return new MngHttpError(error.message ?? 'Http Error occurred', error, opts);
|
|
8304
|
+
}
|
|
8305
|
+
else {
|
|
8306
|
+
opts.cause = error;
|
|
8307
|
+
return new MngInternalError(error.message ?? 'Internal Error occurred', opts);
|
|
8308
|
+
}
|
|
8309
|
+
}
|
|
8310
|
+
/**
|
|
8311
|
+
* Checks if error is Http error (Angular or Mng).
|
|
8312
|
+
* @param error
|
|
8313
|
+
*/
|
|
8314
|
+
static isHttpErrorResponse(error) {
|
|
8315
|
+
return error instanceof HttpErrorResponse || error instanceof MngHttpError || (error instanceof MngActionError && error.httpError);
|
|
8316
|
+
}
|
|
8317
|
+
/**
|
|
8318
|
+
* Gets HttpErrorResponse from error (Angular or Mng).
|
|
8319
|
+
* @param error Error.
|
|
8320
|
+
*/
|
|
8321
|
+
static getHttpErrorResponse(error) {
|
|
8322
|
+
if (error instanceof HttpErrorResponse) {
|
|
8323
|
+
return error;
|
|
8324
|
+
}
|
|
8325
|
+
else if (error instanceof MngHttpError) {
|
|
8326
|
+
return error.httpError;
|
|
8327
|
+
}
|
|
8328
|
+
else if (error instanceof MngActionError) {
|
|
8329
|
+
return error.httpError ?? null;
|
|
8330
|
+
}
|
|
8331
|
+
else {
|
|
8332
|
+
return null;
|
|
8333
|
+
}
|
|
8334
|
+
}
|
|
8335
|
+
/**
|
|
8336
|
+
* Gets HttpErrorResponse status from error (Angular or Mng).
|
|
8337
|
+
* @param error Error.
|
|
8338
|
+
*/
|
|
8339
|
+
static getHttpErrorResponseStatus(error) {
|
|
8340
|
+
return ErrorUtil.getHttpErrorResponse(error)?.status ?? null;
|
|
8341
|
+
}
|
|
8342
|
+
/**
|
|
8343
|
+
* Get error log level. All is error, except if error is http error with status >=400 and <500.
|
|
8344
|
+
* @param error Error.
|
|
8345
|
+
*/
|
|
8346
|
+
static getErrorLogLevel(error) {
|
|
8347
|
+
if (ErrorUtil.isHttpErrorResponse(error)) {
|
|
8348
|
+
const status = ErrorUtil.getHttpErrorResponseStatus(error);
|
|
8349
|
+
if (status && status >= 400 && status < 500) {
|
|
8350
|
+
return LogLevelEnum.Warning;
|
|
8351
|
+
}
|
|
8352
|
+
}
|
|
8353
|
+
return LogLevelEnum.Error;
|
|
8354
|
+
}
|
|
8355
|
+
/**
|
|
8356
|
+
* Get error name (prototype name or type from mng error if name is not provided).
|
|
8357
|
+
* @param error Error.
|
|
8358
|
+
*/
|
|
8359
|
+
static getErrorName(error) {
|
|
8360
|
+
if (error instanceof AMngErrorBase) {
|
|
8361
|
+
return error.name ?? error.type;
|
|
8362
|
+
}
|
|
8363
|
+
else {
|
|
8364
|
+
return error.name;
|
|
8365
|
+
}
|
|
8366
|
+
}
|
|
8367
|
+
/**
|
|
8368
|
+
* Writes http error to string with all headers and body.
|
|
8369
|
+
* @param error Http response error.
|
|
8370
|
+
* @param opts Options for hiding parts of error:
|
|
8371
|
+
* - hideMessage Hides message of error (message include url, status and status text!).
|
|
8372
|
+
* - hideHeaders Hides headers.
|
|
8373
|
+
* - hideBody Hides JSON representation of body.
|
|
8374
|
+
*/
|
|
8375
|
+
static httpErrorResponseToString(error, opts) {
|
|
8376
|
+
let str = opts?.hideMessage ? '' : `${error.message}\n`; // message should already include url, status, etc.
|
|
8377
|
+
if (!opts?.hideHeaders) {
|
|
8378
|
+
str += `Http Response Headers: ${error.headers.keys().reduce((acc, key) => `${acc}[${key}: ${error.headers.get(key)}]`, '')}`;
|
|
8379
|
+
}
|
|
8380
|
+
if (!opts?.hideBody) {
|
|
8381
|
+
str += `\nHttp Response Body: ${StringUtil.stringify(error.error)}`;
|
|
8382
|
+
}
|
|
8383
|
+
return str;
|
|
8384
|
+
}
|
|
8385
|
+
/**
|
|
8386
|
+
* Error to string.
|
|
8387
|
+
* @param error Error.
|
|
8388
|
+
* @param opts Options for hiding parts of error:
|
|
8389
|
+
* - hideMessage Hides message of error.
|
|
8390
|
+
* - hideName Hides error name.
|
|
8391
|
+
* - hideCause Hides cause of an error (if present, see @link(errorCauseToString) for other options).
|
|
8392
|
+
* - hideStack Hides stack of an error (if present).
|
|
8393
|
+
* - hideDetails Hides JSON detail's representation of error (if present).
|
|
8394
|
+
* - hideLocation Hides location (URL) where error was thrown.
|
|
8395
|
+
* - hideHttp Hides http error portion of error if http error response (see @link(httpErrorResponseToString) for other options).
|
|
8396
|
+
*/
|
|
8397
|
+
static errorToString(error, opts) {
|
|
8398
|
+
if (error instanceof AMngErrorBase) {
|
|
8399
|
+
return ErrorUtil.mngErrorToString(error, opts);
|
|
8400
|
+
}
|
|
8401
|
+
else if (error instanceof HttpErrorResponse) {
|
|
8402
|
+
return ErrorUtil.httpErrorResponseToString(error, opts);
|
|
8403
|
+
}
|
|
8404
|
+
const strBlocks = [];
|
|
8405
|
+
if (!opts?.hideMessage) {
|
|
8406
|
+
strBlocks.push(error.message);
|
|
8407
|
+
}
|
|
8408
|
+
if (error.name) {
|
|
8409
|
+
strBlocks.push(`Error name: ${error.name}`);
|
|
8410
|
+
}
|
|
8411
|
+
if (!opts?.hideCause) {
|
|
8412
|
+
strBlocks.push(ErrorUtil.errorCauseToString(error, opts));
|
|
8413
|
+
}
|
|
8414
|
+
if (!opts?.hideStack && error.stack) {
|
|
8415
|
+
strBlocks.push(`Stack trace:\n${error.stack}`);
|
|
8416
|
+
}
|
|
8417
|
+
return strBlocks.filter(s => s.trim().length > 0).join('\n');
|
|
8418
|
+
}
|
|
8419
|
+
/**
|
|
8420
|
+
* Mng error to string.
|
|
8421
|
+
* @param error Mng error.
|
|
8422
|
+
* @param opts Options for hiding parts of error:
|
|
8423
|
+
* - hideMessage Hides message of error.
|
|
8424
|
+
* - hideName Hides error name.
|
|
8425
|
+
* - hideCause Hides cause of an error (if present, see @link(errorCauseToString) for other options).
|
|
8426
|
+
* - hideStack Hides stack of an error (if present).
|
|
8427
|
+
* - hideDetails Hides JSON detail's representation of error (if present).
|
|
8428
|
+
* - hideLocation Hides location (URL) where error was thrown.
|
|
8429
|
+
* - hideHttp Hides http error portion of error if http error response (see @link(httpErrorResponseToString) for other options).
|
|
8430
|
+
* - hideItems Hides all item information (http body, action context data).
|
|
8431
|
+
* - hideActionData See @link(mngActionErrorContextToString) for additional info.
|
|
8432
|
+
* - hideQueryParams See @link(mngActionErrorContextToString) for additional info.
|
|
8433
|
+
*/
|
|
8434
|
+
static mngErrorToString(error, opts) {
|
|
8435
|
+
const strBlocks = [];
|
|
8436
|
+
if (!opts?.hideMessage) {
|
|
8437
|
+
strBlocks.push(`${error.message}${error.messageCode ? ` (code: ${error.messageCode})` : ''}`);
|
|
8438
|
+
}
|
|
8439
|
+
if (!opts?.hideName) {
|
|
8440
|
+
strBlocks.push(`Error name: ${error.name ?? error.type} ${error.name ? `(${error.type})` : ''}`);
|
|
8441
|
+
}
|
|
8442
|
+
if (!opts?.hideLocation && error.location) {
|
|
8443
|
+
strBlocks.push(`Location: ${error.location}`);
|
|
8444
|
+
}
|
|
8445
|
+
let isHttp = false;
|
|
8446
|
+
if (!opts?.hideHttp && error instanceof MngHttpError) {
|
|
8447
|
+
strBlocks.push(ErrorUtil.httpErrorResponseToString(error.httpError, {
|
|
8448
|
+
hideBody: opts?.hideItems || opts?.hideBody,
|
|
8449
|
+
hideHeaders: opts?.hideHeaders,
|
|
8450
|
+
hideMessage: error.message.indexOf(error.httpError.message) >= 0
|
|
8451
|
+
}));
|
|
8452
|
+
isHttp = true;
|
|
8453
|
+
}
|
|
8454
|
+
if (error instanceof MngActionError) {
|
|
8455
|
+
if (error.actionContext) {
|
|
8456
|
+
strBlocks.push(ErrorUtil.mngActionErrorContextToString(error, opts));
|
|
8457
|
+
}
|
|
8458
|
+
if (!opts?.hideHttp && error.httpError) {
|
|
8459
|
+
strBlocks.push(ErrorUtil.httpErrorResponseToString(error.httpError, {
|
|
8460
|
+
hideBody: opts?.hideItems || opts?.hideBody,
|
|
8461
|
+
hideHeaders: opts?.hideHeaders,
|
|
8462
|
+
hideMessage: error.message.indexOf(error.httpError.message) >= 0
|
|
8463
|
+
}));
|
|
8464
|
+
isHttp = true;
|
|
8465
|
+
}
|
|
8466
|
+
}
|
|
8467
|
+
if (!opts?.hideDetails && error.details) {
|
|
8468
|
+
strBlocks.push(`Details: ${StringUtil.stringify(error.details)}`);
|
|
8469
|
+
}
|
|
8470
|
+
if (!opts?.hideCause && (!isHttp || !(error.cause instanceof HttpErrorResponse))) {
|
|
8471
|
+
strBlocks.push(ErrorUtil.errorCauseToString(error, opts));
|
|
8472
|
+
}
|
|
8473
|
+
if (!opts?.hideStack && error.stack) {
|
|
8474
|
+
strBlocks.push(`Stack trace:\n${error.stack}`);
|
|
8475
|
+
}
|
|
8476
|
+
return strBlocks.filter(s => s.trim().length > 0).join('\n');
|
|
8477
|
+
}
|
|
8478
|
+
/**
|
|
8479
|
+
* Writes Mng action error info from context as string.
|
|
8480
|
+
* @param error Mng action error.
|
|
8481
|
+
* @param opts Options for hiding parts of error:
|
|
8482
|
+
* - hideItems Hides all item related information (item, form item, submit item, ...).
|
|
8483
|
+
* - hideActionData Hides action data.
|
|
8484
|
+
* - hideQueryParams Hides query params.
|
|
8485
|
+
*/
|
|
8486
|
+
static mngActionErrorContextToString(error, opts) {
|
|
8487
|
+
let paramsMessage = '';
|
|
8488
|
+
if (error.actionContext?.parameters) {
|
|
8489
|
+
if (error.actionContext?.parameters.itemId) {
|
|
8490
|
+
paramsMessage += `[itemId: ${error.actionContext.parameters.itemId}]`;
|
|
8491
|
+
}
|
|
8492
|
+
if (!opts?.hideItems && error.actionContext?.parameters.item) {
|
|
8493
|
+
paramsMessage += `[item: ${StringUtil.stringify(error.actionContext.parameters.item)}]`;
|
|
8494
|
+
}
|
|
8495
|
+
if (!opts?.hideActionData && error.actionContext?.parameters.actionData) {
|
|
8496
|
+
paramsMessage += Object.entries(error.actionContext?.parameters.actionData).reduce((acc, [key, value]) => `${acc}[actionData ${key}: ${StringUtil.stringify(value)}]`, '');
|
|
8497
|
+
}
|
|
8498
|
+
if (!opts?.hideQueryParams && error.actionContext?.parameters.queryParam) {
|
|
8499
|
+
paramsMessage += `[queryParam: ${StringUtil.stringify(error.actionContext.parameters.queryParam)}]`;
|
|
8500
|
+
}
|
|
8501
|
+
if (!opts?.hideItems && error.actionContext?.parameters.formItem) {
|
|
8502
|
+
paramsMessage += `[formItem: ${StringUtil.stringify(error.actionContext.parameters.formItem)}]`;
|
|
8503
|
+
}
|
|
8504
|
+
if (!opts?.hideItems && error.actionContext?.parameters.submitResult) {
|
|
8505
|
+
paramsMessage += `[formItem: ${StringUtil.stringify(error.actionContext.parameters.submitResult)}]`;
|
|
8506
|
+
}
|
|
8507
|
+
if (error.actionContext?.parameters.locale) {
|
|
8508
|
+
paramsMessage += `[locale: ${StringUtil.stringify(error.actionContext.parameters.locale)}]`;
|
|
8509
|
+
}
|
|
8510
|
+
}
|
|
8511
|
+
return paramsMessage;
|
|
8512
|
+
}
|
|
8513
|
+
/**
|
|
8514
|
+
* Writes cause of an error as string.
|
|
8515
|
+
* @param error Error.
|
|
8516
|
+
* @param opts Options for hiding parts of error:
|
|
8517
|
+
* - causeOnErrorOnly Prints only if cause is instance of error.
|
|
8518
|
+
* - causeAsJson Print error cause as a JSON (by default, if error only message and name will be printed).
|
|
8519
|
+
*/
|
|
8520
|
+
static errorCauseToString(error, opts) {
|
|
8521
|
+
// if already logged as http error, check that cause is not also http error (cause it is usually duplicated)
|
|
8522
|
+
if (error.cause && (!opts?.causeOnErrorOnly || error.cause instanceof Error)) {
|
|
8523
|
+
const stringify = opts?.causeAsJson || !(error.cause instanceof Error);
|
|
8524
|
+
if (!opts?.causeOnErrorOnly || error.cause instanceof Error) {
|
|
8525
|
+
return ('Caused by: ' +
|
|
8526
|
+
(stringify ? StringUtil.stringify(error.cause) : `${error.cause.message}${error.cause.name ? ` (${error.cause.name})` : ''}`));
|
|
8527
|
+
}
|
|
8528
|
+
}
|
|
8529
|
+
return '';
|
|
8530
|
+
}
|
|
8531
|
+
}
|
|
8532
|
+
|
|
8533
|
+
class TypeUtil {
|
|
8534
|
+
static { this.reflectTypeNameKey = 'typeName'; }
|
|
8535
|
+
static { this.reflectTypeIdPropertyKey = 'typeIdProperty'; }
|
|
8536
|
+
static { this.reflectTypeTitlePropertyKey = 'typeTitleProperty'; }
|
|
8537
|
+
static { this.reflectEnumNameKey = 'enumName'; }
|
|
8538
|
+
/**
|
|
8539
|
+
* Defines type name decorator.
|
|
8540
|
+
* @param targetType class.
|
|
8541
|
+
* @param typeName Name of the type.
|
|
8542
|
+
*/
|
|
8543
|
+
static defineReflectTypeName(targetType, typeName) {
|
|
8544
|
+
if (!Reflect.hasOwnMetadata(TypeUtil.reflectTypeNameKey, targetType)) {
|
|
8545
|
+
Reflect.defineMetadata(TypeUtil.reflectTypeNameKey, typeName, targetType);
|
|
8546
|
+
}
|
|
8547
|
+
}
|
|
8548
|
+
/**
|
|
8549
|
+
* Defines enum name decorator.
|
|
8550
|
+
* @param targetType enum object.
|
|
8551
|
+
* @param enumName Name of the enum.
|
|
8552
|
+
*/
|
|
8553
|
+
static defineReflectEnumName(targetType, enumName) {
|
|
8554
|
+
if (!Reflect.hasOwnMetadata(TypeUtil.reflectEnumNameKey, targetType)) {
|
|
8555
|
+
Reflect.defineMetadata(TypeUtil.reflectEnumNameKey, enumName, targetType);
|
|
8556
|
+
}
|
|
8557
|
+
}
|
|
8558
|
+
/**
|
|
8559
|
+
* Defines type's id property.
|
|
8560
|
+
* @param targetType class.
|
|
8561
|
+
* @param idProperty Id property
|
|
8562
|
+
*/
|
|
8563
|
+
static defineReflectTypeIdProperty(targetType, idProperty) {
|
|
8564
|
+
if (!Reflect.hasOwnMetadata(TypeUtil.reflectTypeIdPropertyKey, targetType)) {
|
|
8565
|
+
Reflect.defineMetadata(TypeUtil.reflectTypeIdPropertyKey, idProperty, targetType);
|
|
8566
|
+
}
|
|
8567
|
+
}
|
|
8568
|
+
/**
|
|
8569
|
+
* Defines type's id property.
|
|
8570
|
+
* @param targetType class.
|
|
8571
|
+
* @param titleProperty Title property
|
|
8572
|
+
*/
|
|
8573
|
+
static defineReflectTypeTitleProperty(targetType, titleProperty) {
|
|
8574
|
+
if (!Reflect.hasOwnMetadata(TypeUtil.reflectTypeTitlePropertyKey, targetType)) {
|
|
8575
|
+
Reflect.defineMetadata(TypeUtil.reflectTypeTitlePropertyKey, titleProperty, targetType);
|
|
8576
|
+
}
|
|
8577
|
+
}
|
|
8578
|
+
/**
|
|
8579
|
+
* Gets type name from reflect metadata.
|
|
8580
|
+
* @param type Class.
|
|
8581
|
+
*/
|
|
8582
|
+
static findTypeName(type) {
|
|
8583
|
+
const typeName = Reflect.getMetadata(TypeUtil.reflectTypeNameKey, type);
|
|
8584
|
+
if (typeName) {
|
|
8585
|
+
return typeName;
|
|
8586
|
+
}
|
|
8587
|
+
MngLoggerService.get().debug('WARNING: Reflect metadata could not be found for type, you might experience some issues in production build.', type?.name);
|
|
8588
|
+
return type.name;
|
|
8589
|
+
}
|
|
8590
|
+
/**
|
|
8591
|
+
* Gets type name from either decorator or reflect metadata.
|
|
8592
|
+
* @param type Class.
|
|
8593
|
+
*/
|
|
8594
|
+
static typeNameExists(type) {
|
|
8595
|
+
return Reflect.hasOwnMetadata(TypeUtil.reflectTypeNameKey, type);
|
|
8596
|
+
}
|
|
8597
|
+
/**
|
|
8598
|
+
* Gets enum name from either decorator or reflect metadata.
|
|
8125
8599
|
* @param enumType Class.
|
|
8126
8600
|
*/
|
|
8127
8601
|
static findEnumName(enumType) {
|
|
@@ -8129,7 +8603,7 @@ class TypeUtil {
|
|
|
8129
8603
|
if (enumName) {
|
|
8130
8604
|
return enumName;
|
|
8131
8605
|
}
|
|
8132
|
-
throw new MngInternalError('Could not fined enum name', '
|
|
8606
|
+
throw new MngInternalError('Could not fined enum name', { name: 'TypeUtilsError' });
|
|
8133
8607
|
}
|
|
8134
8608
|
/**
|
|
8135
8609
|
* Gets type's id property from reflect metadata.
|
|
@@ -8404,14 +8878,11 @@ var I18nUtils;
|
|
|
8404
8878
|
const paramsRes = { ...params };
|
|
8405
8879
|
paramsRes.errorStatus = '';
|
|
8406
8880
|
paramsRes.errorMessage = '';
|
|
8407
|
-
if (error
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
paramsRes.
|
|
8412
|
-
}
|
|
8413
|
-
if (error.statusDescription) {
|
|
8414
|
-
paramsRes.errorStatusDescription = error.statusDescription;
|
|
8881
|
+
if (ErrorUtil.isHttpErrorResponse(error)) {
|
|
8882
|
+
const httpError = ErrorUtil.getHttpErrorResponse(error);
|
|
8883
|
+
paramsRes.errorStatus = httpError?.status;
|
|
8884
|
+
paramsRes.errorMessage = httpError?.message;
|
|
8885
|
+
paramsRes.errorStatusDescription = httpError?.statusText;
|
|
8415
8886
|
}
|
|
8416
8887
|
paramsRes.error = error;
|
|
8417
8888
|
return paramsRes;
|
|
@@ -8537,119 +9008,6 @@ class NotificationUtil {
|
|
|
8537
9008
|
}
|
|
8538
9009
|
}
|
|
8539
9010
|
|
|
8540
|
-
class ObjectUtil {
|
|
8541
|
-
static deepCopy(obj, options) {
|
|
8542
|
-
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
|
8543
|
-
return obj;
|
|
8544
|
-
}
|
|
8545
|
-
if (obj instanceof Date) {
|
|
8546
|
-
return new Date(+obj);
|
|
8547
|
-
}
|
|
8548
|
-
let copy;
|
|
8549
|
-
if (options?.mapGettersToProperties) {
|
|
8550
|
-
copy = {};
|
|
8551
|
-
}
|
|
8552
|
-
else {
|
|
8553
|
-
copy = options?.objectPrototype ? Object.create(options.objectPrototype['prototype']) : Object.create(Object.getPrototypeOf(obj));
|
|
8554
|
-
Object.assign(copy, obj);
|
|
8555
|
-
}
|
|
8556
|
-
for (const key of ObjectUtil.getProperties(obj)) {
|
|
8557
|
-
const prop = obj[key];
|
|
8558
|
-
copy[key] = ObjectUtil.handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
8559
|
-
}
|
|
8560
|
-
if (options?.mapGettersToProperties) {
|
|
8561
|
-
for (const getterKey of ObjectUtil.getGetters(obj)) {
|
|
8562
|
-
const prop = obj[getterKey];
|
|
8563
|
-
copy[getterKey] = ObjectUtil.handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
8564
|
-
}
|
|
8565
|
-
}
|
|
8566
|
-
return copy;
|
|
8567
|
-
}
|
|
8568
|
-
static deepMerge(target, source) {
|
|
8569
|
-
if (!ObjectUtil.isObject(source)) {
|
|
8570
|
-
return target;
|
|
8571
|
-
}
|
|
8572
|
-
for (const key of ObjectUtil.getProperties(source)) {
|
|
8573
|
-
if (ObjectUtil.isObject(source[key])) {
|
|
8574
|
-
if (ObjectUtil.isObject(target[key])) {
|
|
8575
|
-
target[key] = ObjectUtil.deepMerge(target[key], source[key]);
|
|
8576
|
-
}
|
|
8577
|
-
else {
|
|
8578
|
-
target[key] = ObjectUtil.deepCopy(source[key]);
|
|
8579
|
-
}
|
|
8580
|
-
}
|
|
8581
|
-
else if (Array.isArray(source[key])) {
|
|
8582
|
-
if (!Array.isArray(target[key])) {
|
|
8583
|
-
target[key] = source[key].map(i => (ObjectUtil.isObject(i) ? ObjectUtil.deepMerge({}, i) : i));
|
|
8584
|
-
}
|
|
8585
|
-
}
|
|
8586
|
-
else if (typeof target[key] === 'undefined') {
|
|
8587
|
-
target[key] = source[key];
|
|
8588
|
-
}
|
|
8589
|
-
}
|
|
8590
|
-
return target;
|
|
8591
|
-
}
|
|
8592
|
-
static isObject(obj) {
|
|
8593
|
-
return typeof obj === 'object' && obj !== null && !Array.isArray(obj);
|
|
8594
|
-
}
|
|
8595
|
-
static handleProp(prop, options) {
|
|
8596
|
-
if (Array.isArray(prop)) {
|
|
8597
|
-
return prop.map(i => ObjectUtil.deepCopy(i, options));
|
|
8598
|
-
}
|
|
8599
|
-
else if (typeof prop === 'object' && prop !== null) {
|
|
8600
|
-
return ObjectUtil.deepCopy(prop, options);
|
|
8601
|
-
}
|
|
8602
|
-
else {
|
|
8603
|
-
return prop;
|
|
8604
|
-
}
|
|
8605
|
-
}
|
|
8606
|
-
static getProperties(obj) {
|
|
8607
|
-
return Object.keys(obj);
|
|
8608
|
-
}
|
|
8609
|
-
static getGetters(obj) {
|
|
8610
|
-
const getterSet = new Set();
|
|
8611
|
-
let currObj = obj;
|
|
8612
|
-
while (currObj) {
|
|
8613
|
-
const getters = Object.entries(Object.getOwnPropertyDescriptors(currObj))
|
|
8614
|
-
.filter(([, descriptor]) => typeof descriptor.get === 'function')
|
|
8615
|
-
.filter(([key]) => key !== '__proto__')
|
|
8616
|
-
.map(([key]) => key);
|
|
8617
|
-
for (const getter of getters) {
|
|
8618
|
-
getterSet.add(getter);
|
|
8619
|
-
}
|
|
8620
|
-
currObj = Object.getPrototypeOf(currObj);
|
|
8621
|
-
}
|
|
8622
|
-
return Array.from(getterSet);
|
|
8623
|
-
}
|
|
8624
|
-
}
|
|
8625
|
-
|
|
8626
|
-
class StringUtil {
|
|
8627
|
-
static escapeHtml(value) {
|
|
8628
|
-
return value.replace(/</g, '<').replace(/>/g, '>');
|
|
8629
|
-
}
|
|
8630
|
-
static escapeHtmlAny(value) {
|
|
8631
|
-
if (typeof value === 'string') {
|
|
8632
|
-
return StringUtil.escapeHtml(value);
|
|
8633
|
-
}
|
|
8634
|
-
else if (typeof value === 'object') {
|
|
8635
|
-
const escapedValue = ObjectUtil.deepCopy(value, { mapGettersToProperties: true });
|
|
8636
|
-
for (const key in value) {
|
|
8637
|
-
if (typeof value[key] === 'string') {
|
|
8638
|
-
escapedValue[key] = StringUtil.escapeHtml(value[key]);
|
|
8639
|
-
}
|
|
8640
|
-
else if (typeof value[key] === 'object') {
|
|
8641
|
-
escapedValue[key] = StringUtil.escapeHtmlAny(value[key]);
|
|
8642
|
-
}
|
|
8643
|
-
else {
|
|
8644
|
-
escapedValue[key] = value[key];
|
|
8645
|
-
}
|
|
8646
|
-
}
|
|
8647
|
-
return escapedValue;
|
|
8648
|
-
}
|
|
8649
|
-
return value;
|
|
8650
|
-
}
|
|
8651
|
-
}
|
|
8652
|
-
|
|
8653
9011
|
class ExportUtils {
|
|
8654
9012
|
static prepareDataForExport(pageData, delimiter, descriptor, translate) {
|
|
8655
9013
|
const replaceNullValue = (key, value) => (value === null ? '' : value);
|
|
@@ -8892,7 +9250,7 @@ class ActionDescriptor {
|
|
|
8892
9250
|
this._model = model;
|
|
8893
9251
|
this._actionName = actionName;
|
|
8894
9252
|
if ((parentType && !parentProperty) || (!parentProperty && parentProperty)) {
|
|
8895
|
-
throw new MngInternalError(`Provide both the parent type and parent property or none: ${parentType}, ${parentProperty}
|
|
9253
|
+
throw new MngInternalError(`Provide both the parent type and parent property or none: ${this._actionName}, ${parentType}, ${parentProperty}.`);
|
|
8896
9254
|
}
|
|
8897
9255
|
this._parentType = parentType;
|
|
8898
9256
|
this._parentTypeName = parentType ? TypeUtil.findTypeName(parentType) : undefined;
|
|
@@ -8941,7 +9299,7 @@ class ActionDescriptor {
|
|
|
8941
9299
|
}
|
|
8942
9300
|
get runFunction() {
|
|
8943
9301
|
if (!this._runFunction) {
|
|
8944
|
-
throw new MngInternalError(
|
|
9302
|
+
throw new MngInternalError(`Run function is not defined for action ${this._actionNameLong} and cannot be invoked`);
|
|
8945
9303
|
}
|
|
8946
9304
|
return this._runFunction;
|
|
8947
9305
|
}
|
|
@@ -9027,7 +9385,7 @@ class ActionDescriptor {
|
|
|
9027
9385
|
}
|
|
9028
9386
|
withServiceType(serviceType) {
|
|
9029
9387
|
if (!this._model) {
|
|
9030
|
-
throw new MngInternalError(`Cannot set data provider if no model type is provided
|
|
9388
|
+
throw new MngInternalError(`Cannot set data provider for action ${this._actionNameLong} if no model type is provided`);
|
|
9031
9389
|
}
|
|
9032
9390
|
this._dataProvider = new DataProvider(this._model.type, serviceType);
|
|
9033
9391
|
return this;
|
|
@@ -9217,7 +9575,7 @@ class ActionEditorDescriptor extends ActionDescriptor {
|
|
|
9217
9575
|
return this._dataProvider;
|
|
9218
9576
|
}
|
|
9219
9577
|
get runFunction() {
|
|
9220
|
-
throw new MngInternalError(
|
|
9578
|
+
throw new MngInternalError(`Run function cannot be used in editor action for ${this._actionNameLong}. Use submit function instead`);
|
|
9221
9579
|
}
|
|
9222
9580
|
get fetchFunction() {
|
|
9223
9581
|
return this._fetchFunction;
|
|
@@ -9251,7 +9609,7 @@ class ActionEditorDescriptor extends ActionDescriptor {
|
|
|
9251
9609
|
}
|
|
9252
9610
|
withServiceType(serviceType) {
|
|
9253
9611
|
if (!this._model) {
|
|
9254
|
-
throw new MngInternalError(`Cannot set data provider if no model type is provided
|
|
9612
|
+
throw new MngInternalError(`Cannot set data provider for action ${this._actionNameLong} if no model type is provided`);
|
|
9255
9613
|
}
|
|
9256
9614
|
this._dataProvider = new EditorDataProvider(this._model.type, serviceType);
|
|
9257
9615
|
return this;
|
|
@@ -10602,6 +10960,14 @@ class MngAutocompleteComponent {
|
|
|
10602
10960
|
this.searchSubscription = this.getLookup(queryParamBuilder.build(), event.query).subscribe({
|
|
10603
10961
|
next: items => {
|
|
10604
10962
|
this.setSuggestionsFromItems(items, event.query);
|
|
10963
|
+
},
|
|
10964
|
+
error: err => {
|
|
10965
|
+
this.setSuggestionsFromItems([], event.query);
|
|
10966
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngAutocompleteComponentError', {
|
|
10967
|
+
search: event.query,
|
|
10968
|
+
queryParam: queryParamBuilder.build()
|
|
10969
|
+
});
|
|
10970
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
10605
10971
|
}
|
|
10606
10972
|
});
|
|
10607
10973
|
}
|
|
@@ -10708,7 +11074,9 @@ class MngAutocompleteComponent {
|
|
|
10708
11074
|
this.itemsValueProperty = 'value';
|
|
10709
11075
|
}
|
|
10710
11076
|
else {
|
|
10711
|
-
throw new MngInternalError(`Invalid use with value (${this.itemsLabelPropertyInit}) and label (${this.itemsLabelPropertyInit}) property setup.`,
|
|
11077
|
+
throw new MngInternalError(`Invalid use with value (${this.itemsLabelPropertyInit}) and label (${this.itemsLabelPropertyInit}) property setup.`, {
|
|
11078
|
+
name: 'MngAutocompleteComponentError'
|
|
11079
|
+
});
|
|
10712
11080
|
}
|
|
10713
11081
|
}
|
|
10714
11082
|
}
|
|
@@ -10884,7 +11252,9 @@ class MngDropdownComponent {
|
|
|
10884
11252
|
this.itemsValueProperty = 'value';
|
|
10885
11253
|
}
|
|
10886
11254
|
else {
|
|
10887
|
-
throw new MngInternalError(`Invalid use with value (${this.itemsLabelPropertyInit}) and label (${this.itemsLabelPropertyInit}) property setup.`,
|
|
11255
|
+
throw new MngInternalError(`Invalid use with value (${this.itemsLabelPropertyInit}) and label (${this.itemsLabelPropertyInit}) property setup.`, {
|
|
11256
|
+
name: 'MngDropdownComponentError'
|
|
11257
|
+
});
|
|
10888
11258
|
}
|
|
10889
11259
|
}
|
|
10890
11260
|
this.itemsSubscription = this.dataProvider
|
|
@@ -10917,9 +11287,17 @@ class MngDropdownComponent {
|
|
|
10917
11287
|
return of(items);
|
|
10918
11288
|
}
|
|
10919
11289
|
}))
|
|
10920
|
-
.subscribe(
|
|
10921
|
-
|
|
10922
|
-
|
|
11290
|
+
.subscribe({
|
|
11291
|
+
next: res => {
|
|
11292
|
+
this.itemsSubject.next(res);
|
|
11293
|
+
this.loadingSubject.next(false);
|
|
11294
|
+
},
|
|
11295
|
+
error: err => {
|
|
11296
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngDropdownComponentError', {
|
|
11297
|
+
queryParam: queryParamBuilder.build()
|
|
11298
|
+
});
|
|
11299
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
11300
|
+
}
|
|
10923
11301
|
});
|
|
10924
11302
|
if (this.selectFirstItem && !this.dropdownFormControl?.value) {
|
|
10925
11303
|
this.items$.pipe(first()).subscribe(res => {
|
|
@@ -12110,6 +12488,7 @@ class MngTableComponent {
|
|
|
12110
12488
|
this.localStorageService = localStorageService;
|
|
12111
12489
|
this.filterDisplayRow = TableFilterDisplayEnum.Row;
|
|
12112
12490
|
this.cmpTypeName = 'MngTableComponent';
|
|
12491
|
+
this.logger = inject(MngLoggerService).create(this.cmpTypeName);
|
|
12113
12492
|
this.useQueryParams = false;
|
|
12114
12493
|
// extra features input
|
|
12115
12494
|
this.selectionMode = 'multiple';
|
|
@@ -12170,52 +12549,11 @@ class MngTableComponent {
|
|
|
12170
12549
|
// Used for configs within this method and is not dynamically set by TableDynamicDescriptor
|
|
12171
12550
|
const baseConfigDescriptor = this.initialDescriptor;
|
|
12172
12551
|
if (!(this.initialDescriptor instanceof TableDynamicDescriptor)) {
|
|
12173
|
-
this.
|
|
12552
|
+
this.setMainAndRelatedDescriptors(this.initialDescriptor);
|
|
12174
12553
|
}
|
|
12175
12554
|
// map row settings
|
|
12176
|
-
this.filterDescriptors = this.descriptor?.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor) ?? [];
|
|
12177
|
-
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
12178
12555
|
this.rows = baseConfigDescriptor?.defaultNumRows ?? 25;
|
|
12179
12556
|
this.rowsPerPageOptions = baseConfigDescriptor?.rowsPerPageOptions ?? [25, 50, 100];
|
|
12180
|
-
// get layout preferences if they exist
|
|
12181
|
-
if (this.descriptor?.model.typeName) {
|
|
12182
|
-
this.localstorageKey = TableviewUtil.generateTableLayoutPrefsKey(this.descriptor?.model.typeName, this.router.url, this.descriptor?.dataKey);
|
|
12183
|
-
const preferences = this.localStorageService.getItem(this.cmpTypeName, this.localstorageKey);
|
|
12184
|
-
if (preferences && typeof preferences === 'object') {
|
|
12185
|
-
if (preferences.columnWidths) {
|
|
12186
|
-
this.layoutPreferences.columnWidths = preferences.columnWidths;
|
|
12187
|
-
}
|
|
12188
|
-
if (preferences.columnOrder && Array.isArray(preferences.columnOrder) && preferences.columnOrder.every((el) => typeof el === 'string')) {
|
|
12189
|
-
this.layoutPreferences.columnOrder = preferences.columnOrder;
|
|
12190
|
-
}
|
|
12191
|
-
if (preferences.columnVisibility && Array.isArray(preferences.columnVisibility) && preferences.columnVisibility.every((el) => typeof el === 'string')) {
|
|
12192
|
-
this.layoutPreferences.columnVisibility = preferences.columnVisibility;
|
|
12193
|
-
}
|
|
12194
|
-
}
|
|
12195
|
-
}
|
|
12196
|
-
// initialize columns with additional properties
|
|
12197
|
-
if (this.descriptor?.columns) {
|
|
12198
|
-
this.areColumnsReorderable = this.descriptor.columns.some(value => value.isReorderable);
|
|
12199
|
-
this.areColumnsToggleable = this.descriptor.columns.some(value => value.isToggleable);
|
|
12200
|
-
this.columns = this.descriptor.columns.map(col => ({
|
|
12201
|
-
descriptor: col,
|
|
12202
|
-
disabled: !col.isToggleable,
|
|
12203
|
-
isVisible: this.layoutPreferences.columnVisibility ? this.layoutPreferences.columnVisibility.includes(col.property) : col.isVisible,
|
|
12204
|
-
width: this.layoutPreferences.columnWidths?.[col.property]
|
|
12205
|
-
}));
|
|
12206
|
-
if (this.layoutPreferences.columnOrder) {
|
|
12207
|
-
const newColumnOrder = [];
|
|
12208
|
-
for (const colName of this.layoutPreferences.columnOrder) {
|
|
12209
|
-
const foundCol = this.columns.find(el => el.descriptor.property === colName);
|
|
12210
|
-
if (foundCol) {
|
|
12211
|
-
newColumnOrder.push(foundCol);
|
|
12212
|
-
}
|
|
12213
|
-
}
|
|
12214
|
-
if (newColumnOrder.length === this.columns.length)
|
|
12215
|
-
this.columns = newColumnOrder;
|
|
12216
|
-
}
|
|
12217
|
-
this.visibleColumns = this.columns.filter(el => el.isVisible);
|
|
12218
|
-
}
|
|
12219
12557
|
// process actions
|
|
12220
12558
|
for (const action of this.actions) {
|
|
12221
12559
|
switch (action.position) {
|
|
@@ -12478,13 +12816,7 @@ class MngTableComponent {
|
|
|
12478
12816
|
.subscribe({
|
|
12479
12817
|
next: res => {
|
|
12480
12818
|
if (this.initialDescriptor instanceof TableDynamicDescriptor) {
|
|
12481
|
-
this.
|
|
12482
|
-
this.filterDescriptors = this.descriptor.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor);
|
|
12483
|
-
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
12484
|
-
this.isPagination = this.descriptor.paginationMode === TablePaginationModeEnum.Pagination;
|
|
12485
|
-
this.infiniteScroll = this.descriptor.paginationMode === TablePaginationModeEnum.InfiniteScroll;
|
|
12486
|
-
this.rows = this.initialDescriptor.defaultNumRows;
|
|
12487
|
-
this.rowsPerPageOptions = this.initialDescriptor.rowsPerPageOptions;
|
|
12819
|
+
this.setMainAndRelatedDescriptors(this.initialDescriptor.toTableDescriptorFromData(res));
|
|
12488
12820
|
}
|
|
12489
12821
|
if (this.infiniteScroll) {
|
|
12490
12822
|
if (this.isFilterChanged || this.isSortChanged) {
|
|
@@ -12508,6 +12840,10 @@ class MngTableComponent {
|
|
|
12508
12840
|
emptyQueryResult.allDataCount = 0;
|
|
12509
12841
|
this.dataProviderQueryResultSubject.next(emptyQueryResult);
|
|
12510
12842
|
this.dataProviderLoadingSubject.next(false);
|
|
12843
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngTableComponentError', {
|
|
12844
|
+
queryParam: queryParam
|
|
12845
|
+
});
|
|
12846
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
12511
12847
|
}
|
|
12512
12848
|
});
|
|
12513
12849
|
if (emitEvent) {
|
|
@@ -12526,6 +12862,50 @@ class MngTableComponent {
|
|
|
12526
12862
|
this.useQueryParamsInitializedSubejct.next(true);
|
|
12527
12863
|
this.loadTableWithDataProvider(mediusQueryParam);
|
|
12528
12864
|
}
|
|
12865
|
+
setMainAndRelatedDescriptors(descriptor) {
|
|
12866
|
+
this.descriptor = descriptor;
|
|
12867
|
+
this.filterDescriptors = this.descriptor?.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor) ?? [];
|
|
12868
|
+
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
12869
|
+
// get layout preferences if they exist
|
|
12870
|
+
if (this.descriptor?.model.typeName) {
|
|
12871
|
+
this.localstorageKey = TableviewUtil.generateTableLayoutPrefsKey(this.descriptor?.model.typeName, this.router.url, this.descriptor?.dataKey);
|
|
12872
|
+
const preferences = this.localStorageService.getItem(this.cmpTypeName, this.localstorageKey);
|
|
12873
|
+
if (preferences && typeof preferences === 'object') {
|
|
12874
|
+
if (preferences.columnWidths) {
|
|
12875
|
+
this.layoutPreferences.columnWidths = preferences.columnWidths;
|
|
12876
|
+
}
|
|
12877
|
+
if (preferences.columnOrder && Array.isArray(preferences.columnOrder) && preferences.columnOrder.every((el) => typeof el === 'string')) {
|
|
12878
|
+
this.layoutPreferences.columnOrder = preferences.columnOrder;
|
|
12879
|
+
}
|
|
12880
|
+
if (preferences.columnVisibility && Array.isArray(preferences.columnVisibility) && preferences.columnVisibility.every((el) => typeof el === 'string')) {
|
|
12881
|
+
this.layoutPreferences.columnVisibility = preferences.columnVisibility;
|
|
12882
|
+
}
|
|
12883
|
+
}
|
|
12884
|
+
}
|
|
12885
|
+
// initialize columns with additional properties
|
|
12886
|
+
if (this.descriptor?.columns) {
|
|
12887
|
+
this.areColumnsReorderable = this.descriptor.columns.some(value => value.isReorderable);
|
|
12888
|
+
this.areColumnsToggleable = this.descriptor.columns.some(value => value.isToggleable);
|
|
12889
|
+
this.columns = this.descriptor.columns.map(col => ({
|
|
12890
|
+
descriptor: col,
|
|
12891
|
+
disabled: !col.isToggleable,
|
|
12892
|
+
isVisible: this.layoutPreferences.columnVisibility ? this.layoutPreferences.columnVisibility.includes(col.property) : col.isVisible,
|
|
12893
|
+
width: this.layoutPreferences.columnWidths?.[col.property]
|
|
12894
|
+
}));
|
|
12895
|
+
if (this.layoutPreferences.columnOrder) {
|
|
12896
|
+
const newColumnOrder = [];
|
|
12897
|
+
for (const colName of this.layoutPreferences.columnOrder) {
|
|
12898
|
+
const foundCol = this.columns.find(el => el.descriptor.property === colName);
|
|
12899
|
+
if (foundCol) {
|
|
12900
|
+
newColumnOrder.push(foundCol);
|
|
12901
|
+
}
|
|
12902
|
+
}
|
|
12903
|
+
if (newColumnOrder.length === this.columns.length)
|
|
12904
|
+
this.columns = newColumnOrder;
|
|
12905
|
+
}
|
|
12906
|
+
this.visibleColumns = this.columns.filter(el => el.isVisible);
|
|
12907
|
+
}
|
|
12908
|
+
}
|
|
12529
12909
|
updatePrimeSortAndFilter(mediusQueryParam) {
|
|
12530
12910
|
this.multiSortMeta = this.createSortMeta(mediusQueryParam);
|
|
12531
12911
|
this.filterMetadata = this.createFilterMeta(mediusQueryParam);
|
|
@@ -13127,6 +13507,7 @@ class MngFormlyFieldLookupDialogComponent extends FieldType {
|
|
|
13127
13507
|
constructor(injector) {
|
|
13128
13508
|
super();
|
|
13129
13509
|
this.injector = injector;
|
|
13510
|
+
this.logger = inject(MngLoggerService).create('MngFormlyFieldLookupDialogComponent');
|
|
13130
13511
|
this.fieldLabelFormControl = new FormControl();
|
|
13131
13512
|
this.itemsSubject = new ReplaySubject(1);
|
|
13132
13513
|
this.itemsAsync = this.itemsSubject.asObservable();
|
|
@@ -13217,6 +13598,10 @@ class MngFormlyFieldLookupDialogComponent extends FieldType {
|
|
|
13217
13598
|
eventSubtype: 'LookupError',
|
|
13218
13599
|
queryResult: err
|
|
13219
13600
|
});
|
|
13601
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngFormlyFieldLookupDialogComponentError', {
|
|
13602
|
+
queryParam: queryParamBuilder.build()
|
|
13603
|
+
});
|
|
13604
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
13220
13605
|
}
|
|
13221
13606
|
});
|
|
13222
13607
|
}
|
|
@@ -13274,7 +13659,7 @@ class MngFormlyFieldLookupDialogComponent extends FieldType {
|
|
|
13274
13659
|
if (typeof value === 'object') {
|
|
13275
13660
|
const labelProperty = this.descriptor.itemsLabelProperty ?? this.descriptor.dialogTableDescriptor?.model.titlePropertyName;
|
|
13276
13661
|
if (!labelProperty) {
|
|
13277
|
-
throw new MngInternalError('Could not determine label property.', '
|
|
13662
|
+
throw new MngInternalError('Could not determine label property.', { name: 'MngFormlyFieldLookupDialogError' });
|
|
13278
13663
|
}
|
|
13279
13664
|
this.fieldLabelFormControl.setValue(value[labelProperty]);
|
|
13280
13665
|
}
|
|
@@ -13336,7 +13721,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
13336
13721
|
})
|
|
13337
13722
|
.withSubmitFunction(ctx => {
|
|
13338
13723
|
if (!ctx.parameters.item) {
|
|
13339
|
-
return throwError(() => new MngInternalError(`No item was provided in context, add cannot be done.`, '
|
|
13724
|
+
return throwError(() => new MngInternalError(`No item was provided in context, add cannot be done.`, { name: 'FormlyFieldTableDialogFormComponentError' }));
|
|
13340
13725
|
}
|
|
13341
13726
|
this.formState.submittedOn = Date.now();
|
|
13342
13727
|
let value = this.formControl.value;
|
|
@@ -13364,7 +13749,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
13364
13749
|
})
|
|
13365
13750
|
.withSubmitFunction(ctx => {
|
|
13366
13751
|
if (!ctx.parameters.item) {
|
|
13367
|
-
return throwError(() => new MngInternalError(`No item was provided in context, edit cannot be done.`, '
|
|
13752
|
+
return throwError(() => new MngInternalError(`No item was provided in context, edit cannot be done.`, { name: 'FormlyFieldTableDialogFormComponentError' }));
|
|
13368
13753
|
}
|
|
13369
13754
|
this.formState.submittedOn = Date.now();
|
|
13370
13755
|
const formControlValue = this.formControl.value;
|
|
@@ -13387,7 +13772,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
13387
13772
|
.withButtonDescriptor(new ActionButtonDescriptor().withStyleClass(new ButtonStyleBuilder(StyleLevelEnum.Danger).withSize(StyleSizeEnum.ExtraSmall)))
|
|
13388
13773
|
.withRunFunction(ctx => {
|
|
13389
13774
|
if (!ctx.parameters.item) {
|
|
13390
|
-
return throwError(() => new MngInternalError(`No item was provided in context, delete cannot be done.`, '
|
|
13775
|
+
return throwError(() => new MngInternalError(`No item was provided in context, delete cannot be done.`, { name: 'FormlyFieldTableDialogFormComponentError' }));
|
|
13391
13776
|
}
|
|
13392
13777
|
let formControlValue = this.formControl.value;
|
|
13393
13778
|
const compareProperty = this.descriptor.tableDescriptor.dataKeyProperty
|
|
@@ -13405,7 +13790,9 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
13405
13790
|
this.formControl.markAsDirty();
|
|
13406
13791
|
}
|
|
13407
13792
|
else {
|
|
13408
|
-
return throwError(() => new MngInternalError('Cannot compare items, please provide main table data key property or model id property.',
|
|
13793
|
+
return throwError(() => new MngInternalError('Cannot compare items, please provide main table data key property or model id property.', {
|
|
13794
|
+
name: 'FormlyFieldTableDialogFormComponentError'
|
|
13795
|
+
}));
|
|
13409
13796
|
}
|
|
13410
13797
|
this.formControl.markAsTouched();
|
|
13411
13798
|
return of(ctxItem);
|
|
@@ -13488,6 +13875,7 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13488
13875
|
constructor(injector) {
|
|
13489
13876
|
super();
|
|
13490
13877
|
this.injector = injector;
|
|
13878
|
+
this.logger = inject(MngLoggerService).create('MngFormlyFieldTableDialogMultiselectComponent');
|
|
13491
13879
|
this.itemsSubject = new ReplaySubject(1);
|
|
13492
13880
|
this.itemsAsync = this.itemsSubject.asObservable();
|
|
13493
13881
|
this.addItemsSubject = new ReplaySubject(1);
|
|
@@ -13565,7 +13953,7 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13565
13953
|
this.descriptor.lookupTableDescriptor.defaultSortProperty.forEach((p, idx) => queryParamBuilder.withSort(p, this.descriptor.lookupTableDescriptor.defaultSortAsc[idx]));
|
|
13566
13954
|
}
|
|
13567
13955
|
if (this.descriptor.hasLookupExcludeValues) {
|
|
13568
|
-
const filterValues = this.formControl.value.map((i) => i
|
|
13956
|
+
const filterValues = this.formControl.value.map((i) => ObjectUtil.getPropertyByPath(i, this.descriptor.excludeValueProperty));
|
|
13569
13957
|
queryParamBuilder.withFilter(this.descriptor.excludeFilterProperty, filterValues, undefined, MediusFilterMatchType.NotIn);
|
|
13570
13958
|
}
|
|
13571
13959
|
this.lookupDataProviderSubscription = this.descriptor.lookupTableDataProvider?.getAll(queryParamBuilder.build(), this.dialogDataProviderService).subscribe({
|
|
@@ -13574,8 +13962,12 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13574
13962
|
this.dialogAreItemsLoaded = true;
|
|
13575
13963
|
this.dialogIsLoadingSubject.next(false);
|
|
13576
13964
|
},
|
|
13577
|
-
error:
|
|
13965
|
+
error: err => {
|
|
13578
13966
|
this.dialogIsLoadingSubject.next(false);
|
|
13967
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngFormlyFieldTableDialogMultiselectComponent', {
|
|
13968
|
+
queryParam: queryParamBuilder.build()
|
|
13969
|
+
});
|
|
13970
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
13579
13971
|
}
|
|
13580
13972
|
});
|
|
13581
13973
|
});
|
|
@@ -13618,9 +14010,11 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13618
14010
|
? this.descriptor.mainTableDescriptor.dataKeyProperty
|
|
13619
14011
|
: this.descriptor.mainTableDescriptor.model.idPropertyName;
|
|
13620
14012
|
if (!compareProperty) {
|
|
13621
|
-
throw new MngInternalError('Cannot compare items, please provide main table data key property or model id property.',
|
|
14013
|
+
throw new MngInternalError('Cannot compare items, please provide main table data key property or model id property.', {
|
|
14014
|
+
name: 'FormlyFieldTableDialogMultiselectComponentError'
|
|
14015
|
+
});
|
|
13622
14016
|
}
|
|
13623
|
-
value = value.filter((i) => i
|
|
14017
|
+
value = value.filter((i) => ObjectUtil.getPropertyByPath(i, compareProperty) !== ObjectUtil.getPropertyByPath(item, compareProperty));
|
|
13624
14018
|
this.formControl.patchValue(value);
|
|
13625
14019
|
this.formControl.markAsTouched();
|
|
13626
14020
|
this.formControl.markAsDirty();
|
|
@@ -13631,11 +14025,11 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13631
14025
|
this.searchDebounceSubject.next(query);
|
|
13632
14026
|
}
|
|
13633
14027
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngFormlyFieldTableDialogMultiselectComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
13634
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngFormlyFieldTableDialogMultiselectComponent, isStandalone: true, selector: "mng-formly-table-multiselect-add-field", viewQueries: [{ propertyName: "addTableComponent", first: true, predicate: ["addTableComponent"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mng-table [descriptor]=\"descriptor.mainTableDescriptor\" [items]=\"itemsAsync\" [viewContainer]=\"viewContainer\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-row justify-content-end align-items-center table-header pt-0\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\"\n >{{ props.label! | translate }} <span *ngIf=\"props.required && props['hideRequiredMarker'] !== true\">*</span></label\n >\n <button\n *ngIf=\"hasAddAction && !options?.formState?.disabled\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-plus\"\n class=\"p-button-rounded mng-button-xs\"\n (click)=\"openAddDialog()\"\n [disabled]=\"formControl!.disabled\"></button>\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnAction\" let-item=\"rowItem\">\n <button\n *ngIf=\"hasDeleteAction && !options?.formState?.disabled\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n class=\"p-button-rounded p-button-danger mng-button-xs\"\n (click)=\"removeItem(item)\"\n [disabled]=\"formControl!.disabled\"></button>\n </ng-template>\n</mng-table>\n\n<p-dialog\n *ngIf=\"hasAddAction\"\n [(visible)]=\"isDialogVisible\"\n [draggable]=\"false\"\n [header]=\"'general.addItem' | translate : {item: props.label! | translate}\"\n [modal]=\"true\"\n appendTo=\"body\"\n styleClass=\"p-fluid mng-dialog mng-dialog-sm mng-formly-field-table-multiselect-dialog\">\n <ng-template pTemplate=\"content\" class=\"table-container\">\n <div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1 formly-field-table-multiselect-dialog-form-container\">\n <div class=\"mng-formly-field-table-multiselect-dialog-table\">\n <mng-table\n #addTableComponent\n [descriptor]=\"descriptor.
|
|
14028
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngFormlyFieldTableDialogMultiselectComponent, isStandalone: true, selector: "mng-formly-table-multiselect-add-field", viewQueries: [{ propertyName: "addTableComponent", first: true, predicate: ["addTableComponent"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mng-table [descriptor]=\"descriptor.mainTableDescriptor\" [items]=\"itemsAsync\" [viewContainer]=\"viewContainer\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-row justify-content-end align-items-center table-header pt-0\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\"\n >{{ props.label! | translate }} <span *ngIf=\"props.required && props['hideRequiredMarker'] !== true\">*</span></label\n >\n <button\n *ngIf=\"hasAddAction && !options?.formState?.disabled\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-plus\"\n class=\"p-button-rounded mng-button-xs\"\n (click)=\"openAddDialog()\"\n [disabled]=\"formControl!.disabled\"></button>\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnAction\" let-item=\"rowItem\">\n <button\n *ngIf=\"hasDeleteAction && !options?.formState?.disabled\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n class=\"p-button-rounded p-button-danger mng-button-xs\"\n (click)=\"removeItem(item)\"\n [disabled]=\"formControl!.disabled\"></button>\n </ng-template>\n</mng-table>\n\n<p-dialog\n *ngIf=\"hasAddAction\"\n [(visible)]=\"isDialogVisible\"\n [draggable]=\"false\"\n [header]=\"'general.addItem' | translate : {item: props.label! | translate}\"\n [modal]=\"true\"\n appendTo=\"body\"\n styleClass=\"p-fluid mng-dialog mng-dialog-sm mng-formly-field-table-multiselect-dialog\">\n <ng-template pTemplate=\"content\" class=\"table-container\">\n <div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1 formly-field-table-multiselect-dialog-form-container\">\n <div class=\"mng-formly-field-table-multiselect-dialog-table\">\n <mng-table\n #addTableComponent\n [descriptor]=\"descriptor.lookupTableDescriptor\"\n [globalFilterFields]=\"descriptor.searchFields\"\n [queryResult]=\"addItemsAsync\"\n [selectionEnabled]=\"true\"\n [loading]=\"dialogIsLoading$\"\n (selectionChange)=\"onSelectionChange($event)\"\n [viewContainer]=\"viewContainer\">\n <ng-template *ngIf=\"descriptor.searchEnabled\" mngTemplate=\"caption\">\n <div class=\"flex\">\n <span class=\"p-input-icon-left ml-auto\" [ngStyle]=\"{width: 'unset'}\">\n <i class=\"pi pi-search\"></i>\n <input pInputText type=\"text\" (input)=\"onSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n </span>\n </div>\n </ng-template>\n </mng-table>\n </div>\n </div>\n\n <div class=\"flex flex-row justify-content-end mng-formly-field-table-multiselect-dialog-footer\">\n <button pButton pRipple type=\"button\" [label]=\"'general.cancel' | translate\" icon=\"pi pi-times\" class=\"p-button-text\" (click)=\"hideDialog()\"></button>\n <button\n pButton\n pRipple\n type=\"button\"\n [label]=\"'general.add' | translate\"\n icon=\"pi pi-check\"\n class=\"p-button-primary\"\n (click)=\"addItems()\"\n [loading]=\"(dialogIsLoading$ | async) ?? false\"\n [disabled]=\"form.disabled\"></button>\n </div>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [".table-footer{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;align-content:center;margin-top:2rem}.table-container{overflow:hidden}.table-footer button{width:8rem}.table-footer button:not(:first-child){margin-left:1.5rem}.table-scroll{max-height:75vh;overflow-y:auto}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth", "globalFilterFields"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4$4.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i1$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i6.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i6$1.Ripple, selector: "[pRipple]" }, { kind: "directive", type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i14.InputText, selector: "[pInputText]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
13635
14029
|
}
|
|
13636
14030
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngFormlyFieldTableDialogMultiselectComponent, decorators: [{
|
|
13637
14031
|
type: Component,
|
|
13638
|
-
args: [{ standalone: true, selector: 'mng-formly-table-multiselect-add-field', imports: [TranslateModule, NgIf, AsyncPipe, MngTableComponent, DialogModule, ButtonModule, RippleModule, MngTemplateDirective, InputTextModule, NgStyle], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-table [descriptor]=\"descriptor.mainTableDescriptor\" [items]=\"itemsAsync\" [viewContainer]=\"viewContainer\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-row justify-content-end align-items-center table-header pt-0\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\"\n >{{ props.label! | translate }} <span *ngIf=\"props.required && props['hideRequiredMarker'] !== true\">*</span></label\n >\n <button\n *ngIf=\"hasAddAction && !options?.formState?.disabled\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-plus\"\n class=\"p-button-rounded mng-button-xs\"\n (click)=\"openAddDialog()\"\n [disabled]=\"formControl!.disabled\"></button>\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnAction\" let-item=\"rowItem\">\n <button\n *ngIf=\"hasDeleteAction && !options?.formState?.disabled\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n class=\"p-button-rounded p-button-danger mng-button-xs\"\n (click)=\"removeItem(item)\"\n [disabled]=\"formControl!.disabled\"></button>\n </ng-template>\n</mng-table>\n\n<p-dialog\n *ngIf=\"hasAddAction\"\n [(visible)]=\"isDialogVisible\"\n [draggable]=\"false\"\n [header]=\"'general.addItem' | translate : {item: props.label! | translate}\"\n [modal]=\"true\"\n appendTo=\"body\"\n styleClass=\"p-fluid mng-dialog mng-dialog-sm mng-formly-field-table-multiselect-dialog\">\n <ng-template pTemplate=\"content\" class=\"table-container\">\n <div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1 formly-field-table-multiselect-dialog-form-container\">\n <div class=\"mng-formly-field-table-multiselect-dialog-table\">\n <mng-table\n #addTableComponent\n [descriptor]=\"descriptor.
|
|
14032
|
+
args: [{ standalone: true, selector: 'mng-formly-table-multiselect-add-field', imports: [TranslateModule, NgIf, AsyncPipe, MngTableComponent, DialogModule, ButtonModule, RippleModule, MngTemplateDirective, InputTextModule, NgStyle], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-table [descriptor]=\"descriptor.mainTableDescriptor\" [items]=\"itemsAsync\" [viewContainer]=\"viewContainer\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-row justify-content-end align-items-center table-header pt-0\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\"\n >{{ props.label! | translate }} <span *ngIf=\"props.required && props['hideRequiredMarker'] !== true\">*</span></label\n >\n <button\n *ngIf=\"hasAddAction && !options?.formState?.disabled\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-plus\"\n class=\"p-button-rounded mng-button-xs\"\n (click)=\"openAddDialog()\"\n [disabled]=\"formControl!.disabled\"></button>\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnAction\" let-item=\"rowItem\">\n <button\n *ngIf=\"hasDeleteAction && !options?.formState?.disabled\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n class=\"p-button-rounded p-button-danger mng-button-xs\"\n (click)=\"removeItem(item)\"\n [disabled]=\"formControl!.disabled\"></button>\n </ng-template>\n</mng-table>\n\n<p-dialog\n *ngIf=\"hasAddAction\"\n [(visible)]=\"isDialogVisible\"\n [draggable]=\"false\"\n [header]=\"'general.addItem' | translate : {item: props.label! | translate}\"\n [modal]=\"true\"\n appendTo=\"body\"\n styleClass=\"p-fluid mng-dialog mng-dialog-sm mng-formly-field-table-multiselect-dialog\">\n <ng-template pTemplate=\"content\" class=\"table-container\">\n <div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1 formly-field-table-multiselect-dialog-form-container\">\n <div class=\"mng-formly-field-table-multiselect-dialog-table\">\n <mng-table\n #addTableComponent\n [descriptor]=\"descriptor.lookupTableDescriptor\"\n [globalFilterFields]=\"descriptor.searchFields\"\n [queryResult]=\"addItemsAsync\"\n [selectionEnabled]=\"true\"\n [loading]=\"dialogIsLoading$\"\n (selectionChange)=\"onSelectionChange($event)\"\n [viewContainer]=\"viewContainer\">\n <ng-template *ngIf=\"descriptor.searchEnabled\" mngTemplate=\"caption\">\n <div class=\"flex\">\n <span class=\"p-input-icon-left ml-auto\" [ngStyle]=\"{width: 'unset'}\">\n <i class=\"pi pi-search\"></i>\n <input pInputText type=\"text\" (input)=\"onSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n </span>\n </div>\n </ng-template>\n </mng-table>\n </div>\n </div>\n\n <div class=\"flex flex-row justify-content-end mng-formly-field-table-multiselect-dialog-footer\">\n <button pButton pRipple type=\"button\" [label]=\"'general.cancel' | translate\" icon=\"pi pi-times\" class=\"p-button-text\" (click)=\"hideDialog()\"></button>\n <button\n pButton\n pRipple\n type=\"button\"\n [label]=\"'general.add' | translate\"\n icon=\"pi pi-check\"\n class=\"p-button-primary\"\n (click)=\"addItems()\"\n [loading]=\"(dialogIsLoading$ | async) ?? false\"\n [disabled]=\"form.disabled\"></button>\n </div>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [".table-footer{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;align-content:center;margin-top:2rem}.table-container{overflow:hidden}.table-footer button{width:8rem}.table-footer button:not(:first-child){margin-left:1.5rem}.table-scroll{max-height:75vh;overflow-y:auto}\n"] }]
|
|
13639
14033
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { addTableComponent: [{
|
|
13640
14034
|
type: ViewChild,
|
|
13641
14035
|
args: ['addTableComponent']
|
|
@@ -13679,7 +14073,8 @@ class MngFormlyFieldActionComponent extends FieldType {
|
|
|
13679
14073
|
this.buttonClass = this.descriptor.button.styleClass.build();
|
|
13680
14074
|
}
|
|
13681
14075
|
onClick() {
|
|
13682
|
-
this.
|
|
14076
|
+
this.actionMessage = undefined;
|
|
14077
|
+
const result = this.descriptor.runFunction?.({
|
|
13683
14078
|
descriptor: this.descriptor,
|
|
13684
14079
|
formEditorComponent: this.props.formEditorComponent,
|
|
13685
14080
|
formly: {
|
|
@@ -13691,13 +14086,26 @@ class MngFormlyFieldActionComponent extends FieldType {
|
|
|
13691
14086
|
props: this.props
|
|
13692
14087
|
}
|
|
13693
14088
|
});
|
|
14089
|
+
if (result) {
|
|
14090
|
+
if (isObservable(result)) {
|
|
14091
|
+
result.subscribe(res => this.processResult(res));
|
|
14092
|
+
}
|
|
14093
|
+
else {
|
|
14094
|
+
this.processResult(result);
|
|
14095
|
+
}
|
|
14096
|
+
}
|
|
14097
|
+
}
|
|
14098
|
+
processResult(res) {
|
|
14099
|
+
if (res.message) {
|
|
14100
|
+
this.actionMessage = res.message;
|
|
14101
|
+
}
|
|
13694
14102
|
}
|
|
13695
14103
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngFormlyFieldActionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
13696
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngFormlyFieldActionComponent, isStandalone: true, selector: "mng-formly-field-action", usesInheritance: true, ngImport: i0, template: "<button\n
|
|
14104
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngFormlyFieldActionComponent, isStandalone: true, selector: "mng-formly-field-action", usesInheritance: true, ngImport: i0, template: "<div class=\"flex\">\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(descriptor.button.icon)\"\n [label]=\"$any(descriptor.button.label === null ? null : descriptor.button.label ?? props!.label) | translate\"\n [pTooltip]=\"$any(descriptor.button.tooltip) | translate\"\n [disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n [class]=\"buttonClass + (actionMessage ? ' mr-2' : '')\"></button>\n <p-message *ngIf=\"actionMessage\" [text]=\"actionMessage!.content\" [severity]=\"actionMessage?.severity ?? 'success'\"></p-message>\n</div>\n", dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i6.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i6$1.Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i4$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i5$2.UIMessage, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
13697
14105
|
}
|
|
13698
14106
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngFormlyFieldActionComponent, decorators: [{
|
|
13699
14107
|
type: Component,
|
|
13700
|
-
args: [{ standalone: true, selector: 'mng-formly-field-action', imports: [ButtonModule, RippleModule, TranslateModule, TooltipModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n
|
|
14108
|
+
args: [{ standalone: true, selector: 'mng-formly-field-action', imports: [ButtonModule, RippleModule, TranslateModule, TooltipModule, JsonPipe, MessageModule, NgIf], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex\">\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(descriptor.button.icon)\"\n [label]=\"$any(descriptor.button.label === null ? null : descriptor.button.label ?? props!.label) | translate\"\n [pTooltip]=\"$any(descriptor.button.tooltip) | translate\"\n [disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n [class]=\"buttonClass + (actionMessage ? ' mr-2' : '')\"></button>\n <p-message *ngIf=\"actionMessage\" [text]=\"actionMessage!.content\" [severity]=\"actionMessage?.severity ?? 'success'\"></p-message>\n</div>\n" }]
|
|
13701
14109
|
}] });
|
|
13702
14110
|
|
|
13703
14111
|
class MngFormlyFieldCustomComponent extends FieldType {
|
|
@@ -13851,7 +14259,7 @@ class RouteUtil {
|
|
|
13851
14259
|
}
|
|
13852
14260
|
else if (path[0].startsWith('../')) {
|
|
13853
14261
|
// TODO: process multi upper folder
|
|
13854
|
-
throw new MngInternalError('Not implemented', '
|
|
14262
|
+
throw new MngInternalError('Not implemented', { name: 'RouteUtilsError' });
|
|
13855
14263
|
}
|
|
13856
14264
|
else {
|
|
13857
14265
|
return RouteUtil.removeEmptyPathSegments([...basePath, ...path]);
|
|
@@ -14571,16 +14979,12 @@ class MngErrorHandler {
|
|
|
14571
14979
|
}
|
|
14572
14980
|
static { this.logCategory = 'MngErrorHandler'; }
|
|
14573
14981
|
handleError(error) {
|
|
14574
|
-
if (error instanceof
|
|
14575
|
-
const
|
|
14576
|
-
this.logger.log(
|
|
14577
|
-
}
|
|
14578
|
-
else if (error instanceof HttpErrorResponse) {
|
|
14579
|
-
const isClientError = error.status >= 400 && error.status < 500;
|
|
14580
|
-
this.logger.log(`Http error occurred with status ${error.status} ${error.statusText}: ${error.message}`, isClientError ? LogLevelEnum.Warning : LogLevelEnum.Error, MngErrorHandler.logCategory, error);
|
|
14982
|
+
if (error instanceof AMngErrorBase || error instanceof HttpErrorResponse) {
|
|
14983
|
+
const logLevel = ErrorUtil.getErrorLogLevel(error);
|
|
14984
|
+
this.logger.log(error, logLevel);
|
|
14581
14985
|
}
|
|
14582
14986
|
else {
|
|
14583
|
-
this.logger.
|
|
14987
|
+
this.logger.error('Unexpected error occurred', error);
|
|
14584
14988
|
}
|
|
14585
14989
|
}
|
|
14586
14990
|
}
|
|
@@ -14593,6 +14997,7 @@ class MngCommonsInitService {
|
|
|
14593
14997
|
constructor() {
|
|
14594
14998
|
this.httpClient = inject(HttpClient);
|
|
14595
14999
|
this.logger = inject(MngLoggerService);
|
|
15000
|
+
this.logPublishers = inject(MNG_LOG_PUBLISHERS, { optional: true });
|
|
14596
15001
|
this.config = inject(MngConfigurationService);
|
|
14597
15002
|
this.mngCommons = inject(MngCommonsService);
|
|
14598
15003
|
this.mngRouter = inject(MngRouterService);
|
|
@@ -14632,7 +15037,7 @@ class MngCommonsInitService {
|
|
|
14632
15037
|
}
|
|
14633
15038
|
return this.config.loadJsonConfigurations().pipe(mergeMap(() => {
|
|
14634
15039
|
// init logger
|
|
14635
|
-
MngLoggerService.init(this.config);
|
|
15040
|
+
MngLoggerService.init(this.config, this.logPublishers ?? []);
|
|
14636
15041
|
if (this.commonsInitializers) {
|
|
14637
15042
|
ctxLogger.debug('Project initializers are being initialized');
|
|
14638
15043
|
return combineLatest(this.commonsInitializers.map(ci => ci())).pipe(map(res => res));
|
|
@@ -14987,6 +15392,11 @@ function provideMngCommons(config) {
|
|
|
14987
15392
|
provide: MngLoggerService,
|
|
14988
15393
|
useFactory: () => MngLoggerService.get()
|
|
14989
15394
|
},
|
|
15395
|
+
{
|
|
15396
|
+
provide: MNG_LOG_PUBLISHERS,
|
|
15397
|
+
useClass: MngLogPublisherConsoleService,
|
|
15398
|
+
multi: true
|
|
15399
|
+
},
|
|
14990
15400
|
{
|
|
14991
15401
|
provide: ErrorHandler,
|
|
14992
15402
|
useClass: MngErrorHandler
|
|
@@ -15710,13 +16120,13 @@ class RouteBuilder {
|
|
|
15710
16120
|
}
|
|
15711
16121
|
toParent() {
|
|
15712
16122
|
if (!this.parent) {
|
|
15713
|
-
throw new MngInternalError('Parent was not provided.', 'RouteBuilder error');
|
|
16123
|
+
throw new MngInternalError('Parent was not provided.', { name: 'RouteBuilder error' });
|
|
15714
16124
|
}
|
|
15715
16125
|
return this.parent;
|
|
15716
16126
|
}
|
|
15717
16127
|
toRoot() {
|
|
15718
16128
|
if (!this.root) {
|
|
15719
|
-
throw new MngInternalError('Root was not provided.', '
|
|
16129
|
+
throw new MngInternalError('Root was not provided.', { name: 'RouteBuilderError' });
|
|
15720
16130
|
}
|
|
15721
16131
|
return this.root;
|
|
15722
16132
|
}
|
|
@@ -15898,7 +16308,7 @@ class RoutesBuilder {
|
|
|
15898
16308
|
}
|
|
15899
16309
|
toRoute() {
|
|
15900
16310
|
if (!this.currentRoute) {
|
|
15901
|
-
throw new MngInternalError('No routes were added!', '
|
|
16311
|
+
throw new MngInternalError('No routes were added!', { name: 'RoutesBuilderError' });
|
|
15902
16312
|
}
|
|
15903
16313
|
return this.currentRoute;
|
|
15904
16314
|
}
|
|
@@ -16148,5 +16558,5 @@ function EnumName(typeName) {
|
|
|
16148
16558
|
* Generated bundle index. Do not edit.
|
|
16149
16559
|
*/
|
|
16150
16560
|
|
|
16151
|
-
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngFormlyCustomFieldComponent, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionButtonDescriptor, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnDisplayTypeEnum, ColumnDynamicDescriptor, ColumnTypeEnum, DataProvider, DateUtil, DefaultActionMngErrorMapperService, DynamicTableviewDataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, EnumeratePipeI18nHelper, ExportUtils, FieldActionDescriptor, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FileUtil, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterLookupTypeEnum, FilterMatchModeEnum, FilterTypeEnum, I18nUtils, IdProperty, JsonPathPipe, LogLevelEnum, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_BROWSER_STORAGE_IT, MNG_COMMONS_INITIALIZER_IT, MNG_DATE_RANGE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionErrorMapperService, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngClassMapPipe, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDataLanguageDropdownComponent, MngDateRangeComponent, MngDropdownComponent, MngEnumPipe, MngEnumerateAsyncPipe, MngEnumeratePipe, MngErrorHandler, MngErrorPageComponent, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormEvent, MngFormEventTypeEnum, MngFormFieldEvent, MngFormFieldEventComponentSubtype, MngFormFieldEventDialogSubtype, MngFormFieldEventTypeEnum, MngFormlyFieldActionComponent, MngFormlyFieldAutocompleteComponent, MngFormlyFieldCustomComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldLabelComponent, MngFormlyFieldLookupDialogComponent, MngFormlyFieldNoLabelWrapperComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngGetterPipe, MngI18nPropertyPipe, MngInternalError, MngLocalStorageService, MngLocaleDefaultRowClassPipe, MngLoggerService, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngNotFoundPageComponent, MngParametrizePipe, MngRouterService, MngTableCellClickEvent, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableLoadEvent, MngTableReloadEvent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTemplatePipe, MngTopbarComponent, MngTopbarUserComponent, MngVersionComponent, MngVersionService, MngViewContainerComponentService, ModelDescriptor, ModelUtil, NotificationUtil, ObjectSerializer, ObjectUtil, Permissions, RouteBuilder, RoutesBuilder, StringUtil, StyleLevelEnum, StyleSizeEnum, StylesUtil, TableDataProvider, TableDescriptor, TableDynamicColumnsModeEnum, TableDynamicDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewActionDefaultCategories, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewDynamicDescriptor, TableviewEditorTypeEnum, TableviewRouteBuilder, TableviewRouteBuilderInternal, TitleProperty, TypeName, TypeUtil, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxDateValidationMessage, getMaxLengthValidationMessage, getMaxValidationMessage, getMinDateValidationMessage, getMinLengthValidationMessage, getMinValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngAuthorizationGuard, mngFormlyConfigProvider, primeNgModules, provideMngCommons, typeMapBase };
|
|
16561
|
+
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngErrorBase, AMngFormlyCustomFieldComponent, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionButtonDescriptor, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnDisplayTypeEnum, ColumnDynamicDescriptor, ColumnTypeEnum, DataProvider, DateUtil, DefaultActionMngErrorMapperService, DynamicTableviewDataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, EnumeratePipeI18nHelper, ErrorUtil, ExportUtils, FieldActionDescriptor, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FileUtil, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterLookupTypeEnum, FilterMatchModeEnum, FilterTypeEnum, I18nUtils, IdProperty, JsonPathPipe, LogLevelEnum, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_BROWSER_STORAGE_IT, MNG_COMMONS_INITIALIZER_IT, MNG_DATE_RANGE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_LOG_PUBLISHERS, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionError, MngActionErrorMapperService, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngClassMapPipe, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDataLanguageDropdownComponent, MngDateRangeComponent, MngDropdownComponent, MngEnumPipe, MngEnumerateAsyncPipe, MngEnumeratePipe, MngErrorHandler, MngErrorPageComponent, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormEvent, MngFormEventTypeEnum, MngFormFieldEvent, MngFormFieldEventComponentSubtype, MngFormFieldEventDialogSubtype, MngFormFieldEventTypeEnum, MngFormlyFieldActionComponent, MngFormlyFieldAutocompleteComponent, MngFormlyFieldCustomComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldLabelComponent, MngFormlyFieldLookupDialogComponent, MngFormlyFieldNoLabelWrapperComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngGetterPipe, MngHttpError, MngI18nPropertyPipe, MngInternalError, MngLocalStorageService, MngLocaleDefaultRowClassPipe, MngLogPublisherConsoleService, MngLoggerService, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngNotFoundPageComponent, MngParametrizePipe, MngRouterService, MngTableCellClickEvent, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableLoadEvent, MngTableReloadEvent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTemplatePipe, MngTopbarComponent, MngTopbarUserComponent, MngVersionComponent, MngVersionService, MngViewContainerComponentService, ModelDescriptor, ModelUtil, NotificationUtil, ObjectSerializer, ObjectUtil, Permissions, RouteBuilder, RoutesBuilder, StringUtil, StyleLevelEnum, StyleSizeEnum, StylesUtil, TableDataProvider, TableDescriptor, TableDynamicColumnsModeEnum, TableDynamicDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewActionDefaultCategories, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewDynamicDescriptor, TableviewEditorTypeEnum, TableviewRouteBuilder, TableviewRouteBuilderInternal, TitleProperty, TypeName, TypeUtil, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxDateValidationMessage, getMaxLengthValidationMessage, getMaxValidationMessage, getMinDateValidationMessage, getMinLengthValidationMessage, getMinValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngAuthorizationGuard, mngFormlyConfigProvider, primeNgModules, provideMngCommons, typeMapBase };
|
|
16152
16562
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|