@mediusinc/mng-commons 0.13.0 → 0.14.1
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/assets/i18n/en.json +3 -2
- package/assets/i18n/sl.json +3 -2
- package/esm2020/lib/api/models/filter-param.model.mjs +1 -1
- package/esm2020/lib/api/utils/medius-rest.util.mjs +66 -8
- package/esm2020/lib/components/action/action.component.mjs +17 -4
- package/esm2020/lib/components/action/editor/action-editor.component.mjs +1 -1
- package/esm2020/lib/components/action/models/action-execution.model.mjs +6 -1
- package/esm2020/lib/components/action/models/index.mjs +2 -1
- package/esm2020/lib/components/action/models/tableview-action-default-categories.model.mjs +11 -0
- package/esm2020/lib/components/form/date-range/date-range.component.mjs +106 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +1 -1
- package/esm2020/lib/components/form/index.mjs +2 -1
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +17 -10
- package/esm2020/lib/components/tableview/route/tableview-route.component.mjs +5 -13
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +38 -23
- package/esm2020/lib/components/tableview/table/table.component.mjs +54 -21
- package/esm2020/lib/components/tableview/tableview.component.mjs +9 -3
- package/esm2020/lib/data-providers/table.data-provider.mjs +9 -2
- package/esm2020/lib/data-providers/tableview.data-provider.mjs +30 -2
- package/esm2020/lib/descriptors/action.descriptor.mjs +11 -1
- package/esm2020/lib/descriptors/column.descriptor.mjs +121 -29
- package/esm2020/lib/descriptors/editor.descriptor.mjs +109 -7
- package/esm2020/lib/descriptors/field.descriptor.mjs +38 -4
- package/esm2020/lib/descriptors/filter.descriptor.mjs +32 -6
- package/esm2020/lib/descriptors/index.mjs +2 -2
- package/esm2020/lib/descriptors/table.descriptor.mjs +282 -16
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +175 -3
- package/esm2020/lib/descriptors/types/table.type.mjs +10 -1
- package/esm2020/lib/mng-commons.module.mjs +9 -2
- package/esm2020/lib/models/index.mjs +2 -1
- package/esm2020/lib/models/tableview-attr.model.mjs +2 -0
- package/esm2020/lib/pipes/class-map.pipe.mjs +22 -0
- package/esm2020/lib/pipes/index.mjs +2 -1
- package/esm2020/lib/router/models/router.model.mjs +1 -1
- package/esm2020/lib/router/tableview-route-builder.mjs +41 -17
- package/esm2020/lib/services/action-executor.service.mjs +1 -1
- package/esm2020/lib/services/commons.service.mjs +6 -5
- package/esm2020/lib/utils/date.util.mjs +118 -0
- package/esm2020/lib/utils/index.mjs +2 -1
- package/esm2020/lib/utils/tableview.util.mjs +144 -0
- package/fesm2015/mediusinc-mng-commons.mjs +1462 -169
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +1428 -147
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/api/models/filter-param.model.d.ts +2 -2
- package/lib/api/utils/medius-rest.util.d.ts +1 -0
- package/lib/components/action/action.component.d.ts +2 -1
- package/lib/components/action/models/action-execution.model.d.ts +2 -0
- package/lib/components/action/models/index.d.ts +1 -0
- package/lib/components/action/models/tableview-action-default-categories.model.d.ts +10 -0
- package/lib/components/form/date-range/date-range.component.d.ts +28 -0
- package/lib/components/form/index.d.ts +1 -0
- package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +9 -4
- package/lib/components/tableview/route/tableview-route.component.d.ts +0 -5
- package/lib/components/tableview/table/column-filter/column-filter.component.d.ts +13 -7
- package/lib/components/tableview/table/table.component.d.ts +4 -2
- package/lib/components/tableview/tableview.component.d.ts +3 -0
- package/lib/data-providers/table.data-provider.d.ts +6 -1
- package/lib/data-providers/tableview.data-provider.d.ts +16 -2
- package/lib/descriptors/action.descriptor.d.ts +4 -0
- package/lib/descriptors/column.descriptor.d.ts +39 -5
- package/lib/descriptors/editor.descriptor.d.ts +69 -11
- package/lib/descriptors/field.descriptor.d.ts +7 -2
- package/lib/descriptors/filter.descriptor.d.ts +12 -6
- package/lib/descriptors/index.d.ts +1 -1
- package/lib/descriptors/table.descriptor.d.ts +124 -8
- package/lib/descriptors/tableview.descriptor.d.ts +81 -7
- package/lib/descriptors/types/table.type.d.ts +8 -0
- package/lib/mng-commons.module.d.ts +73 -71
- package/lib/models/index.d.ts +1 -0
- package/lib/models/tableview-attr.model.d.ts +9 -0
- package/lib/pipes/class-map.pipe.d.ts +7 -0
- package/lib/pipes/index.d.ts +1 -0
- package/lib/router/models/router.model.d.ts +6 -0
- package/lib/router/tableview-route-builder.d.ts +3 -0
- package/lib/services/commons.service.d.ts +3 -2
- package/lib/utils/date.util.d.ts +7 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/tableview.util.d.ts +39 -0
- package/package.json +1 -1
- package/scss/mng-overrides/_theme_tableview.scss +17 -0
- package/version-info.json +5 -5
|
@@ -3,11 +3,11 @@ import { CommonModule } from '@angular/common';
|
|
|
3
3
|
import * as i1$3 from '@angular/common/http';
|
|
4
4
|
import { HttpErrorResponse, HttpClient, HttpClientModule } from '@angular/common/http';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { InjectionToken, Injectable, Pipe, Inject, EventEmitter, Component, ChangeDetectionStrategy, Optional, HostBinding, Input, Output, Directive, ContentChildren, ViewChild, forwardRef, LOCALE_ID, ViewChildren, HostListener, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
6
|
+
import { InjectionToken, Injectable, Pipe, Inject, EventEmitter, Component, ChangeDetectionStrategy, Optional, HostBinding, Input, Output, Directive, ContentChildren, ViewChild, forwardRef, LOCALE_ID, ViewChildren, inject, HostListener, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
7
7
|
import * as i2$1 from '@angular/forms';
|
|
8
8
|
import { Validators, FormGroup, FormArray, NG_VALUE_ACCESSOR, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
9
9
|
import * as i1 from '@angular/router';
|
|
10
|
-
import { NavigationEnd, GuardsCheckEnd, RouterModule } from '@angular/router';
|
|
10
|
+
import { NavigationEnd, ActivatedRoute, GuardsCheckEnd, RouterModule } from '@angular/router';
|
|
11
11
|
import * as i2$2 from '@ngx-formly/core';
|
|
12
12
|
import { FieldWrapper, FieldType, FORMLY_CONFIG, FormlyModule } from '@ngx-formly/core';
|
|
13
13
|
import * as i1$2 from '@ngx-translate/core';
|
|
@@ -63,7 +63,7 @@ import { SelectButtonModule } from 'primeng/selectbutton';
|
|
|
63
63
|
import * as i7$3 from 'primeng/skeleton';
|
|
64
64
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
65
65
|
import * as i6$4 from 'primeng/table';
|
|
66
|
-
import { Table, TableModule } from 'primeng/table';
|
|
66
|
+
import { ColumnFilter, Table, TableModule } from 'primeng/table';
|
|
67
67
|
import * as i4$4 from 'primeng/tabview';
|
|
68
68
|
import { TabViewModule } from 'primeng/tabview';
|
|
69
69
|
import { TagModule } from 'primeng/tag';
|
|
@@ -74,7 +74,7 @@ import * as i6$2 from 'primeng/toolbar';
|
|
|
74
74
|
import { ToolbarModule } from 'primeng/toolbar';
|
|
75
75
|
import * as i7 from 'primeng/tooltip';
|
|
76
76
|
import { TooltipModule } from 'primeng/tooltip';
|
|
77
|
-
import { isObservable, throwError, of, Subject, BehaviorSubject, ReplaySubject, distinctUntilChanged, combineLatest, tap, switchMap, mergeMap as mergeMap$1, from, Observable } from 'rxjs';
|
|
77
|
+
import { isObservable, throwError, of, Subject, BehaviorSubject, ReplaySubject, distinctUntilChanged, combineLatest, tap, switchMap, mergeMap as mergeMap$1, from, Observable, merge, debounceTime } from 'rxjs';
|
|
78
78
|
import { map, mergeMap, catchError, first, filter, finalize, startWith } from 'rxjs/operators';
|
|
79
79
|
import 'reflect-metadata';
|
|
80
80
|
import * as i4 from '@angular/platform-browser';
|
|
@@ -453,6 +453,124 @@ class ActionDataProviderUtil {
|
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
+
class DateUtil {
|
|
457
|
+
static toIsoString(date, inUtc = false, withTimezone = false, withMillis = false) {
|
|
458
|
+
if (typeof date === 'string') {
|
|
459
|
+
date = new Date(date);
|
|
460
|
+
}
|
|
461
|
+
if (!(date instanceof Date)) {
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
if (inUtc) {
|
|
465
|
+
let str = date.toISOString();
|
|
466
|
+
if (!withMillis) {
|
|
467
|
+
const dotIdx = str.lastIndexOf('.');
|
|
468
|
+
str = str.substring(0, dotIdx) + str.substring(dotIdx + 4, str.length);
|
|
469
|
+
}
|
|
470
|
+
if (!withTimezone) {
|
|
471
|
+
str = str.substring(0, str.length - 1);
|
|
472
|
+
}
|
|
473
|
+
return str;
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
const tzo = -date.getTimezoneOffset(), dif = tzo >= 0 ? '+' : '-', pad = (num) => (num < 10 ? '0' : '') + num;
|
|
477
|
+
let base = date.getFullYear() +
|
|
478
|
+
'-' +
|
|
479
|
+
pad(date.getMonth() + 1) +
|
|
480
|
+
'-' +
|
|
481
|
+
pad(date.getDate()) +
|
|
482
|
+
'T' +
|
|
483
|
+
pad(date.getHours()) +
|
|
484
|
+
':' +
|
|
485
|
+
pad(date.getMinutes()) +
|
|
486
|
+
':' +
|
|
487
|
+
pad(date.getSeconds());
|
|
488
|
+
if (withMillis) {
|
|
489
|
+
base += '.' + pad(date.getMilliseconds());
|
|
490
|
+
}
|
|
491
|
+
if (withTimezone) {
|
|
492
|
+
return base + (dif + pad(Math.floor(Math.abs(tzo) / 60)) + ':' + pad(Math.abs(tzo) % 60));
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
return base;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
static fromPrimeToAngularDateFormat(ngDateFormat) {
|
|
500
|
+
let primeDateFormat = ngDateFormat;
|
|
501
|
+
for (const regex of DateUtil.NG_PRIME_FORMAT_OTHER) {
|
|
502
|
+
primeDateFormat = primeDateFormat.replace(regex, ' ');
|
|
503
|
+
}
|
|
504
|
+
for (const regex of DateUtil.NG_PRIME_FORMAT_SUPPORTED) {
|
|
505
|
+
const matches = [...primeDateFormat.matchAll(regex)].reverse();
|
|
506
|
+
for (const match of matches) {
|
|
507
|
+
if (match.index) {
|
|
508
|
+
const matchStr = match[0];
|
|
509
|
+
const replacement = DateUtil.NG_PRIME_FORMAT_MAP[matchStr] ?? match[0];
|
|
510
|
+
primeDateFormat = primeDateFormat.substring(0, match.index) + replacement + primeDateFormat.substring(match.index + matchStr.length);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
primeDateFormat = primeDateFormat.replace(/\s+\W\s+/g, ' ');
|
|
515
|
+
primeDateFormat = primeDateFormat.replace(/\s\s+/g, ' ');
|
|
516
|
+
return primeDateFormat.trim();
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
DateUtil.NG_PRIME_FORMAT_SUPPORTED = [/d{1,2}/g, /E{1,5}/g, /c{1,5}/g, /M{1,5}/g, /L{1,5}/g, /y{1,4}/g, /Y{1,4}/g];
|
|
520
|
+
DateUtil.NG_PRIME_FORMAT_OTHER = [
|
|
521
|
+
/G{1,5}/g,
|
|
522
|
+
/w{1,2}/g,
|
|
523
|
+
/W/g,
|
|
524
|
+
/a{1,5}/g,
|
|
525
|
+
/B{1,5}/g,
|
|
526
|
+
/b{1,5}/g,
|
|
527
|
+
/h{1,2}/g,
|
|
528
|
+
/H{1,2}/g,
|
|
529
|
+
/m{1,2}/g,
|
|
530
|
+
/s{1,2}/g,
|
|
531
|
+
/S{1,3}/g,
|
|
532
|
+
/z{1,4}/g,
|
|
533
|
+
/Z{1,5}/g,
|
|
534
|
+
/O{1,4}/g
|
|
535
|
+
];
|
|
536
|
+
DateUtil.NG_PRIME_FORMAT_MAP = {
|
|
537
|
+
// days
|
|
538
|
+
d: 'd',
|
|
539
|
+
dd: 'dd',
|
|
540
|
+
E: 'D',
|
|
541
|
+
EE: 'D',
|
|
542
|
+
EEE: 'D',
|
|
543
|
+
EEEE: 'DD',
|
|
544
|
+
EEEEE: 'D',
|
|
545
|
+
EEEEEE: 'D',
|
|
546
|
+
c: 'd',
|
|
547
|
+
cc: 'dd',
|
|
548
|
+
ccc: 'D',
|
|
549
|
+
cccc: 'DD',
|
|
550
|
+
ccccc: 'D',
|
|
551
|
+
cccccc: 'D',
|
|
552
|
+
// months
|
|
553
|
+
M: 'm',
|
|
554
|
+
MM: 'mm',
|
|
555
|
+
MMM: 'M',
|
|
556
|
+
MMMM: 'MM',
|
|
557
|
+
MMMMM: 'M',
|
|
558
|
+
L: 'm',
|
|
559
|
+
LL: 'mm',
|
|
560
|
+
LLL: 'M',
|
|
561
|
+
LLLL: 'MM',
|
|
562
|
+
LLLLL: 'M',
|
|
563
|
+
// year
|
|
564
|
+
y: 'y',
|
|
565
|
+
yy: 'y',
|
|
566
|
+
yyy: 'yy',
|
|
567
|
+
yyyy: 'yy',
|
|
568
|
+
Y: 'y',
|
|
569
|
+
YY: 'y',
|
|
570
|
+
YYY: 'yy',
|
|
571
|
+
YYYY: 'yy'
|
|
572
|
+
};
|
|
573
|
+
|
|
456
574
|
class DataProvider {
|
|
457
575
|
constructor(modelType, serviceType) {
|
|
458
576
|
this._modelType = modelType;
|
|
@@ -523,28 +641,63 @@ class TableDataProvider extends DataProvider {
|
|
|
523
641
|
constructor(modelType, serviceType) {
|
|
524
642
|
super(modelType, serviceType);
|
|
525
643
|
this._getAll = () => of(new MediusQueryResult());
|
|
644
|
+
this._getAllReloadSubject = new Subject();
|
|
526
645
|
}
|
|
527
646
|
get getAll() {
|
|
528
647
|
return this._getAll;
|
|
529
648
|
}
|
|
649
|
+
get getAllReload$() {
|
|
650
|
+
return this._getAllReloadSubject.asObservable();
|
|
651
|
+
}
|
|
530
652
|
withGetAll(getAll) {
|
|
531
653
|
this._getAll = getAll;
|
|
532
654
|
return this;
|
|
533
655
|
}
|
|
656
|
+
getAllReload(queryParam) {
|
|
657
|
+
this._getAllReloadSubject.next(queryParam);
|
|
658
|
+
}
|
|
534
659
|
}
|
|
535
660
|
|
|
536
661
|
class TableviewDataProvider extends EditorDataProvider {
|
|
537
662
|
constructor(modelType, serviceType) {
|
|
538
663
|
super(modelType, serviceType);
|
|
539
664
|
this._getAll = () => of(new MediusQueryResult());
|
|
665
|
+
this._getAllReloadSubject = new Subject();
|
|
540
666
|
}
|
|
541
667
|
get getAll() {
|
|
542
668
|
return this._getAll;
|
|
543
669
|
}
|
|
670
|
+
get getAllReload$() {
|
|
671
|
+
return this._getAllReloadSubject.asObservable();
|
|
672
|
+
}
|
|
544
673
|
withGetAll(getAll) {
|
|
545
674
|
this._getAll = getAll;
|
|
546
675
|
return this;
|
|
547
676
|
}
|
|
677
|
+
getAllReload(queryParam) {
|
|
678
|
+
this._getAllReloadSubject.next(queryParam);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
class DynamicTableviewDataProvider extends TableviewDataProvider {
|
|
682
|
+
constructor() {
|
|
683
|
+
super({});
|
|
684
|
+
this._getAll = () => of(new MediusQueryResult());
|
|
685
|
+
this._fetch = () => of({});
|
|
686
|
+
}
|
|
687
|
+
withGetAll(getAll) {
|
|
688
|
+
this._getAll = getAll;
|
|
689
|
+
return this;
|
|
690
|
+
}
|
|
691
|
+
withFetch(fetch) {
|
|
692
|
+
this._fetch = fetch;
|
|
693
|
+
return this;
|
|
694
|
+
}
|
|
695
|
+
get getAll() {
|
|
696
|
+
return this._getAll;
|
|
697
|
+
}
|
|
698
|
+
get fetch() {
|
|
699
|
+
return this._fetch;
|
|
700
|
+
}
|
|
548
701
|
}
|
|
549
702
|
|
|
550
703
|
class TableviewCrudDataProvider extends TableviewDataProvider {
|
|
@@ -841,6 +994,15 @@ var TableSizeEnum;
|
|
|
841
994
|
TableSizeEnum[TableSizeEnum["Normal"] = 1] = "Normal";
|
|
842
995
|
TableSizeEnum[TableSizeEnum["Large"] = 2] = "Large";
|
|
843
996
|
})(TableSizeEnum || (TableSizeEnum = {}));
|
|
997
|
+
/**
|
|
998
|
+
* EXCLUDE default, all columns has sort and filter on by default, developer EXCLUDES properties from sort/filter
|
|
999
|
+
* INCLUDE_ONLY only selected columns have sort/filter, developers INCLUDES properties
|
|
1000
|
+
*/
|
|
1001
|
+
var TableDynamicColumnsModeEnum;
|
|
1002
|
+
(function (TableDynamicColumnsModeEnum) {
|
|
1003
|
+
TableDynamicColumnsModeEnum[TableDynamicColumnsModeEnum["EXCLUDE"] = 0] = "EXCLUDE";
|
|
1004
|
+
TableDynamicColumnsModeEnum[TableDynamicColumnsModeEnum["INCLUDE_ONLY"] = 1] = "INCLUDE_ONLY";
|
|
1005
|
+
})(TableDynamicColumnsModeEnum || (TableDynamicColumnsModeEnum = {}));
|
|
844
1006
|
|
|
845
1007
|
class StylesUtil {
|
|
846
1008
|
static calculateTableColumnActionWidth(table, actions) {
|
|
@@ -1159,6 +1321,8 @@ class ActionDescriptor {
|
|
|
1159
1321
|
this._hasRunNotificationError = true;
|
|
1160
1322
|
//button
|
|
1161
1323
|
this._buttonDescriptor = new ButtonDescriptor();
|
|
1324
|
+
// multiple row selection
|
|
1325
|
+
this._hasItemsSelection = false;
|
|
1162
1326
|
this._model = model;
|
|
1163
1327
|
this._actionName = actionName;
|
|
1164
1328
|
if ((parentType && !parentProperty) || (!parentProperty && parentProperty)) {
|
|
@@ -1270,6 +1434,9 @@ class ActionDescriptor {
|
|
|
1270
1434
|
get permissionsRouteType() {
|
|
1271
1435
|
return this._permissionsRouteType;
|
|
1272
1436
|
}
|
|
1437
|
+
get hasItemsSelection() {
|
|
1438
|
+
return this._hasItemsSelection;
|
|
1439
|
+
}
|
|
1273
1440
|
get buttonDescriptor() {
|
|
1274
1441
|
return this._buttonDescriptor;
|
|
1275
1442
|
}
|
|
@@ -1357,6 +1524,11 @@ class ActionDescriptor {
|
|
|
1357
1524
|
this._buttonDescriptor = buttonDescriptor;
|
|
1358
1525
|
return this;
|
|
1359
1526
|
}
|
|
1527
|
+
withItemsSelection(hasSelection = true) {
|
|
1528
|
+
this._hasItemsSelection = hasSelection;
|
|
1529
|
+
this._isEnabledFunction = this._isEnabledFunction ?? (ctx => of((ctx.parameters.selectedItems?.length ?? 0) > 0));
|
|
1530
|
+
return this;
|
|
1531
|
+
}
|
|
1360
1532
|
}
|
|
1361
1533
|
class ActionSimpleDescriptor extends ActionDescriptor {
|
|
1362
1534
|
constructor(actionName, modelType, idProperty, titleProperty) {
|
|
@@ -1655,14 +1827,157 @@ class ActionLinkDescriptor extends ActionDescriptor {
|
|
|
1655
1827
|
}
|
|
1656
1828
|
}
|
|
1657
1829
|
|
|
1830
|
+
class TableviewUtil {
|
|
1831
|
+
/**
|
|
1832
|
+
* returns attributes from class type and extends to typed def with column and field enum type
|
|
1833
|
+
* @param modelType class type
|
|
1834
|
+
*/
|
|
1835
|
+
static getAttributeDefMap(modelType) {
|
|
1836
|
+
return TableviewUtil.expandAttributeDefWithTableviewTypes(ObjectSerializer.get().findAttributesDefinitionByClassType(modelType));
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* expands AttributeDef to TableviewAttributeDef with defined input and column enum type
|
|
1840
|
+
* @param attributes open api specification model
|
|
1841
|
+
*/
|
|
1842
|
+
static expandAttributeDefWithTableviewTypes(attributes) {
|
|
1843
|
+
if (attributes == null) {
|
|
1844
|
+
throw new Error('AttributeDef is null, problem with ObjectSerializer::findAttributesDefinitionByClassType?');
|
|
1845
|
+
}
|
|
1846
|
+
const objectSerializer = ObjectSerializer.get();
|
|
1847
|
+
const tableviewAttributeDef = [];
|
|
1848
|
+
for (const attribute of attributes) {
|
|
1849
|
+
const enumType = objectSerializer.findEnum(attribute.type);
|
|
1850
|
+
tableviewAttributeDef.push({
|
|
1851
|
+
name: attribute.name,
|
|
1852
|
+
baseName: attribute.baseName,
|
|
1853
|
+
type: attribute.type,
|
|
1854
|
+
columnType: enumType ? ColumnTypeEnum.Enum : TableviewUtil.toColumnType(attribute.type),
|
|
1855
|
+
fieldType: TableviewUtil.toFieldInputType(attribute.type),
|
|
1856
|
+
enumType: objectSerializer.findEnum(attribute.type),
|
|
1857
|
+
classType: objectSerializer.findType(attribute.type)
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
return tableviewAttributeDef;
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* converts column to number or date on value based
|
|
1864
|
+
* @param column column to be transformed
|
|
1865
|
+
* @param value value to check if applicable
|
|
1866
|
+
*/
|
|
1867
|
+
static stringColumnConverter(column, value) {
|
|
1868
|
+
if (typeof value === 'boolean') {
|
|
1869
|
+
return column.asBoolean();
|
|
1870
|
+
}
|
|
1871
|
+
else if (!isNaN(value) && typeof value === 'number') {
|
|
1872
|
+
return column.asNumber();
|
|
1873
|
+
}
|
|
1874
|
+
else if (this._dateRegex.test(value)) {
|
|
1875
|
+
return column.asDate();
|
|
1876
|
+
}
|
|
1877
|
+
else {
|
|
1878
|
+
return column;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* converts string type to column type enum, default is string
|
|
1883
|
+
* @param property
|
|
1884
|
+
*/
|
|
1885
|
+
static toColumnType(property) {
|
|
1886
|
+
const os = ObjectSerializer.get();
|
|
1887
|
+
if (os.findEnum(property)) {
|
|
1888
|
+
property = 'enum';
|
|
1889
|
+
}
|
|
1890
|
+
else if (os.findType(property)) {
|
|
1891
|
+
property = 'class';
|
|
1892
|
+
}
|
|
1893
|
+
switch (property) {
|
|
1894
|
+
case 'number':
|
|
1895
|
+
return ColumnTypeEnum.Number;
|
|
1896
|
+
case 'currency':
|
|
1897
|
+
return ColumnTypeEnum.Currency;
|
|
1898
|
+
case 'boolean':
|
|
1899
|
+
return ColumnTypeEnum.Boolean;
|
|
1900
|
+
case 'date':
|
|
1901
|
+
return ColumnTypeEnum.Date;
|
|
1902
|
+
case 'enum':
|
|
1903
|
+
return ColumnTypeEnum.Enum;
|
|
1904
|
+
case 'custom':
|
|
1905
|
+
return ColumnTypeEnum.Custom;
|
|
1906
|
+
case 'class':
|
|
1907
|
+
return ColumnTypeEnum.String;
|
|
1908
|
+
case 'string':
|
|
1909
|
+
default:
|
|
1910
|
+
return ColumnTypeEnum.String;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* converts string type to type enum, default is text
|
|
1915
|
+
* @param property
|
|
1916
|
+
*/
|
|
1917
|
+
static toFieldInputType(property) {
|
|
1918
|
+
switch (property) {
|
|
1919
|
+
case 'hidden':
|
|
1920
|
+
return FieldInputTypeEnum.Hidden;
|
|
1921
|
+
case 'label':
|
|
1922
|
+
return FieldInputTypeEnum.Label;
|
|
1923
|
+
case 'textarea':
|
|
1924
|
+
return FieldInputTypeEnum.Textarea;
|
|
1925
|
+
case 'number':
|
|
1926
|
+
return FieldInputTypeEnum.Number;
|
|
1927
|
+
case 'currency':
|
|
1928
|
+
return FieldInputTypeEnum.Currency;
|
|
1929
|
+
case 'switch':
|
|
1930
|
+
case 'boolean':
|
|
1931
|
+
return FieldInputTypeEnum.Switch;
|
|
1932
|
+
case 'radio':
|
|
1933
|
+
return FieldInputTypeEnum.Radio;
|
|
1934
|
+
case 'datepicker':
|
|
1935
|
+
return FieldInputTypeEnum.Datepicker;
|
|
1936
|
+
case 'mask':
|
|
1937
|
+
return FieldInputTypeEnum.Mask;
|
|
1938
|
+
case 'file':
|
|
1939
|
+
return FieldInputTypeEnum.File;
|
|
1940
|
+
case 'custom':
|
|
1941
|
+
return FieldInputTypeEnum.Custom;
|
|
1942
|
+
case 'text':
|
|
1943
|
+
default:
|
|
1944
|
+
return FieldInputTypeEnum.Text;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* convert column type to equivalent field input type
|
|
1949
|
+
* @param type column type
|
|
1950
|
+
*/
|
|
1951
|
+
static toFieldInputTypeFromColumnType(type) {
|
|
1952
|
+
switch (type) {
|
|
1953
|
+
case ColumnTypeEnum.Number:
|
|
1954
|
+
return FieldInputTypeEnum.Number;
|
|
1955
|
+
case ColumnTypeEnum.Currency:
|
|
1956
|
+
return FieldInputTypeEnum.Currency;
|
|
1957
|
+
case ColumnTypeEnum.Boolean:
|
|
1958
|
+
return FieldInputTypeEnum.Switch;
|
|
1959
|
+
case ColumnTypeEnum.Date:
|
|
1960
|
+
return FieldInputTypeEnum.Datepicker;
|
|
1961
|
+
case ColumnTypeEnum.Custom:
|
|
1962
|
+
return FieldInputTypeEnum.Custom;
|
|
1963
|
+
case ColumnTypeEnum.String:
|
|
1964
|
+
case ColumnTypeEnum.Enum:
|
|
1965
|
+
default:
|
|
1966
|
+
return FieldInputTypeEnum.Text;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
TableviewUtil._dateRegex = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
|
|
1971
|
+
|
|
1658
1972
|
class FilterDescriptor {
|
|
1659
1973
|
constructor(property) {
|
|
1660
1974
|
this._filterType = FilterTypeEnum.String;
|
|
1661
1975
|
this._hasDefaultValue = false;
|
|
1662
|
-
this._defaultFilterMatchMode = FilterMatchModeEnum.Equals;
|
|
1663
1976
|
this._matchModes = null;
|
|
1664
1977
|
this._numberUseGrouping = true;
|
|
1665
1978
|
this._datePickerShowTime = false;
|
|
1979
|
+
this._datePickerValueWithTimezone = false;
|
|
1980
|
+
this._datePickerValueInUtc = false;
|
|
1666
1981
|
this._className = '';
|
|
1667
1982
|
this._columnClassName = '';
|
|
1668
1983
|
this._columnWidth = null;
|
|
@@ -1705,6 +2020,12 @@ class FilterDescriptor {
|
|
|
1705
2020
|
get datePickerShowTime() {
|
|
1706
2021
|
return this._datePickerShowTime;
|
|
1707
2022
|
}
|
|
2023
|
+
get datePickerValueInUtc() {
|
|
2024
|
+
return this._datePickerValueInUtc;
|
|
2025
|
+
}
|
|
2026
|
+
get datePickerValueWithTimezone() {
|
|
2027
|
+
return this._datePickerValueWithTimezone;
|
|
2028
|
+
}
|
|
1708
2029
|
get placeholder() {
|
|
1709
2030
|
return this._placeholder;
|
|
1710
2031
|
}
|
|
@@ -1735,13 +2056,11 @@ class FilterDescriptor {
|
|
|
1735
2056
|
this._filterProperty = filterProperty;
|
|
1736
2057
|
return this;
|
|
1737
2058
|
}
|
|
1738
|
-
withDefaultFilter(filterValue, filterValueTo, filterMatchMode
|
|
2059
|
+
withDefaultFilter(filterValue, filterValueTo, filterMatchMode) {
|
|
1739
2060
|
this._hasDefaultValue = true;
|
|
1740
2061
|
this._defaultValue = filterValue;
|
|
1741
2062
|
this._defaultValueTo = filterValueTo;
|
|
1742
|
-
|
|
1743
|
-
this._defaultFilterMatchMode = filterMatchMode;
|
|
1744
|
-
}
|
|
2063
|
+
this._defaultFilterMatchMode = filterMatchMode;
|
|
1745
2064
|
return this;
|
|
1746
2065
|
}
|
|
1747
2066
|
withNumberFractions(min, max) {
|
|
@@ -1758,6 +2077,15 @@ class FilterDescriptor {
|
|
|
1758
2077
|
this._datePickerShowTime = showTime;
|
|
1759
2078
|
return this;
|
|
1760
2079
|
}
|
|
2080
|
+
withDateValue(inUtc, withTimezone) {
|
|
2081
|
+
if (typeof inUtc !== 'undefined') {
|
|
2082
|
+
this._datePickerValueInUtc = inUtc;
|
|
2083
|
+
}
|
|
2084
|
+
if (typeof withTimezone !== 'undefined') {
|
|
2085
|
+
this._datePickerValueWithTimezone = withTimezone;
|
|
2086
|
+
}
|
|
2087
|
+
return this;
|
|
2088
|
+
}
|
|
1761
2089
|
withPlaceholder(placeholder) {
|
|
1762
2090
|
this._placeholder = placeholder;
|
|
1763
2091
|
return this;
|
|
@@ -1796,6 +2124,8 @@ class FilterDescriptor {
|
|
|
1796
2124
|
descriptor._numberUseGrouping = this._numberUseGrouping;
|
|
1797
2125
|
descriptor._datePickerFormat = this._datePickerFormat;
|
|
1798
2126
|
descriptor._datePickerShowTime = this._datePickerShowTime;
|
|
2127
|
+
descriptor._datePickerValueInUtc = this._datePickerValueInUtc;
|
|
2128
|
+
descriptor._datePickerValueWithTimezone = this._datePickerValueWithTimezone;
|
|
1799
2129
|
descriptor._placeholder = this._placeholder;
|
|
1800
2130
|
descriptor._className = this._className;
|
|
1801
2131
|
descriptor._columnWidth = this._columnWidth;
|
|
@@ -1888,6 +2218,16 @@ class FilterLookupDescriptor extends FilterDescriptor {
|
|
|
1888
2218
|
this._dropdownClassName = dropdownClassName;
|
|
1889
2219
|
return this;
|
|
1890
2220
|
}
|
|
2221
|
+
withDefaultFilter(filterValue, filterValueTo, filterMatchMode) {
|
|
2222
|
+
this._hasDefaultValue = true;
|
|
2223
|
+
this._defaultValue = filterValue;
|
|
2224
|
+
this._defaultValueTo = filterValueTo;
|
|
2225
|
+
this._defaultFilterMatchMode = filterMatchMode;
|
|
2226
|
+
if (Array.isArray(filterValue) && !this.multiselect) {
|
|
2227
|
+
throw new Error('Array default filter can only be used with a multiselect filter.');
|
|
2228
|
+
}
|
|
2229
|
+
return this;
|
|
2230
|
+
}
|
|
1891
2231
|
asAutocomplete(openOnFocus = false, inlineSearch = false) {
|
|
1892
2232
|
this._lookupType = FilterLookupTypeEnum.Autocomplete;
|
|
1893
2233
|
this._autocompleteOpenOnFocus = openOnFocus;
|
|
@@ -2047,9 +2387,29 @@ class ColumnDescriptor {
|
|
|
2047
2387
|
get getter() {
|
|
2048
2388
|
return this._getter;
|
|
2049
2389
|
}
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2390
|
+
/**
|
|
2391
|
+
* converts column to given type with additional arguments
|
|
2392
|
+
* @param type column type enum
|
|
2393
|
+
* @param args any additional arguments for column (optional)
|
|
2394
|
+
*/
|
|
2395
|
+
asType(type, ...args) {
|
|
2396
|
+
switch (type) {
|
|
2397
|
+
case ColumnTypeEnum.Number:
|
|
2398
|
+
return this.asNumber(...args);
|
|
2399
|
+
case ColumnTypeEnum.Currency:
|
|
2400
|
+
return this.asCurrency(...args);
|
|
2401
|
+
case ColumnTypeEnum.Boolean:
|
|
2402
|
+
return this.asBoolean(...args);
|
|
2403
|
+
case ColumnTypeEnum.Date:
|
|
2404
|
+
return this.asDate(...args);
|
|
2405
|
+
case ColumnTypeEnum.Enum:
|
|
2406
|
+
return this.asEnum(args[0], args[1], args[2]);
|
|
2407
|
+
case ColumnTypeEnum.Custom:
|
|
2408
|
+
return this.asCustomComponent(args[0]);
|
|
2409
|
+
case ColumnTypeEnum.String:
|
|
2410
|
+
default:
|
|
2411
|
+
return this;
|
|
2412
|
+
}
|
|
2053
2413
|
}
|
|
2054
2414
|
asNumber(displayFormat = '1.0-0', locale) {
|
|
2055
2415
|
this._columnType = ColumnTypeEnum.Number;
|
|
@@ -2130,6 +2490,7 @@ class ColumnDescriptor {
|
|
|
2130
2490
|
}
|
|
2131
2491
|
switch (this._columnType) {
|
|
2132
2492
|
case ColumnTypeEnum.Number:
|
|
2493
|
+
case ColumnTypeEnum.Currency:
|
|
2133
2494
|
filterType = FilterTypeEnum.Number;
|
|
2134
2495
|
break;
|
|
2135
2496
|
case ColumnTypeEnum.Boolean:
|
|
@@ -2153,6 +2514,19 @@ class ColumnDescriptor {
|
|
|
2153
2514
|
break;
|
|
2154
2515
|
}
|
|
2155
2516
|
this._filterDescriptor.asFilterType(filterType);
|
|
2517
|
+
if (filterType === FilterTypeEnum.Number) {
|
|
2518
|
+
const displayFormatFractions = this._displayFormat?.split('.')?.[1]?.split('-');
|
|
2519
|
+
if (displayFormatFractions && displayFormatFractions.length > 2) {
|
|
2520
|
+
this._filterDescriptor.withNumberFractions(parseInt(displayFormatFractions[0]), parseInt(displayFormatFractions[1]));
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
else if (filterType === FilterTypeEnum.Date) {
|
|
2524
|
+
const displayFormat = this._displayFormat;
|
|
2525
|
+
if (displayFormat) {
|
|
2526
|
+
const filterDisplayFormat = DateUtil.fromPrimeToAngularDateFormat(displayFormat);
|
|
2527
|
+
this._filterDescriptor.withDateFormat(filterDisplayFormat);
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2156
2530
|
return this._filterDescriptor;
|
|
2157
2531
|
}
|
|
2158
2532
|
withFilterLookup() {
|
|
@@ -2190,32 +2564,88 @@ class ColumnDescriptor {
|
|
|
2190
2564
|
}
|
|
2191
2565
|
copy() {
|
|
2192
2566
|
const descriptor = new ColumnDescriptor(this._table, this._property);
|
|
2193
|
-
|
|
2567
|
+
this.copyFieldsTo(descriptor);
|
|
2568
|
+
return descriptor;
|
|
2569
|
+
}
|
|
2570
|
+
copyFieldsTo(obj) {
|
|
2571
|
+
obj._jsonPath = this._jsonPath;
|
|
2572
|
+
obj._title = this._title;
|
|
2573
|
+
obj._isSortEnabled = this._isSortEnabled;
|
|
2574
|
+
obj._columnType = this._columnType;
|
|
2575
|
+
obj._filterDescriptor = this._filterDescriptor?.copy();
|
|
2576
|
+
obj._enumType = this._enumType;
|
|
2577
|
+
obj._enumTitlePath = this._enumTitlePath;
|
|
2578
|
+
obj._enumNameAsValue = this._enumNameAsValue;
|
|
2579
|
+
obj._booleanAsIcon = this._booleanAsIcon;
|
|
2580
|
+
obj._booleanYes = this._booleanYes;
|
|
2581
|
+
obj._booleanNo = this._booleanNo;
|
|
2582
|
+
obj._objectModelType = this._objectModelType;
|
|
2583
|
+
obj._objectTitleProperty = this._objectTitleProperty;
|
|
2584
|
+
obj._locale = this._locale;
|
|
2585
|
+
obj._currencyCode = this._currencyCode;
|
|
2586
|
+
obj._currencyDisplay = this._currencyDisplay;
|
|
2587
|
+
obj._currencyFromProperty = this._currencyFromProperty;
|
|
2588
|
+
obj._displayFormat = this._displayFormat;
|
|
2589
|
+
obj._headerClassName = this._headerClassName;
|
|
2590
|
+
obj._className = this._className;
|
|
2591
|
+
obj._width = this._width;
|
|
2592
|
+
obj._minWidth = this._minWidth;
|
|
2593
|
+
obj._maxWidth = this._maxWidth;
|
|
2594
|
+
obj._hasCopyToClipboard = this._hasCopyToClipboard;
|
|
2595
|
+
obj._template = this._template;
|
|
2596
|
+
obj._getter = this._getter;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
class ColumnDynamicDescriptor extends ColumnDescriptor {
|
|
2600
|
+
// private _filterStatus;
|
|
2601
|
+
constructor(table, property) {
|
|
2602
|
+
super(table, property);
|
|
2603
|
+
this._visibility = true;
|
|
2604
|
+
this._table = table;
|
|
2605
|
+
}
|
|
2606
|
+
get visibility() {
|
|
2607
|
+
return this._visibility;
|
|
2608
|
+
}
|
|
2609
|
+
/**
|
|
2610
|
+
* sets column's title and returns this column
|
|
2611
|
+
* @param title title to be set
|
|
2612
|
+
* @param override should column title if all ready set?
|
|
2613
|
+
*/
|
|
2614
|
+
withTitle(title, override = false) {
|
|
2615
|
+
if (this._title == null || override) {
|
|
2616
|
+
this._title = title;
|
|
2617
|
+
}
|
|
2618
|
+
return this;
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* defines automatic type and returns this column
|
|
2622
|
+
* @param value
|
|
2623
|
+
*/
|
|
2624
|
+
withAutomaticType(value) {
|
|
2625
|
+
TableviewUtil.stringColumnConverter(this, value);
|
|
2626
|
+
return this;
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* sets visibility state for column and returns this column
|
|
2630
|
+
* @param visibility
|
|
2631
|
+
*/
|
|
2632
|
+
withVisibility(visibility) {
|
|
2633
|
+
this._visibility = visibility;
|
|
2634
|
+
return this;
|
|
2635
|
+
}
|
|
2636
|
+
/**
|
|
2637
|
+
* creates deep copy of column dynamic descriptor
|
|
2638
|
+
*/
|
|
2639
|
+
copy() {
|
|
2640
|
+
const descriptor = new ColumnDynamicDescriptor(this._table, this._property);
|
|
2641
|
+
this.copyFieldsTo(descriptor);
|
|
2194
2642
|
descriptor._title = this._title;
|
|
2195
|
-
descriptor.
|
|
2196
|
-
descriptor
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
descriptor
|
|
2200
|
-
|
|
2201
|
-
descriptor._booleanAsIcon = this._booleanAsIcon;
|
|
2202
|
-
descriptor._booleanYes = this._booleanYes;
|
|
2203
|
-
descriptor._booleanNo = this._booleanNo;
|
|
2204
|
-
descriptor._objectModelType = this._objectModelType;
|
|
2205
|
-
descriptor._objectTitleProperty = this._objectTitleProperty;
|
|
2206
|
-
descriptor._locale = this._locale;
|
|
2207
|
-
descriptor._currencyCode = this._currencyCode;
|
|
2208
|
-
descriptor._currencyDisplay = this._currencyDisplay;
|
|
2209
|
-
descriptor._currencyFromProperty = this._currencyFromProperty;
|
|
2210
|
-
descriptor._displayFormat = this._displayFormat;
|
|
2211
|
-
descriptor._headerClassName = this._headerClassName;
|
|
2212
|
-
descriptor._className = this._className;
|
|
2213
|
-
descriptor._width = this._width;
|
|
2214
|
-
descriptor._minWidth = this._minWidth;
|
|
2215
|
-
descriptor._maxWidth = this._maxWidth;
|
|
2216
|
-
descriptor._hasCopyToClipboard = this._hasCopyToClipboard;
|
|
2217
|
-
descriptor._template = this._template;
|
|
2218
|
-
descriptor._getter = this._getter;
|
|
2643
|
+
descriptor._visibility = this._visibility;
|
|
2644
|
+
return descriptor;
|
|
2645
|
+
}
|
|
2646
|
+
toColumnDescriptor(tableDescriptor) {
|
|
2647
|
+
const descriptor = new ColumnDescriptor(tableDescriptor, this._property);
|
|
2648
|
+
this.copyFieldsTo(descriptor);
|
|
2219
2649
|
return descriptor;
|
|
2220
2650
|
}
|
|
2221
2651
|
}
|
|
@@ -2226,9 +2656,37 @@ class EditorDescriptor {
|
|
|
2226
2656
|
this._groups = [];
|
|
2227
2657
|
this._fields = [];
|
|
2228
2658
|
this._disabled = false;
|
|
2659
|
+
this._modelType = modelType;
|
|
2229
2660
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
2230
2661
|
this._tableviewEditorType = tableviewEditorType;
|
|
2231
2662
|
}
|
|
2663
|
+
/**
|
|
2664
|
+
* auto generated editor descriptor based on openapi definition
|
|
2665
|
+
* generates all fields from definition
|
|
2666
|
+
* @param modelType class type
|
|
2667
|
+
* @param idProperty
|
|
2668
|
+
* @param titleProperty
|
|
2669
|
+
* @param tableEditorType
|
|
2670
|
+
*/
|
|
2671
|
+
static from(modelType, idProperty, titleProperty, tableEditorType = TableviewTypeEnum.None) {
|
|
2672
|
+
return EditorDescriptor.fromModelWithAttributes(modelType, TableviewUtil.getAttributeDefMap(modelType), titleProperty, idProperty, tableEditorType);
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2675
|
+
* auto generated editor descriptor based on openapi definition
|
|
2676
|
+
* generates only selected fields
|
|
2677
|
+
* @param modelType class type
|
|
2678
|
+
* @param attributes list of selected properties to generate fields based on
|
|
2679
|
+
* @param idProperty
|
|
2680
|
+
* @param titleProperty
|
|
2681
|
+
* @param tableEditorType
|
|
2682
|
+
*/
|
|
2683
|
+
static fromModelWithAttributes(modelType, attributes, idProperty, titleProperty, tableEditorType = TableviewTypeEnum.None) {
|
|
2684
|
+
const descriptor = new EditorDescriptor(modelType, idProperty, titleProperty, tableEditorType);
|
|
2685
|
+
attributes
|
|
2686
|
+
.filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array'))
|
|
2687
|
+
.forEach(attr => descriptor.upsertFieldFromAttributeDef(attr, descriptor.fields.find(col => col.property === attr.name)));
|
|
2688
|
+
return descriptor;
|
|
2689
|
+
}
|
|
2232
2690
|
get model() {
|
|
2233
2691
|
return this._model;
|
|
2234
2692
|
}
|
|
@@ -2275,20 +2733,23 @@ class EditorDescriptor {
|
|
|
2275
2733
|
this.addFieldDescriptor(field);
|
|
2276
2734
|
return field;
|
|
2277
2735
|
}
|
|
2736
|
+
/**
|
|
2737
|
+
* removes filed if exists in descriptor
|
|
2738
|
+
* @param property field name
|
|
2739
|
+
*/
|
|
2278
2740
|
removeField(property) {
|
|
2279
2741
|
const fieldIdx = this._fields.findIndex(f => f.property === property);
|
|
2280
2742
|
if (fieldIdx < 0) {
|
|
2281
2743
|
throw new Error(`Field ${property} does not exist.`);
|
|
2282
2744
|
}
|
|
2283
|
-
const
|
|
2284
|
-
|
|
2285
|
-
const groupFieldIdx = field.group.fields.findIndex(f => f instanceof AFieldDescriptor && f.property === property);
|
|
2745
|
+
for (const group of this._groups) {
|
|
2746
|
+
const groupFieldIdx = group.fields.findIndex(f => f instanceof AFieldDescriptor && f.property === property);
|
|
2286
2747
|
if (groupFieldIdx >= 0) {
|
|
2287
|
-
|
|
2748
|
+
group.fields.splice(groupFieldIdx, 1);
|
|
2749
|
+
break;
|
|
2288
2750
|
}
|
|
2289
2751
|
}
|
|
2290
2752
|
this._fields.splice(fieldIdx, 1);
|
|
2291
|
-
return this;
|
|
2292
2753
|
}
|
|
2293
2754
|
getField(property) {
|
|
2294
2755
|
return this._fields.find(f => f.property === property) ?? null;
|
|
@@ -2361,6 +2822,75 @@ class EditorDescriptor {
|
|
|
2361
2822
|
this.createTabGroup(EditorDescriptor.defaultGroupName, 'general.general');
|
|
2362
2823
|
}
|
|
2363
2824
|
}
|
|
2825
|
+
/**
|
|
2826
|
+
* modifies selected field
|
|
2827
|
+
* do not use it for enums! (use withFieldModifiedEnum instead)
|
|
2828
|
+
* @param property field name
|
|
2829
|
+
* @param fieldType new field type for selected field
|
|
2830
|
+
* @param args additional parameters for field
|
|
2831
|
+
*/
|
|
2832
|
+
withFieldModifiedType(property, fieldType, ...args) {
|
|
2833
|
+
const attribute = TableviewUtil.getAttributeDefMap(this._modelType).find(attribute => attribute.name === property);
|
|
2834
|
+
if (attribute) {
|
|
2835
|
+
attribute.fieldType = fieldType;
|
|
2836
|
+
this.upsertFieldFromAttributeDef(attribute, this.fields.find(fi => fi.property === property), ...args);
|
|
2837
|
+
}
|
|
2838
|
+
return this;
|
|
2839
|
+
}
|
|
2840
|
+
/**
|
|
2841
|
+
* modifies selected field with enum type
|
|
2842
|
+
* @param property field property name
|
|
2843
|
+
* @param enumType type of enum for new field
|
|
2844
|
+
* @param optionsTitlePath
|
|
2845
|
+
* @param values
|
|
2846
|
+
* @param nameAsValue
|
|
2847
|
+
*/
|
|
2848
|
+
withFieldModifiedEnum(property, enumType, optionsTitlePath, values, nameAsValue = false) {
|
|
2849
|
+
const attribute = TableviewUtil.getAttributeDefMap(this._modelType).find(a => a.name === property);
|
|
2850
|
+
if (attribute) {
|
|
2851
|
+
attribute.fieldType = FieldInputTypeEnum.Radio;
|
|
2852
|
+
const field = this.fields.find(f => f.property === property);
|
|
2853
|
+
if (field && field instanceof FieldInputDescriptor) {
|
|
2854
|
+
field.asRadioFromEnum(enumType ?? ObjectSerializer.get().findEnum(attribute.type), optionsTitlePath, values, nameAsValue);
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
return this;
|
|
2858
|
+
}
|
|
2859
|
+
/**
|
|
2860
|
+
* adds lookup to given field
|
|
2861
|
+
* @param property field property name
|
|
2862
|
+
* @param modelType model type of field
|
|
2863
|
+
* @param lookupProvider provider to be added to field
|
|
2864
|
+
* @param titleProperty
|
|
2865
|
+
*/
|
|
2866
|
+
withFieldModifiedLookup(property, modelType, lookupProvider, titleProperty) {
|
|
2867
|
+
this.removeField(property);
|
|
2868
|
+
const field = this.addFieldLookup(property, modelType).asAutocomplete().withLookupDataProvider(lookupProvider);
|
|
2869
|
+
if (titleProperty) {
|
|
2870
|
+
field.withItemsLabelProperty(titleProperty);
|
|
2871
|
+
}
|
|
2872
|
+
return this;
|
|
2873
|
+
}
|
|
2874
|
+
/**
|
|
2875
|
+
* generates field based on attribute definition, used for auto model
|
|
2876
|
+
* @param attribute definition
|
|
2877
|
+
* @param field optional, if defined will be replaced, otherwise new will be generated
|
|
2878
|
+
* @param args additional arguments
|
|
2879
|
+
*/
|
|
2880
|
+
upsertFieldFromAttributeDef(attribute, field, ...args) {
|
|
2881
|
+
if (field == null) {
|
|
2882
|
+
field = this.addField(attribute.name);
|
|
2883
|
+
}
|
|
2884
|
+
if (field instanceof FieldInputDescriptor) {
|
|
2885
|
+
if (attribute.enumType) {
|
|
2886
|
+
return field.asRadioFromEnum(attribute.enumType);
|
|
2887
|
+
}
|
|
2888
|
+
else {
|
|
2889
|
+
return field.asType(attribute.fieldType ?? TableviewUtil.toFieldInputTypeFromColumnType(attribute.columnType), ...args);
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
return field;
|
|
2893
|
+
}
|
|
2364
2894
|
}
|
|
2365
2895
|
EditorDescriptor.defaultGroupName = '_default';
|
|
2366
2896
|
|
|
@@ -2433,9 +2963,6 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
|
|
|
2433
2963
|
get property() {
|
|
2434
2964
|
return this._property;
|
|
2435
2965
|
}
|
|
2436
|
-
get group() {
|
|
2437
|
-
return this._group;
|
|
2438
|
-
}
|
|
2439
2966
|
get label() {
|
|
2440
2967
|
return this._label;
|
|
2441
2968
|
}
|
|
@@ -2599,6 +3126,39 @@ class FieldInputDescriptor extends AFieldDescriptor {
|
|
|
2599
3126
|
this._fileMultiple = false;
|
|
2600
3127
|
this._fileMaxFileSize = 500000;
|
|
2601
3128
|
}
|
|
3129
|
+
/**
|
|
3130
|
+
* converts field to given type with additional arguments
|
|
3131
|
+
* @param fieldType field type enum
|
|
3132
|
+
* @param args any additional arguments for field (optional)
|
|
3133
|
+
*/
|
|
3134
|
+
asType(fieldType, ...args) {
|
|
3135
|
+
switch (fieldType) {
|
|
3136
|
+
case FieldInputTypeEnum.Hidden:
|
|
3137
|
+
return this.asHidden();
|
|
3138
|
+
case FieldInputTypeEnum.Label:
|
|
3139
|
+
return this.asLabel();
|
|
3140
|
+
case FieldInputTypeEnum.Textarea:
|
|
3141
|
+
return this.asTextarea(...args);
|
|
3142
|
+
case FieldInputTypeEnum.Number:
|
|
3143
|
+
return this.asNumber();
|
|
3144
|
+
case FieldInputTypeEnum.Currency:
|
|
3145
|
+
return this.asCurrency(...args);
|
|
3146
|
+
case FieldInputTypeEnum.Switch:
|
|
3147
|
+
return this.asSwitch();
|
|
3148
|
+
case FieldInputTypeEnum.Radio:
|
|
3149
|
+
return this.asRadio(args[0], args[1]);
|
|
3150
|
+
case FieldInputTypeEnum.Datepicker:
|
|
3151
|
+
return this.asDatePicker(...args);
|
|
3152
|
+
case FieldInputTypeEnum.Mask:
|
|
3153
|
+
return this.asMask(args[0], args[1]);
|
|
3154
|
+
case FieldInputTypeEnum.File:
|
|
3155
|
+
return this.asFile(...args);
|
|
3156
|
+
case FieldInputTypeEnum.Custom:
|
|
3157
|
+
return this.asCustomComponent(args[0]);
|
|
3158
|
+
case FieldInputTypeEnum.Text:
|
|
3159
|
+
return this.asText();
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
2602
3162
|
get fieldType() {
|
|
2603
3163
|
return this._fieldType;
|
|
2604
3164
|
}
|
|
@@ -3132,6 +3692,10 @@ class AFieldGroupDescriptor extends AGenericFieldDescriptor {
|
|
|
3132
3692
|
this._name = `${this.baseName}${name}`;
|
|
3133
3693
|
this._default = name === EditorDescriptor.defaultGroupName;
|
|
3134
3694
|
}
|
|
3695
|
+
removeField(property, filterFunction) {
|
|
3696
|
+
this._fields = filterFunction(this._fields);
|
|
3697
|
+
return this._fields;
|
|
3698
|
+
}
|
|
3135
3699
|
get title() {
|
|
3136
3700
|
return this._title;
|
|
3137
3701
|
}
|
|
@@ -3281,9 +3845,33 @@ class TableDescriptor {
|
|
|
3281
3845
|
this._size = TableSizeEnum.Large;
|
|
3282
3846
|
this._hasHover = true;
|
|
3283
3847
|
this._hasGridlines = false;
|
|
3848
|
+
this._autoGenerated = false;
|
|
3849
|
+
this._modelType = modelType;
|
|
3284
3850
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
3285
3851
|
this._dataKeyProperty = idProperty ?? ModelUtil.findIdAttribute(modelType) ?? undefined;
|
|
3286
3852
|
}
|
|
3853
|
+
/**
|
|
3854
|
+
* generates descriptor based on modelType attribute definition
|
|
3855
|
+
* @param modelType class type
|
|
3856
|
+
* @param idProperty
|
|
3857
|
+
* @param titleProperty
|
|
3858
|
+
*/
|
|
3859
|
+
static from(modelType, idProperty, titleProperty) {
|
|
3860
|
+
return TableDescriptor.fromModelWithAttributes(modelType, TableviewUtil.getAttributeDefMap(modelType), idProperty, titleProperty);
|
|
3861
|
+
}
|
|
3862
|
+
/**
|
|
3863
|
+
* generates descriptor base on given attribute definition
|
|
3864
|
+
* @param modelType class type
|
|
3865
|
+
* @param attributes attributes from which descriptor is generated
|
|
3866
|
+
* @param idProperty
|
|
3867
|
+
* @param titleProperty
|
|
3868
|
+
*/
|
|
3869
|
+
static fromModelWithAttributes(modelType, attributes, idProperty, titleProperty) {
|
|
3870
|
+
const descriptor = new TableDescriptor(modelType, idProperty, titleProperty);
|
|
3871
|
+
descriptor._autoGenerated = true;
|
|
3872
|
+
attributes.filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array')).forEach(attr => descriptor.upsertColumnFromAttributeDef(attr));
|
|
3873
|
+
return descriptor;
|
|
3874
|
+
}
|
|
3287
3875
|
get filterDisplay() {
|
|
3288
3876
|
return this._filterDisplay;
|
|
3289
3877
|
}
|
|
@@ -3338,6 +3926,18 @@ class TableDescriptor {
|
|
|
3338
3926
|
get hasGridlines() {
|
|
3339
3927
|
return this._hasGridlines;
|
|
3340
3928
|
}
|
|
3929
|
+
get rowClassName() {
|
|
3930
|
+
return this._rowClassName;
|
|
3931
|
+
}
|
|
3932
|
+
get rowClassNameMapFn() {
|
|
3933
|
+
return this._rowClassNameMapFn;
|
|
3934
|
+
}
|
|
3935
|
+
get headerClassName() {
|
|
3936
|
+
return this._headerClassName;
|
|
3937
|
+
}
|
|
3938
|
+
getColumn(property) {
|
|
3939
|
+
return this._columns.find(col => col.property === property);
|
|
3940
|
+
}
|
|
3341
3941
|
addColumnDescriptor(column) {
|
|
3342
3942
|
this._columns.push(column);
|
|
3343
3943
|
return this;
|
|
@@ -3377,6 +3977,10 @@ class TableDescriptor {
|
|
|
3377
3977
|
this._columns.push(column);
|
|
3378
3978
|
return column;
|
|
3379
3979
|
}
|
|
3980
|
+
removeColumn(property) {
|
|
3981
|
+
const columndIdx = this._columns.findIndex(c => c.property === property);
|
|
3982
|
+
this._columns.splice(columndIdx, 1);
|
|
3983
|
+
}
|
|
3380
3984
|
withFilterDisplay(filterDisplayType) {
|
|
3381
3985
|
this._filterDisplay = filterDisplayType;
|
|
3382
3986
|
return this;
|
|
@@ -3439,28 +4043,252 @@ class TableDescriptor {
|
|
|
3439
4043
|
this._hasGridlines = gridlines;
|
|
3440
4044
|
return this;
|
|
3441
4045
|
}
|
|
4046
|
+
withRowClassName(rowClassName, classNameMapFn) {
|
|
4047
|
+
this._rowClassName = rowClassName;
|
|
4048
|
+
this._rowClassNameMapFn = classNameMapFn;
|
|
4049
|
+
return this;
|
|
4050
|
+
}
|
|
4051
|
+
withHeaderClassName(headerClassName) {
|
|
4052
|
+
this._headerClassName = headerClassName;
|
|
4053
|
+
return this;
|
|
4054
|
+
}
|
|
4055
|
+
copyFieldsTo(obj) {
|
|
4056
|
+
obj._title = this._title;
|
|
4057
|
+
obj._hideHeader = this._hideHeader;
|
|
4058
|
+
obj._dataKeyProperty = this._dataKeyProperty;
|
|
4059
|
+
obj._hasDefaultSort = this._hasDefaultSort;
|
|
4060
|
+
obj._defaultSortProperty = this._defaultSortProperty.map(p => p);
|
|
4061
|
+
obj._defaultSortAsc = this._defaultSortAsc.map(p => p);
|
|
4062
|
+
obj._filterDisplay = this._filterDisplay;
|
|
4063
|
+
obj._className = this._className;
|
|
4064
|
+
obj._size = this._size;
|
|
4065
|
+
obj._tableFullHeightOffset = this._tableFullHeightOffset;
|
|
4066
|
+
obj._rowHeight = this._rowHeight;
|
|
4067
|
+
obj._hasHover = this._hasHover;
|
|
4068
|
+
obj._hasGridlines = this._hasGridlines;
|
|
4069
|
+
}
|
|
3442
4070
|
copy() {
|
|
3443
4071
|
const descriptor = new TableDescriptor(this.model.type, this.model.idPropertyName, this.model.titlePropertyName);
|
|
4072
|
+
this.copyFieldsTo(descriptor);
|
|
3444
4073
|
descriptor._columns = this.columns.map(c => c.copy());
|
|
3445
|
-
descriptor
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
4074
|
+
return descriptor;
|
|
4075
|
+
}
|
|
4076
|
+
/**
|
|
4077
|
+
* generates column based on attributes
|
|
4078
|
+
* @param attribute attribute map
|
|
4079
|
+
* @param column if provided, replaced by new, otherwise new is created
|
|
4080
|
+
* @param args additional parameters
|
|
4081
|
+
*/
|
|
4082
|
+
upsertColumnFromAttributeDef(attribute, column, ...args) {
|
|
4083
|
+
if (column == null) {
|
|
4084
|
+
column = this.addColumn(attribute.name);
|
|
4085
|
+
}
|
|
4086
|
+
if (attribute.columnType === ColumnTypeEnum.Enum && args.length === 0) {
|
|
4087
|
+
args = [attribute.enumType];
|
|
4088
|
+
}
|
|
4089
|
+
column = column.asType(attribute.columnType, ...args);
|
|
4090
|
+
if (attribute.classType) {
|
|
4091
|
+
column.withObjectProperty(attribute.classType).withSort();
|
|
4092
|
+
}
|
|
4093
|
+
else {
|
|
4094
|
+
column.withSort().withFilter();
|
|
4095
|
+
}
|
|
4096
|
+
return column;
|
|
4097
|
+
}
|
|
4098
|
+
/**
|
|
4099
|
+
* defines modified type of column
|
|
4100
|
+
* DO NOT USE with enum (use withCustomEnumType)
|
|
4101
|
+
* @param property column name
|
|
4102
|
+
* @param columnType modified type
|
|
4103
|
+
* @param args additional attributes
|
|
4104
|
+
*/
|
|
4105
|
+
withColumnModifiedType(property, columnType, ...args) {
|
|
4106
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4107
|
+
if (attributeDef != null) {
|
|
4108
|
+
attributeDef.columnType = columnType ?? attributeDef.columnType;
|
|
4109
|
+
this.upsertColumnFromAttributeDef(attributeDef, this.columns.find(col => col.property === attributeDef.name), ...args);
|
|
4110
|
+
}
|
|
4111
|
+
return this;
|
|
4112
|
+
}
|
|
4113
|
+
/**
|
|
4114
|
+
* defines custom enum type for column
|
|
4115
|
+
* @param property column name
|
|
4116
|
+
* @param enumType
|
|
4117
|
+
*/
|
|
4118
|
+
withColumnModifiedEnum(property, enumType) {
|
|
4119
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4120
|
+
if (attributeDef != null) {
|
|
4121
|
+
attributeDef.columnType = ColumnTypeEnum.Enum;
|
|
4122
|
+
this.upsertColumnFromAttributeDef(attributeDef, this.columns.find(col => col.property === property), enumType ?? ObjectSerializer.get().findEnum(attributeDef.type));
|
|
4123
|
+
}
|
|
4124
|
+
return this;
|
|
4125
|
+
}
|
|
4126
|
+
/**
|
|
4127
|
+
* modifies column with class and lookup provider
|
|
4128
|
+
* @param property column name
|
|
4129
|
+
* @param lookupProvider lookupProvider for class
|
|
4130
|
+
* @param itemsLabelProperty
|
|
4131
|
+
* @param filterProperty
|
|
4132
|
+
*/
|
|
4133
|
+
withColumnModifiedLookup(property, lookupProvider, itemsLabelProperty, filterProperty) {
|
|
4134
|
+
const column = this.columns.find(col => col.property === property);
|
|
4135
|
+
if (column) {
|
|
4136
|
+
column.withFilterLookup().withLookupDataProvider(lookupProvider);
|
|
4137
|
+
if (column instanceof FilterLookupDescriptor) {
|
|
4138
|
+
if (itemsLabelProperty) {
|
|
4139
|
+
column.withItemsLabelProperty(itemsLabelProperty);
|
|
4140
|
+
}
|
|
4141
|
+
if (filterProperty) {
|
|
4142
|
+
column.withFilterProperty(filterProperty);
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
return this;
|
|
4147
|
+
}
|
|
4148
|
+
}
|
|
4149
|
+
class TableDynamicDescriptor extends TableDescriptor {
|
|
4150
|
+
constructor(idProperty, titleProperty) {
|
|
4151
|
+
super({}, idProperty, titleProperty);
|
|
4152
|
+
this._excludedColumns = [];
|
|
4153
|
+
this._filterColumns = [];
|
|
4154
|
+
this._sortColumns = [];
|
|
4155
|
+
this._sortColumnMode = TableDynamicColumnsModeEnum.EXCLUDE;
|
|
4156
|
+
this._filterColumnMode = TableDynamicColumnsModeEnum.EXCLUDE;
|
|
4157
|
+
this._columns = [];
|
|
4158
|
+
this.withTitle('Dynamic table');
|
|
4159
|
+
}
|
|
4160
|
+
get columns() {
|
|
4161
|
+
return this._columns;
|
|
4162
|
+
}
|
|
4163
|
+
/**
|
|
4164
|
+
* defines excluded columns when generating descriptor
|
|
4165
|
+
* @param excludedColumn names of excluded columns
|
|
4166
|
+
*/
|
|
4167
|
+
withColumnsExcluded(excludedColumn) {
|
|
4168
|
+
this._excludedColumns = excludedColumn;
|
|
4169
|
+
return this;
|
|
4170
|
+
}
|
|
4171
|
+
/**
|
|
4172
|
+
* defines column properties on which sort is defined or not depending on sortColumnMode
|
|
4173
|
+
* @param sortOnColumns column names
|
|
4174
|
+
* @param sortColumnMode INCLUDE_ONLY (default) only given columns will have sort, EXCLUDE given columns will NOT have sort
|
|
4175
|
+
*/
|
|
4176
|
+
withColumnsSort(sortOnColumns, sortColumnMode = TableDynamicColumnsModeEnum.INCLUDE_ONLY) {
|
|
4177
|
+
this._sortColumnMode = sortColumnMode;
|
|
4178
|
+
this._sortColumns = sortOnColumns;
|
|
4179
|
+
return this;
|
|
4180
|
+
}
|
|
4181
|
+
/**
|
|
4182
|
+
* defines column properties on which filter is defined or not depending on filterColumnMode
|
|
4183
|
+
* @param filterOnColumn column names
|
|
4184
|
+
* @param filterColumnMode INCLUDE_ONLY (default) only given columns will have filter, EXCLUDE given columns will NOT have filter
|
|
4185
|
+
*/
|
|
4186
|
+
withColumnsFilter(filterOnColumn, filterColumnMode = TableDynamicColumnsModeEnum.INCLUDE_ONLY) {
|
|
4187
|
+
this._filterColumnMode = filterColumnMode;
|
|
4188
|
+
this._filterColumns = filterOnColumn;
|
|
4189
|
+
return this;
|
|
4190
|
+
}
|
|
4191
|
+
/**
|
|
4192
|
+
* sets given type to column with given property and returns this table
|
|
4193
|
+
* @param property column's property
|
|
4194
|
+
* @param type custom type for column
|
|
4195
|
+
* @param args addition arguments for column
|
|
4196
|
+
*/
|
|
4197
|
+
withColumnModifiedType(property, type, ...args) {
|
|
4198
|
+
const column = this._columns.find(col => property === col.property) ?? this.addColumn(property).withTitle(property);
|
|
4199
|
+
if (column) {
|
|
4200
|
+
column.asType(type, ...args);
|
|
4201
|
+
}
|
|
4202
|
+
return this;
|
|
4203
|
+
}
|
|
4204
|
+
/**
|
|
4205
|
+
* sets title to column with given property and returns this table
|
|
4206
|
+
* @param property column's property
|
|
4207
|
+
* @param title column's title
|
|
4208
|
+
*/
|
|
4209
|
+
withColumnTitle(property, title) {
|
|
4210
|
+
const column = this._columns.find(col => property === col.property) ?? this.addColumn(property);
|
|
4211
|
+
column.withTitle(title, true);
|
|
4212
|
+
return this;
|
|
4213
|
+
}
|
|
4214
|
+
/**
|
|
4215
|
+
* generates columns defined on table based on data fetched from api
|
|
4216
|
+
* @param data data from api
|
|
4217
|
+
*/
|
|
4218
|
+
toTableDescriptorFromData(data) {
|
|
4219
|
+
const tableDescriptor = this.toTableDescriptor();
|
|
4220
|
+
if (data.pageData == null || data.pageData.length == 0) {
|
|
4221
|
+
return tableDescriptor;
|
|
4222
|
+
}
|
|
4223
|
+
const objectModel = data.pageData[0];
|
|
4224
|
+
const entries = Object.entries(objectModel)
|
|
4225
|
+
.filter(([key]) => !this._excludedColumns.includes(key))
|
|
4226
|
+
.filter(([, value]) => !Array.isArray(value)); //exclude arrays and sets
|
|
4227
|
+
for (const [key, value] of entries) {
|
|
4228
|
+
const metaColumn = this._columns.find(col => col.property === key);
|
|
4229
|
+
let column;
|
|
4230
|
+
if (metaColumn) {
|
|
4231
|
+
if (!metaColumn.visibility) {
|
|
4232
|
+
continue;
|
|
4233
|
+
}
|
|
4234
|
+
column = metaColumn.toColumnDescriptor(tableDescriptor);
|
|
4235
|
+
tableDescriptor.addColumnDescriptor(column);
|
|
4236
|
+
}
|
|
4237
|
+
else {
|
|
4238
|
+
column = tableDescriptor.addColumn(key).withTitle(key);
|
|
4239
|
+
TableviewUtil.stringColumnConverter(column, value);
|
|
4240
|
+
}
|
|
4241
|
+
const elementOfSortColumns = this._sortColumns.includes(column.property);
|
|
4242
|
+
if ((this._sortColumnMode === TableDynamicColumnsModeEnum.EXCLUDE && !elementOfSortColumns) ||
|
|
4243
|
+
(this._sortColumnMode === TableDynamicColumnsModeEnum.INCLUDE_ONLY && elementOfSortColumns)) {
|
|
4244
|
+
column.withSort();
|
|
4245
|
+
}
|
|
4246
|
+
const elementOfFilterColumns = this._filterColumns.includes(column.property);
|
|
4247
|
+
if ((this._filterColumnMode === TableDynamicColumnsModeEnum.EXCLUDE && !elementOfFilterColumns) ||
|
|
4248
|
+
(this._filterColumnMode === TableDynamicColumnsModeEnum.INCLUDE_ONLY && elementOfFilterColumns)) {
|
|
4249
|
+
column.withFilter();
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
return tableDescriptor;
|
|
4253
|
+
}
|
|
4254
|
+
/**
|
|
4255
|
+
* adds ColumnDynamicDescriptor to this table
|
|
4256
|
+
* @param property column's property
|
|
4257
|
+
*/
|
|
4258
|
+
addColumn(property) {
|
|
4259
|
+
const column = new ColumnDynamicDescriptor(this, property);
|
|
4260
|
+
this._columns.push(column);
|
|
4261
|
+
return column;
|
|
4262
|
+
}
|
|
4263
|
+
removeColumn(property) {
|
|
4264
|
+
const column = this.columns.find(col => col.property === property) ?? this.addColumn(property);
|
|
4265
|
+
column.withVisibility(false);
|
|
4266
|
+
return this;
|
|
4267
|
+
}
|
|
4268
|
+
/**
|
|
4269
|
+
* creates deep copy of table dynamic descriptor
|
|
4270
|
+
*/
|
|
4271
|
+
copy() {
|
|
4272
|
+
const descriptor = new TableDynamicDescriptor(this.model.idPropertyName, this.model.titlePropertyName);
|
|
4273
|
+
this.copyFieldsTo(descriptor);
|
|
4274
|
+
descriptor._columns = this.columns.map(c => c.copy());
|
|
4275
|
+
descriptor._excludedColumns = [...this._excludedColumns];
|
|
4276
|
+
descriptor._filterColumns = [...this._filterColumns];
|
|
4277
|
+
descriptor._sortColumns = [...this._sortColumns];
|
|
4278
|
+
descriptor._filterColumnMode = this._filterColumnMode;
|
|
4279
|
+
descriptor._sortColumnMode = this._sortColumnMode;
|
|
4280
|
+
return descriptor;
|
|
4281
|
+
}
|
|
4282
|
+
toTableDescriptor() {
|
|
4283
|
+
const descriptor = new TableDescriptor({}, this.model.idPropertyName, this.model.titlePropertyName);
|
|
4284
|
+
this.copyFieldsTo(descriptor);
|
|
3458
4285
|
return descriptor;
|
|
3459
4286
|
}
|
|
3460
4287
|
}
|
|
3461
4288
|
|
|
3462
4289
|
class TableviewDescriptor {
|
|
3463
4290
|
constructor(modelType, idProperty, titleProperty) {
|
|
4291
|
+
this._modelType = modelType;
|
|
3464
4292
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
3465
4293
|
this._table = new TableDescriptor(modelType, idProperty, titleProperty);
|
|
3466
4294
|
this._viewEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewTypeEnum.View);
|
|
@@ -3469,6 +4297,38 @@ class TableviewDescriptor {
|
|
|
3469
4297
|
this._editEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewTypeEnum.Edit);
|
|
3470
4298
|
this._tableTitle = `${this._model.typeName}.name`;
|
|
3471
4299
|
}
|
|
4300
|
+
/**
|
|
4301
|
+
* generates descriptor from attribute definition of openaapi model
|
|
4302
|
+
* @param modelType class type
|
|
4303
|
+
* @param idProperty
|
|
4304
|
+
* @param titleProperty
|
|
4305
|
+
*/
|
|
4306
|
+
static from(modelType, idProperty, titleProperty) {
|
|
4307
|
+
const descriptor = new TableviewDescriptor(modelType, idProperty, titleProperty);
|
|
4308
|
+
descriptor._table = TableDescriptor.from(modelType, idProperty, titleProperty);
|
|
4309
|
+
descriptor._editEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4310
|
+
descriptor._viewEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4311
|
+
descriptor._addEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4312
|
+
return descriptor;
|
|
4313
|
+
}
|
|
4314
|
+
/**
|
|
4315
|
+
* generates descriptor from given attribute definition
|
|
4316
|
+
* @param modelType class type
|
|
4317
|
+
* @param columnAttributes attribute definition to generate columns
|
|
4318
|
+
* @param fieldAttributes attribute definition to generate fields, if undefined columnDefinition is used, if null editors are not generated
|
|
4319
|
+
* @param idProperty
|
|
4320
|
+
* @param titleProperty
|
|
4321
|
+
*/
|
|
4322
|
+
static fromModelWithDefinition(modelType, columnAttributes, fieldAttributes, idProperty, titleProperty) {
|
|
4323
|
+
const descriptor = new TableviewDescriptor(modelType, idProperty, titleProperty);
|
|
4324
|
+
descriptor._table = TableDescriptor.fromModelWithAttributes(modelType, columnAttributes, idProperty, titleProperty);
|
|
4325
|
+
if (fieldAttributes !== null) {
|
|
4326
|
+
descriptor._editEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4327
|
+
descriptor._viewEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4328
|
+
descriptor._addEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4329
|
+
}
|
|
4330
|
+
return descriptor;
|
|
4331
|
+
}
|
|
3472
4332
|
get table() {
|
|
3473
4333
|
return this._table;
|
|
3474
4334
|
}
|
|
@@ -3491,6 +4351,12 @@ class TableviewDescriptor {
|
|
|
3491
4351
|
this._table = descriptor;
|
|
3492
4352
|
return this;
|
|
3493
4353
|
}
|
|
4354
|
+
withEditorDescriptors(descriptor) {
|
|
4355
|
+
this._viewEditor = descriptor;
|
|
4356
|
+
this._editEditor = descriptor;
|
|
4357
|
+
this._addEditor = descriptor;
|
|
4358
|
+
return this;
|
|
4359
|
+
}
|
|
3494
4360
|
withViewDescriptor(descriptor) {
|
|
3495
4361
|
this._viewEditor = descriptor;
|
|
3496
4362
|
return this;
|
|
@@ -3519,6 +4385,26 @@ class TableviewDescriptor {
|
|
|
3519
4385
|
addColumn(property) {
|
|
3520
4386
|
return this._table.addColumn(property);
|
|
3521
4387
|
}
|
|
4388
|
+
removeColumn(property) {
|
|
4389
|
+
this._table.removeColumn(property);
|
|
4390
|
+
}
|
|
4391
|
+
getField(property, editorType) {
|
|
4392
|
+
switch (editorType) {
|
|
4393
|
+
case TableviewTypeEnum.Edit:
|
|
4394
|
+
return this._editEditor.getField(property);
|
|
4395
|
+
case TableviewTypeEnum.Add:
|
|
4396
|
+
return this._addEditor.getField(property);
|
|
4397
|
+
case TableviewTypeEnum.View:
|
|
4398
|
+
return this._viewEditor.getField(property);
|
|
4399
|
+
case TableviewTypeEnum.None:
|
|
4400
|
+
return null;
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
removeField(property) {
|
|
4404
|
+
this._editEditor.removeField(property);
|
|
4405
|
+
this._addEditor.removeField(property);
|
|
4406
|
+
this._viewEditor.removeField(property);
|
|
4407
|
+
}
|
|
3522
4408
|
addColumnNumber(property, displayFormat) {
|
|
3523
4409
|
return this._table.addColumnNumber(property, displayFormat);
|
|
3524
4410
|
}
|
|
@@ -3590,6 +4476,116 @@ class TableviewDescriptor {
|
|
|
3590
4476
|
tableview._editEditor = this._editEditor.copy();
|
|
3591
4477
|
return tableview;
|
|
3592
4478
|
}
|
|
4479
|
+
/**
|
|
4480
|
+
* creates column and field with custom type, for example currency
|
|
4481
|
+
* if field exists, it is replaced
|
|
4482
|
+
* DO NOT USE WITH TYPES WHERE ARGS ARE REQUIRED - ERROR WILL BE THROWN
|
|
4483
|
+
* for enum use withEnumType
|
|
4484
|
+
* for custom class use withClassType
|
|
4485
|
+
* @param property name of field
|
|
4486
|
+
* @param columnType required column type
|
|
4487
|
+
* @param fieldType optional, if not provided it is converted from column type
|
|
4488
|
+
*/
|
|
4489
|
+
withModifiedType(property, columnType, fieldType) {
|
|
4490
|
+
if (columnType === ColumnTypeEnum.Enum) {
|
|
4491
|
+
throw new Error('Do not use with types where args are required');
|
|
4492
|
+
}
|
|
4493
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4494
|
+
if (attributeDef != null) {
|
|
4495
|
+
fieldType ?? (fieldType = TableviewUtil.toFieldInputTypeFromColumnType(columnType));
|
|
4496
|
+
attributeDef.fieldType = fieldType;
|
|
4497
|
+
this._table.withColumnModifiedType(property, columnType);
|
|
4498
|
+
this._editEditor.withFieldModifiedType(property, fieldType);
|
|
4499
|
+
this._addEditor.withFieldModifiedType(property, fieldType);
|
|
4500
|
+
this._viewEditor.withFieldModifiedType(property, fieldType);
|
|
4501
|
+
}
|
|
4502
|
+
return this;
|
|
4503
|
+
}
|
|
4504
|
+
/**
|
|
4505
|
+
* creates column with enum type
|
|
4506
|
+
* if fields exists, it is replaced
|
|
4507
|
+
* @param property property name
|
|
4508
|
+
* @param enumType type of enum
|
|
4509
|
+
* @param fieldType type of field, optional, default is Text
|
|
4510
|
+
*/
|
|
4511
|
+
withModifiedEnum(property, enumType, fieldType) {
|
|
4512
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4513
|
+
if (attributeDef != null) {
|
|
4514
|
+
attributeDef.fieldType = fieldType ?? FieldInputTypeEnum.Text;
|
|
4515
|
+
this._table.withColumnModifiedEnum(property, enumType);
|
|
4516
|
+
this._editEditor.withFieldModifiedEnum(property, enumType);
|
|
4517
|
+
this._viewEditor.withFieldModifiedEnum(property, enumType);
|
|
4518
|
+
this._addEditor.withFieldModifiedEnum(property, enumType);
|
|
4519
|
+
}
|
|
4520
|
+
return this;
|
|
4521
|
+
}
|
|
4522
|
+
/**
|
|
4523
|
+
* generates column with custom class type
|
|
4524
|
+
* field is generated only if lookupProvider is provided
|
|
4525
|
+
* @param property property name
|
|
4526
|
+
* @param modelType class type of object
|
|
4527
|
+
* @param titleProperty
|
|
4528
|
+
* @param lookupProvider
|
|
4529
|
+
* @param itemsLabelProperty
|
|
4530
|
+
* @param filterProperty
|
|
4531
|
+
*/
|
|
4532
|
+
withModifiedLookup(property, modelType, lookupProvider, titleProperty, itemsLabelProperty, filterProperty) {
|
|
4533
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4534
|
+
if (attributeDef != null) {
|
|
4535
|
+
modelType ?? (modelType = attributeDef.classType ?? ObjectSerializer.get().findType(attributeDef.type));
|
|
4536
|
+
titleProperty ?? (titleProperty = ModelUtil.findTitleAttribute(modelType) ?? undefined);
|
|
4537
|
+
itemsLabelProperty ?? (itemsLabelProperty = titleProperty);
|
|
4538
|
+
attributeDef.columnType = ColumnTypeEnum.String;
|
|
4539
|
+
attributeDef.fieldType = FieldInputTypeEnum.Text;
|
|
4540
|
+
if (lookupProvider != null) {
|
|
4541
|
+
this._table.withColumnModifiedLookup(property, lookupProvider, itemsLabelProperty, filterProperty);
|
|
4542
|
+
this._addEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4543
|
+
this._viewEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4544
|
+
this._editEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4545
|
+
}
|
|
4546
|
+
else {
|
|
4547
|
+
const column = this._table.getColumn(property) ?? this.addColumn(property);
|
|
4548
|
+
column.withObjectProperty(modelType, titleProperty);
|
|
4549
|
+
}
|
|
4550
|
+
}
|
|
4551
|
+
return this;
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
class TableviewDynamicDescriptor extends TableviewDescriptor {
|
|
4555
|
+
constructor(idProperty, titleProperty) {
|
|
4556
|
+
super({}, idProperty, titleProperty);
|
|
4557
|
+
this._table = new TableDynamicDescriptor(idProperty, titleProperty);
|
|
4558
|
+
super._tableTitle = undefined;
|
|
4559
|
+
}
|
|
4560
|
+
get table() {
|
|
4561
|
+
return this._table;
|
|
4562
|
+
}
|
|
4563
|
+
/**
|
|
4564
|
+
* sets custom table descriptor
|
|
4565
|
+
* @param descriptor
|
|
4566
|
+
*/
|
|
4567
|
+
withTableDescriptor(descriptor) {
|
|
4568
|
+
this._table = descriptor;
|
|
4569
|
+
return this;
|
|
4570
|
+
}
|
|
4571
|
+
/**
|
|
4572
|
+
* sets visibility hidden state to column with given property
|
|
4573
|
+
* equals to be removing in auto and base tableview descriptor
|
|
4574
|
+
* * @param property column's property
|
|
4575
|
+
*/
|
|
4576
|
+
removeColumn(property) {
|
|
4577
|
+
this._table.removeColumn(property);
|
|
4578
|
+
return this;
|
|
4579
|
+
}
|
|
4580
|
+
/**
|
|
4581
|
+
* creates depp copy of tableview object and its children
|
|
4582
|
+
*/
|
|
4583
|
+
copy() {
|
|
4584
|
+
const descriptor = new TableviewDynamicDescriptor(this.model.idPropertyName, this.model.titlePropertyName);
|
|
4585
|
+
descriptor._table = this._table.copy();
|
|
4586
|
+
descriptor._tableTitle = this._tableTitle;
|
|
4587
|
+
return descriptor;
|
|
4588
|
+
}
|
|
3593
4589
|
}
|
|
3594
4590
|
|
|
3595
4591
|
class ButtonDescriptor {
|
|
@@ -4744,7 +5740,7 @@ class MediusRestUtil {
|
|
|
4744
5740
|
const operator = filterFieldSplit.length > 1 ? filterFieldSplit[1] : 'eq';
|
|
4745
5741
|
// prepare value
|
|
4746
5742
|
let value = filterFieldSplit.length > 2 ? filterFieldSplit.slice(2).join(':') : '';
|
|
4747
|
-
|
|
5743
|
+
let valueTo = undefined;
|
|
4748
5744
|
if (value.startsWith("'")) {
|
|
4749
5745
|
value = value.substring(1, value.length - 1);
|
|
4750
5746
|
}
|
|
@@ -4754,11 +5750,14 @@ class MediusRestUtil {
|
|
|
4754
5750
|
.split(',')
|
|
4755
5751
|
.map((v) => (v.startsWith("'") ? v.substring(1, v.length - 1) : v));
|
|
4756
5752
|
}
|
|
5753
|
+
if (operator === 'ft') {
|
|
5754
|
+
valueTo = value[1];
|
|
5755
|
+
value = value[0];
|
|
5756
|
+
}
|
|
4757
5757
|
const filterDescriptor = filterDescriptors.find(f => f.property === field);
|
|
4758
5758
|
const matchMode = MediusRestUtil.getMapping(operator, filterDescriptor?.filterType, 1);
|
|
4759
5759
|
if (matchMode && filterDescriptor) {
|
|
4760
|
-
|
|
4761
|
-
mediusParamsBuilder.withFilter(fieldFilterProperty, value, valueTo, MediusRestUtil.getMediusFilterMatchTypeFromPrimeMatchMode(matchMode[0]));
|
|
5760
|
+
mediusParamsBuilder.withFilter(filterDescriptor.property, value, valueTo, MediusRestUtil.getMediusFilterMatchTypeFromPrimeMatchMode(matchMode[0]));
|
|
4762
5761
|
}
|
|
4763
5762
|
}
|
|
4764
5763
|
}
|
|
@@ -4777,7 +5776,7 @@ class MediusRestUtil {
|
|
|
4777
5776
|
if (event.rows && event.rows !== defaultItemsPerPage && event.rows > 0) {
|
|
4778
5777
|
params['rows'] = event.rows;
|
|
4779
5778
|
}
|
|
4780
|
-
if (event.multiSortMeta?.length
|
|
5779
|
+
if (event.multiSortMeta?.length) {
|
|
4781
5780
|
params['sort'] = event.multiSortMeta?.map(s => `${s.field}${s.order === 1 ? '' : ':desc'}`).join(',');
|
|
4782
5781
|
}
|
|
4783
5782
|
if (event.filters) {
|
|
@@ -4796,11 +5795,21 @@ class MediusRestUtil {
|
|
|
4796
5795
|
doAddFilter = true;
|
|
4797
5796
|
}
|
|
4798
5797
|
else if (Array.isArray(value)) {
|
|
4799
|
-
|
|
5798
|
+
const joinedValue = value
|
|
5799
|
+
.map(v => {
|
|
5800
|
+
if (v instanceof Date) {
|
|
5801
|
+
// for query params, always convert to iso string, correct transformation will be done later
|
|
5802
|
+
return v.toISOString();
|
|
5803
|
+
}
|
|
5804
|
+
return v;
|
|
5805
|
+
})
|
|
5806
|
+
.join(',');
|
|
5807
|
+
value = `[${joinedValue}]`;
|
|
4800
5808
|
doAddFilter = true;
|
|
4801
5809
|
}
|
|
4802
5810
|
else if (value instanceof Date) {
|
|
4803
|
-
|
|
5811
|
+
// for query params, always convert to iso string, correct transformation will be done later
|
|
5812
|
+
value = value.toISOString();
|
|
4804
5813
|
doAddFilter = true;
|
|
4805
5814
|
}
|
|
4806
5815
|
if (doAddFilter) {
|
|
@@ -4814,6 +5823,49 @@ class MediusRestUtil {
|
|
|
4814
5823
|
}
|
|
4815
5824
|
return params;
|
|
4816
5825
|
}
|
|
5826
|
+
static modifyFilterProperties(mediusQueryParams, filterDescriptors) {
|
|
5827
|
+
for (const filterParam of mediusQueryParams.filterParams ?? []) {
|
|
5828
|
+
const filterDescriptor = filterDescriptors.find(f => f.property === filterParam.property);
|
|
5829
|
+
filterParam.property = filterDescriptor?.filterProperty ?? filterParam.property;
|
|
5830
|
+
if (filterDescriptor?.filterType === FilterTypeEnum.Date) {
|
|
5831
|
+
if (filterParam.filterMatchType === MediusFilterMatchType.Equals) {
|
|
5832
|
+
// convert date equals filter to date range
|
|
5833
|
+
const filterDate = filterParam.filterValue;
|
|
5834
|
+
const startDate = new Date(filterDate);
|
|
5835
|
+
const endDate = new Date(startDate);
|
|
5836
|
+
if (filterDescriptor.datePickerShowTime) {
|
|
5837
|
+
startDate.setHours(startDate.getHours(), startDate.getMinutes(), 0, 0);
|
|
5838
|
+
endDate.setHours(endDate.getHours(), endDate.getMinutes() + 1, 0, 0);
|
|
5839
|
+
}
|
|
5840
|
+
else {
|
|
5841
|
+
startDate.setHours(0, 0, 0, 0);
|
|
5842
|
+
endDate.setHours(0, 0, 0, 0);
|
|
5843
|
+
endDate.setDate(endDate.getDate() + 1);
|
|
5844
|
+
}
|
|
5845
|
+
filterParam.filterMatchType = MediusFilterMatchType.FromTo;
|
|
5846
|
+
filterParam.filterValue = startDate;
|
|
5847
|
+
filterParam.filterValueTo = endDate;
|
|
5848
|
+
}
|
|
5849
|
+
// transform dates to correct iso string
|
|
5850
|
+
if (typeof filterParam.filterValue !== 'undefined') {
|
|
5851
|
+
if (Array.isArray(filterParam.filterValue)) {
|
|
5852
|
+
filterParam.filterValue = filterParam.filterValue.map(v => DateUtil.toIsoString(v, filterDescriptor.datePickerValueInUtc, filterDescriptor.datePickerValueWithTimezone));
|
|
5853
|
+
}
|
|
5854
|
+
else {
|
|
5855
|
+
filterParam.filterValue = DateUtil.toIsoString(filterParam.filterValue, filterDescriptor.datePickerValueInUtc, filterDescriptor.datePickerValueWithTimezone);
|
|
5856
|
+
}
|
|
5857
|
+
}
|
|
5858
|
+
if (typeof filterParam.filterValueTo !== 'undefined') {
|
|
5859
|
+
if (Array.isArray(filterParam.filterValueTo)) {
|
|
5860
|
+
filterParam.filterValueTo = filterParam.filterValueTo.map(v => DateUtil.toIsoString(v, filterDescriptor.datePickerValueInUtc, filterDescriptor.datePickerValueWithTimezone));
|
|
5861
|
+
}
|
|
5862
|
+
else {
|
|
5863
|
+
filterParam.filterValueTo = DateUtil.toIsoString(filterParam.filterValueTo, filterDescriptor.datePickerValueInUtc, filterDescriptor.datePickerValueWithTimezone);
|
|
5864
|
+
}
|
|
5865
|
+
}
|
|
5866
|
+
}
|
|
5867
|
+
}
|
|
5868
|
+
}
|
|
4817
5869
|
static fromPrimeLazyLoadEventToMediusQueryParams(event) {
|
|
4818
5870
|
const queryParamBuilder = MediusQueryParamBuilder.create(event.rows, event.first);
|
|
4819
5871
|
// apply sorting
|
|
@@ -4866,7 +5918,8 @@ MediusRestUtil.matchModeMapping = [
|
|
|
4866
5918
|
[FilterMatchMode.STARTS_WITH, 'sw', MediusFilterMatchType.StartsWith, null],
|
|
4867
5919
|
[FilterMatchMode.IN, 'in', MediusFilterMatchType.In, null],
|
|
4868
5920
|
[FilterMatchMode.NOT_EQUALS, 'neq', MediusFilterMatchType.NotEquals, null],
|
|
4869
|
-
[FilterMatchMode.
|
|
5921
|
+
[FilterMatchMode.BETWEEN, 'ft', MediusFilterMatchType.FromTo, FilterTypeEnum.Date],
|
|
5922
|
+
[FilterMatchMode.DATE_IS, 'dteq', MediusFilterMatchType.Equals, FilterTypeEnum.Date],
|
|
4870
5923
|
[FilterMatchMode.DATE_BEFORE, 'lt', MediusFilterMatchType.SmallerThan, FilterTypeEnum.Date],
|
|
4871
5924
|
[FilterMatchMode.DATE_AFTER, 'gt', MediusFilterMatchType.GreaterThan, FilterTypeEnum.Date],
|
|
4872
5925
|
[FilterMatchMode.DATE_IS_NOT, 'neq', MediusFilterMatchType.NotEquals, FilterTypeEnum.Date]
|
|
@@ -5063,6 +6116,7 @@ class ActionParameters {
|
|
|
5063
6116
|
constructor(itemId, item) {
|
|
5064
6117
|
this.itemId = itemId;
|
|
5065
6118
|
this.item = item;
|
|
6119
|
+
this.selectedItems = [];
|
|
5066
6120
|
}
|
|
5067
6121
|
withActionData(actionData) {
|
|
5068
6122
|
this.actionData = actionData;
|
|
@@ -5084,6 +6138,10 @@ class ActionParameters {
|
|
|
5084
6138
|
this.route = route;
|
|
5085
6139
|
return this;
|
|
5086
6140
|
}
|
|
6141
|
+
withSelectedItems(selectedItems) {
|
|
6142
|
+
this.selectedItems = selectedItems;
|
|
6143
|
+
return this;
|
|
6144
|
+
}
|
|
5087
6145
|
}
|
|
5088
6146
|
var ActionInstanceStateEnum;
|
|
5089
6147
|
(function (ActionInstanceStateEnum) {
|
|
@@ -5107,6 +6165,17 @@ var ActionInstanceStateEnum;
|
|
|
5107
6165
|
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishDismissed"] = 17] = "FinishDismissed"; // action was dismissed by user
|
|
5108
6166
|
})(ActionInstanceStateEnum || (ActionInstanceStateEnum = {}));
|
|
5109
6167
|
|
|
6168
|
+
/**
|
|
6169
|
+
* Default categories for tableview actions
|
|
6170
|
+
*/
|
|
6171
|
+
class TableviewActionDefaultCategories {
|
|
6172
|
+
}
|
|
6173
|
+
TableviewActionDefaultCategories.READ = 'read';
|
|
6174
|
+
TableviewActionDefaultCategories.ADD = 'add';
|
|
6175
|
+
TableviewActionDefaultCategories.EDIT = 'edit';
|
|
6176
|
+
TableviewActionDefaultCategories.DELETE = 'delete';
|
|
6177
|
+
TableviewActionDefaultCategories.DETAILS = 'details';
|
|
6178
|
+
|
|
5110
6179
|
class AuthorizationUtil {
|
|
5111
6180
|
static isPermitted(permissions, userRoles) {
|
|
5112
6181
|
switch (permissions.authorizationType) {
|
|
@@ -5567,6 +6636,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
5567
6636
|
}]
|
|
5568
6637
|
}], ctorParameters: function () { return [{ type: MngParametrizePipe }]; } });
|
|
5569
6638
|
|
|
6639
|
+
class MngClassMapPipe {
|
|
6640
|
+
transform(value, classNameMapFn, i) {
|
|
6641
|
+
if (classNameMapFn && typeof classNameMapFn === 'function') {
|
|
6642
|
+
return classNameMapFn(value, i);
|
|
6643
|
+
}
|
|
6644
|
+
else {
|
|
6645
|
+
return value ?? '';
|
|
6646
|
+
}
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
MngClassMapPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6650
|
+
MngClassMapPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, name: "mngClassMapPipe" });
|
|
6651
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, decorators: [{
|
|
6652
|
+
type: Pipe,
|
|
6653
|
+
args: [{
|
|
6654
|
+
name: 'mngClassMapPipe',
|
|
6655
|
+
pure: true
|
|
6656
|
+
}]
|
|
6657
|
+
}] });
|
|
6658
|
+
|
|
5570
6659
|
class MngActionExecutorService {
|
|
5571
6660
|
constructor(injector, router, dialogService, confirmationService, translate, configurationService, navigationService, errorMapper, parametrize, defaultEditorDialogComponent) {
|
|
5572
6661
|
this.injector = injector;
|
|
@@ -6099,11 +7188,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
6099
7188
|
}] }]; } });
|
|
6100
7189
|
|
|
6101
7190
|
class MngCommonsService {
|
|
6102
|
-
constructor(router, primengConfig, translate, titleService, moduleConfig, localStorage) {
|
|
7191
|
+
constructor(router, primengConfig, translate, titleService, filterService, moduleConfig, localStorage) {
|
|
6103
7192
|
this.router = router;
|
|
6104
7193
|
this.primengConfig = primengConfig;
|
|
6105
7194
|
this.translate = translate;
|
|
6106
7195
|
this.titleService = titleService;
|
|
7196
|
+
this.filterService = filterService;
|
|
6107
7197
|
this.moduleConfig = moduleConfig;
|
|
6108
7198
|
this.localStorage = localStorage;
|
|
6109
7199
|
// menu
|
|
@@ -6259,7 +7349,7 @@ class MngCommonsService {
|
|
|
6259
7349
|
this.primengConfig.filterMatchModeOptions = {
|
|
6260
7350
|
text: [FilterMatchModeEnum.Contains, FilterMatchModeEnum.Equals, FilterMatchModeEnum.NotEquals, FilterMatchModeEnum.StartsWith, FilterMatchModeEnum.EndsWith],
|
|
6261
7351
|
numeric: [FilterMatchModeEnum.Equals, FilterMatchModeEnum.NotEquals, FilterMatchModeEnum.LessThan, FilterMatchModeEnum.GreaterThan],
|
|
6262
|
-
date: [FilterMatchModeEnum.DateIs, FilterMatchModeEnum.
|
|
7352
|
+
date: [FilterMatchModeEnum.DateIs, FilterMatchModeEnum.DateBefore, FilterMatchModeEnum.DateAfter, FilterMatchModeEnum.Between]
|
|
6263
7353
|
};
|
|
6264
7354
|
// translate
|
|
6265
7355
|
this.translate.langs = this.appLanguages;
|
|
@@ -6418,11 +7508,11 @@ class MngCommonsService {
|
|
|
6418
7508
|
return titlePieces.join(' - ');
|
|
6419
7509
|
}
|
|
6420
7510
|
}
|
|
6421
|
-
MngCommonsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngCommonsService, deps: [{ token: i1.Router }, { token: i2.PrimeNGConfig }, { token: i1$2.TranslateService }, { token: i4.Title }, { token: MNG_MODULE_CONFIG_IT }, { token: MNG_BROWSER_STORAGE_IT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7511
|
+
MngCommonsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngCommonsService, deps: [{ token: i1.Router }, { token: i2.PrimeNGConfig }, { token: i1$2.TranslateService }, { token: i4.Title }, { token: i2.FilterService }, { token: MNG_MODULE_CONFIG_IT }, { token: MNG_BROWSER_STORAGE_IT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6422
7512
|
MngCommonsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngCommonsService });
|
|
6423
7513
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngCommonsService, decorators: [{
|
|
6424
7514
|
type: Injectable
|
|
6425
|
-
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.PrimeNGConfig }, { type: i1$2.TranslateService }, { type: i4.Title }, { type: undefined, decorators: [{
|
|
7515
|
+
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.PrimeNGConfig }, { type: i1$2.TranslateService }, { type: i4.Title }, { type: i2.FilterService }, { type: undefined, decorators: [{
|
|
6426
7516
|
type: Inject,
|
|
6427
7517
|
args: [MNG_MODULE_CONFIG_IT]
|
|
6428
7518
|
}] }, { type: Storage, decorators: [{
|
|
@@ -6533,6 +7623,7 @@ class MngActionComponent {
|
|
|
6533
7623
|
this.isHostHidden = false;
|
|
6534
7624
|
this.inputDisabled = of(false);
|
|
6535
7625
|
this.inputLoading = of(false);
|
|
7626
|
+
this.selectedItems = [];
|
|
6536
7627
|
this.finishEventEmitter = new EventEmitter();
|
|
6537
7628
|
this.loadingSubject = new ReplaySubject(1);
|
|
6538
7629
|
this.$loading = this.loadingSubject.asObservable();
|
|
@@ -6580,7 +7671,10 @@ class MngActionComponent {
|
|
|
6580
7671
|
this.buttonClass = this.action.buttonDescriptor.styleClass.getButtonClass(this.hasNoTitle);
|
|
6581
7672
|
}
|
|
6582
7673
|
ngOnChanges(changes) {
|
|
6583
|
-
if (!(changes['item']?.firstChange ?? true) ||
|
|
7674
|
+
if (!(changes['item']?.firstChange ?? true) ||
|
|
7675
|
+
!(changes['itemId']?.firstChange ?? true) ||
|
|
7676
|
+
!(changes['actionData']?.firstChange ?? true) ||
|
|
7677
|
+
(this.action.hasItemsSelection && !(changes['selectedItems']?.firstChange ?? true))) {
|
|
6584
7678
|
this.processSubscriptions();
|
|
6585
7679
|
}
|
|
6586
7680
|
}
|
|
@@ -6601,11 +7695,15 @@ class MngActionComponent {
|
|
|
6601
7695
|
.withQueryParam(this.queryParam)
|
|
6602
7696
|
.withRoute(this.route)
|
|
6603
7697
|
.withViewContainer(this.viewContainer)
|
|
6604
|
-
.withSourceComponent(this)
|
|
7698
|
+
.withSourceComponent(this)
|
|
7699
|
+
.withSelectedItems(this.selectedItems);
|
|
6605
7700
|
const instance = this.actionExecutor.triggerAction(this.action, parameters);
|
|
6606
7701
|
this.subscriptions.push(instance.result$.subscribe({
|
|
6607
7702
|
next: () => {
|
|
6608
7703
|
this.finishEventEmitter.next(instance);
|
|
7704
|
+
if (this.action.hasItemsSelection) {
|
|
7705
|
+
this.viewContainerService?.triggerTableReload({});
|
|
7706
|
+
}
|
|
6609
7707
|
}
|
|
6610
7708
|
}));
|
|
6611
7709
|
this.subscriptions.push(instance.error$.subscribe({
|
|
@@ -6630,6 +7728,9 @@ class MngActionComponent {
|
|
|
6630
7728
|
.withActionData(this.actionData)
|
|
6631
7729
|
.withViewContainer(this.viewContainer ?? undefined)
|
|
6632
7730
|
.withSourceComponent(this);
|
|
7731
|
+
if (this.action.hasItemsSelection) {
|
|
7732
|
+
parameters.withSelectedItems(this.selectedItems);
|
|
7733
|
+
}
|
|
6633
7734
|
const context = this.actionExecutor.prepareActionContextValidation(this.action, parameters, this.dataProvider);
|
|
6634
7735
|
if (typeof this.action.isVisibleFunction === 'function') {
|
|
6635
7736
|
this.isVisibleSubscription?.unsubscribe();
|
|
@@ -6665,7 +7766,7 @@ class MngActionComponent {
|
|
|
6665
7766
|
}
|
|
6666
7767
|
}
|
|
6667
7768
|
MngActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1$2.TranslateService }, { token: MngAuthorizationService }, { token: MngActionExecutorService }, { token: i2.ConfirmationService }, { token: MngViewContainerComponentService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
6668
|
-
MngActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngActionComponent, selector: "mng-action", inputs: { action: "action", item: "item", itemId: "itemId", actionData: "actionData", queryParam: "queryParam", dataProvider: "dataProvider", inputDisabled: ["disabled", "inputDisabled"], inputLoading: ["loading", "inputLoading"], viewContainerInit: ["viewContainer", "viewContainerInit"] }, outputs: { finishEventEmitter: "finish" }, host: { properties: { "class": "this.hostClass", "class.m-0": "this.isHostHidden" } }, providers: [ConfirmationService], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"($isVisible | async) && ($isPermitted | async)\">\n <a\n *ngIf=\"actionLink && actionLink.url !== ''; else routerLink\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [href]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.url | parametrize: itemId:item:actionData)\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n <ng-template #routerLink>\n <a\n *ngIf=\"actionLink; else button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.pathSegments | parametrize: itemId:item:actionData)\"\n [queryParams]=\"actionLink.queryParams | parametrize: itemId:item:actionData\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n </ng-template>\n <ng-template #button>\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"$any($tooltip | async)\"\n [loading]=\"(($loading | async) ?? false) || ((inputLoading | async) ?? false)\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (click)=\"triggerAction($event)\"\n [class]=\"buttonClass\"></button>\n </ng-template>\n <p-confirmDialog\n *ngIf=\"action.runConfirmationDialogDescriptor\"\n [key]=\"action.actionName + '_' + cmpId\"\n [baseZIndex]=\"50\"\n appendTo=\"body\"\n [closable]=\"action.runConfirmationDialogDescriptor.closable\"></p-confirmDialog>\n</ng-container>\n", styles: [":host{display:inline-block}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { kind: "directive", type: i7.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "component", type: i9.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }, { kind: "directive", type: i6.Ripple, selector: "[pRipple]" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: MngParametrizePipe, name: "parametrize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7769
|
+
MngActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngActionComponent, selector: "mng-action", inputs: { action: "action", item: "item", itemId: "itemId", actionData: "actionData", queryParam: "queryParam", dataProvider: "dataProvider", inputDisabled: ["disabled", "inputDisabled"], inputLoading: ["loading", "inputLoading"], viewContainerInit: ["viewContainer", "viewContainerInit"], selectedItems: "selectedItems" }, outputs: { finishEventEmitter: "finish" }, host: { properties: { "class": "this.hostClass", "class.m-0": "this.isHostHidden" } }, providers: [ConfirmationService], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"($isVisible | async) && ($isPermitted | async)\">\n <a\n *ngIf=\"actionLink && actionLink.url !== ''; else routerLink\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [href]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.url | parametrize: itemId:item:actionData)\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n <ng-template #routerLink>\n <a\n *ngIf=\"actionLink; else button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.pathSegments | parametrize: itemId:item:actionData)\"\n [queryParams]=\"actionLink.queryParams | parametrize: itemId:item:actionData\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n </ng-template>\n <ng-template #button>\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"$any($tooltip | async)\"\n [loading]=\"(($loading | async) ?? false) || ((inputLoading | async) ?? false)\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (click)=\"triggerAction($event)\"\n [class]=\"buttonClass\"></button>\n </ng-template>\n <p-confirmDialog\n *ngIf=\"action.runConfirmationDialogDescriptor\"\n [key]=\"action.actionName + '_' + cmpId\"\n [baseZIndex]=\"50\"\n appendTo=\"body\"\n [closable]=\"action.runConfirmationDialogDescriptor.closable\"></p-confirmDialog>\n</ng-container>\n", styles: [":host{display:inline-block}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { kind: "directive", type: i7.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "component", type: i9.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }, { kind: "directive", type: i6.Ripple, selector: "[pRipple]" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: MngParametrizePipe, name: "parametrize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6669
7770
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionComponent, decorators: [{
|
|
6670
7771
|
type: Component,
|
|
6671
7772
|
args: [{ selector: 'mng-action', changeDetection: ChangeDetectionStrategy.OnPush, providers: [ConfirmationService], template: "<ng-container *ngIf=\"($isVisible | async) && ($isPermitted | async)\">\n <a\n *ngIf=\"actionLink && actionLink.url !== ''; else routerLink\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [href]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.url | parametrize: itemId:item:actionData)\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n <ng-template #routerLink>\n <a\n *ngIf=\"actionLink; else button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.pathSegments | parametrize: itemId:item:actionData)\"\n [queryParams]=\"actionLink.queryParams | parametrize: itemId:item:actionData\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n </ng-template>\n <ng-template #button>\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"$any($tooltip | async)\"\n [loading]=\"(($loading | async) ?? false) || ((inputLoading | async) ?? false)\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (click)=\"triggerAction($event)\"\n [class]=\"buttonClass\"></button>\n </ng-template>\n <p-confirmDialog\n *ngIf=\"action.runConfirmationDialogDescriptor\"\n [key]=\"action.actionName + '_' + cmpId\"\n [baseZIndex]=\"50\"\n appendTo=\"body\"\n [closable]=\"action.runConfirmationDialogDescriptor.closable\"></p-confirmDialog>\n</ng-container>\n", styles: [":host{display:inline-block}\n"] }]
|
|
@@ -6698,6 +7799,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
6698
7799
|
}], viewContainerInit: [{
|
|
6699
7800
|
type: Input,
|
|
6700
7801
|
args: ['viewContainer']
|
|
7802
|
+
}], selectedItems: [{
|
|
7803
|
+
type: Input
|
|
6701
7804
|
}], finishEventEmitter: [{
|
|
6702
7805
|
type: Output,
|
|
6703
7806
|
args: ['finish']
|
|
@@ -7556,6 +8659,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
7556
8659
|
args: [Dropdown]
|
|
7557
8660
|
}] } });
|
|
7558
8661
|
|
|
8662
|
+
const MNG_DATE_RANGE_VALUE_ACCESSOR = {
|
|
8663
|
+
provide: NG_VALUE_ACCESSOR,
|
|
8664
|
+
useExisting: forwardRef(() => MngDateRangeComponent),
|
|
8665
|
+
multi: true
|
|
8666
|
+
};
|
|
8667
|
+
class MngDateRangeComponent {
|
|
8668
|
+
constructor(formBuilder) {
|
|
8669
|
+
this.formBuilder = formBuilder;
|
|
8670
|
+
this.showTime = false;
|
|
8671
|
+
this.showSeconds = false;
|
|
8672
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
8673
|
+
this.onChangeFn = () => { };
|
|
8674
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
8675
|
+
this.onTouchedFn = () => { };
|
|
8676
|
+
this.subscriptions = [];
|
|
8677
|
+
}
|
|
8678
|
+
get fromCtrl() {
|
|
8679
|
+
return this.fromToFormControl.get('from');
|
|
8680
|
+
}
|
|
8681
|
+
get toCtrl() {
|
|
8682
|
+
return this.fromToFormControl.get('to');
|
|
8683
|
+
}
|
|
8684
|
+
get dateRangeCtrl() {
|
|
8685
|
+
return this.fromToFormControl.get('dateRange');
|
|
8686
|
+
}
|
|
8687
|
+
ngOnInit() {
|
|
8688
|
+
this.fromToFormControl = this.formBuilder.group({
|
|
8689
|
+
from: [],
|
|
8690
|
+
to: [],
|
|
8691
|
+
dateRange: []
|
|
8692
|
+
});
|
|
8693
|
+
this.subscriptions.push(merge(this.fromCtrl.valueChanges, this.toCtrl.valueChanges, this.dateRangeCtrl.valueChanges).subscribe(() => this.onValueChange()));
|
|
8694
|
+
}
|
|
8695
|
+
ngOnDestroy() {
|
|
8696
|
+
this.subscriptions.forEach(value => value.unsubscribe());
|
|
8697
|
+
}
|
|
8698
|
+
registerOnChange(fn) {
|
|
8699
|
+
this.onChangeFn = fn;
|
|
8700
|
+
}
|
|
8701
|
+
registerOnTouched(fn) {
|
|
8702
|
+
this.onTouchedFn = fn;
|
|
8703
|
+
}
|
|
8704
|
+
setDisabledState(isDisabled) {
|
|
8705
|
+
if (isDisabled) {
|
|
8706
|
+
this.fromToFormControl.disable();
|
|
8707
|
+
}
|
|
8708
|
+
else {
|
|
8709
|
+
this.fromToFormControl.enable();
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8712
|
+
writeValue(obj) {
|
|
8713
|
+
let startDate = null;
|
|
8714
|
+
let endDate = null;
|
|
8715
|
+
if (Array.isArray(obj)) {
|
|
8716
|
+
if (obj.length > 0 && (obj[0] instanceof Date || typeof obj[0] === 'string' || typeof obj[0] === 'number')) {
|
|
8717
|
+
startDate = new Date(obj[0]);
|
|
8718
|
+
}
|
|
8719
|
+
if (obj.length > 1 && (obj[1] instanceof Date || typeof obj[1] === 'string' || typeof obj[1] === 'number')) {
|
|
8720
|
+
endDate = new Date(obj[1]);
|
|
8721
|
+
}
|
|
8722
|
+
}
|
|
8723
|
+
else if (obj instanceof Date || typeof obj === 'string' || typeof obj === 'number') {
|
|
8724
|
+
startDate = new Date(obj);
|
|
8725
|
+
}
|
|
8726
|
+
if (this.showTime) {
|
|
8727
|
+
this.fromCtrl.setValue(startDate);
|
|
8728
|
+
this.toCtrl.setValue(endDate);
|
|
8729
|
+
}
|
|
8730
|
+
else {
|
|
8731
|
+
this.dateRangeCtrl.setValue([startDate, endDate]);
|
|
8732
|
+
}
|
|
8733
|
+
}
|
|
8734
|
+
onValueChange() {
|
|
8735
|
+
if (this.showTime) {
|
|
8736
|
+
const fromDate = this.fromCtrl.value;
|
|
8737
|
+
const toDate = this.toCtrl.value;
|
|
8738
|
+
this.onChangeFn([fromDate, toDate]);
|
|
8739
|
+
}
|
|
8740
|
+
else {
|
|
8741
|
+
const date = this.dateRangeCtrl.value;
|
|
8742
|
+
this.onChangeFn(date);
|
|
8743
|
+
}
|
|
8744
|
+
}
|
|
8745
|
+
}
|
|
8746
|
+
MngDateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngDateRangeComponent, deps: [{ token: i2$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
8747
|
+
MngDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngDateRangeComponent, selector: "mng-date-range", inputs: { placeholder: "placeholder", showTime: "showTime", showSeconds: "showSeconds", dateFormat: "dateFormat" }, providers: [MNG_DATE_RANGE_VALUE_ACCESSOR], ngImport: i0, template: "<ng-container *ngIf=\"showTime; else defaultRange\">\n <div class=\"flex gap-2\">\n <p-calendar\n appendTo=\"body\"\n [formControl]=\"fromCtrl\"\n [maxDate]=\"toCtrl.value\"\n [placeholder]=\"$any(placeholder)\"\n [dateFormat]=\"$any(dateFormat)\"\n [showTime]=\"showTime\"\n [showSeconds]=\"showSeconds\"\n [showIcon]=\"true\"\n (onFocus)=\"onTouchedFn()\"></p-calendar>\n <p-calendar\n appendTo=\"body\"\n [formControl]=\"toCtrl\"\n [minDate]=\"fromCtrl.value\"\n [placeholder]=\"$any(placeholder)\"\n [dateFormat]=\"$any(dateFormat)\"\n [showTime]=\"showTime\"\n [showSeconds]=\"showSeconds\"\n [showIcon]=\"true\"\n (onFocus)=\"onTouchedFn()\"></p-calendar>\n </div>\n</ng-container>\n<ng-template #defaultRange>\n <p-calendar\n appendTo=\"body\"\n [formControl]=\"dateRangeCtrl\"\n [placeholder]=\"$any(placeholder)\"\n [dateFormat]=\"$any(dateFormat)\"\n selectionMode=\"range\"\n [showIcon]=\"true\"\n (onFocus)=\"onTouchedFn()\"></p-calendar>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i4$3.Calendar, selector: "p-calendar", inputs: ["style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "view", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8748
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngDateRangeComponent, decorators: [{
|
|
8749
|
+
type: Component,
|
|
8750
|
+
args: [{ selector: 'mng-date-range', providers: [MNG_DATE_RANGE_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"showTime; else defaultRange\">\n <div class=\"flex gap-2\">\n <p-calendar\n appendTo=\"body\"\n [formControl]=\"fromCtrl\"\n [maxDate]=\"toCtrl.value\"\n [placeholder]=\"$any(placeholder)\"\n [dateFormat]=\"$any(dateFormat)\"\n [showTime]=\"showTime\"\n [showSeconds]=\"showSeconds\"\n [showIcon]=\"true\"\n (onFocus)=\"onTouchedFn()\"></p-calendar>\n <p-calendar\n appendTo=\"body\"\n [formControl]=\"toCtrl\"\n [minDate]=\"fromCtrl.value\"\n [placeholder]=\"$any(placeholder)\"\n [dateFormat]=\"$any(dateFormat)\"\n [showTime]=\"showTime\"\n [showSeconds]=\"showSeconds\"\n [showIcon]=\"true\"\n (onFocus)=\"onTouchedFn()\"></p-calendar>\n </div>\n</ng-container>\n<ng-template #defaultRange>\n <p-calendar\n appendTo=\"body\"\n [formControl]=\"dateRangeCtrl\"\n [placeholder]=\"$any(placeholder)\"\n [dateFormat]=\"$any(dateFormat)\"\n selectionMode=\"range\"\n [showIcon]=\"true\"\n (onFocus)=\"onTouchedFn()\"></p-calendar>\n</ng-template>\n" }]
|
|
8751
|
+
}], ctorParameters: function () { return [{ type: i2$1.FormBuilder }]; }, propDecorators: { placeholder: [{
|
|
8752
|
+
type: Input
|
|
8753
|
+
}], showTime: [{
|
|
8754
|
+
type: Input
|
|
8755
|
+
}], showSeconds: [{
|
|
8756
|
+
type: Input
|
|
8757
|
+
}], dateFormat: [{
|
|
8758
|
+
type: Input
|
|
8759
|
+
}] } });
|
|
8760
|
+
|
|
7559
8761
|
class MngActionEditorComponent {
|
|
7560
8762
|
constructor(injector, translate, actionExecutor, mngCommonsService, navigationService, dialogRef, dialogConfig, viewContainerService) {
|
|
7561
8763
|
this.injector = injector;
|
|
@@ -7745,7 +8947,7 @@ class MngActionEditorComponent {
|
|
|
7745
8947
|
}
|
|
7746
8948
|
}
|
|
7747
8949
|
MngActionEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionEditorComponent, deps: [{ token: i0.Injector }, { token: i1$2.TranslateService }, { token: MngActionExecutorService }, { token: MngCommonsService }, { token: MngNavigationService }, { token: i3.DynamicDialogRef, optional: true }, { token: i3.DynamicDialogConfig, optional: true }, { token: MngViewContainerComponentService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
7748
|
-
MngActionEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngActionEditorComponent, selector: "mng-action-editor", inputs: { action: "action", itemId: "itemId", item: "item", actionData: "actionData", dataProvider: "dataProvider", viewContainerInit: ["viewContainer", "viewContainerInit"] }, outputs: { actionRunEventEmitter: "actionSubmit", actionCancelEventEmitter: "actionCancel" }, queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], viewQueries: [{ propertyName: "submitButtonElementRef", first: true, predicate: ["submitButton"], descendants: true }, { propertyName: "editorComponent", first: true, predicate: MngFormEditorComponent, descendants: true }], ngImport: i0, template: "<h5 *ngIf=\"!isDialog && title\">{{ title }}</h5>\n<div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <p-toolbar styleClass=\"mng-action-editor-toolbar\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n </p-toolbar>\n </div>\n\n <div class=\"flex-grow-1\">\n <div class=\"text-center\" *ngIf=\"loading$ | async\">\n <p-progressSpinner [style]=\"{width: '3rem', height: '3rem'}\" strokeWidth=\"3\"></p-progressSpinner>\n </div>\n <mng-form-editor *ngIf=\"action.editorDescriptor && (loading$ | async) === false\" [descriptor]=\"action.editorDescriptor\" [item]=\"item\" (formSubmit)=\"onSubmit($event)\">\n </mng-form-editor>\n </div>\n\n <div class=\"flex flex-row justify-content-between\">\n <div>\n <mng-action *ngFor=\"let action of footerLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n <div>\n <mng-action *ngFor=\"let action of footerRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i6$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { kind: "component", type: i7$1.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: MngFormEditorComponent, selector: "mng-form-editor", inputs: ["descriptor", "submitLoading", "item", "isSubmitButtonVisible", "isFormDisabled"], outputs: ["formSubmit"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer"], outputs: ["finish"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8950
|
+
MngActionEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngActionEditorComponent, selector: "mng-action-editor", inputs: { action: "action", itemId: "itemId", item: "item", actionData: "actionData", dataProvider: "dataProvider", viewContainerInit: ["viewContainer", "viewContainerInit"] }, outputs: { actionRunEventEmitter: "actionSubmit", actionCancelEventEmitter: "actionCancel" }, queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], viewQueries: [{ propertyName: "submitButtonElementRef", first: true, predicate: ["submitButton"], descendants: true }, { propertyName: "editorComponent", first: true, predicate: MngFormEditorComponent, descendants: true }], ngImport: i0, template: "<h5 *ngIf=\"!isDialog && title\">{{ title }}</h5>\n<div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <p-toolbar styleClass=\"mng-action-editor-toolbar\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n </p-toolbar>\n </div>\n\n <div class=\"flex-grow-1\">\n <div class=\"text-center\" *ngIf=\"loading$ | async\">\n <p-progressSpinner [style]=\"{width: '3rem', height: '3rem'}\" strokeWidth=\"3\"></p-progressSpinner>\n </div>\n <mng-form-editor *ngIf=\"action.editorDescriptor && (loading$ | async) === false\" [descriptor]=\"action.editorDescriptor\" [item]=\"item\" (formSubmit)=\"onSubmit($event)\">\n </mng-form-editor>\n </div>\n\n <div class=\"flex flex-row justify-content-between\">\n <div>\n <mng-action *ngFor=\"let action of footerLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n <div>\n <mng-action *ngFor=\"let action of footerRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i6$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { kind: "component", type: i7$1.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: MngFormEditorComponent, selector: "mng-form-editor", inputs: ["descriptor", "submitLoading", "item", "isSubmitButtonVisible", "isFormDisabled"], outputs: ["formSubmit"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7749
8951
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionEditorComponent, decorators: [{
|
|
7750
8952
|
type: Component,
|
|
7751
8953
|
args: [{ selector: 'mng-action-editor', changeDetection: ChangeDetectionStrategy.OnPush, template: "<h5 *ngIf=\"!isDialog && title\">{{ title }}</h5>\n<div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <p-toolbar styleClass=\"mng-action-editor-toolbar\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n </p-toolbar>\n </div>\n\n <div class=\"flex-grow-1\">\n <div class=\"text-center\" *ngIf=\"loading$ | async\">\n <p-progressSpinner [style]=\"{width: '3rem', height: '3rem'}\" strokeWidth=\"3\"></p-progressSpinner>\n </div>\n <mng-form-editor *ngIf=\"action.editorDescriptor && (loading$ | async) === false\" [descriptor]=\"action.editorDescriptor\" [item]=\"item\" (formSubmit)=\"onSubmit($event)\">\n </mng-form-editor>\n </div>\n\n <div class=\"flex flex-row justify-content-between\">\n <div>\n <mng-action *ngFor=\"let action of footerLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n <div>\n <mng-action *ngFor=\"let action of footerRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n </div>\n</div>\n" }]
|
|
@@ -8092,9 +9294,17 @@ class MngTableColumnFilterComponent {
|
|
|
8092
9294
|
this.primeShowMatchMode = true;
|
|
8093
9295
|
this.primeDisplay = 'row';
|
|
8094
9296
|
this.primeMatchModes = null;
|
|
9297
|
+
this.dateDebounceSubject = new Subject();
|
|
9298
|
+
this.dateDebounceSubscription = this.dateDebounceSubject.pipe(debounceTime(500), distinctUntilChanged()).subscribe(v => {
|
|
9299
|
+
this.dateFilterCallback?.(v);
|
|
9300
|
+
});
|
|
9301
|
+
}
|
|
9302
|
+
get activeMatchMode() {
|
|
9303
|
+
const filter = this.primeColumnFilter?.dt.filters[this.descriptor.property];
|
|
9304
|
+
return filter?.matchMode;
|
|
8095
9305
|
}
|
|
8096
9306
|
ngOnInit() {
|
|
8097
|
-
this.primeDefaultMatchMode = this.descriptor.defaultFilterMatchMode;
|
|
9307
|
+
this.primeDefaultMatchMode = this.descriptor.defaultFilterMatchMode ?? FilterMatchModeEnum.Equals;
|
|
8098
9308
|
switch (this.descriptor.filterType) {
|
|
8099
9309
|
case FilterTypeEnum.Boolean:
|
|
8100
9310
|
this.primeType = 'boolean';
|
|
@@ -8105,7 +9315,7 @@ class MngTableColumnFilterComponent {
|
|
|
8105
9315
|
break;
|
|
8106
9316
|
case FilterTypeEnum.Date:
|
|
8107
9317
|
this.primeType = 'date';
|
|
8108
|
-
this.primeDefaultMatchMode =
|
|
9318
|
+
this.primeDefaultMatchMode = FilterMatchModeEnum.DateIs;
|
|
8109
9319
|
break;
|
|
8110
9320
|
case FilterTypeEnum.Lookup:
|
|
8111
9321
|
this.primeType = 'lookup';
|
|
@@ -8113,10 +9323,13 @@ class MngTableColumnFilterComponent {
|
|
|
8113
9323
|
this.lookupDescriptor = this.descriptor;
|
|
8114
9324
|
this.primeField = `${this.descriptor.property}${this.lookupDescriptor.itemsValueProperty ? `.${this.lookupDescriptor.itemsValueProperty}` : ''}`;
|
|
8115
9325
|
this.primeMatchModes = [{ value: FilterMatchModeEnum.Equals, label: this.primeConfig.getTranslation(FilterMatchModeEnum.Equals) }];
|
|
9326
|
+
if (this.lookupDescriptor.multiselect) {
|
|
9327
|
+
this.primeDefaultMatchMode = FilterMatchModeEnum.In;
|
|
9328
|
+
}
|
|
8116
9329
|
break;
|
|
8117
9330
|
case FilterTypeEnum.String:
|
|
8118
9331
|
this.primeType = 'text';
|
|
8119
|
-
this.primeDefaultMatchMode =
|
|
9332
|
+
this.primeDefaultMatchMode = FilterMatchModeEnum.Contains;
|
|
8120
9333
|
break;
|
|
8121
9334
|
}
|
|
8122
9335
|
if (this.descriptor.matchModes) {
|
|
@@ -8130,20 +9343,22 @@ class MngTableColumnFilterComponent {
|
|
|
8130
9343
|
this.primeDisplay = 'menu';
|
|
8131
9344
|
}
|
|
8132
9345
|
}
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
8136
|
-
return new Date(value);
|
|
8137
|
-
}
|
|
8138
|
-
else if (value instanceof Date) {
|
|
8139
|
-
return value;
|
|
8140
|
-
}
|
|
8141
|
-
else {
|
|
8142
|
-
return null;
|
|
8143
|
-
}
|
|
9346
|
+
ngOnDestroy() {
|
|
9347
|
+
this.dateDebounceSubscription?.unsubscribe();
|
|
8144
9348
|
}
|
|
8145
9349
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
8146
9350
|
dateFilter(value, filterCallback) {
|
|
9351
|
+
this.dateFilterCallback = filterCallback;
|
|
9352
|
+
if (this.activeMatchMode === FilterMatchModeEnum.Between && Array.isArray(value)) {
|
|
9353
|
+
const dateValues = value.filter(v => v instanceof Date);
|
|
9354
|
+
if (dateValues.length <= 1) {
|
|
9355
|
+
return;
|
|
9356
|
+
}
|
|
9357
|
+
}
|
|
9358
|
+
this.dateDebounceSubject.next(value);
|
|
9359
|
+
}
|
|
9360
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
9361
|
+
dateRangeChange(value, filterCallback) {
|
|
8147
9362
|
filterCallback(value);
|
|
8148
9363
|
}
|
|
8149
9364
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -8157,19 +9372,19 @@ class MngTableColumnFilterComponent {
|
|
|
8157
9372
|
}
|
|
8158
9373
|
filterCallback(value);
|
|
8159
9374
|
}
|
|
8160
|
-
toLookupFilterValue(value) {
|
|
8161
|
-
return this.lookupDescriptor.dataKeyProperty && value ? { [this.lookupDescriptor.dataKeyProperty]: value } : value;
|
|
8162
|
-
}
|
|
8163
9375
|
}
|
|
8164
9376
|
MngTableColumnFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableColumnFilterComponent, deps: [{ token: i2.PrimeNGConfig }], target: i0.ɵɵFactoryTarget.Component });
|
|
8165
|
-
MngTableColumnFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: { descriptor: "descriptor", display: "display" }, ngImport: i0, template: "<p-columnFilter\n class=\"ml-auto\"\n [type]=\"primeType\"\n [field]=\"descriptor.property\"\n [display]=\"primeDisplay\"\n [matchMode]=\"primeDefaultMatchMode\"\n [matchModeOptions]=\"$any(primeMatchModes)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showMatchModes]=\"true\"\n [showOperator]=\"false\"\n [showAddButton]=\"false\"\n [hideOnClear]=\"true\"\n [showMenu]=\"primeShowMatchMode\"\n [minFractionDigits]=\"$any(descriptor.numberMinFractionDigits)\"\n [maxFractionDigits]=\"$any(descriptor.numberMaxFractionDigits)\"\n [useGrouping]=\"descriptor.numberUseGrouping\">\n <ng-template *ngIf=\"primeType === 'date'\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <p-calendar\n
|
|
9377
|
+
MngTableColumnFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: { descriptor: "descriptor", display: "display" }, viewQueries: [{ propertyName: "primeColumnFilter", first: true, predicate: ColumnFilter, descendants: true }], ngImport: i0, template: "<p-columnFilter\n class=\"ml-auto\"\n [type]=\"primeType\"\n [field]=\"descriptor.property\"\n [display]=\"primeDisplay\"\n [matchMode]=\"$any(primeDefaultMatchMode)\"\n [matchModeOptions]=\"$any(primeMatchModes)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showMatchModes]=\"true\"\n [showOperator]=\"false\"\n [showAddButton]=\"false\"\n [hideOnClear]=\"true\"\n [showMenu]=\"primeShowMatchMode\"\n [minFractionDigits]=\"$any(descriptor.numberMinFractionDigits)\"\n [maxFractionDigits]=\"$any(descriptor.numberMaxFractionDigits)\"\n [useGrouping]=\"descriptor.numberUseGrouping\">\n <ng-template *ngIf=\"primeType === 'date'\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <ng-container *ngIf=\"activeMatchMode === 'between'; else datePicker\">\n <mng-date-range\n [ngModel]=\"value\"\n (ngModelChange)=\"dateFilter($event, filterCallback)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [dateFormat]=\"descriptor.datePickerFormat\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"></mng-date-range>\n </ng-container>\n <ng-template #datePicker>\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"value\"\n (ngModelChange)=\"dateFilter($event, filterCallback)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [dateFormat]=\"descriptor.datePickerFormat ?? 'dd.mm.yy'\"\n [showTime]=\"descriptor.datePickerShowTime\">\n </p-calendar>\n </ng-template>\n </ng-template>\n <ng-template *ngIf=\"lookupDescriptor\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <ng-container [ngSwitch]=\"lookupDescriptor.lookupType\">\n <mng-autocomplete\n *ngSwitchCase=\"lookupTypeAutocomplete\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsValueProperty]=\"lookupDescriptor.itemsValueProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [itemsLabelTranslate]=\"lookupDescriptor.itemsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [openOnFocus]=\"lookupDescriptor.autocompleteOpenOnFocus\"\n [inlineSearch]=\"lookupDescriptor.autocompleteInlineSearch\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n (valueChange)=\"autocompleteFilter($event, filterCallback)\">\n </mng-autocomplete>\n <mng-dropdown\n *ngSwitchCase=\"lookupTypeDropdown\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [itemsValueProperty]=\"lookupDescriptor.itemsValueProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [itemsLabelTranslate]=\"lookupDescriptor.itemsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"lookupDescriptor.multiselect\"\n (valueChange)=\"dropdownFilter($event, filterCallback)\">\n </mng-dropdown>\n </ng-container>\n </ng-template>\n</p-columnFilter>\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i4$3.Calendar, selector: "p-calendar", inputs: ["style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "view", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i6$4.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping"] }, { kind: "component", type: MngAutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "dataKeyProperty", "itemsValueProperty", "itemsLabelProperty", "itemsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName"], outputs: ["valueChange"] }, { kind: "component", type: MngDropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "dataKeyProperty", "itemsLabelProperty", "itemsLabelTranslate", "itemsValueProperty", "itemsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur"], outputs: ["valueChange"] }, { kind: "component", type: MngDateRangeComponent, selector: "mng-date-range", inputs: ["placeholder", "showTime", "showSeconds", "dateFormat"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }] });
|
|
8166
9378
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableColumnFilterComponent, decorators: [{
|
|
8167
9379
|
type: Component,
|
|
8168
|
-
args: [{ selector: 'mng-table-column-filter', template: "<p-columnFilter\n class=\"ml-auto\"\n [type]=\"primeType\"\n [field]=\"descriptor.property\"\n [display]=\"primeDisplay\"\n [matchMode]=\"primeDefaultMatchMode\"\n [matchModeOptions]=\"$any(primeMatchModes)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showMatchModes]=\"true\"\n [showOperator]=\"false\"\n [showAddButton]=\"false\"\n [hideOnClear]=\"true\"\n [showMenu]=\"primeShowMatchMode\"\n [minFractionDigits]=\"$any(descriptor.numberMinFractionDigits)\"\n [maxFractionDigits]=\"$any(descriptor.numberMaxFractionDigits)\"\n [useGrouping]=\"descriptor.numberUseGrouping\">\n <ng-template *ngIf=\"primeType === 'date'\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <p-calendar\n
|
|
9380
|
+
args: [{ selector: 'mng-table-column-filter', template: "<p-columnFilter\n class=\"ml-auto\"\n [type]=\"primeType\"\n [field]=\"descriptor.property\"\n [display]=\"primeDisplay\"\n [matchMode]=\"$any(primeDefaultMatchMode)\"\n [matchModeOptions]=\"$any(primeMatchModes)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showMatchModes]=\"true\"\n [showOperator]=\"false\"\n [showAddButton]=\"false\"\n [hideOnClear]=\"true\"\n [showMenu]=\"primeShowMatchMode\"\n [minFractionDigits]=\"$any(descriptor.numberMinFractionDigits)\"\n [maxFractionDigits]=\"$any(descriptor.numberMaxFractionDigits)\"\n [useGrouping]=\"descriptor.numberUseGrouping\">\n <ng-template *ngIf=\"primeType === 'date'\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <ng-container *ngIf=\"activeMatchMode === 'between'; else datePicker\">\n <mng-date-range\n [ngModel]=\"value\"\n (ngModelChange)=\"dateFilter($event, filterCallback)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [dateFormat]=\"descriptor.datePickerFormat\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"></mng-date-range>\n </ng-container>\n <ng-template #datePicker>\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"value\"\n (ngModelChange)=\"dateFilter($event, filterCallback)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [dateFormat]=\"descriptor.datePickerFormat ?? 'dd.mm.yy'\"\n [showTime]=\"descriptor.datePickerShowTime\">\n </p-calendar>\n </ng-template>\n </ng-template>\n <ng-template *ngIf=\"lookupDescriptor\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <ng-container [ngSwitch]=\"lookupDescriptor.lookupType\">\n <mng-autocomplete\n *ngSwitchCase=\"lookupTypeAutocomplete\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsValueProperty]=\"lookupDescriptor.itemsValueProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [itemsLabelTranslate]=\"lookupDescriptor.itemsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [openOnFocus]=\"lookupDescriptor.autocompleteOpenOnFocus\"\n [inlineSearch]=\"lookupDescriptor.autocompleteInlineSearch\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n (valueChange)=\"autocompleteFilter($event, filterCallback)\">\n </mng-autocomplete>\n <mng-dropdown\n *ngSwitchCase=\"lookupTypeDropdown\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [itemsValueProperty]=\"lookupDescriptor.itemsValueProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [itemsLabelTranslate]=\"lookupDescriptor.itemsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"lookupDescriptor.multiselect\"\n (valueChange)=\"dropdownFilter($event, filterCallback)\">\n </mng-dropdown>\n </ng-container>\n </ng-template>\n</p-columnFilter>\n" }]
|
|
8169
9381
|
}], ctorParameters: function () { return [{ type: i2.PrimeNGConfig }]; }, propDecorators: { descriptor: [{
|
|
8170
9382
|
type: Input
|
|
8171
9383
|
}], display: [{
|
|
8172
9384
|
type: Input
|
|
9385
|
+
}], primeColumnFilter: [{
|
|
9386
|
+
type: ViewChild,
|
|
9387
|
+
args: [ColumnFilter]
|
|
8173
9388
|
}] } });
|
|
8174
9389
|
|
|
8175
9390
|
class MngTableComponent {
|
|
@@ -8218,6 +9433,7 @@ class MngTableComponent {
|
|
|
8218
9433
|
this.dataProviderLatestLazyLoadEventVersion = 0;
|
|
8219
9434
|
this.dataProviderLatestQueryParamVersion = 0;
|
|
8220
9435
|
// filter, sort
|
|
9436
|
+
this.hasColumnFilters = false;
|
|
8221
9437
|
this.isFilterChanged = false;
|
|
8222
9438
|
this.isSortChanged = false;
|
|
8223
9439
|
this.filterDescriptors = [];
|
|
@@ -8229,10 +9445,14 @@ class MngTableComponent {
|
|
|
8229
9445
|
}
|
|
8230
9446
|
ngOnInit() {
|
|
8231
9447
|
this.viewContainer = this.viewContainerInit ?? this.viewContainerService ?? undefined;
|
|
8232
|
-
|
|
9448
|
+
if (!(this.initialDescriptor instanceof TableDynamicDescriptor)) {
|
|
9449
|
+
this.descriptor = this.initialDescriptor;
|
|
9450
|
+
}
|
|
8233
9451
|
// map row settings
|
|
8234
|
-
this.
|
|
8235
|
-
this.
|
|
9452
|
+
this.filterDescriptors = this.descriptor?.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor) ?? [];
|
|
9453
|
+
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
9454
|
+
this.rows = this.descriptor?.defaultNumRows ?? 25;
|
|
9455
|
+
this.rowsPerPageOptions = this.descriptor?.rowsPerPageOptions ?? [25, 50, 100];
|
|
8236
9456
|
// process actions
|
|
8237
9457
|
for (const action of this.actions) {
|
|
8238
9458
|
switch (action.position) {
|
|
@@ -8246,14 +9466,14 @@ class MngTableComponent {
|
|
|
8246
9466
|
}
|
|
8247
9467
|
this.showInlineActionsColumn = typeof this.columnActionComponent !== 'undefined' || this.rowInlineActions.length > 0;
|
|
8248
9468
|
// define all styles
|
|
8249
|
-
this.className = this.descriptor
|
|
8250
|
-
this.tableFullHeightOffset = this.descriptor
|
|
8251
|
-
this.rowHeight = this.descriptor
|
|
9469
|
+
this.className = this.descriptor?.className ?? '';
|
|
9470
|
+
this.tableFullHeightOffset = this.descriptor?.tableFullHeightOffset ?? null;
|
|
9471
|
+
this.rowHeight = this.descriptor?.rowHeight ?? null;
|
|
8252
9472
|
if (typeof this.isColumnClickable === 'undefined') {
|
|
8253
9473
|
// define if cell click is being observed via output
|
|
8254
9474
|
this.isColumnClickable = this.rowClickActions.length > 0 || this.cellClickEventEmitter.observed;
|
|
8255
9475
|
}
|
|
8256
|
-
switch (this.descriptor
|
|
9476
|
+
switch (this.descriptor?.size) {
|
|
8257
9477
|
case TableSizeEnum.Small:
|
|
8258
9478
|
this.className += ' p-datatable-sm';
|
|
8259
9479
|
break;
|
|
@@ -8261,14 +9481,14 @@ class MngTableComponent {
|
|
|
8261
9481
|
this.className += ' p-datatable-lg';
|
|
8262
9482
|
break;
|
|
8263
9483
|
}
|
|
8264
|
-
if (this.descriptor
|
|
9484
|
+
if (this.descriptor?.hasGridlines) {
|
|
8265
9485
|
this.className += ' p-datatable-gridlines';
|
|
8266
9486
|
}
|
|
8267
|
-
if (!this.columnActionMinWidth) {
|
|
9487
|
+
if (this.descriptor && !this.columnActionMinWidth) {
|
|
8268
9488
|
this.columnActionMinWidth = StylesUtil.calculateTableColumnActionWidth(this.descriptor, this.rowInlineActions);
|
|
8269
9489
|
}
|
|
8270
9490
|
// check if infinite scroll
|
|
8271
|
-
if (this.descriptor
|
|
9491
|
+
if (this.descriptor?.paginationMode === TablePaginationModeEnum.InfiniteScroll) {
|
|
8272
9492
|
this.infiniteScroll = true;
|
|
8273
9493
|
this.scrollHeight = 'flex';
|
|
8274
9494
|
this.tableFullHeightOffset = this.descriptor.tableFullHeightOffset ?? 315;
|
|
@@ -8290,6 +9510,12 @@ class MngTableComponent {
|
|
|
8290
9510
|
if (this.dataProvider.serviceType) {
|
|
8291
9511
|
this.dataProviderService = this.injector.get(this.dataProvider.serviceType);
|
|
8292
9512
|
}
|
|
9513
|
+
const reloadSubscription = this.dataProvider.getAllReload$.subscribe({
|
|
9514
|
+
next: () => {
|
|
9515
|
+
this.reload();
|
|
9516
|
+
}
|
|
9517
|
+
});
|
|
9518
|
+
this.subscriptions.push(reloadSubscription);
|
|
8293
9519
|
}
|
|
8294
9520
|
else {
|
|
8295
9521
|
// if query result is provided, use it as secondary source or else try to use items
|
|
@@ -8316,7 +9542,7 @@ class MngTableComponent {
|
|
|
8316
9542
|
}
|
|
8317
9543
|
const initialQueryParamMap = this.route.snapshot.queryParamMap;
|
|
8318
9544
|
if (this.useQueryParams &&
|
|
8319
|
-
((!initialQueryParamMap.has('sort') && this.descriptor
|
|
9545
|
+
((!initialQueryParamMap.has('sort') && this.descriptor?.hasDefaultSort) ||
|
|
8320
9546
|
(!initialQueryParamMap.has('filter') && this.filterDescriptors.some(fd => fd.hasDefaultValue)))) {
|
|
8321
9547
|
// default sort/filters are applied, no additional filtering/sorting is specified in query param
|
|
8322
9548
|
// redirect must be done at first step
|
|
@@ -8364,7 +9590,12 @@ class MngTableComponent {
|
|
|
8364
9590
|
this.subscriptions.forEach(s => s.unsubscribe());
|
|
8365
9591
|
}
|
|
8366
9592
|
reload(emitEvent = false, resetParams = false) {
|
|
8367
|
-
|
|
9593
|
+
const queryParamsBuilder = resetParams
|
|
9594
|
+
? MediusQueryParamBuilder.create(this.rowsPerPageOptions[0], 0)
|
|
9595
|
+
: MediusQueryParamBuilder.createFromExisting(this.dataProviderLatestQueryParam ?? new MediusQueryParam())
|
|
9596
|
+
.withItemsPerPage(this.rows)
|
|
9597
|
+
.withItemsOffset(this.offset);
|
|
9598
|
+
this.loadTableWithDataProvider(queryParamsBuilder.build(), emitEvent);
|
|
8368
9599
|
}
|
|
8369
9600
|
onTableLazyLoad(event) {
|
|
8370
9601
|
this.dataProviderLatestLazyLoadEvent = event;
|
|
@@ -8430,8 +9661,16 @@ class MngTableComponent {
|
|
|
8430
9661
|
}
|
|
8431
9662
|
this.dataProviderLatestQueryParam = queryParam;
|
|
8432
9663
|
this.dataProviderLatestQueryParamVersion++;
|
|
9664
|
+
MediusRestUtil.modifyFilterProperties(queryParam, this.filterDescriptors);
|
|
8433
9665
|
this.dataProviderSubscription = this.dataProvider?.getAll(queryParam, this.dataProviderService).subscribe({
|
|
8434
9666
|
next: res => {
|
|
9667
|
+
if (this.initialDescriptor instanceof TableDynamicDescriptor) {
|
|
9668
|
+
this.descriptor = this.initialDescriptor.toTableDescriptorFromData(res);
|
|
9669
|
+
this.filterDescriptors = this.descriptor.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor);
|
|
9670
|
+
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
9671
|
+
// } else {
|
|
9672
|
+
// this.descriptor = this.initialDescriptor.onDataReceivedTypeBuilding(res);
|
|
9673
|
+
}
|
|
8435
9674
|
if (this.infiniteScroll) {
|
|
8436
9675
|
if (this.isFilterChanged || this.isSortChanged) {
|
|
8437
9676
|
this.dataProviderInfiniteScrollItems = [];
|
|
@@ -8447,6 +9686,7 @@ class MngTableComponent {
|
|
|
8447
9686
|
this.dataProviderLoadingSubject.next(false);
|
|
8448
9687
|
},
|
|
8449
9688
|
error: err => {
|
|
9689
|
+
// TODO: check what happens on error with no model iniside descriptor
|
|
8450
9690
|
NotificationUtil.tableNotificationError(this.translate, this.descriptor, err, this.viewContainer);
|
|
8451
9691
|
const emptyQueryResult = new MediusQueryResult();
|
|
8452
9692
|
emptyQueryResult.pageData = [];
|
|
@@ -8490,7 +9730,7 @@ class MngTableComponent {
|
|
|
8490
9730
|
const applyDefaultFilters = (params.filterParams?.length ?? 0) === 0;
|
|
8491
9731
|
this.filterDescriptors.forEach(f => {
|
|
8492
9732
|
let matchMode;
|
|
8493
|
-
if (f.
|
|
9733
|
+
if (f.defaultFilterMatchMode) {
|
|
8494
9734
|
matchMode = f.defaultFilterMatchMode;
|
|
8495
9735
|
}
|
|
8496
9736
|
else {
|
|
@@ -8499,7 +9739,7 @@ class MngTableComponent {
|
|
|
8499
9739
|
matchMode = FilterMatchMode.CONTAINS;
|
|
8500
9740
|
break;
|
|
8501
9741
|
case FilterTypeEnum.Date:
|
|
8502
|
-
matchMode = FilterMatchMode.
|
|
9742
|
+
matchMode = FilterMatchMode.DATE_IS;
|
|
8503
9743
|
break;
|
|
8504
9744
|
case FilterTypeEnum.Lookup:
|
|
8505
9745
|
case FilterTypeEnum.LookupEnum: {
|
|
@@ -8531,6 +9771,11 @@ class MngTableComponent {
|
|
|
8531
9771
|
if (typeof filterValue === 'string' || typeof filterValue === 'number') {
|
|
8532
9772
|
filterValue = new Date(filterValue);
|
|
8533
9773
|
}
|
|
9774
|
+
// if range is provided, take that into account
|
|
9775
|
+
if (typeof f.filterValueTo === 'string' || typeof f.filterValueTo === 'number') {
|
|
9776
|
+
const filterValueTo = new Date(f.filterValueTo);
|
|
9777
|
+
filterValue = [filterValue, filterValueTo];
|
|
9778
|
+
}
|
|
8534
9779
|
}
|
|
8535
9780
|
primeFilterMeta[descriptor.property] = {
|
|
8536
9781
|
value: filterValue,
|
|
@@ -8550,7 +9795,7 @@ class MngTableComponent {
|
|
|
8550
9795
|
}
|
|
8551
9796
|
let sortMeta;
|
|
8552
9797
|
const applyDefaultSorts = (params.sortProperty?.length ?? 0) === 0;
|
|
8553
|
-
if (applyDefaultSorts && this.descriptor
|
|
9798
|
+
if (applyDefaultSorts && this.descriptor?.hasDefaultSort) {
|
|
8554
9799
|
sortMeta = this.descriptor.defaultSortProperty.map((p, idx) => ({
|
|
8555
9800
|
field: p,
|
|
8556
9801
|
order: this.descriptor.defaultSortAsc[idx] ? 1 : -1
|
|
@@ -8595,14 +9840,15 @@ class MngTableComponent {
|
|
|
8595
9840
|
}
|
|
8596
9841
|
}
|
|
8597
9842
|
MngTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableComponent, deps: [{ token: i0.Injector }, { token: i1.Router }, { token: i1.ActivatedRoute }, { token: i1$2.TranslateService }, { token: MngActionExecutorService }, { token: MngViewContainerComponentService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
8598
|
-
MngTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableComponent, selector: "mng-table", inputs: { descriptor: "descriptor", 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" }, 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]=\"scrollHeight === 'flex' ? '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]=\"$any(descriptor.dataKeyProperty)\"\n [lazy]=\"useDataProvider\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"useDataProvider && !infiniteScroll\"\n [rows]=\"$any(infiniteScroll ? 20 : rows)\"\n [first]=\"$any(infiniteScroll ? 0 : offset)\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"$any(infiniteScroll ? null : rowsPerPageOptions)\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"$any(multiSortMeta)\"\n [filters]=\"filterMetadata\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [scrollable]=\"infiniteScroll\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualRowHeight]=\"$any(rowHeight)\"\n [scrollHeight]=\"$any(scrollHeight)\"\n [selectionMode]=\"$any(selectionEnabled ? selectionMode : null)\"\n [rowHover]=\"descriptor.hasHover\"\n [styleClass]=\"className\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\"\n sortMode=\"multiple\"\n responsiveLayout=\"scroll\"\n [resizableColumns]=\"true\"\n [autoLayout]=\"true\">\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\">\n <th *ngIf=\"selectionEnabled && selectionMode === 'multiple'\">\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\"></th>\n <ng-container *ngFor=\"let col of descriptor.columns\">\n <th *ngIf=\"col.isSortEnabled\" [pSortableColumn]=\"col.property\" [class]=\"col.headerClassName\" [style.width.%]=\"col.width\" [style.min-width.px]=\"col.minWidth\">\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.title ?? (col.property | i18nProperty: descriptor.model) | translate }}\n <p-sortIcon [field]=\"col.property\"></p-sortIcon>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"!col.isSortEnabled\">\n {{ col.title ?? (col.property | i18nProperty: descriptor.model) | translate }}\n <ng-container>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </ng-container>\n </th>\n </ng-container>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n <tr *ngIf=\"descriptor.filterDisplay === filterDisplayRow\" 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 && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <th\n *ngFor=\"let col of descriptor.columns\"\n [class]=\"(col.filterDescriptor ? 'mng-column-filter-' + col.filterDescriptor.filterType + ' ' : ' ') + col.filterDescriptor?.columnClassName\"\n [style.width.%]=\"col.filterDescriptor?.columnWidth ?? col.width\"\n [style.min-width.px]=\"col.filterDescriptor?.columnMinWidth ?? col.minWidth\">\n <div class=\"flex\" *ngIf=\"col.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor.filterDisplay\" [descriptor]=\"col.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr [style.height.px]=\"rowHeight\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"width: 3rem\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"width: 3rem\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <td\n *ngFor=\"let col of descriptor.columns\"\n (click)=\"onCellClick($event, col, item, idx)\"\n [class]=\"col.className\"\n [class.clickable]=\"isColumnClickable\"\n [style.width.%]=\"col.width\"\n [style.min-width.px]=\"col.minWidth\">\n <mng-table-column-value [descriptor]=\"col\" [item]=\"item\"></mng-table-column-value>\n </td>\n <td *ngIf=\"showInlineActionsColumn\" class=\"column-action text-right\" [style.min-width.px]=\"columnActionMinWidth\">\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 [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=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"descriptor.columns.length + (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 + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i6$4.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", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i6$4.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i6$4.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i6$4.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i6$4.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i6$4.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i7$3.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "directive", type: MngComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "inputs"], outputs: ["instanceCreated"] }, { kind: "component", type: MngTableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "component", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: ["descriptor", "display"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer"], outputs: ["finish"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: MngI18nPropertyPipe, name: "i18nProperty" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9843
|
+
MngTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableComponent, 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" }, 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]=\"scrollHeight === 'flex' ? '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]=\"$any(descriptor?.dataKeyProperty ?? null)\"\n [lazy]=\"useDataProvider\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"useDataProvider && !infiniteScroll\"\n [rows]=\"$any(infiniteScroll ? 20 : rows)\"\n [first]=\"$any(infiniteScroll ? 0 : offset)\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"$any(infiniteScroll ? null : rowsPerPageOptions)\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"$any(multiSortMeta)\"\n [filters]=\"filterMetadata\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [scrollable]=\"infiniteScroll\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualRowHeight]=\"$any(rowHeight)\"\n [scrollHeight]=\"$any(scrollHeight)\"\n [selectionMode]=\"$any(selectionEnabled ? selectionMode : null)\"\n [rowHover]=\"descriptor?.hasHover ?? true\"\n [styleClass]=\"className\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\"\n sortMode=\"multiple\"\n responsiveLayout=\"scroll\"\n [resizableColumns]=\"true\"\n [autoLayout]=\"true\">\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'\">\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\"></th>\n <ng-container *ngFor=\"let col of descriptor?.columns\">\n <th *ngIf=\"col.isSortEnabled\" [pSortableColumn]=\"col.property\" [style.width.%]=\"col.width\" [style.min-width.px]=\"col.minWidth\" [class]=\"col.headerClassName\">\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.title ?? (col.property | i18nProperty: descriptor!.model) | translate }}\n <p-sortIcon [field]=\"col.property\"></p-sortIcon>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor!.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor!.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"!col.isSortEnabled\">\n {{ col.title ?? (col.property | i18nProperty: descriptor!.model) | translate }}\n <ng-container>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor!.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor!.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </ng-container>\n </th>\n </ng-container>\n <th *ngIf=\"showInlineActionsColumn\"></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 && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <th\n *ngFor=\"let col of descriptor?.columns\"\n [class]=\"(col.filterDescriptor ? 'mng-column-filter-' + col.filterDescriptor.filterType + ' ' : ' ') + col.filterDescriptor?.columnClassName\"\n [style.width.%]=\"col.filterDescriptor?.columnWidth ?? col.width\"\n [style.min-width.px]=\"col.filterDescriptor?.columnMinWidth ?? col.minWidth\">\n <div class=\"flex\" *ngIf=\"col.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor!.filterDisplay\" [descriptor]=\"col.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr [style.height.px]=\"rowHeight\" [class]=\"descriptor?.rowClassName | mngClassMapPipe: descriptor?.rowClassNameMapFn:item\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"width: 3rem\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"width: 3rem\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <td\n *ngFor=\"let col of descriptor?.columns\"\n (click)=\"onCellClick($event, col, item, idx)\"\n [class]=\"col.className\"\n [class.clickable]=\"isColumnClickable\"\n [style.width.%]=\"col.width\"\n [style.min-width.px]=\"col.minWidth\">\n <mng-table-column-value [descriptor]=\"col\" [item]=\"item\"></mng-table-column-value>\n </td>\n <td *ngIf=\"showInlineActionsColumn\" class=\"column-action text-right\" [style.min-width.px]=\"columnActionMinWidth\">\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 [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=\"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 </p-table>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i6$4.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", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i6$4.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i6$4.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i6$4.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i6$4.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i6$4.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i7$3.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "directive", type: MngComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "inputs"], outputs: ["instanceCreated"] }, { kind: "component", type: MngTableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "component", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: ["descriptor", "display"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: MngI18nPropertyPipe, name: "i18nProperty" }, { kind: "pipe", type: MngClassMapPipe, name: "mngClassMapPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8599
9844
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableComponent, decorators: [{
|
|
8600
9845
|
type: Component,
|
|
8601
|
-
args: [{ selector: 'mng-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.height]=\"scrollHeight === 'flex' ? '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]=\"$any(descriptor
|
|
9846
|
+
args: [{ selector: 'mng-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.height]=\"scrollHeight === 'flex' ? '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]=\"$any(descriptor?.dataKeyProperty ?? null)\"\n [lazy]=\"useDataProvider\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"useDataProvider && !infiniteScroll\"\n [rows]=\"$any(infiniteScroll ? 20 : rows)\"\n [first]=\"$any(infiniteScroll ? 0 : offset)\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"$any(infiniteScroll ? null : rowsPerPageOptions)\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"$any(multiSortMeta)\"\n [filters]=\"filterMetadata\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [scrollable]=\"infiniteScroll\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualRowHeight]=\"$any(rowHeight)\"\n [scrollHeight]=\"$any(scrollHeight)\"\n [selectionMode]=\"$any(selectionEnabled ? selectionMode : null)\"\n [rowHover]=\"descriptor?.hasHover ?? true\"\n [styleClass]=\"className\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\"\n sortMode=\"multiple\"\n responsiveLayout=\"scroll\"\n [resizableColumns]=\"true\"\n [autoLayout]=\"true\">\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'\">\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\"></th>\n <ng-container *ngFor=\"let col of descriptor?.columns\">\n <th *ngIf=\"col.isSortEnabled\" [pSortableColumn]=\"col.property\" [style.width.%]=\"col.width\" [style.min-width.px]=\"col.minWidth\" [class]=\"col.headerClassName\">\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.title ?? (col.property | i18nProperty: descriptor!.model) | translate }}\n <p-sortIcon [field]=\"col.property\"></p-sortIcon>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor!.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor!.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"!col.isSortEnabled\">\n {{ col.title ?? (col.property | i18nProperty: descriptor!.model) | translate }}\n <ng-container>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor!.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor!.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </ng-container>\n </th>\n </ng-container>\n <th *ngIf=\"showInlineActionsColumn\"></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 && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <th\n *ngFor=\"let col of descriptor?.columns\"\n [class]=\"(col.filterDescriptor ? 'mng-column-filter-' + col.filterDescriptor.filterType + ' ' : ' ') + col.filterDescriptor?.columnClassName\"\n [style.width.%]=\"col.filterDescriptor?.columnWidth ?? col.width\"\n [style.min-width.px]=\"col.filterDescriptor?.columnMinWidth ?? col.minWidth\">\n <div class=\"flex\" *ngIf=\"col.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor!.filterDisplay\" [descriptor]=\"col.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr [style.height.px]=\"rowHeight\" [class]=\"descriptor?.rowClassName | mngClassMapPipe: descriptor?.rowClassNameMapFn:item\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"width: 3rem\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"width: 3rem\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <td\n *ngFor=\"let col of descriptor?.columns\"\n (click)=\"onCellClick($event, col, item, idx)\"\n [class]=\"col.className\"\n [class.clickable]=\"isColumnClickable\"\n [style.width.%]=\"col.width\"\n [style.min-width.px]=\"col.minWidth\">\n <mng-table-column-value [descriptor]=\"col\" [item]=\"item\"></mng-table-column-value>\n </td>\n <td *ngIf=\"showInlineActionsColumn\" class=\"column-action text-right\" [style.min-width.px]=\"columnActionMinWidth\">\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 [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=\"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 </p-table>\n</div>\n" }]
|
|
8602
9847
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.Router }, { type: i1.ActivatedRoute }, { type: i1$2.TranslateService }, { type: MngActionExecutorService }, { type: MngViewContainerComponentService, decorators: [{
|
|
8603
9848
|
type: Optional
|
|
8604
|
-
}] }]; }, propDecorators: {
|
|
8605
|
-
type: Input
|
|
9849
|
+
}] }]; }, propDecorators: { initialDescriptor: [{
|
|
9850
|
+
type: Input,
|
|
9851
|
+
args: ['descriptor']
|
|
8606
9852
|
}], items: [{
|
|
8607
9853
|
type: Input
|
|
8608
9854
|
}], queryResult: [{
|
|
@@ -8671,6 +9917,8 @@ class MngTableviewComponent {
|
|
|
8671
9917
|
this.toolbarLeftActions = [];
|
|
8672
9918
|
this.toolbarRightActions = [];
|
|
8673
9919
|
this.subscriptions = [];
|
|
9920
|
+
this.hasItemSelectionAction = false;
|
|
9921
|
+
this.selectedItems = [];
|
|
8674
9922
|
}
|
|
8675
9923
|
ngOnInit() {
|
|
8676
9924
|
this.viewContainerService.actions = this.actions;
|
|
@@ -8698,6 +9946,7 @@ class MngTableviewComponent {
|
|
|
8698
9946
|
}
|
|
8699
9947
|
}
|
|
8700
9948
|
this.toolbarRightActions = this.toolbarRightActions.reverse();
|
|
9949
|
+
this.hasItemSelectionAction = [...this.toolbarLeftActions, ...this.toolbarRightActions].some(e => e.hasItemsSelection);
|
|
8701
9950
|
}
|
|
8702
9951
|
ngOnDestroy() {
|
|
8703
9952
|
this.subscriptions.forEach(s => s.unsubscribe());
|
|
@@ -8714,12 +9963,15 @@ class MngTableviewComponent {
|
|
|
8714
9963
|
onTableLoad(event) {
|
|
8715
9964
|
this.tableQueryParam = event.queryParam;
|
|
8716
9965
|
}
|
|
9966
|
+
selectionChange(selectedItems) {
|
|
9967
|
+
this.selectedItems = selectedItems;
|
|
9968
|
+
}
|
|
8717
9969
|
}
|
|
8718
9970
|
MngTableviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewComponent, deps: [{ token: i1.ActivatedRoute }, { token: i2.MessageService }, { token: i1$2.TranslateService }, { token: i3.DialogService }, { token: i2.ConfirmationService }, { token: MngActionExecutorService }, { token: MngViewContainerComponentService }], target: i0.ɵɵFactoryTarget.Component });
|
|
8719
|
-
MngTableviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableviewComponent, selector: "mng-tableview", inputs: { descriptor: "descriptor", dataProvider: "dataProvider", actions: "actions" }, providers: [MessageService, ConfirmationService, MngViewContainerComponentService], viewQueries: [{ propertyName: "tableComponent", first: true, predicate: MngTableComponent, descendants: true }], ngImport: i0, template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\"
|
|
9971
|
+
MngTableviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableviewComponent, selector: "mng-tableview", inputs: { descriptor: "descriptor", dataProvider: "dataProvider", actions: "actions" }, providers: [MessageService, ConfirmationService, MngViewContainerComponentService], viewQueries: [{ propertyName: "tableComponent", first: true, predicate: MngTableComponent, descendants: true }], ngImport: i0, template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\" [selectedItems]=\"selectedItems\"></mng-action>\n </ng-template>\n\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\" [selectedItems]=\"selectedItems\"></mng-action>\n </ng-template>\n </p-toolbar>\n\n <mng-table\n [descriptor]=\"descriptor.table\"\n [dataProvider]=\"dataProvider\"\n [useQueryParams]=\"true\"\n [actions]=\"actions\"\n [selectionEnabled]=\"hasItemSelectionAction\"\n [selectionMode]=\"'multiple'\"\n (tableLoad)=\"onTableLoad($event)\"\n (selectionChange)=\"selectionChange($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-0 m-0\">{{ descriptor.tableTitle ?? '' | translate }}</h5>\n </div>\n </ng-template>\n </mng-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i7$4.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { kind: "component", type: i6$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { kind: "directive", type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }] });
|
|
8720
9972
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewComponent, decorators: [{
|
|
8721
9973
|
type: Component,
|
|
8722
|
-
args: [{ selector: 'mng-tableview', providers: [MessageService, ConfirmationService, MngViewContainerComponentService], template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\"
|
|
9974
|
+
args: [{ selector: 'mng-tableview', providers: [MessageService, ConfirmationService, MngViewContainerComponentService], template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\" [selectedItems]=\"selectedItems\"></mng-action>\n </ng-template>\n\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\" [selectedItems]=\"selectedItems\"></mng-action>\n </ng-template>\n </p-toolbar>\n\n <mng-table\n [descriptor]=\"descriptor.table\"\n [dataProvider]=\"dataProvider\"\n [useQueryParams]=\"true\"\n [actions]=\"actions\"\n [selectionEnabled]=\"hasItemSelectionAction\"\n [selectionMode]=\"'multiple'\"\n (tableLoad)=\"onTableLoad($event)\"\n (selectionChange)=\"selectionChange($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-0 m-0\">{{ descriptor.tableTitle ?? '' | translate }}</h5>\n </div>\n </ng-template>\n </mng-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n" }]
|
|
8723
9975
|
}], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: i2.MessageService }, { type: i1$2.TranslateService }, { type: i3.DialogService }, { type: i2.ConfirmationService }, { type: MngActionExecutorService }, { type: MngViewContainerComponentService }]; }, propDecorators: { descriptor: [{
|
|
8724
9976
|
type: Input
|
|
8725
9977
|
}], dataProvider: [{
|
|
@@ -8732,6 +9984,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
8732
9984
|
}] } });
|
|
8733
9985
|
|
|
8734
9986
|
class AMngTableviewRouteComponent {
|
|
9987
|
+
constructor() {
|
|
9988
|
+
this.route = inject(ActivatedRoute);
|
|
9989
|
+
}
|
|
9990
|
+
get routeData() {
|
|
9991
|
+
return this.route.snapshot.data;
|
|
9992
|
+
}
|
|
8735
9993
|
ngOnInit() {
|
|
8736
9994
|
this.descriptor = this.createTableviewDescriptor();
|
|
8737
9995
|
this.dataProvider = this.createTableviewDataProvider();
|
|
@@ -8745,25 +10003,25 @@ class AMngTableviewRouteComponent {
|
|
|
8745
10003
|
this.createActionDescriptorForDelete(),
|
|
8746
10004
|
this.createActionDescriptorForRefresh(),
|
|
8747
10005
|
this.createActionDescriptorForExport()
|
|
8748
|
-
];
|
|
10006
|
+
].filter(e => e != null);
|
|
8749
10007
|
}
|
|
8750
10008
|
createActionDescriptorForDetails(descriptor = this.descriptor.viewEditor) {
|
|
8751
|
-
return new ActionEditorDetailsDescriptor(descriptor);
|
|
10009
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasDetails ? new ActionEditorDetailsDescriptor(descriptor) : null;
|
|
8752
10010
|
}
|
|
8753
10011
|
createActionDescriptorForAdd(descriptor = this.descriptor.addEditor) {
|
|
8754
|
-
return new ActionEditorAddDescriptor(descriptor);
|
|
10012
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasAdd ? new ActionEditorAddDescriptor(descriptor) : null;
|
|
8755
10013
|
}
|
|
8756
10014
|
createActionDescriptorForEdit(descriptor = this.descriptor.editEditor) {
|
|
8757
|
-
return new ActionEditorEditDescriptor(descriptor);
|
|
10015
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasEdit ? new ActionEditorEditDescriptor(descriptor) : null;
|
|
8758
10016
|
}
|
|
8759
10017
|
createActionDescriptorForDelete(descriptor = this.descriptor.model) {
|
|
8760
|
-
return new ActionDeleteDescriptor(descriptor);
|
|
10018
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasDelete ? new ActionDeleteDescriptor(descriptor) : null;
|
|
8761
10019
|
}
|
|
8762
10020
|
createActionDescriptorForExport(descriptor = this.descriptor.model) {
|
|
8763
10021
|
const action = new ActionDescriptor(descriptor, 'export')
|
|
8764
10022
|
.withRunFunction(ctx => {
|
|
8765
10023
|
const queryParamBuilder = ctx.parameters.queryParam ? MediusQueryParamBuilder.createFromExisting(ctx.parameters.queryParam) : MediusQueryParamBuilder.create();
|
|
8766
|
-
queryParamBuilder.withItemsOffset(0).withItemsPerPage(
|
|
10024
|
+
queryParamBuilder.withItemsOffset(0).withItemsPerPage(500);
|
|
8767
10025
|
ctx.parameters.withQueryParam(queryParamBuilder.build());
|
|
8768
10026
|
return ActionDataProviderUtil.runGetAllOrFail(ctx).pipe(map(res => {
|
|
8769
10027
|
const blob = new Blob([JSON.stringify(res.pageData, undefined, 4)], { type: 'application/json;charset=utf-8' });
|
|
@@ -8781,7 +10039,7 @@ class AMngTableviewRouteComponent {
|
|
|
8781
10039
|
.withPosition(ActionPositionEnum.ToolbarRight)
|
|
8782
10040
|
.withPermissionsRouteType(Permissions.ActionTypes.READ)
|
|
8783
10041
|
.withRunNotificationSuccess(undefined, undefined, false)
|
|
8784
|
-
.withRunFunction(ctx => {
|
|
10042
|
+
.withRunFunction((ctx) => {
|
|
8785
10043
|
ctx.parameters.viewContainer.triggerTableReload({});
|
|
8786
10044
|
return of(null);
|
|
8787
10045
|
});
|
|
@@ -8793,16 +10051,9 @@ AMngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.
|
|
|
8793
10051
|
AMngTableviewRouteComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: AMngTableviewRouteComponent, ngImport: i0 });
|
|
8794
10052
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: AMngTableviewRouteComponent, decorators: [{
|
|
8795
10053
|
type: Directive
|
|
8796
|
-
}] });
|
|
10054
|
+
}], ctorParameters: function () { return []; } });
|
|
8797
10055
|
|
|
8798
10056
|
class MngTableviewRouteComponent extends AMngTableviewRouteComponent {
|
|
8799
|
-
constructor(route) {
|
|
8800
|
-
super();
|
|
8801
|
-
this.route = route;
|
|
8802
|
-
}
|
|
8803
|
-
get routeData() {
|
|
8804
|
-
return this.route.snapshot.data;
|
|
8805
|
-
}
|
|
8806
10057
|
createTableviewDescriptor() {
|
|
8807
10058
|
if (this.descriptorInit) {
|
|
8808
10059
|
return this.descriptorInit;
|
|
@@ -8831,12 +10082,12 @@ class MngTableviewRouteComponent extends AMngTableviewRouteComponent {
|
|
|
8831
10082
|
this.tableviewComponent?.reloadTable();
|
|
8832
10083
|
}
|
|
8833
10084
|
}
|
|
8834
|
-
MngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, deps:
|
|
10085
|
+
MngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
8835
10086
|
MngTableviewRouteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableviewRouteComponent, selector: "mng-tableview-route", inputs: { descriptorInit: ["descriptor", "descriptorInit"], dataProviderInit: ["dataProvider", "dataProviderInit"], actionsInit: ["actions", "actionsInit"] }, viewQueries: [{ propertyName: "tableviewComponent", first: true, predicate: MngTableviewComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"grid\">\n <div class=\"col-12\">\n <mng-tableview [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: MngTableviewComponent, selector: "mng-tableview", inputs: ["descriptor", "dataProvider", "actions"] }] });
|
|
8836
10087
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, decorators: [{
|
|
8837
10088
|
type: Component,
|
|
8838
10089
|
args: [{ selector: 'mng-tableview-route', template: "<div class=\"grid\">\n <div class=\"col-12\">\n <mng-tableview [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview>\n </div>\n</div>\n" }]
|
|
8839
|
-
}],
|
|
10090
|
+
}], propDecorators: { descriptorInit: [{
|
|
8840
10091
|
type: Input,
|
|
8841
10092
|
args: ['descriptor']
|
|
8842
10093
|
}], dataProviderInit: [{
|
|
@@ -9160,7 +10411,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
9160
10411
|
}
|
|
9161
10412
|
}
|
|
9162
10413
|
MngFormlyFieldTableDialogFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, deps: [{ token: MngActionExecutorService }], target: i0.ɵɵFactoryTarget.Component });
|
|
9163
|
-
MngFormlyFieldTableDialogFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngFormlyFieldTableDialogFormComponent, selector: "mng-formly-table-dialog-form-field", usesInheritance: true, ngImport: i0, template: "<mng-table [descriptor]=\"descriptor.tableDescriptor\" [items]=\"items$\" [actions]=\"actions\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-end align-items-center table-header\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"></mng-action>\n </div>\n </ng-template>\n</mng-table>\n", styles: [".submit-button{display:none!important;visibility:hidden}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer"], outputs: ["finish"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
10414
|
+
MngFormlyFieldTableDialogFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngFormlyFieldTableDialogFormComponent, selector: "mng-formly-table-dialog-form-field", usesInheritance: true, ngImport: i0, template: "<mng-table [descriptor]=\"descriptor.tableDescriptor\" [items]=\"items$\" [actions]=\"actions\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-end align-items-center table-header\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"></mng-action>\n </div>\n </ng-template>\n</mng-table>\n", styles: [".submit-button{display:none!important;visibility:hidden}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9164
10415
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, decorators: [{
|
|
9165
10416
|
type: Component,
|
|
9166
10417
|
args: [{ selector: 'mng-formly-table-dialog-form-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-table [descriptor]=\"descriptor.tableDescriptor\" [items]=\"items$\" [actions]=\"actions\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-end align-items-center table-header\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"></mng-action>\n </div>\n </ng-template>\n</mng-table>\n", styles: [".submit-button{display:none!important;visibility:hidden}\n"] }]
|
|
@@ -10273,6 +11524,7 @@ const declarations = [
|
|
|
10273
11524
|
MngParametrizePipe,
|
|
10274
11525
|
MngGetterPipe,
|
|
10275
11526
|
MngTemplatePipe,
|
|
11527
|
+
MngClassMapPipe,
|
|
10276
11528
|
// layout components
|
|
10277
11529
|
MngBreadcrumbComponent,
|
|
10278
11530
|
MngFooterComponent,
|
|
@@ -10284,6 +11536,7 @@ const declarations = [
|
|
|
10284
11536
|
// mng fields
|
|
10285
11537
|
MngAutocompleteComponent,
|
|
10286
11538
|
MngDropdownComponent,
|
|
11539
|
+
MngDateRangeComponent,
|
|
10287
11540
|
// formly wrappers
|
|
10288
11541
|
MngFormlyFieldWrapperComponent,
|
|
10289
11542
|
MngFormlyTableWrapperComponent,
|
|
@@ -10396,6 +11649,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10396
11649
|
MngParametrizePipe,
|
|
10397
11650
|
MngGetterPipe,
|
|
10398
11651
|
MngTemplatePipe,
|
|
11652
|
+
MngClassMapPipe,
|
|
10399
11653
|
// layout components
|
|
10400
11654
|
MngBreadcrumbComponent,
|
|
10401
11655
|
MngFooterComponent,
|
|
@@ -10407,6 +11661,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10407
11661
|
// mng fields
|
|
10408
11662
|
MngAutocompleteComponent,
|
|
10409
11663
|
MngDropdownComponent,
|
|
11664
|
+
MngDateRangeComponent,
|
|
10410
11665
|
// formly wrappers
|
|
10411
11666
|
MngFormlyFieldWrapperComponent,
|
|
10412
11667
|
MngFormlyTableWrapperComponent,
|
|
@@ -10515,6 +11770,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10515
11770
|
MngParametrizePipe,
|
|
10516
11771
|
MngGetterPipe,
|
|
10517
11772
|
MngTemplatePipe,
|
|
11773
|
+
MngClassMapPipe,
|
|
10518
11774
|
// layout components
|
|
10519
11775
|
MngBreadcrumbComponent,
|
|
10520
11776
|
MngFooterComponent,
|
|
@@ -10526,6 +11782,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10526
11782
|
// mng fields
|
|
10527
11783
|
MngAutocompleteComponent,
|
|
10528
11784
|
MngDropdownComponent,
|
|
11785
|
+
MngDateRangeComponent,
|
|
10529
11786
|
// formly wrappers
|
|
10530
11787
|
MngFormlyFieldWrapperComponent,
|
|
10531
11788
|
MngFormlyTableWrapperComponent,
|
|
@@ -11213,6 +12470,7 @@ class TableviewRouteBuilder {
|
|
|
11213
12470
|
this.editPath = ':itemId/edit';
|
|
11214
12471
|
this.hasAdd = true;
|
|
11215
12472
|
this.addPath = 'add';
|
|
12473
|
+
this.hasDelete = true;
|
|
11216
12474
|
}
|
|
11217
12475
|
static fromComponent(path, component) {
|
|
11218
12476
|
const inst = new TableviewRouteBuilder(path);
|
|
@@ -11240,6 +12498,15 @@ class TableviewRouteBuilder {
|
|
|
11240
12498
|
}
|
|
11241
12499
|
return inst;
|
|
11242
12500
|
}
|
|
12501
|
+
withReadOnly(permissions) {
|
|
12502
|
+
if (permissions) {
|
|
12503
|
+
this.withPermissions(permissions);
|
|
12504
|
+
}
|
|
12505
|
+
this.withAdd(false);
|
|
12506
|
+
this.withEdit(false);
|
|
12507
|
+
this.withDelete(false);
|
|
12508
|
+
return this;
|
|
12509
|
+
}
|
|
11243
12510
|
withDetails(hasDetails = true, permissions, path) {
|
|
11244
12511
|
this.hasDetails = hasDetails;
|
|
11245
12512
|
if (permissions) {
|
|
@@ -11270,24 +12537,31 @@ class TableviewRouteBuilder {
|
|
|
11270
12537
|
}
|
|
11271
12538
|
return this;
|
|
11272
12539
|
}
|
|
12540
|
+
withDelete(hasDelete = true, permissions) {
|
|
12541
|
+
this.hasDelete = hasDelete;
|
|
12542
|
+
if (permissions) {
|
|
12543
|
+
this.withPermissions(undefined, undefined, undefined, permissions);
|
|
12544
|
+
}
|
|
12545
|
+
return this;
|
|
12546
|
+
}
|
|
11273
12547
|
withPermissions(read, add, edit, delet, details) {
|
|
11274
12548
|
if (!this.permissions) {
|
|
11275
12549
|
this.permissions = {};
|
|
11276
12550
|
}
|
|
11277
12551
|
if (read) {
|
|
11278
|
-
this.permissions[
|
|
12552
|
+
this.permissions[TableviewActionDefaultCategories.READ] = read;
|
|
11279
12553
|
}
|
|
11280
12554
|
if (add) {
|
|
11281
|
-
this.permissions[
|
|
12555
|
+
this.permissions[TableviewActionDefaultCategories.ADD] = add;
|
|
11282
12556
|
}
|
|
11283
12557
|
if (edit) {
|
|
11284
|
-
this.permissions[
|
|
12558
|
+
this.permissions[TableviewActionDefaultCategories.EDIT] = edit;
|
|
11285
12559
|
}
|
|
11286
12560
|
if (delet) {
|
|
11287
|
-
this.permissions[
|
|
12561
|
+
this.permissions[TableviewActionDefaultCategories.DELETE] = delet;
|
|
11288
12562
|
}
|
|
11289
12563
|
if (details) {
|
|
11290
|
-
this.permissions[
|
|
12564
|
+
this.permissions[TableviewActionDefaultCategories.DETAILS] = details;
|
|
11291
12565
|
}
|
|
11292
12566
|
return this;
|
|
11293
12567
|
}
|
|
@@ -11323,35 +12597,42 @@ class TableviewRouteBuilder {
|
|
|
11323
12597
|
if (this.permissions) {
|
|
11324
12598
|
routeData.tableviewPermissions = { ...this.permissions };
|
|
11325
12599
|
}
|
|
12600
|
+
routeData.tableviewActions = {
|
|
12601
|
+
hasAdd: this.hasAdd,
|
|
12602
|
+
hasEdit: this.hasEdit,
|
|
12603
|
+
hasDetails: this.hasDetails,
|
|
12604
|
+
hasDelete: this.hasDelete
|
|
12605
|
+
};
|
|
11326
12606
|
tableviewRouteBuilder.withData(routeData);
|
|
11327
|
-
if (this.permissions?.[
|
|
11328
|
-
tableviewRouteBuilder.withPermissions(this.permissions[
|
|
12607
|
+
if (this.permissions?.[TableviewActionDefaultCategories.READ]) {
|
|
12608
|
+
tableviewRouteBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.READ]);
|
|
11329
12609
|
}
|
|
11330
12610
|
// list route
|
|
11331
12611
|
const rootChildRouteBuilder = RouteBuilder.create('', MngActionRouteComponent);
|
|
11332
|
-
|
|
11333
|
-
|
|
12612
|
+
rootChildRouteBuilder.withData({ ...routeData });
|
|
12613
|
+
if (this.permissions?.[TableviewActionDefaultCategories.READ]) {
|
|
12614
|
+
rootChildRouteBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.READ]);
|
|
11334
12615
|
}
|
|
11335
12616
|
tableviewRouteBuilder.addChildBuilder(rootChildRouteBuilder);
|
|
11336
12617
|
// add route
|
|
11337
12618
|
if (this.hasAdd) {
|
|
11338
12619
|
const routeBuilder = RouteBuilder.create(this.addPath, MngActionRouteComponent);
|
|
11339
|
-
if (this.permissions?.[
|
|
11340
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12620
|
+
if (this.permissions?.[TableviewActionDefaultCategories.ADD]) {
|
|
12621
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.ADD]);
|
|
11341
12622
|
}
|
|
11342
12623
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11343
12624
|
}
|
|
11344
12625
|
if (this.hasDetails) {
|
|
11345
12626
|
const routeBuilder = RouteBuilder.create(this.detailsPath, MngActionRouteComponent);
|
|
11346
|
-
if (this.permissions?.[
|
|
11347
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12627
|
+
if (this.permissions?.[TableviewActionDefaultCategories.DETAILS]) {
|
|
12628
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.DETAILS]);
|
|
11348
12629
|
}
|
|
11349
12630
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11350
12631
|
}
|
|
11351
12632
|
if (this.hasEdit) {
|
|
11352
12633
|
const routeBuilder = RouteBuilder.create(this.editPath, MngActionRouteComponent);
|
|
11353
|
-
if (this.permissions?.[
|
|
11354
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12634
|
+
if (this.permissions?.[TableviewActionDefaultCategories.EDIT]) {
|
|
12635
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.EDIT]);
|
|
11355
12636
|
}
|
|
11356
12637
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11357
12638
|
}
|
|
@@ -11367,5 +12648,5 @@ class TableviewRouteBuilder {
|
|
|
11367
12648
|
* Generated bundle index. Do not edit.
|
|
11368
12649
|
*/
|
|
11369
12650
|
|
|
11370
|
-
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorDialogSizeEnum, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLevelEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionSizeEnum, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonDescriptor, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnTypeEnum, DataProvider, DefaultMngErrorMapperService, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterLookupTypeEnum, FilterMatchModeEnum, FilterTypeEnum, I18nUtils, JsonPathPipe, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_BROWSER_STORAGE_IT, MNG_COMMONS_INITIALIZER_IT, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationGuard, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngButtonComponent, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDropdownComponent, MngEnumPipe, MngErrorMapperService, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormFieldEvent, MngFormFieldEventComponentSubtype, MngFormFieldEventDialogSubtype, MngFormFieldEventTypeEnum, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldLabelComponent, MngFormlyFieldLookupDialogComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngFormlyTableWrapperComponent, MngGetterPipe, MngI18nPropertyPipe, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngParametrizePipe, MngTableCellClickEvent, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableLoadEvent, MngTableReloadEvent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTemplatePipe, MngTopbarComponent, MngVersionComponent, MngViewContainerComponentService, ModelDescriptor, ModelUtil, NotificationUtil, ObjectSerializer, Permissions, RouteBuilder, RoutesBuilder, StringUtil, StylesUtil, TableDataProvider, TableDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewRouteBuilder, TableviewTypeEnum, TypeName, TypeUtil, enumNameDecoratorPropertyName, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
12651
|
+
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorDialogSizeEnum, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLevelEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionSizeEnum, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonDescriptor, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnDynamicDescriptor, ColumnTypeEnum, DataProvider, DateUtil, DefaultMngErrorMapperService, DynamicTableviewDataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterLookupTypeEnum, FilterMatchModeEnum, FilterTypeEnum, I18nUtils, JsonPathPipe, 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, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationGuard, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngButtonComponent, MngClassMapPipe, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDateRangeComponent, MngDropdownComponent, MngEnumPipe, MngErrorMapperService, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormFieldEvent, MngFormFieldEventComponentSubtype, MngFormFieldEventDialogSubtype, MngFormFieldEventTypeEnum, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldLabelComponent, MngFormlyFieldLookupDialogComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngFormlyTableWrapperComponent, MngGetterPipe, MngI18nPropertyPipe, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngParametrizePipe, MngTableCellClickEvent, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableLoadEvent, MngTableReloadEvent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTemplatePipe, MngTopbarComponent, MngVersionComponent, MngViewContainerComponentService, ModelDescriptor, ModelUtil, NotificationUtil, ObjectSerializer, Permissions, RouteBuilder, RoutesBuilder, StringUtil, StylesUtil, TableDataProvider, TableDescriptor, TableDynamicColumnsModeEnum, TableDynamicDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewActionDefaultCategories, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewDynamicDescriptor, TableviewRouteBuilder, TableviewTypeEnum, TypeName, TypeUtil, enumNameDecoratorPropertyName, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
11371
12652
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|