@mediusinc/mng-commons 3.0.0-rc.7 → 3.0.0-rc.9
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/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-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 +15 -6
- package/esm2022/lib/components/tableview/table/table.component.mjs +11 -6
- package/esm2022/lib/descriptors/action/action.descriptor.mjs +6 -6
- package/esm2022/lib/descriptors/editor/editor.descriptor.mjs +2 -2
- package/esm2022/lib/descriptors/filter/filter.descriptor.mjs +4 -4
- package/esm2022/lib/descriptors/table/column.descriptor.mjs +2 -2
- package/esm2022/lib/descriptors/table/table.descriptor.mjs +15 -5
- 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/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 +40 -25
- 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/router.service.mjs +28 -33
- 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/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/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 +700 -308
- 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-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/tableview/table/table.component.d.ts +1 -0
- package/lib/descriptors/editor/field.descriptor.d.ts +1 -1
- package/lib/descriptors/table/column.descriptor.d.ts +1 -1
- package/lib/descriptors/table/table.descriptor.d.ts +10 -3
- 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/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/router.service.d.ts +1 -2
- 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/string.util.d.ts +5 -0
- package/package.json +1 -1
- package/scss/mng-overrides/_theme_tableview.scss +4 -0
- package/esm2022/lib/models/internal-error.model.mjs +0 -30
- package/lib/models/internal-error.model.d.ts +0 -26
|
@@ -324,33 +324,47 @@ const typeMapBase = {
|
|
|
324
324
|
QueryParam: MediusQueryParam
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
-
class
|
|
328
|
-
constructor(message,
|
|
327
|
+
class AMngErrorBase extends Error {
|
|
328
|
+
constructor(message, options) {
|
|
329
329
|
super(message);
|
|
330
|
-
this.
|
|
331
|
-
this.name = name;
|
|
332
|
-
this.id = options?.id;
|
|
330
|
+
this.name = options?.name ?? 'MngError';
|
|
333
331
|
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;
|
|
332
|
+
this.location = options?.location ?? window?.location?.href;
|
|
339
333
|
this.cause = options?.cause;
|
|
340
334
|
this.stack = options?.stack ?? (options?.cause ? options.cause.stack : new Error(message).stack);
|
|
335
|
+
this.details = options?.details;
|
|
341
336
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
return message;
|
|
337
|
+
}
|
|
338
|
+
class MngInternalError extends AMngErrorBase {
|
|
339
|
+
constructor(message, options) {
|
|
340
|
+
super(message, {
|
|
341
|
+
name: 'MngInternalError',
|
|
342
|
+
...options
|
|
343
|
+
});
|
|
344
|
+
this.type = 'MngInternalError';
|
|
351
345
|
}
|
|
352
|
-
|
|
353
|
-
|
|
346
|
+
}
|
|
347
|
+
class MngHttpError extends AMngErrorBase {
|
|
348
|
+
constructor(message, httpError, options) {
|
|
349
|
+
super(message, {
|
|
350
|
+
name: 'MngHttpError_' + httpError.url,
|
|
351
|
+
cause: httpError,
|
|
352
|
+
...options
|
|
353
|
+
});
|
|
354
|
+
this.type = 'MngHttpError';
|
|
355
|
+
this.httpError = httpError;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
class MngActionError extends AMngErrorBase {
|
|
359
|
+
constructor(message, actionName, options) {
|
|
360
|
+
super(message, {
|
|
361
|
+
name: 'MngActionError_' + actionName,
|
|
362
|
+
...options
|
|
363
|
+
});
|
|
364
|
+
this.type = 'MngActionError';
|
|
365
|
+
this.actionId = actionName;
|
|
366
|
+
this.actionContext = options?.actionContext;
|
|
367
|
+
this.httpError = options?.httpError;
|
|
354
368
|
}
|
|
355
369
|
}
|
|
356
370
|
|
|
@@ -373,11 +387,11 @@ class ActionDataProviderUtil {
|
|
|
373
387
|
const serviceExec = ActionDataProviderUtil.runGetAllService(ctx);
|
|
374
388
|
return isObservable(serviceExec)
|
|
375
389
|
? serviceExec
|
|
376
|
-
: throwError(() => new
|
|
390
|
+
: 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
391
|
}
|
|
378
392
|
static runFetchOrFail(ctx) {
|
|
379
393
|
return (ActionDataProviderUtil.runFetch(ctx) ??
|
|
380
|
-
throwError(() => new
|
|
394
|
+
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
395
|
}
|
|
382
396
|
static runFetch(ctx, fallback) {
|
|
383
397
|
const dataProviderExec = ActionDataProviderUtil.runFetchDataProvider(ctx);
|
|
@@ -389,7 +403,7 @@ class ActionDataProviderUtil {
|
|
|
389
403
|
}
|
|
390
404
|
static runCreateOrFail(ctx) {
|
|
391
405
|
return (ActionDataProviderUtil.runCreate(ctx) ??
|
|
392
|
-
throwError(() => new
|
|
406
|
+
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
407
|
}
|
|
394
408
|
static runCreate(ctx, fallback) {
|
|
395
409
|
const dataProviderExec = ActionDataProviderUtil.runCreateDataProvider(ctx);
|
|
@@ -401,7 +415,7 @@ class ActionDataProviderUtil {
|
|
|
401
415
|
}
|
|
402
416
|
static runUpdateOrFail(ctx) {
|
|
403
417
|
return (ActionDataProviderUtil.runUpdate(ctx) ??
|
|
404
|
-
throwError(() => new
|
|
418
|
+
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
419
|
}
|
|
406
420
|
static runUpdate(ctx, fallback) {
|
|
407
421
|
const dataProviderExec = ActionDataProviderUtil.runUpdateDataProvider(ctx);
|
|
@@ -419,7 +433,7 @@ class ActionDataProviderUtil {
|
|
|
419
433
|
const serviceExec = ActionDataProviderUtil.runDeleteService(ctx);
|
|
420
434
|
return isObservable(serviceExec)
|
|
421
435
|
? serviceExec
|
|
422
|
-
: throwError(() => new
|
|
436
|
+
: 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
437
|
}
|
|
424
438
|
static runGetAllService(ctx) {
|
|
425
439
|
if (typeof ctx.serviceInstance !== 'undefined') {
|
|
@@ -1575,17 +1589,18 @@ class DefaultActionMngErrorMapperService extends MngActionErrorMapperService {
|
|
|
1575
1589
|
mngError = {
|
|
1576
1590
|
type: 'MngActionError',
|
|
1577
1591
|
name: error?.name ?? 'UnknownError',
|
|
1578
|
-
message: error.message ?? 'Unknown error'
|
|
1592
|
+
message: error.message ?? 'Unknown error',
|
|
1593
|
+
cause: error
|
|
1579
1594
|
};
|
|
1580
1595
|
}
|
|
1581
1596
|
return mngError;
|
|
1582
1597
|
}
|
|
1583
1598
|
}
|
|
1584
1599
|
|
|
1585
|
-
/* eslint-disable no-console */
|
|
1586
1600
|
class MngLoggerService {
|
|
1587
1601
|
static { this._instance = new MngLoggerService(); }
|
|
1588
1602
|
static { this._isInit = false; }
|
|
1603
|
+
static { this._publishers = []; }
|
|
1589
1604
|
static { this._entriesBuffer = []; }
|
|
1590
1605
|
static { this._categoryInstances = {}; }
|
|
1591
1606
|
static { this._timestampFormat = 'yyyy-MM-dd HH:mm:ss.SSS'; }
|
|
@@ -1603,15 +1618,19 @@ class MngLoggerService {
|
|
|
1603
1618
|
MngLoggerService._timestampFormat = config.timestampFormat;
|
|
1604
1619
|
}
|
|
1605
1620
|
}
|
|
1606
|
-
static init(configurationService) {
|
|
1621
|
+
static init(configurationService, publishers) {
|
|
1607
1622
|
if (MngLoggerService._isInit) {
|
|
1608
1623
|
return;
|
|
1609
1624
|
}
|
|
1610
1625
|
MngLoggerService._configurationService = configurationService;
|
|
1626
|
+
MngLoggerService._publishers = publishers;
|
|
1611
1627
|
MngLoggerService._isInit = true;
|
|
1612
1628
|
MngLoggerService._flushBuffer();
|
|
1613
1629
|
}
|
|
1614
1630
|
static _flushBuffer() {
|
|
1631
|
+
if (!MngLoggerService._isInit) {
|
|
1632
|
+
return;
|
|
1633
|
+
}
|
|
1615
1634
|
MngLoggerService._entriesBuffer.forEach(e => this._instance._log(e));
|
|
1616
1635
|
MngLoggerService._entriesBuffer = [];
|
|
1617
1636
|
}
|
|
@@ -1630,26 +1649,38 @@ class MngLoggerService {
|
|
|
1630
1649
|
MngLoggerService._categoryInstances[category] = logger;
|
|
1631
1650
|
return logger;
|
|
1632
1651
|
}
|
|
1633
|
-
_processLog(
|
|
1634
|
-
const timestamp =
|
|
1635
|
-
const
|
|
1636
|
-
const log = {
|
|
1652
|
+
_processLog(msgOrError, logLevel, category = undefined, data) {
|
|
1653
|
+
const [timestamp, timestampFormatted] = [...this._getTimestamps()];
|
|
1654
|
+
const logEntry = {
|
|
1637
1655
|
level: logLevel,
|
|
1638
|
-
message:
|
|
1656
|
+
message: typeof msgOrError === 'string' ? msgOrError : msgOrError.message,
|
|
1639
1657
|
data: data,
|
|
1640
|
-
category: category,
|
|
1658
|
+
category: this.category ?? category,
|
|
1641
1659
|
timestamp: timestamp,
|
|
1642
1660
|
timestampFormatted: timestampFormatted ?? undefined
|
|
1643
1661
|
};
|
|
1644
|
-
if (
|
|
1645
|
-
//
|
|
1646
|
-
|
|
1662
|
+
if (msgOrError instanceof Error) {
|
|
1663
|
+
// set error from message param
|
|
1664
|
+
logEntry.error = msgOrError;
|
|
1647
1665
|
}
|
|
1648
|
-
else {
|
|
1649
|
-
|
|
1666
|
+
else if (data?.length && data[0] instanceof Error) {
|
|
1667
|
+
// if first data is error, also consider as error
|
|
1668
|
+
logEntry.error = data[0];
|
|
1669
|
+
data = data.splice(1);
|
|
1650
1670
|
}
|
|
1671
|
+
this._log(logEntry);
|
|
1672
|
+
}
|
|
1673
|
+
_getTimestamps() {
|
|
1674
|
+
const timestamp = new Date();
|
|
1675
|
+
const timestampFormatted = this.datePipe.transform(timestamp, MngLoggerService._timestampFormat) ?? DateUtil.toIsoString(timestamp, false, true, true);
|
|
1676
|
+
return [timestamp, timestampFormatted];
|
|
1651
1677
|
}
|
|
1652
1678
|
_log(log) {
|
|
1679
|
+
if (!MngLoggerService._isInit) {
|
|
1680
|
+
// add to buffer
|
|
1681
|
+
MngLoggerService._entriesBuffer.push(log);
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1653
1684
|
const logConfig = (MngLoggerService._configurationService?.getConfigValue)?.('log');
|
|
1654
1685
|
if ((this.category && log.level < (logConfig?.category?.[this.category]?.level ?? logConfig?.level ?? this.defaultLogLevel)) ||
|
|
1655
1686
|
(!this.category && log.level < (logConfig?.level ?? this.defaultLogLevel))) {
|
|
@@ -1658,48 +1689,38 @@ class MngLoggerService {
|
|
|
1658
1689
|
if (logConfig?.timestampFormat) {
|
|
1659
1690
|
log.timestampFormatted = this.datePipe.transform(log.timestamp, logConfig.timestampFormat) ?? undefined;
|
|
1660
1691
|
}
|
|
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
|
-
}
|
|
1692
|
+
MngLoggerService._publishers.forEach(p => p.addEntry(log));
|
|
1693
|
+
}
|
|
1694
|
+
trace(msgOrError, ...data) {
|
|
1695
|
+
this._processLog(msgOrError, LogLevelEnum.Trace, undefined, data);
|
|
1685
1696
|
}
|
|
1686
|
-
|
|
1687
|
-
this._processLog(
|
|
1697
|
+
debug(msgOrError, ...data) {
|
|
1698
|
+
this._processLog(msgOrError, LogLevelEnum.Debug, undefined, data);
|
|
1688
1699
|
}
|
|
1689
|
-
|
|
1690
|
-
this._processLog(
|
|
1700
|
+
log(msgOrError, logLevel = LogLevelEnum.Log, category = undefined, ...data) {
|
|
1701
|
+
this._processLog(msgOrError, logLevel, category, data);
|
|
1691
1702
|
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1703
|
+
logEntry(logEntry) {
|
|
1704
|
+
const [timestamp, timestampFormatted] = [...this._getTimestamps()];
|
|
1705
|
+
const logEntryFinal = {
|
|
1706
|
+
timestamp: timestamp,
|
|
1707
|
+
timestampFormatted: timestampFormatted ?? undefined,
|
|
1708
|
+
category: this.category ?? logEntry.category,
|
|
1709
|
+
message: '',
|
|
1710
|
+
messageDetails: logEntry.messageDetails,
|
|
1711
|
+
level: LogLevelEnum.Log,
|
|
1712
|
+
...logEntry
|
|
1713
|
+
};
|
|
1714
|
+
this._log(logEntryFinal);
|
|
1694
1715
|
}
|
|
1695
|
-
info(
|
|
1696
|
-
this._processLog(
|
|
1716
|
+
info(msgOrError, ...data) {
|
|
1717
|
+
this._processLog(msgOrError, LogLevelEnum.Info, undefined, data);
|
|
1697
1718
|
}
|
|
1698
|
-
warn(
|
|
1699
|
-
this._processLog(
|
|
1719
|
+
warn(msgOrError, ...data) {
|
|
1720
|
+
this._processLog(msgOrError, LogLevelEnum.Warning, undefined, data);
|
|
1700
1721
|
}
|
|
1701
|
-
error(
|
|
1702
|
-
this._processLog(
|
|
1722
|
+
error(msgOrError, ...data) {
|
|
1723
|
+
this._processLog(msgOrError, LogLevelEnum.Error, undefined, data);
|
|
1703
1724
|
}
|
|
1704
1725
|
}
|
|
1705
1726
|
|
|
@@ -1712,6 +1733,8 @@ const MNG_COMMONS_INITIALIZER_IT = new InjectionToken('MNG Commons Initializer')
|
|
|
1712
1733
|
|
|
1713
1734
|
const ACTION_EDITOR_DIALOG_COMPONENT_SETTING = new InjectionToken('ACTION_EDITOR_DIALOG_COMPONENT_SETTING');
|
|
1714
1735
|
|
|
1736
|
+
const MNG_LOG_PUBLISHERS = new InjectionToken('MNG_LOG_PUBLISHERS');
|
|
1737
|
+
|
|
1715
1738
|
const MNG_MODULE_CONFIG_IT = new InjectionToken('MngModuleConfig');
|
|
1716
1739
|
|
|
1717
1740
|
class MngCommonsService {
|
|
@@ -2442,7 +2465,7 @@ class MngActionExecutorService {
|
|
|
2442
2465
|
return runResult;
|
|
2443
2466
|
}), catchError(err => {
|
|
2444
2467
|
// transform error to mng action error
|
|
2445
|
-
const actionError = this.toMngActionError(err);
|
|
2468
|
+
const actionError = this.toMngActionError(err, ctx);
|
|
2446
2469
|
// set instance state to error
|
|
2447
2470
|
ctx.instance.state = isMainRunFn ? ActionInstanceStateEnum.RunError : ActionInstanceStateEnum.FetchError;
|
|
2448
2471
|
// mark execution error on context
|
|
@@ -2451,10 +2474,6 @@ class MngActionExecutorService {
|
|
|
2451
2474
|
if (isMainRunFn) {
|
|
2452
2475
|
ctx.instance.error = err;
|
|
2453
2476
|
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
2477
|
// handle possible error action if run
|
|
2459
2478
|
if (isMainRunFn && ctx.instance.action.onRunErrorAction) {
|
|
2460
2479
|
// cannot start with trigger, because routing might be problematic (lousing previous results etc.)
|
|
@@ -2472,13 +2491,13 @@ class MngActionExecutorService {
|
|
|
2472
2491
|
NotificationUtil.actionNotificationError(this.translate, ctx.instance.action, actionError, 'fetch', ctx.parameters.viewContainer, ctx.parameters.item);
|
|
2473
2492
|
}
|
|
2474
2493
|
}
|
|
2475
|
-
//
|
|
2494
|
+
// list and map only to mark instance state as finished error state
|
|
2476
2495
|
return errorObs.pipe(map(() => {
|
|
2477
2496
|
// deactivate action only if critical (fetch on editor or run on button actions)
|
|
2478
2497
|
if (isErrorCriticalRunFn) {
|
|
2479
2498
|
this.finishAction(ctx.instance);
|
|
2480
2499
|
}
|
|
2481
|
-
// rethrow error to propagate
|
|
2500
|
+
// rethrow error to propagate further
|
|
2482
2501
|
throw actionError;
|
|
2483
2502
|
}));
|
|
2484
2503
|
}));
|
|
@@ -2487,9 +2506,11 @@ class MngActionExecutorService {
|
|
|
2487
2506
|
this.logger.debug(`ActionContext ${ctx.contextLongName} execution next event`, res);
|
|
2488
2507
|
},
|
|
2489
2508
|
error: err => {
|
|
2490
|
-
this.logger.debug(`ActionContext ${ctx.contextLongName} execution error event`, err);
|
|
2491
2509
|
if (err?.type !== 'MngActionError') {
|
|
2492
|
-
this.logger.error(`Non
|
|
2510
|
+
this.logger.error(`Non action error occurred`, err);
|
|
2511
|
+
}
|
|
2512
|
+
else {
|
|
2513
|
+
this.logger.debug(`Action context ${ctx.contextLongName} execution error event`, err);
|
|
2493
2514
|
}
|
|
2494
2515
|
}
|
|
2495
2516
|
});
|
|
@@ -2852,22 +2873,39 @@ class MngActionExecutorService {
|
|
|
2852
2873
|
/**
|
|
2853
2874
|
* Transform error of any type to mng error by using error mapper that could be provided by final project.
|
|
2854
2875
|
* @param error error of any type.
|
|
2876
|
+
* @param context Action context.
|
|
2855
2877
|
*
|
|
2856
2878
|
* @return mapped MngError.
|
|
2857
2879
|
*/
|
|
2858
|
-
toMngActionError(error) {
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2880
|
+
toMngActionError(error, context) {
|
|
2881
|
+
let mngError;
|
|
2882
|
+
if (context) {
|
|
2883
|
+
const options = {
|
|
2884
|
+
cause: error,
|
|
2885
|
+
location: this.router.url
|
|
2886
|
+
};
|
|
2887
|
+
if (error instanceof HttpErrorResponse) {
|
|
2888
|
+
options.httpError = error;
|
|
2889
|
+
}
|
|
2890
|
+
mngError = new MngActionError(error?.message ?? 'Unknown error', context.contextLongName);
|
|
2869
2891
|
}
|
|
2870
|
-
|
|
2892
|
+
else if (error instanceof HttpErrorResponse) {
|
|
2893
|
+
// should not really happen (should always be wrapped in MngActionError), just in case
|
|
2894
|
+
mngError = new MngHttpError(`Http Error occurred in action`, error, {
|
|
2895
|
+
location: this.router.url
|
|
2896
|
+
});
|
|
2897
|
+
}
|
|
2898
|
+
else {
|
|
2899
|
+
// not from action, so unknown source of error
|
|
2900
|
+
mngError = new MngInternalError(error?.message ?? 'Unknown error', {
|
|
2901
|
+
name: error?.name ?? 'UnknownError',
|
|
2902
|
+
location: this.router.url,
|
|
2903
|
+
cause: error
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
// just trace it, allow user to set if this is error or not
|
|
2907
|
+
this.logger.trace(mngError);
|
|
2908
|
+
return this.errorMapper.toMngError(error, mngError);
|
|
2871
2909
|
}
|
|
2872
2910
|
/**
|
|
2873
2911
|
* Creates or gets existing action instance.
|
|
@@ -2884,7 +2922,7 @@ class MngActionExecutorService {
|
|
|
2884
2922
|
}
|
|
2885
2923
|
if (!instance) {
|
|
2886
2924
|
if (!action) {
|
|
2887
|
-
throw new MngInternalError('Action descriptor is not provided, instance cannot be created.', '
|
|
2925
|
+
throw new MngInternalError('Action descriptor is not provided, instance cannot be created.', { name: 'ActionExecutorServiceError' });
|
|
2888
2926
|
}
|
|
2889
2927
|
// create new instance if non provided
|
|
2890
2928
|
instance = new ActionInstance(action, instanceInitialStatus);
|
|
@@ -3020,18 +3058,13 @@ class MngConfigurationService {
|
|
|
3020
3058
|
return httpClient.get(noEnvUrl);
|
|
3021
3059
|
}
|
|
3022
3060
|
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
|
-
});
|
|
3061
|
+
this.logger?.warn(`Configuration file ${url} not loaded`, err);
|
|
3062
|
+
return of(false);
|
|
3033
3063
|
}
|
|
3034
3064
|
}), map(configuration => {
|
|
3065
|
+
if (typeof configuration !== 'object') {
|
|
3066
|
+
return false;
|
|
3067
|
+
}
|
|
3035
3068
|
sourceInfo.configuration = configuration;
|
|
3036
3069
|
sourceInfo.isLoaded = true;
|
|
3037
3070
|
return true;
|
|
@@ -3095,6 +3128,7 @@ class MngRouterService {
|
|
|
3095
3128
|
this.router = router;
|
|
3096
3129
|
this.logger = inject(MngLoggerService).create('MngRouterService');
|
|
3097
3130
|
this.routesLoadedPropKey = '_loadedRoutes';
|
|
3131
|
+
this.currentNavigationModuleKeys = [];
|
|
3098
3132
|
this.lazyLoadedRoutesConfig = {};
|
|
3099
3133
|
}
|
|
3100
3134
|
getRouteLoadedChildren(path) {
|
|
@@ -3121,59 +3155,53 @@ class MngRouterService {
|
|
|
3121
3155
|
}
|
|
3122
3156
|
startNavigation(url) {
|
|
3123
3157
|
this.currentNavigationPath = url.split('?')[0].split('#')[0];
|
|
3124
|
-
this.
|
|
3125
|
-
this.currentNavigationConfigLoaded = undefined;
|
|
3158
|
+
this.currentNavigationModuleKeys = [];
|
|
3126
3159
|
}
|
|
3127
3160
|
finishNavigation() {
|
|
3128
|
-
if (this.
|
|
3129
|
-
this.getLoadedRoutesFromRoute(true);
|
|
3161
|
+
if (this.currentNavigationModuleKeys.length) {
|
|
3162
|
+
this.currentNavigationModuleKeys.forEach(k => this.getLoadedRoutesFromRoute(k, true));
|
|
3130
3163
|
}
|
|
3131
3164
|
this.currentNavigationPath = undefined;
|
|
3132
3165
|
}
|
|
3133
3166
|
markNavigationConfigLoad(route, isEnd = false) {
|
|
3134
|
-
this.currentNavigationConfigLoaded = isEnd;
|
|
3135
3167
|
let routePath = route.path ?? '';
|
|
3136
3168
|
if (!routePath.startsWith('/'))
|
|
3137
3169
|
routePath = `/${routePath}`;
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
moduleKey = this.currentNavigationPath.substring(0, currentNavigationPathRoutePathIdx + routePath.length);
|
|
3143
|
-
}
|
|
3144
|
-
this.currentNavigationConfigModule = moduleKey;
|
|
3170
|
+
const currentNavigationPathRoutePathIdx = this.currentNavigationPath?.indexOf(routePath) ?? -1;
|
|
3171
|
+
const moduleKey = this.currentNavigationPath?.substring(0, currentNavigationPathRoutePathIdx + routePath.length) ?? routePath;
|
|
3172
|
+
if (!isEnd && this.currentNavigationModuleKeys.indexOf(moduleKey) < 0) {
|
|
3173
|
+
this.currentNavigationModuleKeys.push(moduleKey);
|
|
3145
3174
|
}
|
|
3146
|
-
this.logger.trace(`Config load ${isEnd ? 'end' : 'start'} for ${this.
|
|
3147
|
-
const config = this.getOrCreateRouteForModule(
|
|
3175
|
+
this.logger.trace(`Config load ${isEnd ? 'end' : 'start'} for ${moduleKey} (routePath: ${routePath}; navigationUrl: ${this.currentNavigationPath})`);
|
|
3176
|
+
const config = this.getOrCreateRouteForModule(moduleKey);
|
|
3148
3177
|
config.route = route;
|
|
3149
3178
|
config.isLoadEnd = isEnd;
|
|
3150
|
-
|
|
3179
|
+
if (isEnd) {
|
|
3180
|
+
this.getLoadedRoutesFromRoute(moduleKey);
|
|
3181
|
+
}
|
|
3151
3182
|
}
|
|
3152
|
-
getLoadedRoutesFromRoute(isFinish = false) {
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
Array.isArray(this.lazyLoadedRoutesConfig[this.currentNavigationConfigModule].loadedRoutes)) {
|
|
3183
|
+
getLoadedRoutesFromRoute(moduleKey, isFinish = false) {
|
|
3184
|
+
const moduleConfig = this.lazyLoadedRoutesConfig[moduleKey];
|
|
3185
|
+
if (!moduleConfig?.route || Array.isArray(moduleConfig.loadedRoutes)) {
|
|
3156
3186
|
return;
|
|
3157
3187
|
}
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
if (!Array.isArray(this.lazyLoadedRoutesConfig[this.currentNavigationConfigModule].loadedRoutes) && isFinish) {
|
|
3188
|
+
moduleConfig.loadedRoutes = moduleConfig.route[this.routesLoadedPropKey];
|
|
3189
|
+
if (!Array.isArray(moduleConfig.loadedRoutes) && isFinish) {
|
|
3161
3190
|
// if is called from finish and no lazy loaded routes are matched from router events, try finding in route config, it should be there!
|
|
3162
|
-
this.logger.trace(`Route loadedRoutes for ${
|
|
3163
|
-
const route = this.findRouteInRouteConfig(
|
|
3191
|
+
this.logger.trace(`Route loadedRoutes for ${moduleKey} not found, searching in router config now`);
|
|
3192
|
+
const route = this.findRouteInRouteConfig(moduleKey);
|
|
3164
3193
|
if (route) {
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
this.lazyLoadedRoutesConfig[this.currentNavigationConfigModule].route[this.routesLoadedPropKey];
|
|
3194
|
+
moduleConfig.route = route;
|
|
3195
|
+
moduleConfig.loadedRoutes = moduleConfig.route[this.routesLoadedPropKey];
|
|
3168
3196
|
}
|
|
3169
3197
|
else {
|
|
3170
|
-
this.logger.warn(`Route loadedRoutes for ${
|
|
3198
|
+
this.logger.warn(`Route loadedRoutes for ${moduleKey} were not found in router config`);
|
|
3171
3199
|
}
|
|
3172
3200
|
}
|
|
3173
|
-
if (typeof
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
this.logger.trace(`Config load for ${
|
|
3201
|
+
if (typeof moduleConfig.loadedRoutes !== 'undefined') {
|
|
3202
|
+
moduleConfig.loadedRoutesSubject.next(moduleConfig.loadedRoutes);
|
|
3203
|
+
moduleConfig.loadedRoutesSubject.complete();
|
|
3204
|
+
this.logger.trace(`Config load for ${moduleKey} is complete`, moduleConfig);
|
|
3177
3205
|
}
|
|
3178
3206
|
}
|
|
3179
3207
|
/**
|
|
@@ -3270,6 +3298,7 @@ class MngVersionService {
|
|
|
3270
3298
|
constructor(http, configurationService) {
|
|
3271
3299
|
this.http = http;
|
|
3272
3300
|
this.configurationService = configurationService;
|
|
3301
|
+
this.logger = inject(MngLoggerService).create('MngVersionService');
|
|
3273
3302
|
this.cache = {};
|
|
3274
3303
|
}
|
|
3275
3304
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -3288,6 +3317,9 @@ class MngVersionService {
|
|
|
3288
3317
|
this.http.get(urlSegments.join('')).subscribe({
|
|
3289
3318
|
next: res => {
|
|
3290
3319
|
this.cache[url].next(res);
|
|
3320
|
+
},
|
|
3321
|
+
error: err => {
|
|
3322
|
+
this.logger.error('Version could not be retreived', err);
|
|
3291
3323
|
}
|
|
3292
3324
|
});
|
|
3293
3325
|
}
|
|
@@ -3391,6 +3423,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
3391
3423
|
args: [{ providedIn: 'root' }]
|
|
3392
3424
|
}] });
|
|
3393
3425
|
|
|
3426
|
+
/* eslint-disable no-console */
|
|
3427
|
+
class MngLogPublisherConsoleService {
|
|
3428
|
+
addEntry(entry) {
|
|
3429
|
+
let prefix = `${entry.timestampFormatted}`;
|
|
3430
|
+
if (entry.category)
|
|
3431
|
+
prefix += ` [${entry.category}]`;
|
|
3432
|
+
prefix += ':';
|
|
3433
|
+
const message = `${entry.message}${entry.messageDetails ? `\n${entry.messageDetails}` : ''}`;
|
|
3434
|
+
const logParams = [prefix, message];
|
|
3435
|
+
if (entry.error) {
|
|
3436
|
+
logParams.push(`\n${ErrorUtil.getErrorName(entry.error)}:`, entry.error);
|
|
3437
|
+
}
|
|
3438
|
+
if (entry.data?.length) {
|
|
3439
|
+
logParams.push(`\nData:\n`, ...entry.data);
|
|
3440
|
+
}
|
|
3441
|
+
switch (entry.level) {
|
|
3442
|
+
case LogLevelEnum.Trace:
|
|
3443
|
+
console.trace(...logParams);
|
|
3444
|
+
break;
|
|
3445
|
+
case LogLevelEnum.Debug:
|
|
3446
|
+
console.debug(...logParams);
|
|
3447
|
+
break;
|
|
3448
|
+
case LogLevelEnum.Log:
|
|
3449
|
+
console.log(...logParams);
|
|
3450
|
+
break;
|
|
3451
|
+
case LogLevelEnum.Info:
|
|
3452
|
+
console.info(...logParams);
|
|
3453
|
+
break;
|
|
3454
|
+
case LogLevelEnum.Warning:
|
|
3455
|
+
console.warn(...logParams);
|
|
3456
|
+
break;
|
|
3457
|
+
case LogLevelEnum.Error:
|
|
3458
|
+
console.error(...logParams);
|
|
3459
|
+
break;
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
|
|
3394
3464
|
class ObjectSerializer {
|
|
3395
3465
|
constructor() {
|
|
3396
3466
|
this._logCategory = 'ObjectSerializer';
|
|
@@ -3968,7 +4038,7 @@ class TableviewUtil {
|
|
|
3968
4038
|
*/
|
|
3969
4039
|
static expandAttributeDefWithTableviewTypes(attributes) {
|
|
3970
4040
|
if (attributes == null) {
|
|
3971
|
-
throw new MngInternalError('AttributeDef is null, problem with ObjectSerializer::findAttributesDefinitionByClassType?', '
|
|
4041
|
+
throw new MngInternalError('AttributeDef is null, problem with ObjectSerializer::findAttributesDefinitionByClassType?', { name: 'TableViewUtilsError' });
|
|
3972
4042
|
}
|
|
3973
4043
|
const objectSerializer = ObjectSerializer.get();
|
|
3974
4044
|
const tableviewAttributeDef = [];
|
|
@@ -4815,14 +4885,14 @@ class FilterLookupDescriptor extends FilterDescriptor {
|
|
|
4815
4885
|
this._defaultValueTo = filterValueTo;
|
|
4816
4886
|
this._defaultFilterMatchMode = filterMatchMode;
|
|
4817
4887
|
if (Array.isArray(filterValue) && !this.multiselect) {
|
|
4818
|
-
throw new MngInternalError('Array default filter can only be used with a multiselect filter.', '
|
|
4888
|
+
throw new MngInternalError('Array default filter can only be used with a multiselect filter.', { name: 'FilterDescriptorError' });
|
|
4819
4889
|
}
|
|
4820
4890
|
if (filterMatchMode && this._matchModes && this._matchModes.indexOf(filterMatchMode) < 0) {
|
|
4821
4891
|
this._defaultFilterMatchMode = undefined;
|
|
4822
4892
|
MngLoggerService.get().debug(`WARNING: Default filter match mode '${filterMatchMode}' could not be assigned for property ${this._property}.`);
|
|
4823
4893
|
}
|
|
4824
4894
|
if ((Array.isArray(filterValue) && !this.multiselect) || (this.multiselect && !Array.isArray(filterValue))) {
|
|
4825
|
-
throw new MngInternalError(`Default value not in correct format for property ${this._property}.`, '
|
|
4895
|
+
throw new MngInternalError(`Default value not in correct format for property ${this._property}.`, { name: 'FilterDescriptorError' });
|
|
4826
4896
|
}
|
|
4827
4897
|
return this;
|
|
4828
4898
|
}
|
|
@@ -4878,7 +4948,7 @@ class FilterLookupEnumDescriptor extends FilterLookupDescriptor {
|
|
|
4878
4948
|
return super.withMultiselect(multiselect);
|
|
4879
4949
|
}
|
|
4880
4950
|
withDefaultFilter() {
|
|
4881
|
-
throw new MngInternalError(`withDefaultFilter on FilterLookupEnumDescriptor should not be used. Use withDefaultFilterEnum instead.`, '
|
|
4951
|
+
throw new MngInternalError(`withDefaultFilter on FilterLookupEnumDescriptor should not be used. Use withDefaultFilterEnum instead.`, { name: 'FilterDescriptorError' });
|
|
4882
4952
|
}
|
|
4883
4953
|
withDefaultFilterEnum(filterValue, filterValueTo, filterMatchMode) {
|
|
4884
4954
|
let defaultOptionValue;
|
|
@@ -5219,7 +5289,7 @@ class ColumnDescriptor {
|
|
|
5219
5289
|
}
|
|
5220
5290
|
withFilterLookupEnum(options) {
|
|
5221
5291
|
if (this._columnType !== ColumnTypeEnum.Enum || !this._enumType) {
|
|
5222
|
-
throw new MngInternalError(`Column ${this._property} is not of type enum or enum type is undefined.`, '
|
|
5292
|
+
throw new MngInternalError(`Column ${this._property} is not of type enum or enum type is undefined.`, { name: 'ColumnDescriptorError' });
|
|
5223
5293
|
}
|
|
5224
5294
|
const filterDescriptor = new FilterLookupEnumDescriptor(this._property, this._enumType, options, this._enumNameAsValue, this._enumTitlePath);
|
|
5225
5295
|
this._filterDescriptor = filterDescriptor;
|
|
@@ -5492,6 +5562,9 @@ class TableDescriptor {
|
|
|
5492
5562
|
get rowClassNameMapFn() {
|
|
5493
5563
|
return this._rowClassNameMapFn;
|
|
5494
5564
|
}
|
|
5565
|
+
get selectionColumnFrozen() {
|
|
5566
|
+
return this._selectionColumnFrozen;
|
|
5567
|
+
}
|
|
5495
5568
|
get actionColumnFrozen() {
|
|
5496
5569
|
return this._actionColumnFrozen;
|
|
5497
5570
|
}
|
|
@@ -5648,16 +5721,22 @@ class TableDescriptor {
|
|
|
5648
5721
|
}
|
|
5649
5722
|
/**
|
|
5650
5723
|
* Method that enables/disabled column resize feature with columnResizeMode on all columns.
|
|
5651
|
-
* @param resizableColumns
|
|
5652
|
-
* @param columnResizeMode
|
|
5724
|
+
* @param resizableColumns True if enabled
|
|
5725
|
+
* @param columnResizeMode 'fit' or 'expand' mode
|
|
5653
5726
|
*/
|
|
5654
5727
|
withColumnsResizable(resizableColumns = true, columnResizeMode = 'fit') {
|
|
5655
5728
|
this._hasResizableColumns = resizableColumns;
|
|
5656
5729
|
this._columnResizeMode = columnResizeMode;
|
|
5657
5730
|
return this;
|
|
5658
5731
|
}
|
|
5659
|
-
|
|
5660
|
-
|
|
5732
|
+
/**
|
|
5733
|
+
* Sets column to (un)frozen.
|
|
5734
|
+
* @param selectionColumnFrozen True to freeze selection column, false to unfreeze it.
|
|
5735
|
+
* @param actionColumnFrozen True to freeze action column, false to unfreeze it.
|
|
5736
|
+
*/
|
|
5737
|
+
withColumnFrozen(selectionColumnFrozen, actionColumnFrozen) {
|
|
5738
|
+
this._selectionColumnFrozen = selectionColumnFrozen;
|
|
5739
|
+
this._actionColumnFrozen = actionColumnFrozen;
|
|
5661
5740
|
return this;
|
|
5662
5741
|
}
|
|
5663
5742
|
withRowClassName(rowClassName, classNameMapFn) {
|
|
@@ -5695,6 +5774,7 @@ class TableDescriptor {
|
|
|
5695
5774
|
obj._hasResizableColumns = this._hasResizableColumns;
|
|
5696
5775
|
obj._columnResizeMode = this._columnResizeMode;
|
|
5697
5776
|
obj._actionColumnFrozen = this._actionColumnFrozen;
|
|
5777
|
+
obj._selectionColumnFrozen = this._selectionColumnFrozen;
|
|
5698
5778
|
obj._isLocalized = this._isLocalized;
|
|
5699
5779
|
obj._localizationLocaleProperty = this._localizationLocaleProperty;
|
|
5700
5780
|
obj._paginationMode = this._paginationMode;
|
|
@@ -6154,7 +6234,7 @@ class TableviewDescriptor {
|
|
|
6154
6234
|
*/
|
|
6155
6235
|
withModifiedType(property, columnType, fieldType, columnDisplayType) {
|
|
6156
6236
|
if (columnType === ColumnTypeEnum.Enum) {
|
|
6157
|
-
throw new MngInternalError('Do not use with types where args are required', '
|
|
6237
|
+
throw new MngInternalError('Do not use with types where args are required', { name: 'TableViewDescriptorError' });
|
|
6158
6238
|
}
|
|
6159
6239
|
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
6160
6240
|
if (attributeDef != null) {
|
|
@@ -7478,7 +7558,7 @@ class EditorDescriptor {
|
|
|
7478
7558
|
removeField(property) {
|
|
7479
7559
|
const fieldIdx = this._fields.findIndex(f => f.property === property);
|
|
7480
7560
|
if (fieldIdx < 0) {
|
|
7481
|
-
throw new MngInternalError(`Field ${property} does not exist.`, '
|
|
7561
|
+
throw new MngInternalError(`Field ${property} does not exist.`, { name: 'EditorDescriptorError' });
|
|
7482
7562
|
}
|
|
7483
7563
|
for (const group of this._groups) {
|
|
7484
7564
|
const groupFieldIdx = group.fields.findIndex(f => f instanceof AFieldDescriptor && f.property === property);
|
|
@@ -8051,6 +8131,393 @@ class EnumUtil {
|
|
|
8051
8131
|
}
|
|
8052
8132
|
}
|
|
8053
8133
|
|
|
8134
|
+
class ObjectUtil {
|
|
8135
|
+
static deepCopy(obj, options) {
|
|
8136
|
+
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
|
8137
|
+
return obj;
|
|
8138
|
+
}
|
|
8139
|
+
if (obj instanceof Date) {
|
|
8140
|
+
return new Date(+obj);
|
|
8141
|
+
}
|
|
8142
|
+
let copy;
|
|
8143
|
+
if (options?.mapGettersToProperties) {
|
|
8144
|
+
copy = {};
|
|
8145
|
+
}
|
|
8146
|
+
else {
|
|
8147
|
+
copy = options?.objectPrototype ? Object.create(options.objectPrototype['prototype']) : Object.create(Object.getPrototypeOf(obj));
|
|
8148
|
+
Object.assign(copy, obj);
|
|
8149
|
+
}
|
|
8150
|
+
for (const key of ObjectUtil.getProperties(obj)) {
|
|
8151
|
+
const prop = obj[key];
|
|
8152
|
+
copy[key] = ObjectUtil.handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
8153
|
+
}
|
|
8154
|
+
if (options?.mapGettersToProperties) {
|
|
8155
|
+
for (const getterKey of ObjectUtil.getGetters(obj)) {
|
|
8156
|
+
const prop = obj[getterKey];
|
|
8157
|
+
copy[getterKey] = ObjectUtil.handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
8158
|
+
}
|
|
8159
|
+
}
|
|
8160
|
+
return copy;
|
|
8161
|
+
}
|
|
8162
|
+
static deepMerge(target, source) {
|
|
8163
|
+
if (!ObjectUtil.isObject(source)) {
|
|
8164
|
+
return target;
|
|
8165
|
+
}
|
|
8166
|
+
for (const key of ObjectUtil.getProperties(source)) {
|
|
8167
|
+
if (ObjectUtil.isObject(source[key])) {
|
|
8168
|
+
if (ObjectUtil.isObject(target[key])) {
|
|
8169
|
+
target[key] = ObjectUtil.deepMerge(target[key], source[key]);
|
|
8170
|
+
}
|
|
8171
|
+
else {
|
|
8172
|
+
target[key] = ObjectUtil.deepCopy(source[key]);
|
|
8173
|
+
}
|
|
8174
|
+
}
|
|
8175
|
+
else if (Array.isArray(source[key])) {
|
|
8176
|
+
if (!Array.isArray(target[key])) {
|
|
8177
|
+
target[key] = source[key].map(i => (ObjectUtil.isObject(i) ? ObjectUtil.deepMerge({}, i) : i));
|
|
8178
|
+
}
|
|
8179
|
+
}
|
|
8180
|
+
else if (typeof target[key] === 'undefined') {
|
|
8181
|
+
target[key] = source[key];
|
|
8182
|
+
}
|
|
8183
|
+
}
|
|
8184
|
+
return target;
|
|
8185
|
+
}
|
|
8186
|
+
static isObject(obj) {
|
|
8187
|
+
return typeof obj === 'object' && obj !== null && !Array.isArray(obj);
|
|
8188
|
+
}
|
|
8189
|
+
static handleProp(prop, options) {
|
|
8190
|
+
if (Array.isArray(prop)) {
|
|
8191
|
+
return prop.map(i => ObjectUtil.deepCopy(i, options));
|
|
8192
|
+
}
|
|
8193
|
+
else if (typeof prop === 'object' && prop !== null) {
|
|
8194
|
+
return ObjectUtil.deepCopy(prop, options);
|
|
8195
|
+
}
|
|
8196
|
+
else {
|
|
8197
|
+
return prop;
|
|
8198
|
+
}
|
|
8199
|
+
}
|
|
8200
|
+
static getProperties(obj) {
|
|
8201
|
+
return Object.keys(obj);
|
|
8202
|
+
}
|
|
8203
|
+
static getGetters(obj) {
|
|
8204
|
+
const getterSet = new Set();
|
|
8205
|
+
let currObj = obj;
|
|
8206
|
+
while (currObj) {
|
|
8207
|
+
const getters = Object.entries(Object.getOwnPropertyDescriptors(currObj))
|
|
8208
|
+
.filter(([, descriptor]) => typeof descriptor.get === 'function')
|
|
8209
|
+
.filter(([key]) => key !== '__proto__')
|
|
8210
|
+
.map(([key]) => key);
|
|
8211
|
+
for (const getter of getters) {
|
|
8212
|
+
getterSet.add(getter);
|
|
8213
|
+
}
|
|
8214
|
+
currObj = Object.getPrototypeOf(currObj);
|
|
8215
|
+
}
|
|
8216
|
+
return Array.from(getterSet);
|
|
8217
|
+
}
|
|
8218
|
+
}
|
|
8219
|
+
|
|
8220
|
+
class StringUtil {
|
|
8221
|
+
static escapeHtml(value) {
|
|
8222
|
+
return value.replace(/</g, '<').replace(/>/g, '>');
|
|
8223
|
+
}
|
|
8224
|
+
static escapeHtmlAny(value) {
|
|
8225
|
+
if (typeof value === 'string') {
|
|
8226
|
+
return StringUtil.escapeHtml(value);
|
|
8227
|
+
}
|
|
8228
|
+
else if (typeof value === 'object') {
|
|
8229
|
+
const escapedValue = ObjectUtil.deepCopy(value, { mapGettersToProperties: true });
|
|
8230
|
+
for (const key in value) {
|
|
8231
|
+
if (typeof value[key] === 'string') {
|
|
8232
|
+
escapedValue[key] = StringUtil.escapeHtml(value[key]);
|
|
8233
|
+
}
|
|
8234
|
+
else if (typeof value[key] === 'object') {
|
|
8235
|
+
escapedValue[key] = StringUtil.escapeHtmlAny(value[key]);
|
|
8236
|
+
}
|
|
8237
|
+
else {
|
|
8238
|
+
escapedValue[key] = value[key];
|
|
8239
|
+
}
|
|
8240
|
+
}
|
|
8241
|
+
return escapedValue;
|
|
8242
|
+
}
|
|
8243
|
+
return value;
|
|
8244
|
+
}
|
|
8245
|
+
/**
|
|
8246
|
+
* Stringifies a value - primitives with toString, dates with dateUtil, objects with JSON.stringify.
|
|
8247
|
+
* @param value Any value.
|
|
8248
|
+
*/
|
|
8249
|
+
static stringify(value) {
|
|
8250
|
+
if (value === null) {
|
|
8251
|
+
return 'null';
|
|
8252
|
+
}
|
|
8253
|
+
if (typeof value === 'undefined') {
|
|
8254
|
+
return 'undefined';
|
|
8255
|
+
}
|
|
8256
|
+
// eliminate functions, cause they could fall into objects
|
|
8257
|
+
if (typeof value === 'function') {
|
|
8258
|
+
return `Function ${value.name ?? 'anonymous'}()`;
|
|
8259
|
+
}
|
|
8260
|
+
if (typeof value === 'object') {
|
|
8261
|
+
// date is object, but would like it in ISO string representation
|
|
8262
|
+
if (value instanceof Date) {
|
|
8263
|
+
return DateUtil.toIsoString(value, false, true, true) ?? 'null';
|
|
8264
|
+
}
|
|
8265
|
+
try {
|
|
8266
|
+
return JSON.stringify(value);
|
|
8267
|
+
}
|
|
8268
|
+
catch (e) {
|
|
8269
|
+
return value.toString();
|
|
8270
|
+
}
|
|
8271
|
+
}
|
|
8272
|
+
// only primitives should be left to be printed like this (string, number, boolean)
|
|
8273
|
+
return value.toString();
|
|
8274
|
+
}
|
|
8275
|
+
}
|
|
8276
|
+
|
|
8277
|
+
class ErrorUtil {
|
|
8278
|
+
/**
|
|
8279
|
+
* Converts RxJS subscription error to MngError.
|
|
8280
|
+
* @param error Error.
|
|
8281
|
+
* @param name Optional name to write in mngError.
|
|
8282
|
+
* @param details Optional details of error.
|
|
8283
|
+
*/
|
|
8284
|
+
static fromSubscribeError(error, name, details) {
|
|
8285
|
+
const opts = {
|
|
8286
|
+
name,
|
|
8287
|
+
details,
|
|
8288
|
+
location: window?.location?.href
|
|
8289
|
+
};
|
|
8290
|
+
if (error instanceof HttpErrorResponse) {
|
|
8291
|
+
return new MngHttpError(error.message ?? 'Http Error occurred', error, opts);
|
|
8292
|
+
}
|
|
8293
|
+
else {
|
|
8294
|
+
opts.cause = error;
|
|
8295
|
+
return new MngInternalError(error.message ?? 'Internal Error occurred', opts);
|
|
8296
|
+
}
|
|
8297
|
+
}
|
|
8298
|
+
/**
|
|
8299
|
+
* Checks if error is Http error (Angular or Mng).
|
|
8300
|
+
* @param error
|
|
8301
|
+
*/
|
|
8302
|
+
static isHttpErrorResponse(error) {
|
|
8303
|
+
return error instanceof HttpErrorResponse || error instanceof MngHttpError || (error instanceof MngActionError && error.httpError);
|
|
8304
|
+
}
|
|
8305
|
+
/**
|
|
8306
|
+
* Gets HttpErrorResponse from error (Angular or Mng).
|
|
8307
|
+
* @param error Error.
|
|
8308
|
+
*/
|
|
8309
|
+
static getHttpErrorResponse(error) {
|
|
8310
|
+
if (error instanceof HttpErrorResponse) {
|
|
8311
|
+
return error;
|
|
8312
|
+
}
|
|
8313
|
+
else if (error instanceof MngHttpError) {
|
|
8314
|
+
return error.httpError;
|
|
8315
|
+
}
|
|
8316
|
+
else if (error instanceof MngActionError) {
|
|
8317
|
+
return error.httpError ?? null;
|
|
8318
|
+
}
|
|
8319
|
+
else {
|
|
8320
|
+
return null;
|
|
8321
|
+
}
|
|
8322
|
+
}
|
|
8323
|
+
/**
|
|
8324
|
+
* Gets HttpErrorResponse status from error (Angular or Mng).
|
|
8325
|
+
* @param error Error.
|
|
8326
|
+
*/
|
|
8327
|
+
static getHttpErrorResponseStatus(error) {
|
|
8328
|
+
return ErrorUtil.getHttpErrorResponse(error)?.status ?? null;
|
|
8329
|
+
}
|
|
8330
|
+
/**
|
|
8331
|
+
* Get error log level. All is error, except if error is http error with status >=400 and <500.
|
|
8332
|
+
* @param error Error.
|
|
8333
|
+
*/
|
|
8334
|
+
static getErrorLogLevel(error) {
|
|
8335
|
+
if (ErrorUtil.isHttpErrorResponse(error)) {
|
|
8336
|
+
const status = ErrorUtil.getHttpErrorResponseStatus(error);
|
|
8337
|
+
if (status && status >= 400 && status < 500) {
|
|
8338
|
+
return LogLevelEnum.Warning;
|
|
8339
|
+
}
|
|
8340
|
+
}
|
|
8341
|
+
return LogLevelEnum.Error;
|
|
8342
|
+
}
|
|
8343
|
+
/**
|
|
8344
|
+
* Get error name (prototype name or type from mng error if name is not provided).
|
|
8345
|
+
* @param error Error.
|
|
8346
|
+
*/
|
|
8347
|
+
static getErrorName(error) {
|
|
8348
|
+
if (error instanceof AMngErrorBase) {
|
|
8349
|
+
return error.name ?? error.type;
|
|
8350
|
+
}
|
|
8351
|
+
else {
|
|
8352
|
+
return error.name;
|
|
8353
|
+
}
|
|
8354
|
+
}
|
|
8355
|
+
/**
|
|
8356
|
+
* Writes http error to string with all headers and body.
|
|
8357
|
+
* @param error Http response error.
|
|
8358
|
+
* @param opts Options for hiding parts of error:
|
|
8359
|
+
* - hideMessage Hides message of error (message include url, status and status text!).
|
|
8360
|
+
* - hideHeaders Hides headers.
|
|
8361
|
+
* - hideBody Hides JSON representation of body.
|
|
8362
|
+
*/
|
|
8363
|
+
static httpErrorResponseToString(error, opts) {
|
|
8364
|
+
let str = opts?.hideMessage ? '' : `${error.message}\n`; // message should already include url, status, etc.
|
|
8365
|
+
if (!opts?.hideHeaders) {
|
|
8366
|
+
str += `Http Response Headers: ${error.headers.keys().reduce((acc, key) => `${acc}[${key}: ${error.headers.get(key)}]`, '')}`;
|
|
8367
|
+
}
|
|
8368
|
+
if (!opts?.hideBody) {
|
|
8369
|
+
str += `\nHttp Response Body: ${StringUtil.stringify(error.error)}`;
|
|
8370
|
+
}
|
|
8371
|
+
return str;
|
|
8372
|
+
}
|
|
8373
|
+
/**
|
|
8374
|
+
* Error to string.
|
|
8375
|
+
* @param error Error.
|
|
8376
|
+
* @param opts Options for hiding parts of error:
|
|
8377
|
+
* - hideMessage Hides message of error.
|
|
8378
|
+
* - hideName Hides error name.
|
|
8379
|
+
* - hideCause Hides cause of an error (if present, see @link(errorCauseToString) for other options).
|
|
8380
|
+
* - hideStack Hides stack of an error (if present).
|
|
8381
|
+
* - hideDetails Hides JSON detail's representation of error (if present).
|
|
8382
|
+
* - hideLocation Hides location (URL) where error was thrown.
|
|
8383
|
+
* - hideHttp Hides http error portion of error if http error response (see @link(httpErrorResponseToString) for other options).
|
|
8384
|
+
*/
|
|
8385
|
+
static errorToString(error, opts) {
|
|
8386
|
+
if (error instanceof AMngErrorBase) {
|
|
8387
|
+
return ErrorUtil.mngErrorToString(error, opts);
|
|
8388
|
+
}
|
|
8389
|
+
else if (error instanceof HttpErrorResponse) {
|
|
8390
|
+
return ErrorUtil.httpErrorResponseToString(error, opts);
|
|
8391
|
+
}
|
|
8392
|
+
const strBlocks = [];
|
|
8393
|
+
if (!opts?.hideMessage) {
|
|
8394
|
+
strBlocks.push(error.message);
|
|
8395
|
+
}
|
|
8396
|
+
if (error.name) {
|
|
8397
|
+
strBlocks.push(`Error name: ${error.name}`);
|
|
8398
|
+
}
|
|
8399
|
+
if (!opts?.hideCause) {
|
|
8400
|
+
strBlocks.push(ErrorUtil.errorCauseToString(error, opts));
|
|
8401
|
+
}
|
|
8402
|
+
if (!opts?.hideStack && error.stack) {
|
|
8403
|
+
strBlocks.push(`Stack trace:\n${error.stack}`);
|
|
8404
|
+
}
|
|
8405
|
+
return strBlocks.filter(s => s.trim().length > 0).join('\n');
|
|
8406
|
+
}
|
|
8407
|
+
/**
|
|
8408
|
+
* Mng error to string.
|
|
8409
|
+
* @param error Mng error.
|
|
8410
|
+
* @param opts Options for hiding parts of error:
|
|
8411
|
+
* - hideMessage Hides message of error.
|
|
8412
|
+
* - hideName Hides error name.
|
|
8413
|
+
* - hideCause Hides cause of an error (if present, see @link(errorCauseToString) for other options).
|
|
8414
|
+
* - hideStack Hides stack of an error (if present).
|
|
8415
|
+
* - hideDetails Hides JSON detail's representation of error (if present).
|
|
8416
|
+
* - hideLocation Hides location (URL) where error was thrown.
|
|
8417
|
+
* - hideHttp Hides http error portion of error if http error response (see @link(httpErrorResponseToString) for other options).
|
|
8418
|
+
* - hideItems Hides all item information (http body, action context data).
|
|
8419
|
+
* - hideActionData See @link(mngActionErrorContextToString) for additional info.
|
|
8420
|
+
* - hideQueryParams See @link(mngActionErrorContextToString) for additional info.
|
|
8421
|
+
*/
|
|
8422
|
+
static mngErrorToString(error, opts) {
|
|
8423
|
+
const strBlocks = [];
|
|
8424
|
+
if (!opts?.hideMessage) {
|
|
8425
|
+
strBlocks.push(`${error.message}${error.messageCode ? ` (code: ${error.messageCode})` : ''}`);
|
|
8426
|
+
}
|
|
8427
|
+
if (!opts?.hideName) {
|
|
8428
|
+
strBlocks.push(`Error name: ${error.name ?? error.type} ${error.name ? `(${error.type})` : ''}`);
|
|
8429
|
+
}
|
|
8430
|
+
if (!opts?.hideLocation && error.location) {
|
|
8431
|
+
strBlocks.push(`Location: ${error.location}`);
|
|
8432
|
+
}
|
|
8433
|
+
let isHttp = false;
|
|
8434
|
+
if (!opts?.hideHttp && error instanceof MngHttpError) {
|
|
8435
|
+
strBlocks.push(ErrorUtil.httpErrorResponseToString(error.httpError, {
|
|
8436
|
+
hideBody: opts?.hideItems || opts?.hideBody,
|
|
8437
|
+
hideHeaders: opts?.hideHeaders,
|
|
8438
|
+
hideMessage: error.message.indexOf(error.httpError.message) >= 0
|
|
8439
|
+
}));
|
|
8440
|
+
isHttp = true;
|
|
8441
|
+
}
|
|
8442
|
+
if (error instanceof MngActionError) {
|
|
8443
|
+
if (error.actionContext) {
|
|
8444
|
+
strBlocks.push(ErrorUtil.mngActionErrorContextToString(error, opts));
|
|
8445
|
+
}
|
|
8446
|
+
if (!opts?.hideHttp && error.httpError) {
|
|
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
|
+
}
|
|
8455
|
+
if (!opts?.hideDetails && error.details) {
|
|
8456
|
+
strBlocks.push(`Details: ${StringUtil.stringify(error.details)}`);
|
|
8457
|
+
}
|
|
8458
|
+
if (!opts?.hideCause && (!isHttp || !(error.cause instanceof HttpErrorResponse))) {
|
|
8459
|
+
strBlocks.push(ErrorUtil.errorCauseToString(error, opts));
|
|
8460
|
+
}
|
|
8461
|
+
if (!opts?.hideStack && error.stack) {
|
|
8462
|
+
strBlocks.push(`Stack trace:\n${error.stack}`);
|
|
8463
|
+
}
|
|
8464
|
+
return strBlocks.filter(s => s.trim().length > 0).join('\n');
|
|
8465
|
+
}
|
|
8466
|
+
/**
|
|
8467
|
+
* Writes Mng action error info from context as string.
|
|
8468
|
+
* @param error Mng action error.
|
|
8469
|
+
* @param opts Options for hiding parts of error:
|
|
8470
|
+
* - hideItems Hides all item related information (item, form item, submit item, ...).
|
|
8471
|
+
* - hideActionData Hides action data.
|
|
8472
|
+
* - hideQueryParams Hides query params.
|
|
8473
|
+
*/
|
|
8474
|
+
static mngActionErrorContextToString(error, opts) {
|
|
8475
|
+
let paramsMessage = '';
|
|
8476
|
+
if (error.actionContext?.parameters) {
|
|
8477
|
+
if (error.actionContext?.parameters.itemId) {
|
|
8478
|
+
paramsMessage += `[itemId: ${error.actionContext.parameters.itemId}]`;
|
|
8479
|
+
}
|
|
8480
|
+
if (!opts?.hideItems && error.actionContext?.parameters.item) {
|
|
8481
|
+
paramsMessage += `[item: ${StringUtil.stringify(error.actionContext.parameters.item)}]`;
|
|
8482
|
+
}
|
|
8483
|
+
if (!opts?.hideActionData && error.actionContext?.parameters.actionData) {
|
|
8484
|
+
paramsMessage += Object.entries(error.actionContext?.parameters.actionData).reduce((acc, [key, value]) => `${acc}[actionData ${key}: ${StringUtil.stringify(value)}]`, '');
|
|
8485
|
+
}
|
|
8486
|
+
if (!opts?.hideQueryParams && error.actionContext?.parameters.queryParam) {
|
|
8487
|
+
paramsMessage += `[queryParam: ${StringUtil.stringify(error.actionContext.parameters.queryParam)}]`;
|
|
8488
|
+
}
|
|
8489
|
+
if (!opts?.hideItems && error.actionContext?.parameters.formItem) {
|
|
8490
|
+
paramsMessage += `[formItem: ${StringUtil.stringify(error.actionContext.parameters.formItem)}]`;
|
|
8491
|
+
}
|
|
8492
|
+
if (!opts?.hideItems && error.actionContext?.parameters.submitResult) {
|
|
8493
|
+
paramsMessage += `[formItem: ${StringUtil.stringify(error.actionContext.parameters.submitResult)}]`;
|
|
8494
|
+
}
|
|
8495
|
+
if (error.actionContext?.parameters.locale) {
|
|
8496
|
+
paramsMessage += `[locale: ${StringUtil.stringify(error.actionContext.parameters.locale)}]`;
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8499
|
+
return paramsMessage;
|
|
8500
|
+
}
|
|
8501
|
+
/**
|
|
8502
|
+
* Writes cause of an error as string.
|
|
8503
|
+
* @param error Error.
|
|
8504
|
+
* @param opts Options for hiding parts of error:
|
|
8505
|
+
* - causeOnErrorOnly Prints only if cause is instance of error.
|
|
8506
|
+
* - causeAsJson Print error cause as a JSON (by default, if error only message and name will be printed).
|
|
8507
|
+
*/
|
|
8508
|
+
static errorCauseToString(error, opts) {
|
|
8509
|
+
// if already logged as http error, check that cause is not also http error (cause it is usually duplicated)
|
|
8510
|
+
if (error.cause && (!opts?.causeOnErrorOnly || error.cause instanceof Error)) {
|
|
8511
|
+
const stringify = opts?.causeAsJson || !(error.cause instanceof Error);
|
|
8512
|
+
if (!opts?.causeOnErrorOnly || error.cause instanceof Error) {
|
|
8513
|
+
return ('Caused by: ' +
|
|
8514
|
+
(stringify ? StringUtil.stringify(error.cause) : `${error.cause.message}${error.cause.name ? ` (${error.cause.name})` : ''}`));
|
|
8515
|
+
}
|
|
8516
|
+
}
|
|
8517
|
+
return '';
|
|
8518
|
+
}
|
|
8519
|
+
}
|
|
8520
|
+
|
|
8054
8521
|
class TypeUtil {
|
|
8055
8522
|
static { this.reflectTypeNameKey = 'typeName'; }
|
|
8056
8523
|
static { this.reflectTypeIdPropertyKey = 'typeIdProperty'; }
|
|
@@ -8124,7 +8591,7 @@ class TypeUtil {
|
|
|
8124
8591
|
if (enumName) {
|
|
8125
8592
|
return enumName;
|
|
8126
8593
|
}
|
|
8127
|
-
throw new MngInternalError('Could not fined enum name', '
|
|
8594
|
+
throw new MngInternalError('Could not fined enum name', { name: 'TypeUtilsError' });
|
|
8128
8595
|
}
|
|
8129
8596
|
/**
|
|
8130
8597
|
* Gets type's id property from reflect metadata.
|
|
@@ -8399,14 +8866,11 @@ var I18nUtils;
|
|
|
8399
8866
|
const paramsRes = { ...params };
|
|
8400
8867
|
paramsRes.errorStatus = '';
|
|
8401
8868
|
paramsRes.errorMessage = '';
|
|
8402
|
-
if (error
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
paramsRes.
|
|
8407
|
-
}
|
|
8408
|
-
if (error.statusDescription) {
|
|
8409
|
-
paramsRes.errorStatusDescription = error.statusDescription;
|
|
8869
|
+
if (ErrorUtil.isHttpErrorResponse(error)) {
|
|
8870
|
+
const httpError = ErrorUtil.getHttpErrorResponse(error);
|
|
8871
|
+
paramsRes.errorStatus = httpError?.status;
|
|
8872
|
+
paramsRes.errorMessage = httpError?.message;
|
|
8873
|
+
paramsRes.errorStatusDescription = httpError?.statusText;
|
|
8410
8874
|
}
|
|
8411
8875
|
paramsRes.error = error;
|
|
8412
8876
|
return paramsRes;
|
|
@@ -8532,119 +8996,6 @@ class NotificationUtil {
|
|
|
8532
8996
|
}
|
|
8533
8997
|
}
|
|
8534
8998
|
|
|
8535
|
-
class ObjectUtil {
|
|
8536
|
-
static deepCopy(obj, options) {
|
|
8537
|
-
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
|
8538
|
-
return obj;
|
|
8539
|
-
}
|
|
8540
|
-
if (obj instanceof Date) {
|
|
8541
|
-
return new Date(+obj);
|
|
8542
|
-
}
|
|
8543
|
-
let copy;
|
|
8544
|
-
if (options?.mapGettersToProperties) {
|
|
8545
|
-
copy = {};
|
|
8546
|
-
}
|
|
8547
|
-
else {
|
|
8548
|
-
copy = options?.objectPrototype ? Object.create(options.objectPrototype['prototype']) : Object.create(Object.getPrototypeOf(obj));
|
|
8549
|
-
Object.assign(copy, obj);
|
|
8550
|
-
}
|
|
8551
|
-
for (const key of ObjectUtil.getProperties(obj)) {
|
|
8552
|
-
const prop = obj[key];
|
|
8553
|
-
copy[key] = ObjectUtil.handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
8554
|
-
}
|
|
8555
|
-
if (options?.mapGettersToProperties) {
|
|
8556
|
-
for (const getterKey of ObjectUtil.getGetters(obj)) {
|
|
8557
|
-
const prop = obj[getterKey];
|
|
8558
|
-
copy[getterKey] = ObjectUtil.handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
8559
|
-
}
|
|
8560
|
-
}
|
|
8561
|
-
return copy;
|
|
8562
|
-
}
|
|
8563
|
-
static deepMerge(target, source) {
|
|
8564
|
-
if (!ObjectUtil.isObject(source)) {
|
|
8565
|
-
return target;
|
|
8566
|
-
}
|
|
8567
|
-
for (const key of ObjectUtil.getProperties(source)) {
|
|
8568
|
-
if (ObjectUtil.isObject(source[key])) {
|
|
8569
|
-
if (ObjectUtil.isObject(target[key])) {
|
|
8570
|
-
target[key] = ObjectUtil.deepMerge(target[key], source[key]);
|
|
8571
|
-
}
|
|
8572
|
-
else {
|
|
8573
|
-
target[key] = ObjectUtil.deepCopy(source[key]);
|
|
8574
|
-
}
|
|
8575
|
-
}
|
|
8576
|
-
else if (Array.isArray(source[key])) {
|
|
8577
|
-
if (!Array.isArray(target[key])) {
|
|
8578
|
-
target[key] = source[key].map(i => (ObjectUtil.isObject(i) ? ObjectUtil.deepMerge({}, i) : i));
|
|
8579
|
-
}
|
|
8580
|
-
}
|
|
8581
|
-
else if (typeof target[key] === 'undefined') {
|
|
8582
|
-
target[key] = source[key];
|
|
8583
|
-
}
|
|
8584
|
-
}
|
|
8585
|
-
return target;
|
|
8586
|
-
}
|
|
8587
|
-
static isObject(obj) {
|
|
8588
|
-
return typeof obj === 'object' && obj !== null && !Array.isArray(obj);
|
|
8589
|
-
}
|
|
8590
|
-
static handleProp(prop, options) {
|
|
8591
|
-
if (Array.isArray(prop)) {
|
|
8592
|
-
return prop.map(i => ObjectUtil.deepCopy(i, options));
|
|
8593
|
-
}
|
|
8594
|
-
else if (typeof prop === 'object' && prop !== null) {
|
|
8595
|
-
return ObjectUtil.deepCopy(prop, options);
|
|
8596
|
-
}
|
|
8597
|
-
else {
|
|
8598
|
-
return prop;
|
|
8599
|
-
}
|
|
8600
|
-
}
|
|
8601
|
-
static getProperties(obj) {
|
|
8602
|
-
return Object.keys(obj);
|
|
8603
|
-
}
|
|
8604
|
-
static getGetters(obj) {
|
|
8605
|
-
const getterSet = new Set();
|
|
8606
|
-
let currObj = obj;
|
|
8607
|
-
while (currObj) {
|
|
8608
|
-
const getters = Object.entries(Object.getOwnPropertyDescriptors(currObj))
|
|
8609
|
-
.filter(([, descriptor]) => typeof descriptor.get === 'function')
|
|
8610
|
-
.filter(([key]) => key !== '__proto__')
|
|
8611
|
-
.map(([key]) => key);
|
|
8612
|
-
for (const getter of getters) {
|
|
8613
|
-
getterSet.add(getter);
|
|
8614
|
-
}
|
|
8615
|
-
currObj = Object.getPrototypeOf(currObj);
|
|
8616
|
-
}
|
|
8617
|
-
return Array.from(getterSet);
|
|
8618
|
-
}
|
|
8619
|
-
}
|
|
8620
|
-
|
|
8621
|
-
class StringUtil {
|
|
8622
|
-
static escapeHtml(value) {
|
|
8623
|
-
return value.replace(/</g, '<').replace(/>/g, '>');
|
|
8624
|
-
}
|
|
8625
|
-
static escapeHtmlAny(value) {
|
|
8626
|
-
if (typeof value === 'string') {
|
|
8627
|
-
return StringUtil.escapeHtml(value);
|
|
8628
|
-
}
|
|
8629
|
-
else if (typeof value === 'object') {
|
|
8630
|
-
const escapedValue = ObjectUtil.deepCopy(value, { mapGettersToProperties: true });
|
|
8631
|
-
for (const key in value) {
|
|
8632
|
-
if (typeof value[key] === 'string') {
|
|
8633
|
-
escapedValue[key] = StringUtil.escapeHtml(value[key]);
|
|
8634
|
-
}
|
|
8635
|
-
else if (typeof value[key] === 'object') {
|
|
8636
|
-
escapedValue[key] = StringUtil.escapeHtmlAny(value[key]);
|
|
8637
|
-
}
|
|
8638
|
-
else {
|
|
8639
|
-
escapedValue[key] = value[key];
|
|
8640
|
-
}
|
|
8641
|
-
}
|
|
8642
|
-
return escapedValue;
|
|
8643
|
-
}
|
|
8644
|
-
return value;
|
|
8645
|
-
}
|
|
8646
|
-
}
|
|
8647
|
-
|
|
8648
8999
|
class ExportUtils {
|
|
8649
9000
|
static prepareDataForExport(pageData, delimiter, descriptor, translate) {
|
|
8650
9001
|
const replaceNullValue = (key, value) => (value === null ? '' : value);
|
|
@@ -8887,7 +9238,7 @@ class ActionDescriptor {
|
|
|
8887
9238
|
this._model = model;
|
|
8888
9239
|
this._actionName = actionName;
|
|
8889
9240
|
if ((parentType && !parentProperty) || (!parentProperty && parentProperty)) {
|
|
8890
|
-
throw new MngInternalError(`Provide both the parent type and parent property or none: ${parentType}, ${parentProperty}
|
|
9241
|
+
throw new MngInternalError(`Provide both the parent type and parent property or none: ${this._actionName}, ${parentType}, ${parentProperty}.`);
|
|
8891
9242
|
}
|
|
8892
9243
|
this._parentType = parentType;
|
|
8893
9244
|
this._parentTypeName = parentType ? TypeUtil.findTypeName(parentType) : undefined;
|
|
@@ -8936,7 +9287,7 @@ class ActionDescriptor {
|
|
|
8936
9287
|
}
|
|
8937
9288
|
get runFunction() {
|
|
8938
9289
|
if (!this._runFunction) {
|
|
8939
|
-
throw new MngInternalError(
|
|
9290
|
+
throw new MngInternalError(`Run function is not defined for action ${this._actionNameLong} and cannot be invoked`);
|
|
8940
9291
|
}
|
|
8941
9292
|
return this._runFunction;
|
|
8942
9293
|
}
|
|
@@ -9022,7 +9373,7 @@ class ActionDescriptor {
|
|
|
9022
9373
|
}
|
|
9023
9374
|
withServiceType(serviceType) {
|
|
9024
9375
|
if (!this._model) {
|
|
9025
|
-
throw new MngInternalError(`Cannot set data provider if no model type is provided
|
|
9376
|
+
throw new MngInternalError(`Cannot set data provider for action ${this._actionNameLong} if no model type is provided`);
|
|
9026
9377
|
}
|
|
9027
9378
|
this._dataProvider = new DataProvider(this._model.type, serviceType);
|
|
9028
9379
|
return this;
|
|
@@ -9212,7 +9563,7 @@ class ActionEditorDescriptor extends ActionDescriptor {
|
|
|
9212
9563
|
return this._dataProvider;
|
|
9213
9564
|
}
|
|
9214
9565
|
get runFunction() {
|
|
9215
|
-
throw new MngInternalError(
|
|
9566
|
+
throw new MngInternalError(`Run function cannot be used in editor action for ${this._actionNameLong}. Use submit function instead`);
|
|
9216
9567
|
}
|
|
9217
9568
|
get fetchFunction() {
|
|
9218
9569
|
return this._fetchFunction;
|
|
@@ -9246,7 +9597,7 @@ class ActionEditorDescriptor extends ActionDescriptor {
|
|
|
9246
9597
|
}
|
|
9247
9598
|
withServiceType(serviceType) {
|
|
9248
9599
|
if (!this._model) {
|
|
9249
|
-
throw new MngInternalError(`Cannot set data provider if no model type is provided
|
|
9600
|
+
throw new MngInternalError(`Cannot set data provider for action ${this._actionNameLong} if no model type is provided`);
|
|
9250
9601
|
}
|
|
9251
9602
|
this._dataProvider = new EditorDataProvider(this._model.type, serviceType);
|
|
9252
9603
|
return this;
|
|
@@ -10597,6 +10948,14 @@ class MngAutocompleteComponent {
|
|
|
10597
10948
|
this.searchSubscription = this.getLookup(queryParamBuilder.build(), event.query).subscribe({
|
|
10598
10949
|
next: items => {
|
|
10599
10950
|
this.setSuggestionsFromItems(items, event.query);
|
|
10951
|
+
},
|
|
10952
|
+
error: err => {
|
|
10953
|
+
this.setSuggestionsFromItems([], event.query);
|
|
10954
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngAutocompleteComponentError', {
|
|
10955
|
+
search: event.query,
|
|
10956
|
+
queryParam: queryParamBuilder.build()
|
|
10957
|
+
});
|
|
10958
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
10600
10959
|
}
|
|
10601
10960
|
});
|
|
10602
10961
|
}
|
|
@@ -10703,7 +11062,9 @@ class MngAutocompleteComponent {
|
|
|
10703
11062
|
this.itemsValueProperty = 'value';
|
|
10704
11063
|
}
|
|
10705
11064
|
else {
|
|
10706
|
-
throw new MngInternalError(`Invalid use with value (${this.itemsLabelPropertyInit}) and label (${this.itemsLabelPropertyInit}) property setup.`,
|
|
11065
|
+
throw new MngInternalError(`Invalid use with value (${this.itemsLabelPropertyInit}) and label (${this.itemsLabelPropertyInit}) property setup.`, {
|
|
11066
|
+
name: 'MngAutocompleteComponentError'
|
|
11067
|
+
});
|
|
10707
11068
|
}
|
|
10708
11069
|
}
|
|
10709
11070
|
}
|
|
@@ -10879,7 +11240,9 @@ class MngDropdownComponent {
|
|
|
10879
11240
|
this.itemsValueProperty = 'value';
|
|
10880
11241
|
}
|
|
10881
11242
|
else {
|
|
10882
|
-
throw new MngInternalError(`Invalid use with value (${this.itemsLabelPropertyInit}) and label (${this.itemsLabelPropertyInit}) property setup.`,
|
|
11243
|
+
throw new MngInternalError(`Invalid use with value (${this.itemsLabelPropertyInit}) and label (${this.itemsLabelPropertyInit}) property setup.`, {
|
|
11244
|
+
name: 'MngDropdownComponentError'
|
|
11245
|
+
});
|
|
10883
11246
|
}
|
|
10884
11247
|
}
|
|
10885
11248
|
this.itemsSubscription = this.dataProvider
|
|
@@ -10912,9 +11275,17 @@ class MngDropdownComponent {
|
|
|
10912
11275
|
return of(items);
|
|
10913
11276
|
}
|
|
10914
11277
|
}))
|
|
10915
|
-
.subscribe(
|
|
10916
|
-
|
|
10917
|
-
|
|
11278
|
+
.subscribe({
|
|
11279
|
+
next: res => {
|
|
11280
|
+
this.itemsSubject.next(res);
|
|
11281
|
+
this.loadingSubject.next(false);
|
|
11282
|
+
},
|
|
11283
|
+
error: err => {
|
|
11284
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngDropdownComponentError', {
|
|
11285
|
+
queryParam: queryParamBuilder.build()
|
|
11286
|
+
});
|
|
11287
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
11288
|
+
}
|
|
10918
11289
|
});
|
|
10919
11290
|
if (this.selectFirstItem && !this.dropdownFormControl?.value) {
|
|
10920
11291
|
this.items$.pipe(first()).subscribe(res => {
|
|
@@ -12105,6 +12476,7 @@ class MngTableComponent {
|
|
|
12105
12476
|
this.localStorageService = localStorageService;
|
|
12106
12477
|
this.filterDisplayRow = TableFilterDisplayEnum.Row;
|
|
12107
12478
|
this.cmpTypeName = 'MngTableComponent';
|
|
12479
|
+
this.logger = inject(MngLoggerService).create(this.cmpTypeName);
|
|
12108
12480
|
this.useQueryParams = false;
|
|
12109
12481
|
// extra features input
|
|
12110
12482
|
this.selectionMode = 'multiple';
|
|
@@ -12503,6 +12875,10 @@ class MngTableComponent {
|
|
|
12503
12875
|
emptyQueryResult.allDataCount = 0;
|
|
12504
12876
|
this.dataProviderQueryResultSubject.next(emptyQueryResult);
|
|
12505
12877
|
this.dataProviderLoadingSubject.next(false);
|
|
12878
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngTableComponentError', {
|
|
12879
|
+
queryParam: queryParam
|
|
12880
|
+
});
|
|
12881
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
12506
12882
|
}
|
|
12507
12883
|
});
|
|
12508
12884
|
if (emitEvent) {
|
|
@@ -12714,7 +13090,7 @@ class MngTableComponent {
|
|
|
12714
13090
|
this.layoutPreferences = {};
|
|
12715
13091
|
}
|
|
12716
13092
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngTableComponent, deps: [{ token: i0.Injector }, { token: i1.Router }, { token: i1.ActivatedRoute }, { token: i2.TranslateService }, { token: MngCommonsService }, { token: MngActionExecutorService }, { token: MngViewContainerComponentService, optional: true }, { token: MngLocalStorageService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
12717
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngTableComponent, isStandalone: true, selector: "mng-table", inputs: { initialDescriptor: ["descriptor", "initialDescriptor"], items: "items", queryResult: "queryResult", loading: "loading", dataProvider: "dataProvider", useQueryParams: "useQueryParams", selectionMode: "selectionMode", selectionEnabled: "selectionEnabled", actions: "actions", isColumnClickable: "isColumnClickable", viewContainerInit: ["viewContainer", "viewContainerInit"], captionComponent: "captionComponent", columnActionComponent: "columnActionComponent", columnActionMinWidth: "columnActionMinWidth", globalFilterFieldsInit: ["globalFilterFields", "globalFilterFieldsInit"] }, outputs: { loadEventEmitter: "tableLoad", cellClickEventEmitter: "cellClick", selectionChangeEventEmitter: "selectionChange", captionCmpInstEventEmitter: "captionComponentInstance", columnActionCmpInstEventEmitter: "columnActionComponentInstance" }, queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], viewQueries: [{ propertyName: "primeTable", first: true, predicate: Table, descendants: true }, { propertyName: "components", predicate: MngComponentDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.height]=\"tableFullHeightOffset ? 'calc(100vh - ' + tableFullHeightOffset + 'px)' : null\">\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n <p-table\n *ngIf=\"!useQueryParams || (useQueryParamsInitialized$ | async)\"\n [value]=\"infiniteScroll ? dataProviderInfiniteScrollItems : (queryResult$ | async)?.pageData ?? []\"\n [dataKey]=\"descriptor?.dataKeyProperty\"\n [lazy]=\"isLazy\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"isPagination && !infiniteScroll\"\n [rows]=\"infiniteScroll ? 20 : rows\"\n [first]=\"infiniteScroll ? 0 : offset\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"infiniteScroll ? undefined : rowsPerPageOptions\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"multiSortMeta\"\n [filters]=\"filterMetadata\"\n [globalFilterFields]=\"globalFilterFields\"\n sortMode=\"multiple\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled ? selectionMode : null\"\n [scrollable]=\"true\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualScrollItemSize]=\"rowHeight\"\n scrollHeight=\"flex\"\n [rowHover]=\"descriptor?.hasHover ?? true\"\n [styleClass]=\"className\"\n [resizableColumns]=\"descriptor?.hasResizableColumns ?? false\"\n [columnResizeMode]=\"descriptor?.columnResizeMode ?? 'fit'\"\n [reorderableColumns]=\"areColumnsReorderable\"\n [columns]=\"visibleColumns\"\n (onColResize)=\"onTableColumnResize($event)\"\n (onColReorder)=\"onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\">\n <ng-template *ngIf=\"captionTemplate || captionComponent || descriptor?.title\" pTemplate=\"caption\">\n <ng-container *ngIf=\"captionTemplate; else componentOrDefaultCaption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate\"></ng-container>\n </ng-container>\n <ng-template #componentOrDefaultCaption>\n <div *ngIf=\"captionComponent; else defaultCaption\" [mngComponent]=\"captionComponent\" (instanceCreated)=\"onCaptionCmpInst($event)\"></div>\n <ng-template #defaultCaption>\n <h5 class=\"p-0 m-0\">{{ descriptor?.title }}</h5>\n </ng-template>\n </ng-template>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr *ngIf=\"!descriptor?.hideHeader\" class=\"mng-table-header\" [class]=\"descriptor?.headerClassName\">\n <th *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"min-width: 36px\" pFrozenColumn>\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\" pFrozenColumn></th>\n <ng-container *ngFor=\"let col of columns\">\n <ng-container *ngIf=\"col.isVisible\">\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n </ng-template>\n <th\n *ngIf=\"col.descriptor.isReorderable\"\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.descriptor.property\"\n [pSortableColumnDisabled]=\"!col.descriptor.isSortEnabled\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"\n col.descriptor.headerClassName +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \">\n <ng-container *ngTemplateOutlet=\"col.descriptor.isSortEnabled ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n <th\n *ngIf=\"!col.descriptor.isReorderable\"\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.descriptor.property\"\n [pSortableColumnDisabled]=\"!col.descriptor.isSortEnabled\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"\n col.descriptor.headerClassName +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \">\n <ng-container *ngTemplateOutlet=\"col.descriptor.isSortEnabled ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n </ng-container>\n </ng-container>\n <th\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\"\n class=\"text-right\">\n <p-multiSelect\n #columnToggleMultiselect\n *ngIf=\"areColumnsToggleable || areColumnsReorderable || descriptor?.hasResizableColumns\"\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n optionDisabled=\"disabled\"\n [filter]=\"false\"\n [options]=\"columns\"\n [(ngModel)]=\"visibleColumns\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n tooltipPosition=\"left\"\n defaultLabel=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allChecked\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.toggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allChecked\"\n [ngClass]=\"{\n 'p-highlight': columnToggleMultiselect.allChecked,\n 'p-focus': columnToggleMultiselect.headerCheckboxFocus,\n 'p-disabled': !areColumnsToggleable\n }\"\n (click)=\"columnToggleMultiselect.toggleAll($event)\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': columnToggleMultiselect.allChecked}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n </ng-template>\n </p-multiSelect>\n </th>\n </tr>\n <tr *ngIf=\"descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters\" class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled\" style=\"min-width: 36px\" pFrozenColumn></th>\n <ng-container *ngFor=\"let col of columns\">\n <th\n *ngIf=\"col.isVisible\"\n [class]=\"\n (col.descriptor.filterDescriptor ? 'mng-column-filter-' + col.descriptor.filterDescriptor.filterType + ' ' : ' ') +\n col.descriptor.filterDescriptor?.columnClassName\n \"\n [style.width.%]=\"col.descriptor.filterDescriptor?.columnWidth ?? col.descriptor.width\"\n [style.min-width.px]=\"col.descriptor.filterDescriptor?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.descriptor.maxWidth\">\n <div class=\"flex\" *ngIf=\"col.descriptor.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor!.filterDisplay\" [descriptor]=\"col.descriptor.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n </ng-container>\n <th\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr\n [style.height.px]=\"rowHeight\"\n [ngClass]=\"descriptor?.rowClassName | mngClassMapPipe : descriptor?.rowClassNameMapFn : item | mngLocaleDefaultRowClass : descriptor : item\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"min-width: 36px\" pFrozenColumn>\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\" pFrozenColumn>\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <ng-container *ngFor=\"let col of columns\">\n <td\n *ngIf=\"col.isVisible\"\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \"\n [class.clickable]=\"isColumnClickable\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n </ng-container>\n <td\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n class=\"column-action justify-content-end text-right\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n <ng-container *ngIf=\"columnActionTemplate; else showColumnActionComponentOrDefault\">\n <ng-container *ngTemplateOutlet=\"columnActionTemplate; context: {rowItem: item, rowIndex: idx}\"></ng-container>\n </ng-container>\n <ng-template #showColumnActionComponentOrDefault>\n <span\n *ngIf=\"columnActionComponent; else defaultColumnActions\"\n [mngComponent]=\"columnActionComponent!\"\n (instanceCreated)=\"onColumnActionCmpInst($event)\"></span>\n </ng-template>\n <ng-template #defaultColumnActions>\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [viewContainer]=\"viewContainer\"\n [hostComponent]=\"this\"\n [itemId]=\"descriptor?.model?.idPropertyName ? item[descriptor!.model!.idPropertyName!] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n </ng-template>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor?.loadingIcon\" *ngIf=\"descriptor?.loadingIcon\"></i>\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor?.loadingIcon}\" *ngIf=\"descriptor?.loadingText\">\n {{ descriptor?.loadingText ?? '' | translate }}\n </div>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"emptymessage\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n\n <ng-template *ngIf=\"footerTemplate\" pTemplate=\"summary\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{queryResult: queryResult}\"></ng-container>\n </ng-template>\n </p-table>\n</div>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i4$3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i1$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i4$3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i4$3.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i4$3.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i4$3.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i4$3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i4$3.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i4$3.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i4$3.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "directive", type: MngComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "inputs", "attachToHost"], outputs: ["instanceCreated"] }, { kind: "pipe", type: MngI18nPropertyPipe, name: "i18nProperty" }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: ["descriptor", "display"] }, { kind: "pipe", type: MngClassMapPipe, name: "mngClassMapPipe" }, { kind: "pipe", type: MngLocaleDefaultRowClassPipe, name: "mngLocaleDefaultRowClass" }, { kind: "component", type: MngTableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "hostComponent", "route", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i6$4.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i4$2.MultiSelect, selector: "p-multiSelect", inputs: ["style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "appendTo", "dataKey", "name", "label", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i6.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { 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: FormsModule }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
13093
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngTableComponent, isStandalone: true, selector: "mng-table", inputs: { initialDescriptor: ["descriptor", "initialDescriptor"], items: "items", queryResult: "queryResult", loading: "loading", dataProvider: "dataProvider", useQueryParams: "useQueryParams", selectionMode: "selectionMode", selectionEnabled: "selectionEnabled", actions: "actions", isColumnClickable: "isColumnClickable", viewContainerInit: ["viewContainer", "viewContainerInit"], captionComponent: "captionComponent", columnActionComponent: "columnActionComponent", columnActionMinWidth: "columnActionMinWidth", globalFilterFieldsInit: ["globalFilterFields", "globalFilterFieldsInit"] }, outputs: { loadEventEmitter: "tableLoad", cellClickEventEmitter: "cellClick", selectionChangeEventEmitter: "selectionChange", captionCmpInstEventEmitter: "captionComponentInstance", columnActionCmpInstEventEmitter: "columnActionComponentInstance" }, queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], viewQueries: [{ propertyName: "primeTable", first: true, predicate: Table, descendants: true }, { propertyName: "components", predicate: MngComponentDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.height]=\"tableFullHeightOffset ? 'calc(100vh - ' + tableFullHeightOffset + 'px)' : null\">\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n <p-table\n *ngIf=\"!useQueryParams || (useQueryParamsInitialized$ | async)\"\n [value]=\"infiniteScroll ? dataProviderInfiniteScrollItems : (queryResult$ | async)?.pageData ?? []\"\n [dataKey]=\"descriptor?.dataKeyProperty\"\n [lazy]=\"isLazy\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"isPagination && !infiniteScroll\"\n [rows]=\"infiniteScroll ? 20 : rows\"\n [first]=\"infiniteScroll ? 0 : offset\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"infiniteScroll ? undefined : rowsPerPageOptions\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"multiSortMeta\"\n [filters]=\"filterMetadata\"\n [globalFilterFields]=\"globalFilterFields\"\n sortMode=\"multiple\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled ? selectionMode : null\"\n [scrollable]=\"true\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualScrollItemSize]=\"rowHeight\"\n scrollHeight=\"flex\"\n [rowHover]=\"descriptor?.hasHover ?? true\"\n [styleClass]=\"className\"\n [resizableColumns]=\"descriptor?.hasResizableColumns ?? false\"\n [columnResizeMode]=\"descriptor?.columnResizeMode ?? 'fit'\"\n [reorderableColumns]=\"areColumnsReorderable\"\n [columns]=\"visibleColumns\"\n (onColResize)=\"onTableColumnResize($event)\"\n (onColReorder)=\"onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\">\n <ng-template *ngIf=\"captionTemplate || captionComponent || descriptor?.title\" pTemplate=\"caption\">\n <ng-container *ngIf=\"captionTemplate; else componentOrDefaultCaption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate\"></ng-container>\n </ng-container>\n <ng-template #componentOrDefaultCaption>\n <div *ngIf=\"captionComponent; else defaultCaption\" [mngComponent]=\"captionComponent\" (instanceCreated)=\"onCaptionCmpInst($event)\"></div>\n <ng-template #defaultCaption>\n <h5 class=\"p-0 m-0\">{{ descriptor?.title }}</h5>\n </ng-template>\n </ng-template>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr *ngIf=\"!descriptor?.hideHeader\" class=\"mng-table-header\" [class]=\"descriptor?.headerClassName\">\n <th *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\"></th>\n <ng-container *ngFor=\"let col of columns\">\n <ng-container *ngIf=\"col.isVisible\">\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n </ng-template>\n <th\n *ngIf=\"col.descriptor.isReorderable\"\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.descriptor.property\"\n [pSortableColumnDisabled]=\"!col.descriptor.isSortEnabled\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"\n col.descriptor.headerClassName +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \">\n <ng-container *ngTemplateOutlet=\"col.descriptor.isSortEnabled ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n <th\n *ngIf=\"!col.descriptor.isReorderable\"\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.descriptor.property\"\n [pSortableColumnDisabled]=\"!col.descriptor.isSortEnabled\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"\n col.descriptor.headerClassName +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \">\n <ng-container *ngTemplateOutlet=\"col.descriptor.isSortEnabled ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n </ng-container>\n </ng-container>\n <th\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\"\n class=\"text-right\">\n <p-multiSelect\n #columnToggleMultiselect\n *ngIf=\"areColumnsToggleable || areColumnsReorderable || descriptor?.hasResizableColumns\"\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n optionDisabled=\"disabled\"\n [filter]=\"false\"\n [options]=\"columns\"\n [(ngModel)]=\"visibleColumns\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n tooltipPosition=\"left\"\n defaultLabel=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allChecked\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.toggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allChecked\"\n [ngClass]=\"{\n 'p-highlight': columnToggleMultiselect.allChecked,\n 'p-focus': columnToggleMultiselect.headerCheckboxFocus,\n 'p-disabled': !areColumnsToggleable\n }\"\n (click)=\"columnToggleMultiselect.toggleAll($event)\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': columnToggleMultiselect.allChecked}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n </ng-template>\n </p-multiSelect>\n </th>\n </tr>\n <tr *ngIf=\"descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters\" class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\"></th>\n <ng-container *ngFor=\"let col of columns\">\n <th\n *ngIf=\"col.isVisible\"\n [class]=\"\n (col.descriptor.filterDescriptor ? 'mng-column-filter-' + col.descriptor.filterDescriptor.filterType + ' ' : ' ') +\n col.descriptor.filterDescriptor?.columnClassName\n \"\n [style.width.%]=\"col.descriptor.filterDescriptor?.columnWidth ?? col.descriptor.width\"\n [style.min-width.px]=\"col.descriptor.filterDescriptor?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.descriptor.maxWidth\">\n <div class=\"flex\" *ngIf=\"col.descriptor.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor!.filterDisplay\" [descriptor]=\"col.descriptor.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n </ng-container>\n <th\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr\n [style.height.px]=\"rowHeight\"\n [ngClass]=\"descriptor?.rowClassName | mngClassMapPipe : descriptor?.rowClassNameMapFn : item | mngLocaleDefaultRowClass : descriptor : item\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <ng-container *ngFor=\"let col of columns\">\n <td\n *ngIf=\"col.isVisible\"\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \"\n [class.clickable]=\"isColumnClickable\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n </ng-container>\n <td\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n class=\"column-action justify-content-end text-right\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n <ng-container *ngIf=\"columnActionTemplate; else showColumnActionComponentOrDefault\">\n <ng-container *ngTemplateOutlet=\"columnActionTemplate; context: {rowItem: item, rowIndex: idx}\"></ng-container>\n </ng-container>\n <ng-template #showColumnActionComponentOrDefault>\n <span\n *ngIf=\"columnActionComponent; else defaultColumnActions\"\n [mngComponent]=\"columnActionComponent!\"\n (instanceCreated)=\"onColumnActionCmpInst($event)\"></span>\n </ng-template>\n <ng-template #defaultColumnActions>\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [viewContainer]=\"viewContainer\"\n [hostComponent]=\"this\"\n [itemId]=\"descriptor?.model?.idPropertyName ? item[descriptor!.model!.idPropertyName!] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n </ng-template>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor?.loadingIcon\" *ngIf=\"descriptor?.loadingIcon\"></i>\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor?.loadingIcon}\" *ngIf=\"descriptor?.loadingText\">\n {{ descriptor?.loadingText ?? '' | translate }}\n </div>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"emptymessage\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n\n <ng-template *ngIf=\"footerTemplate\" pTemplate=\"summary\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{queryResult: queryResult}\"></ng-container>\n </ng-template>\n </p-table>\n</div>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i4$3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i1$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i4$3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i4$3.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i4$3.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i4$3.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i4$3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i4$3.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i4$3.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i4$3.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "directive", type: MngComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "inputs", "attachToHost"], outputs: ["instanceCreated"] }, { kind: "pipe", type: MngI18nPropertyPipe, name: "i18nProperty" }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: ["descriptor", "display"] }, { kind: "pipe", type: MngClassMapPipe, name: "mngClassMapPipe" }, { kind: "pipe", type: MngLocaleDefaultRowClassPipe, name: "mngLocaleDefaultRowClass" }, { kind: "component", type: MngTableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "hostComponent", "route", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i6$4.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i4$2.MultiSelect, selector: "p-multiSelect", inputs: ["style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "appendTo", "dataKey", "name", "label", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i6.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { 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: FormsModule }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
12718
13094
|
}
|
|
12719
13095
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngTableComponent, decorators: [{
|
|
12720
13096
|
type: Component,
|
|
@@ -12739,7 +13115,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
12739
13115
|
ButtonModule,
|
|
12740
13116
|
TooltipModule,
|
|
12741
13117
|
FormsModule
|
|
12742
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.height]=\"tableFullHeightOffset ? 'calc(100vh - ' + tableFullHeightOffset + 'px)' : null\">\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n <p-table\n *ngIf=\"!useQueryParams || (useQueryParamsInitialized$ | async)\"\n [value]=\"infiniteScroll ? dataProviderInfiniteScrollItems : (queryResult$ | async)?.pageData ?? []\"\n [dataKey]=\"descriptor?.dataKeyProperty\"\n [lazy]=\"isLazy\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"isPagination && !infiniteScroll\"\n [rows]=\"infiniteScroll ? 20 : rows\"\n [first]=\"infiniteScroll ? 0 : offset\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"infiniteScroll ? undefined : rowsPerPageOptions\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"multiSortMeta\"\n [filters]=\"filterMetadata\"\n [globalFilterFields]=\"globalFilterFields\"\n sortMode=\"multiple\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled ? selectionMode : null\"\n [scrollable]=\"true\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualScrollItemSize]=\"rowHeight\"\n scrollHeight=\"flex\"\n [rowHover]=\"descriptor?.hasHover ?? true\"\n [styleClass]=\"className\"\n [resizableColumns]=\"descriptor?.hasResizableColumns ?? false\"\n [columnResizeMode]=\"descriptor?.columnResizeMode ?? 'fit'\"\n [reorderableColumns]=\"areColumnsReorderable\"\n [columns]=\"visibleColumns\"\n (onColResize)=\"onTableColumnResize($event)\"\n (onColReorder)=\"onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\">\n <ng-template *ngIf=\"captionTemplate || captionComponent || descriptor?.title\" pTemplate=\"caption\">\n <ng-container *ngIf=\"captionTemplate; else componentOrDefaultCaption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate\"></ng-container>\n </ng-container>\n <ng-template #componentOrDefaultCaption>\n <div *ngIf=\"captionComponent; else defaultCaption\" [mngComponent]=\"captionComponent\" (instanceCreated)=\"onCaptionCmpInst($event)\"></div>\n <ng-template #defaultCaption>\n <h5 class=\"p-0 m-0\">{{ descriptor?.title }}</h5>\n </ng-template>\n </ng-template>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr *ngIf=\"!descriptor?.hideHeader\" class=\"mng-table-header\" [class]=\"descriptor?.headerClassName\">\n <th *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"min-width: 36px\" pFrozenColumn>\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\" pFrozenColumn></th>\n <ng-container *ngFor=\"let col of columns\">\n <ng-container *ngIf=\"col.isVisible\">\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n </ng-template>\n <th\n *ngIf=\"col.descriptor.isReorderable\"\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.descriptor.property\"\n [pSortableColumnDisabled]=\"!col.descriptor.isSortEnabled\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"\n col.descriptor.headerClassName +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \">\n <ng-container *ngTemplateOutlet=\"col.descriptor.isSortEnabled ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n <th\n *ngIf=\"!col.descriptor.isReorderable\"\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.descriptor.property\"\n [pSortableColumnDisabled]=\"!col.descriptor.isSortEnabled\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"\n col.descriptor.headerClassName +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \">\n <ng-container *ngTemplateOutlet=\"col.descriptor.isSortEnabled ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n </ng-container>\n </ng-container>\n <th\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\"\n class=\"text-right\">\n <p-multiSelect\n #columnToggleMultiselect\n *ngIf=\"areColumnsToggleable || areColumnsReorderable || descriptor?.hasResizableColumns\"\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n optionDisabled=\"disabled\"\n [filter]=\"false\"\n [options]=\"columns\"\n [(ngModel)]=\"visibleColumns\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n tooltipPosition=\"left\"\n defaultLabel=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allChecked\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.toggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allChecked\"\n [ngClass]=\"{\n 'p-highlight': columnToggleMultiselect.allChecked,\n 'p-focus': columnToggleMultiselect.headerCheckboxFocus,\n 'p-disabled': !areColumnsToggleable\n }\"\n (click)=\"columnToggleMultiselect.toggleAll($event)\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': columnToggleMultiselect.allChecked}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n </ng-template>\n </p-multiSelect>\n </th>\n </tr>\n <tr *ngIf=\"descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters\" class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled\" style=\"min-width: 36px\" pFrozenColumn></th>\n <ng-container *ngFor=\"let col of columns\">\n <th\n *ngIf=\"col.isVisible\"\n [class]=\"\n (col.descriptor.filterDescriptor ? 'mng-column-filter-' + col.descriptor.filterDescriptor.filterType + ' ' : ' ') +\n col.descriptor.filterDescriptor?.columnClassName\n \"\n [style.width.%]=\"col.descriptor.filterDescriptor?.columnWidth ?? col.descriptor.width\"\n [style.min-width.px]=\"col.descriptor.filterDescriptor?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.descriptor.maxWidth\">\n <div class=\"flex\" *ngIf=\"col.descriptor.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor!.filterDisplay\" [descriptor]=\"col.descriptor.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n </ng-container>\n <th\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr\n [style.height.px]=\"rowHeight\"\n [ngClass]=\"descriptor?.rowClassName | mngClassMapPipe : descriptor?.rowClassNameMapFn : item | mngLocaleDefaultRowClass : descriptor : item\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"min-width: 36px\" pFrozenColumn>\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\" pFrozenColumn>\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <ng-container *ngFor=\"let col of columns\">\n <td\n *ngIf=\"col.isVisible\"\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \"\n [class.clickable]=\"isColumnClickable\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n </ng-container>\n <td\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n class=\"column-action justify-content-end text-right\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n <ng-container *ngIf=\"columnActionTemplate; else showColumnActionComponentOrDefault\">\n <ng-container *ngTemplateOutlet=\"columnActionTemplate; context: {rowItem: item, rowIndex: idx}\"></ng-container>\n </ng-container>\n <ng-template #showColumnActionComponentOrDefault>\n <span\n *ngIf=\"columnActionComponent; else defaultColumnActions\"\n [mngComponent]=\"columnActionComponent!\"\n (instanceCreated)=\"onColumnActionCmpInst($event)\"></span>\n </ng-template>\n <ng-template #defaultColumnActions>\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [viewContainer]=\"viewContainer\"\n [hostComponent]=\"this\"\n [itemId]=\"descriptor?.model?.idPropertyName ? item[descriptor!.model!.idPropertyName!] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n </ng-template>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor?.loadingIcon\" *ngIf=\"descriptor?.loadingIcon\"></i>\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor?.loadingIcon}\" *ngIf=\"descriptor?.loadingText\">\n {{ descriptor?.loadingText ?? '' | translate }}\n </div>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"emptymessage\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n\n <ng-template *ngIf=\"footerTemplate\" pTemplate=\"summary\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{queryResult: queryResult}\"></ng-container>\n </ng-template>\n </p-table>\n</div>\n" }]
|
|
13118
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.height]=\"tableFullHeightOffset ? 'calc(100vh - ' + tableFullHeightOffset + 'px)' : null\">\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n <p-table\n *ngIf=\"!useQueryParams || (useQueryParamsInitialized$ | async)\"\n [value]=\"infiniteScroll ? dataProviderInfiniteScrollItems : (queryResult$ | async)?.pageData ?? []\"\n [dataKey]=\"descriptor?.dataKeyProperty\"\n [lazy]=\"isLazy\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"isPagination && !infiniteScroll\"\n [rows]=\"infiniteScroll ? 20 : rows\"\n [first]=\"infiniteScroll ? 0 : offset\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"infiniteScroll ? undefined : rowsPerPageOptions\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"multiSortMeta\"\n [filters]=\"filterMetadata\"\n [globalFilterFields]=\"globalFilterFields\"\n sortMode=\"multiple\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled ? selectionMode : null\"\n [scrollable]=\"true\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualScrollItemSize]=\"rowHeight\"\n scrollHeight=\"flex\"\n [rowHover]=\"descriptor?.hasHover ?? true\"\n [styleClass]=\"className\"\n [resizableColumns]=\"descriptor?.hasResizableColumns ?? false\"\n [columnResizeMode]=\"descriptor?.columnResizeMode ?? 'fit'\"\n [reorderableColumns]=\"areColumnsReorderable\"\n [columns]=\"visibleColumns\"\n (onColResize)=\"onTableColumnResize($event)\"\n (onColReorder)=\"onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\">\n <ng-template *ngIf=\"captionTemplate || captionComponent || descriptor?.title\" pTemplate=\"caption\">\n <ng-container *ngIf=\"captionTemplate; else componentOrDefaultCaption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate\"></ng-container>\n </ng-container>\n <ng-template #componentOrDefaultCaption>\n <div *ngIf=\"captionComponent; else defaultCaption\" [mngComponent]=\"captionComponent\" (instanceCreated)=\"onCaptionCmpInst($event)\"></div>\n <ng-template #defaultCaption>\n <h5 class=\"p-0 m-0\">{{ descriptor?.title }}</h5>\n </ng-template>\n </ng-template>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr *ngIf=\"!descriptor?.hideHeader\" class=\"mng-table-header\" [class]=\"descriptor?.headerClassName\">\n <th *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\"></th>\n <ng-container *ngFor=\"let col of columns\">\n <ng-container *ngIf=\"col.isVisible\">\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n </ng-template>\n <th\n *ngIf=\"col.descriptor.isReorderable\"\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.descriptor.property\"\n [pSortableColumnDisabled]=\"!col.descriptor.isSortEnabled\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"\n col.descriptor.headerClassName +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \">\n <ng-container *ngTemplateOutlet=\"col.descriptor.isSortEnabled ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n <th\n *ngIf=\"!col.descriptor.isReorderable\"\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.descriptor.property\"\n [pSortableColumnDisabled]=\"!col.descriptor.isSortEnabled\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"\n col.descriptor.headerClassName +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \">\n <ng-container *ngTemplateOutlet=\"col.descriptor.isSortEnabled ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n </ng-container>\n </ng-container>\n <th\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\"\n class=\"text-right\">\n <p-multiSelect\n #columnToggleMultiselect\n *ngIf=\"areColumnsToggleable || areColumnsReorderable || descriptor?.hasResizableColumns\"\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n optionDisabled=\"disabled\"\n [filter]=\"false\"\n [options]=\"columns\"\n [(ngModel)]=\"visibleColumns\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n tooltipPosition=\"left\"\n defaultLabel=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allChecked\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.toggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allChecked\"\n [ngClass]=\"{\n 'p-highlight': columnToggleMultiselect.allChecked,\n 'p-focus': columnToggleMultiselect.headerCheckboxFocus,\n 'p-disabled': !areColumnsToggleable\n }\"\n (click)=\"columnToggleMultiselect.toggleAll($event)\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': columnToggleMultiselect.allChecked}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | i18nProperty : descriptor!.model) | translate }}\n </ng-template>\n </p-multiSelect>\n </th>\n </tr>\n <tr *ngIf=\"descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters\" class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\"></th>\n <ng-container *ngFor=\"let col of columns\">\n <th\n *ngIf=\"col.isVisible\"\n [class]=\"\n (col.descriptor.filterDescriptor ? 'mng-column-filter-' + col.descriptor.filterDescriptor.filterType + ' ' : ' ') +\n col.descriptor.filterDescriptor?.columnClassName\n \"\n [style.width.%]=\"col.descriptor.filterDescriptor?.columnWidth ?? col.descriptor.width\"\n [style.min-width.px]=\"col.descriptor.filterDescriptor?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.descriptor.maxWidth\">\n <div class=\"flex\" *ngIf=\"col.descriptor.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor!.filterDisplay\" [descriptor]=\"col.descriptor.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n </ng-container>\n <th\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr\n [style.height.px]=\"rowHeight\"\n [ngClass]=\"descriptor?.rowClassName | mngClassMapPipe : descriptor?.rowClassNameMapFn : item | mngLocaleDefaultRowClass : descriptor : item\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor?.selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <ng-container *ngFor=\"let col of columns\">\n <td\n *ngIf=\"col.isVisible\"\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className +\n (descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters && col.descriptor.filterDescriptor\n ? ' mng-column-filter-' + col.descriptor.filterDescriptor.filterType\n : '')\n \"\n [class.clickable]=\"isColumnClickable\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | i18nProperty : descriptor!.model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n </ng-container>\n <td\n *ngIf=\"showInlineActionsColumn || areColumnsToggleable || areColumnsReorderable\"\n class=\"column-action justify-content-end text-right\"\n [style.min-width.px]=\"columnActionMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor?.actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n <ng-container *ngIf=\"columnActionTemplate; else showColumnActionComponentOrDefault\">\n <ng-container *ngTemplateOutlet=\"columnActionTemplate; context: {rowItem: item, rowIndex: idx}\"></ng-container>\n </ng-container>\n <ng-template #showColumnActionComponentOrDefault>\n <span\n *ngIf=\"columnActionComponent; else defaultColumnActions\"\n [mngComponent]=\"columnActionComponent!\"\n (instanceCreated)=\"onColumnActionCmpInst($event)\"></span>\n </ng-template>\n <ng-template #defaultColumnActions>\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [viewContainer]=\"viewContainer\"\n [hostComponent]=\"this\"\n [itemId]=\"descriptor?.model?.idPropertyName ? item[descriptor!.model!.idPropertyName!] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n </ng-template>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor?.loadingIcon\" *ngIf=\"descriptor?.loadingIcon\"></i>\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor?.loadingIcon}\" *ngIf=\"descriptor?.loadingText\">\n {{ descriptor?.loadingText ?? '' | translate }}\n </div>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"emptymessage\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n\n <ng-template *ngIf=\"footerTemplate\" pTemplate=\"summary\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{queryResult: queryResult}\"></ng-container>\n </ng-template>\n </p-table>\n</div>\n" }]
|
|
12743
13119
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.Router }, { type: i1.ActivatedRoute }, { type: i2.TranslateService }, { type: MngCommonsService }, { type: MngActionExecutorService }, { type: MngViewContainerComponentService, decorators: [{
|
|
12744
13120
|
type: Optional
|
|
12745
13121
|
}] }, { type: MngLocalStorageService }]; }, propDecorators: { initialDescriptor: [{
|
|
@@ -13122,6 +13498,7 @@ class MngFormlyFieldLookupDialogComponent extends FieldType {
|
|
|
13122
13498
|
constructor(injector) {
|
|
13123
13499
|
super();
|
|
13124
13500
|
this.injector = injector;
|
|
13501
|
+
this.logger = inject(MngLoggerService).create('MngFormlyFieldLookupDialogComponent');
|
|
13125
13502
|
this.fieldLabelFormControl = new FormControl();
|
|
13126
13503
|
this.itemsSubject = new ReplaySubject(1);
|
|
13127
13504
|
this.itemsAsync = this.itemsSubject.asObservable();
|
|
@@ -13212,6 +13589,10 @@ class MngFormlyFieldLookupDialogComponent extends FieldType {
|
|
|
13212
13589
|
eventSubtype: 'LookupError',
|
|
13213
13590
|
queryResult: err
|
|
13214
13591
|
});
|
|
13592
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngFormlyFieldLookupDialogComponentError', {
|
|
13593
|
+
queryParam: queryParamBuilder.build()
|
|
13594
|
+
});
|
|
13595
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
13215
13596
|
}
|
|
13216
13597
|
});
|
|
13217
13598
|
}
|
|
@@ -13269,7 +13650,7 @@ class MngFormlyFieldLookupDialogComponent extends FieldType {
|
|
|
13269
13650
|
if (typeof value === 'object') {
|
|
13270
13651
|
const labelProperty = this.descriptor.itemsLabelProperty ?? this.descriptor.dialogTableDescriptor?.model.titlePropertyName;
|
|
13271
13652
|
if (!labelProperty) {
|
|
13272
|
-
throw new MngInternalError('Could not determine label property.', '
|
|
13653
|
+
throw new MngInternalError('Could not determine label property.', { name: 'MngFormlyFieldLookupDialogError' });
|
|
13273
13654
|
}
|
|
13274
13655
|
this.fieldLabelFormControl.setValue(value[labelProperty]);
|
|
13275
13656
|
}
|
|
@@ -13331,7 +13712,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
13331
13712
|
})
|
|
13332
13713
|
.withSubmitFunction(ctx => {
|
|
13333
13714
|
if (!ctx.parameters.item) {
|
|
13334
|
-
return throwError(() => new MngInternalError(`No item was provided in context, add cannot be done.`, '
|
|
13715
|
+
return throwError(() => new MngInternalError(`No item was provided in context, add cannot be done.`, { name: 'FormlyFieldTableDialogFormComponentError' }));
|
|
13335
13716
|
}
|
|
13336
13717
|
this.formState.submittedOn = Date.now();
|
|
13337
13718
|
let value = this.formControl.value;
|
|
@@ -13359,7 +13740,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
13359
13740
|
})
|
|
13360
13741
|
.withSubmitFunction(ctx => {
|
|
13361
13742
|
if (!ctx.parameters.item) {
|
|
13362
|
-
return throwError(() => new MngInternalError(`No item was provided in context, edit cannot be done.`, '
|
|
13743
|
+
return throwError(() => new MngInternalError(`No item was provided in context, edit cannot be done.`, { name: 'FormlyFieldTableDialogFormComponentError' }));
|
|
13363
13744
|
}
|
|
13364
13745
|
this.formState.submittedOn = Date.now();
|
|
13365
13746
|
const formControlValue = this.formControl.value;
|
|
@@ -13382,7 +13763,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
13382
13763
|
.withButtonDescriptor(new ActionButtonDescriptor().withStyleClass(new ButtonStyleBuilder(StyleLevelEnum.Danger).withSize(StyleSizeEnum.ExtraSmall)))
|
|
13383
13764
|
.withRunFunction(ctx => {
|
|
13384
13765
|
if (!ctx.parameters.item) {
|
|
13385
|
-
return throwError(() => new MngInternalError(`No item was provided in context, delete cannot be done.`, '
|
|
13766
|
+
return throwError(() => new MngInternalError(`No item was provided in context, delete cannot be done.`, { name: 'FormlyFieldTableDialogFormComponentError' }));
|
|
13386
13767
|
}
|
|
13387
13768
|
let formControlValue = this.formControl.value;
|
|
13388
13769
|
const compareProperty = this.descriptor.tableDescriptor.dataKeyProperty
|
|
@@ -13400,7 +13781,9 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
13400
13781
|
this.formControl.markAsDirty();
|
|
13401
13782
|
}
|
|
13402
13783
|
else {
|
|
13403
|
-
return throwError(() => new MngInternalError('Cannot compare items, please provide main table data key property or model id property.',
|
|
13784
|
+
return throwError(() => new MngInternalError('Cannot compare items, please provide main table data key property or model id property.', {
|
|
13785
|
+
name: 'FormlyFieldTableDialogFormComponentError'
|
|
13786
|
+
}));
|
|
13404
13787
|
}
|
|
13405
13788
|
this.formControl.markAsTouched();
|
|
13406
13789
|
return of(ctxItem);
|
|
@@ -13483,6 +13866,7 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13483
13866
|
constructor(injector) {
|
|
13484
13867
|
super();
|
|
13485
13868
|
this.injector = injector;
|
|
13869
|
+
this.logger = inject(MngLoggerService).create('MngFormlyFieldTableDialogMultiselectComponent');
|
|
13486
13870
|
this.itemsSubject = new ReplaySubject(1);
|
|
13487
13871
|
this.itemsAsync = this.itemsSubject.asObservable();
|
|
13488
13872
|
this.addItemsSubject = new ReplaySubject(1);
|
|
@@ -13569,8 +13953,12 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13569
13953
|
this.dialogAreItemsLoaded = true;
|
|
13570
13954
|
this.dialogIsLoadingSubject.next(false);
|
|
13571
13955
|
},
|
|
13572
|
-
error:
|
|
13956
|
+
error: err => {
|
|
13573
13957
|
this.dialogIsLoadingSubject.next(false);
|
|
13958
|
+
const mngError = ErrorUtil.fromSubscribeError(err, 'MngFormlyFieldTableDialogMultiselectComponent', {
|
|
13959
|
+
queryParam: queryParamBuilder.build()
|
|
13960
|
+
});
|
|
13961
|
+
this.logger.log(mngError, ErrorUtil.getErrorLogLevel(mngError));
|
|
13574
13962
|
}
|
|
13575
13963
|
});
|
|
13576
13964
|
});
|
|
@@ -13613,7 +14001,9 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13613
14001
|
? this.descriptor.mainTableDescriptor.dataKeyProperty
|
|
13614
14002
|
: this.descriptor.mainTableDescriptor.model.idPropertyName;
|
|
13615
14003
|
if (!compareProperty) {
|
|
13616
|
-
throw new MngInternalError('Cannot compare items, please provide main table data key property or model id property.',
|
|
14004
|
+
throw new MngInternalError('Cannot compare items, please provide main table data key property or model id property.', {
|
|
14005
|
+
name: 'FormlyFieldTableDialogMultiselectComponentError'
|
|
14006
|
+
});
|
|
13617
14007
|
}
|
|
13618
14008
|
value = value.filter((i) => i[compareProperty] !== item[compareProperty]);
|
|
13619
14009
|
this.formControl.patchValue(value);
|
|
@@ -13626,11 +14016,11 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
13626
14016
|
this.searchDebounceSubject.next(query);
|
|
13627
14017
|
}
|
|
13628
14018
|
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 }); }
|
|
13629
|
-
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.
|
|
14019
|
+
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 }); }
|
|
13630
14020
|
}
|
|
13631
14021
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngFormlyFieldTableDialogMultiselectComponent, decorators: [{
|
|
13632
14022
|
type: Component,
|
|
13633
|
-
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.
|
|
14023
|
+
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"] }]
|
|
13634
14024
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { addTableComponent: [{
|
|
13635
14025
|
type: ViewChild,
|
|
13636
14026
|
args: ['addTableComponent']
|
|
@@ -13846,7 +14236,7 @@ class RouteUtil {
|
|
|
13846
14236
|
}
|
|
13847
14237
|
else if (path[0].startsWith('../')) {
|
|
13848
14238
|
// TODO: process multi upper folder
|
|
13849
|
-
throw new MngInternalError('Not implemented', '
|
|
14239
|
+
throw new MngInternalError('Not implemented', { name: 'RouteUtilsError' });
|
|
13850
14240
|
}
|
|
13851
14241
|
else {
|
|
13852
14242
|
return RouteUtil.removeEmptyPathSegments([...basePath, ...path]);
|
|
@@ -14566,16 +14956,12 @@ class MngErrorHandler {
|
|
|
14566
14956
|
}
|
|
14567
14957
|
static { this.logCategory = 'MngErrorHandler'; }
|
|
14568
14958
|
handleError(error) {
|
|
14569
|
-
if (error instanceof
|
|
14570
|
-
const
|
|
14571
|
-
this.logger.log(
|
|
14572
|
-
}
|
|
14573
|
-
else if (error instanceof HttpErrorResponse) {
|
|
14574
|
-
const isClientError = error.status >= 400 && error.status < 500;
|
|
14575
|
-
this.logger.log(`Http error occurred with status ${error.status} ${error.statusText}: ${error.message}`, isClientError ? LogLevelEnum.Warning : LogLevelEnum.Error, MngErrorHandler.logCategory, error);
|
|
14959
|
+
if (error instanceof AMngErrorBase || error instanceof HttpErrorResponse) {
|
|
14960
|
+
const logLevel = ErrorUtil.getErrorLogLevel(error);
|
|
14961
|
+
this.logger.log(error, logLevel);
|
|
14576
14962
|
}
|
|
14577
14963
|
else {
|
|
14578
|
-
this.logger.
|
|
14964
|
+
this.logger.error('Unexpected error occurred', error);
|
|
14579
14965
|
}
|
|
14580
14966
|
}
|
|
14581
14967
|
}
|
|
@@ -14588,6 +14974,7 @@ class MngCommonsInitService {
|
|
|
14588
14974
|
constructor() {
|
|
14589
14975
|
this.httpClient = inject(HttpClient);
|
|
14590
14976
|
this.logger = inject(MngLoggerService);
|
|
14977
|
+
this.logPublishers = inject(MNG_LOG_PUBLISHERS, { optional: true });
|
|
14591
14978
|
this.config = inject(MngConfigurationService);
|
|
14592
14979
|
this.mngCommons = inject(MngCommonsService);
|
|
14593
14980
|
this.mngRouter = inject(MngRouterService);
|
|
@@ -14627,7 +15014,7 @@ class MngCommonsInitService {
|
|
|
14627
15014
|
}
|
|
14628
15015
|
return this.config.loadJsonConfigurations().pipe(mergeMap(() => {
|
|
14629
15016
|
// init logger
|
|
14630
|
-
MngLoggerService.init(this.config);
|
|
15017
|
+
MngLoggerService.init(this.config, this.logPublishers ?? []);
|
|
14631
15018
|
if (this.commonsInitializers) {
|
|
14632
15019
|
ctxLogger.debug('Project initializers are being initialized');
|
|
14633
15020
|
return combineLatest(this.commonsInitializers.map(ci => ci())).pipe(map(res => res));
|
|
@@ -14982,6 +15369,11 @@ function provideMngCommons(config) {
|
|
|
14982
15369
|
provide: MngLoggerService,
|
|
14983
15370
|
useFactory: () => MngLoggerService.get()
|
|
14984
15371
|
},
|
|
15372
|
+
{
|
|
15373
|
+
provide: MNG_LOG_PUBLISHERS,
|
|
15374
|
+
useClass: MngLogPublisherConsoleService,
|
|
15375
|
+
multi: true
|
|
15376
|
+
},
|
|
14985
15377
|
{
|
|
14986
15378
|
provide: ErrorHandler,
|
|
14987
15379
|
useClass: MngErrorHandler
|
|
@@ -15705,13 +16097,13 @@ class RouteBuilder {
|
|
|
15705
16097
|
}
|
|
15706
16098
|
toParent() {
|
|
15707
16099
|
if (!this.parent) {
|
|
15708
|
-
throw new MngInternalError('Parent was not provided.', 'RouteBuilder error');
|
|
16100
|
+
throw new MngInternalError('Parent was not provided.', { name: 'RouteBuilder error' });
|
|
15709
16101
|
}
|
|
15710
16102
|
return this.parent;
|
|
15711
16103
|
}
|
|
15712
16104
|
toRoot() {
|
|
15713
16105
|
if (!this.root) {
|
|
15714
|
-
throw new MngInternalError('Root was not provided.', '
|
|
16106
|
+
throw new MngInternalError('Root was not provided.', { name: 'RouteBuilderError' });
|
|
15715
16107
|
}
|
|
15716
16108
|
return this.root;
|
|
15717
16109
|
}
|
|
@@ -15893,7 +16285,7 @@ class RoutesBuilder {
|
|
|
15893
16285
|
}
|
|
15894
16286
|
toRoute() {
|
|
15895
16287
|
if (!this.currentRoute) {
|
|
15896
|
-
throw new MngInternalError('No routes were added!', '
|
|
16288
|
+
throw new MngInternalError('No routes were added!', { name: 'RoutesBuilderError' });
|
|
15897
16289
|
}
|
|
15898
16290
|
return this.currentRoute;
|
|
15899
16291
|
}
|
|
@@ -16143,5 +16535,5 @@ function EnumName(typeName) {
|
|
|
16143
16535
|
* Generated bundle index. Do not edit.
|
|
16144
16536
|
*/
|
|
16145
16537
|
|
|
16146
|
-
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 };
|
|
16538
|
+
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 };
|
|
16147
16539
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|