@mediusinc/mng-commons 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/api/utils/medius-rest.util.mjs +8 -3
- 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/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +1 -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 +5 -2
- package/esm2020/lib/components/tableview/table/table.component.mjs +48 -20
- 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 +106 -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 +13 -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 +5 -1
- 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/utils/tableview.util.mjs +144 -0
- package/fesm2015/mediusinc-mng-commons.mjs +1095 -128
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +1077 -117
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- 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/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/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 +7 -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 +72 -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/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';
|
|
@@ -534,28 +534,63 @@ class TableDataProvider extends DataProvider {
|
|
|
534
534
|
constructor(modelType, serviceType) {
|
|
535
535
|
super(modelType, serviceType);
|
|
536
536
|
this._getAll = () => of(new MediusQueryResult());
|
|
537
|
+
this._getAllReloadSubject = new Subject();
|
|
537
538
|
}
|
|
538
539
|
get getAll() {
|
|
539
540
|
return this._getAll;
|
|
540
541
|
}
|
|
542
|
+
get getAllReload$() {
|
|
543
|
+
return this._getAllReloadSubject.asObservable();
|
|
544
|
+
}
|
|
541
545
|
withGetAll(getAll) {
|
|
542
546
|
this._getAll = getAll;
|
|
543
547
|
return this;
|
|
544
548
|
}
|
|
549
|
+
getAllReload(queryParam) {
|
|
550
|
+
this._getAllReloadSubject.next(queryParam);
|
|
551
|
+
}
|
|
545
552
|
}
|
|
546
553
|
|
|
547
554
|
class TableviewDataProvider extends EditorDataProvider {
|
|
548
555
|
constructor(modelType, serviceType) {
|
|
549
556
|
super(modelType, serviceType);
|
|
550
557
|
this._getAll = () => of(new MediusQueryResult());
|
|
558
|
+
this._getAllReloadSubject = new Subject();
|
|
551
559
|
}
|
|
552
560
|
get getAll() {
|
|
553
561
|
return this._getAll;
|
|
554
562
|
}
|
|
563
|
+
get getAllReload$() {
|
|
564
|
+
return this._getAllReloadSubject.asObservable();
|
|
565
|
+
}
|
|
555
566
|
withGetAll(getAll) {
|
|
556
567
|
this._getAll = getAll;
|
|
557
568
|
return this;
|
|
558
569
|
}
|
|
570
|
+
getAllReload(queryParam) {
|
|
571
|
+
this._getAllReloadSubject.next(queryParam);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
class DynamicTableviewDataProvider extends TableviewDataProvider {
|
|
575
|
+
constructor() {
|
|
576
|
+
super({});
|
|
577
|
+
this._getAll = () => of(new MediusQueryResult());
|
|
578
|
+
this._fetch = () => of({});
|
|
579
|
+
}
|
|
580
|
+
withGetAll(getAll) {
|
|
581
|
+
this._getAll = getAll;
|
|
582
|
+
return this;
|
|
583
|
+
}
|
|
584
|
+
withFetch(fetch) {
|
|
585
|
+
this._fetch = fetch;
|
|
586
|
+
return this;
|
|
587
|
+
}
|
|
588
|
+
get getAll() {
|
|
589
|
+
return this._getAll;
|
|
590
|
+
}
|
|
591
|
+
get fetch() {
|
|
592
|
+
return this._fetch;
|
|
593
|
+
}
|
|
559
594
|
}
|
|
560
595
|
|
|
561
596
|
class TableviewCrudDataProvider extends TableviewDataProvider {
|
|
@@ -853,6 +888,15 @@ var TableSizeEnum;
|
|
|
853
888
|
TableSizeEnum[TableSizeEnum["Normal"] = 1] = "Normal";
|
|
854
889
|
TableSizeEnum[TableSizeEnum["Large"] = 2] = "Large";
|
|
855
890
|
})(TableSizeEnum || (TableSizeEnum = {}));
|
|
891
|
+
/**
|
|
892
|
+
* EXCLUDE default, all columns has sort and filter on by default, developer EXCLUDES properties from sort/filter
|
|
893
|
+
* INCLUDE_ONLY only selected columns have sort/filter, developers INCLUDES properties
|
|
894
|
+
*/
|
|
895
|
+
var TableDynamicColumnsModeEnum;
|
|
896
|
+
(function (TableDynamicColumnsModeEnum) {
|
|
897
|
+
TableDynamicColumnsModeEnum[TableDynamicColumnsModeEnum["EXCLUDE"] = 0] = "EXCLUDE";
|
|
898
|
+
TableDynamicColumnsModeEnum[TableDynamicColumnsModeEnum["INCLUDE_ONLY"] = 1] = "INCLUDE_ONLY";
|
|
899
|
+
})(TableDynamicColumnsModeEnum || (TableDynamicColumnsModeEnum = {}));
|
|
856
900
|
|
|
857
901
|
class StylesUtil {
|
|
858
902
|
static calculateTableColumnActionWidth(table, actions) {
|
|
@@ -1171,6 +1215,8 @@ class ActionDescriptor {
|
|
|
1171
1215
|
this._hasRunNotificationError = true;
|
|
1172
1216
|
//button
|
|
1173
1217
|
this._buttonDescriptor = new ButtonDescriptor();
|
|
1218
|
+
// multiple row selection
|
|
1219
|
+
this._hasItemsSelection = false;
|
|
1174
1220
|
this._model = model;
|
|
1175
1221
|
this._actionName = actionName;
|
|
1176
1222
|
if ((parentType && !parentProperty) || (!parentProperty && parentProperty)) {
|
|
@@ -1282,6 +1328,9 @@ class ActionDescriptor {
|
|
|
1282
1328
|
get permissionsRouteType() {
|
|
1283
1329
|
return this._permissionsRouteType;
|
|
1284
1330
|
}
|
|
1331
|
+
get hasItemsSelection() {
|
|
1332
|
+
return this._hasItemsSelection;
|
|
1333
|
+
}
|
|
1285
1334
|
get buttonDescriptor() {
|
|
1286
1335
|
return this._buttonDescriptor;
|
|
1287
1336
|
}
|
|
@@ -1369,6 +1418,12 @@ class ActionDescriptor {
|
|
|
1369
1418
|
this._buttonDescriptor = buttonDescriptor;
|
|
1370
1419
|
return this;
|
|
1371
1420
|
}
|
|
1421
|
+
withItemsSelection(hasSelection = true) {
|
|
1422
|
+
var _a;
|
|
1423
|
+
this._hasItemsSelection = hasSelection;
|
|
1424
|
+
this._isEnabledFunction = (_a = this._isEnabledFunction) !== null && _a !== void 0 ? _a : (ctx => { var _a, _b; return of(((_b = (_a = ctx.parameters.selectedItems) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0); });
|
|
1425
|
+
return this;
|
|
1426
|
+
}
|
|
1372
1427
|
}
|
|
1373
1428
|
class ActionSimpleDescriptor extends ActionDescriptor {
|
|
1374
1429
|
constructor(actionName, modelType, idProperty, titleProperty) {
|
|
@@ -1668,11 +1723,152 @@ class ActionLinkDescriptor extends ActionDescriptor {
|
|
|
1668
1723
|
}
|
|
1669
1724
|
}
|
|
1670
1725
|
|
|
1726
|
+
class TableviewUtil {
|
|
1727
|
+
/**
|
|
1728
|
+
* returns attributes from class type and extends to typed def with column and field enum type
|
|
1729
|
+
* @param modelType class type
|
|
1730
|
+
*/
|
|
1731
|
+
static getAttributeDefMap(modelType) {
|
|
1732
|
+
return TableviewUtil.expandAttributeDefWithTableviewTypes(ObjectSerializer.get().findAttributesDefinitionByClassType(modelType));
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1735
|
+
* expands AttributeDef to TableviewAttributeDef with defined input and column enum type
|
|
1736
|
+
* @param attributes open api specification model
|
|
1737
|
+
*/
|
|
1738
|
+
static expandAttributeDefWithTableviewTypes(attributes) {
|
|
1739
|
+
if (attributes == null) {
|
|
1740
|
+
throw new Error('AttributeDef is null, problem with ObjectSerializer::findAttributesDefinitionByClassType?');
|
|
1741
|
+
}
|
|
1742
|
+
const objectSerializer = ObjectSerializer.get();
|
|
1743
|
+
const tableviewAttributeDef = [];
|
|
1744
|
+
for (const attribute of attributes) {
|
|
1745
|
+
const enumType = objectSerializer.findEnum(attribute.type);
|
|
1746
|
+
tableviewAttributeDef.push({
|
|
1747
|
+
name: attribute.name,
|
|
1748
|
+
baseName: attribute.baseName,
|
|
1749
|
+
type: attribute.type,
|
|
1750
|
+
columnType: enumType ? ColumnTypeEnum.Enum : TableviewUtil.toColumnType(attribute.type),
|
|
1751
|
+
fieldType: TableviewUtil.toFieldInputType(attribute.type),
|
|
1752
|
+
enumType: objectSerializer.findEnum(attribute.type),
|
|
1753
|
+
classType: objectSerializer.findType(attribute.type)
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
return tableviewAttributeDef;
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* converts column to number or date on value based
|
|
1760
|
+
* @param column column to be transformed
|
|
1761
|
+
* @param value value to check if applicable
|
|
1762
|
+
*/
|
|
1763
|
+
static stringColumnConverter(column, value) {
|
|
1764
|
+
if (typeof value === 'boolean') {
|
|
1765
|
+
return column.asBoolean();
|
|
1766
|
+
}
|
|
1767
|
+
else if (!isNaN(value) && typeof value === 'number') {
|
|
1768
|
+
return column.asNumber();
|
|
1769
|
+
}
|
|
1770
|
+
else if (this._dateRegex.test(value)) {
|
|
1771
|
+
return column.asDate();
|
|
1772
|
+
}
|
|
1773
|
+
else {
|
|
1774
|
+
return column;
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* converts string type to column type enum, default is string
|
|
1779
|
+
* @param property
|
|
1780
|
+
*/
|
|
1781
|
+
static toColumnType(property) {
|
|
1782
|
+
const os = ObjectSerializer.get();
|
|
1783
|
+
if (os.findEnum(property)) {
|
|
1784
|
+
property = 'enum';
|
|
1785
|
+
}
|
|
1786
|
+
else if (os.findType(property)) {
|
|
1787
|
+
property = 'class';
|
|
1788
|
+
}
|
|
1789
|
+
switch (property) {
|
|
1790
|
+
case 'number':
|
|
1791
|
+
return ColumnTypeEnum.Number;
|
|
1792
|
+
case 'currency':
|
|
1793
|
+
return ColumnTypeEnum.Currency;
|
|
1794
|
+
case 'boolean':
|
|
1795
|
+
return ColumnTypeEnum.Boolean;
|
|
1796
|
+
case 'date':
|
|
1797
|
+
return ColumnTypeEnum.Date;
|
|
1798
|
+
case 'enum':
|
|
1799
|
+
return ColumnTypeEnum.Enum;
|
|
1800
|
+
case 'custom':
|
|
1801
|
+
return ColumnTypeEnum.Custom;
|
|
1802
|
+
case 'class':
|
|
1803
|
+
return ColumnTypeEnum.String;
|
|
1804
|
+
case 'string':
|
|
1805
|
+
default:
|
|
1806
|
+
return ColumnTypeEnum.String;
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* converts string type to type enum, default is text
|
|
1811
|
+
* @param property
|
|
1812
|
+
*/
|
|
1813
|
+
static toFieldInputType(property) {
|
|
1814
|
+
switch (property) {
|
|
1815
|
+
case 'hidden':
|
|
1816
|
+
return FieldInputTypeEnum.Hidden;
|
|
1817
|
+
case 'label':
|
|
1818
|
+
return FieldInputTypeEnum.Label;
|
|
1819
|
+
case 'textarea':
|
|
1820
|
+
return FieldInputTypeEnum.Textarea;
|
|
1821
|
+
case 'number':
|
|
1822
|
+
return FieldInputTypeEnum.Number;
|
|
1823
|
+
case 'currency':
|
|
1824
|
+
return FieldInputTypeEnum.Currency;
|
|
1825
|
+
case 'switch':
|
|
1826
|
+
case 'boolean':
|
|
1827
|
+
return FieldInputTypeEnum.Switch;
|
|
1828
|
+
case 'radio':
|
|
1829
|
+
return FieldInputTypeEnum.Radio;
|
|
1830
|
+
case 'datepicker':
|
|
1831
|
+
return FieldInputTypeEnum.Datepicker;
|
|
1832
|
+
case 'mask':
|
|
1833
|
+
return FieldInputTypeEnum.Mask;
|
|
1834
|
+
case 'file':
|
|
1835
|
+
return FieldInputTypeEnum.File;
|
|
1836
|
+
case 'custom':
|
|
1837
|
+
return FieldInputTypeEnum.Custom;
|
|
1838
|
+
case 'text':
|
|
1839
|
+
default:
|
|
1840
|
+
return FieldInputTypeEnum.Text;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* convert column type to equivalent field input type
|
|
1845
|
+
* @param type column type
|
|
1846
|
+
*/
|
|
1847
|
+
static toFieldInputTypeFromColumnType(type) {
|
|
1848
|
+
switch (type) {
|
|
1849
|
+
case ColumnTypeEnum.Number:
|
|
1850
|
+
return FieldInputTypeEnum.Number;
|
|
1851
|
+
case ColumnTypeEnum.Currency:
|
|
1852
|
+
return FieldInputTypeEnum.Currency;
|
|
1853
|
+
case ColumnTypeEnum.Boolean:
|
|
1854
|
+
return FieldInputTypeEnum.Switch;
|
|
1855
|
+
case ColumnTypeEnum.Date:
|
|
1856
|
+
return FieldInputTypeEnum.Datepicker;
|
|
1857
|
+
case ColumnTypeEnum.Custom:
|
|
1858
|
+
return FieldInputTypeEnum.Custom;
|
|
1859
|
+
case ColumnTypeEnum.String:
|
|
1860
|
+
case ColumnTypeEnum.Enum:
|
|
1861
|
+
default:
|
|
1862
|
+
return FieldInputTypeEnum.Text;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
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)/;
|
|
1867
|
+
|
|
1671
1868
|
class FilterDescriptor {
|
|
1672
1869
|
constructor(property) {
|
|
1673
1870
|
this._filterType = FilterTypeEnum.String;
|
|
1674
1871
|
this._hasDefaultValue = false;
|
|
1675
|
-
this._defaultFilterMatchMode = FilterMatchModeEnum.Equals;
|
|
1676
1872
|
this._matchModes = null;
|
|
1677
1873
|
this._numberUseGrouping = true;
|
|
1678
1874
|
this._datePickerShowTime = false;
|
|
@@ -1748,13 +1944,11 @@ class FilterDescriptor {
|
|
|
1748
1944
|
this._filterProperty = filterProperty;
|
|
1749
1945
|
return this;
|
|
1750
1946
|
}
|
|
1751
|
-
withDefaultFilter(filterValue, filterValueTo, filterMatchMode
|
|
1947
|
+
withDefaultFilter(filterValue, filterValueTo, filterMatchMode) {
|
|
1752
1948
|
this._hasDefaultValue = true;
|
|
1753
1949
|
this._defaultValue = filterValue;
|
|
1754
1950
|
this._defaultValueTo = filterValueTo;
|
|
1755
|
-
|
|
1756
|
-
this._defaultFilterMatchMode = filterMatchMode;
|
|
1757
|
-
}
|
|
1951
|
+
this._defaultFilterMatchMode = filterMatchMode;
|
|
1758
1952
|
return this;
|
|
1759
1953
|
}
|
|
1760
1954
|
withNumberFractions(min, max) {
|
|
@@ -1901,6 +2095,16 @@ class FilterLookupDescriptor extends FilterDescriptor {
|
|
|
1901
2095
|
this._dropdownClassName = dropdownClassName;
|
|
1902
2096
|
return this;
|
|
1903
2097
|
}
|
|
2098
|
+
withDefaultFilter(filterValue, filterValueTo, filterMatchMode) {
|
|
2099
|
+
this._hasDefaultValue = true;
|
|
2100
|
+
this._defaultValue = filterValue;
|
|
2101
|
+
this._defaultValueTo = filterValueTo;
|
|
2102
|
+
this._defaultFilterMatchMode = filterMatchMode;
|
|
2103
|
+
if (Array.isArray(filterValue) && !this.multiselect) {
|
|
2104
|
+
throw new Error('Array default filter can only be used with a multiselect filter.');
|
|
2105
|
+
}
|
|
2106
|
+
return this;
|
|
2107
|
+
}
|
|
1904
2108
|
asAutocomplete(openOnFocus = false, inlineSearch = false) {
|
|
1905
2109
|
this._lookupType = FilterLookupTypeEnum.Autocomplete;
|
|
1906
2110
|
this._autocompleteOpenOnFocus = openOnFocus;
|
|
@@ -2060,9 +2264,29 @@ class ColumnDescriptor {
|
|
|
2060
2264
|
get getter() {
|
|
2061
2265
|
return this._getter;
|
|
2062
2266
|
}
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2267
|
+
/**
|
|
2268
|
+
* converts column to given type with additional arguments
|
|
2269
|
+
* @param type column type enum
|
|
2270
|
+
* @param args any additional arguments for column (optional)
|
|
2271
|
+
*/
|
|
2272
|
+
asType(type, ...args) {
|
|
2273
|
+
switch (type) {
|
|
2274
|
+
case ColumnTypeEnum.Number:
|
|
2275
|
+
return this.asNumber(...args);
|
|
2276
|
+
case ColumnTypeEnum.Currency:
|
|
2277
|
+
return this.asCurrency(...args);
|
|
2278
|
+
case ColumnTypeEnum.Boolean:
|
|
2279
|
+
return this.asBoolean(...args);
|
|
2280
|
+
case ColumnTypeEnum.Date:
|
|
2281
|
+
return this.asDate(...args);
|
|
2282
|
+
case ColumnTypeEnum.Enum:
|
|
2283
|
+
return this.asEnum(args[0], args[1], args[2]);
|
|
2284
|
+
case ColumnTypeEnum.Custom:
|
|
2285
|
+
return this.asCustomComponent(args[0]);
|
|
2286
|
+
case ColumnTypeEnum.String:
|
|
2287
|
+
default:
|
|
2288
|
+
return this;
|
|
2289
|
+
}
|
|
2066
2290
|
}
|
|
2067
2291
|
asNumber(displayFormat = '1.0-0', locale) {
|
|
2068
2292
|
this._columnType = ColumnTypeEnum.Number;
|
|
@@ -2204,34 +2428,90 @@ class ColumnDescriptor {
|
|
|
2204
2428
|
return this;
|
|
2205
2429
|
}
|
|
2206
2430
|
copy() {
|
|
2207
|
-
var _a;
|
|
2208
2431
|
const descriptor = new ColumnDescriptor(this._table, this._property);
|
|
2209
|
-
|
|
2432
|
+
this.copyFieldsTo(descriptor);
|
|
2433
|
+
return descriptor;
|
|
2434
|
+
}
|
|
2435
|
+
copyFieldsTo(obj) {
|
|
2436
|
+
var _a;
|
|
2437
|
+
obj._jsonPath = this._jsonPath;
|
|
2438
|
+
obj._title = this._title;
|
|
2439
|
+
obj._isSortEnabled = this._isSortEnabled;
|
|
2440
|
+
obj._columnType = this._columnType;
|
|
2441
|
+
obj._filterDescriptor = (_a = this._filterDescriptor) === null || _a === void 0 ? void 0 : _a.copy();
|
|
2442
|
+
obj._enumType = this._enumType;
|
|
2443
|
+
obj._enumTitlePath = this._enumTitlePath;
|
|
2444
|
+
obj._enumNameAsValue = this._enumNameAsValue;
|
|
2445
|
+
obj._booleanAsIcon = this._booleanAsIcon;
|
|
2446
|
+
obj._booleanYes = this._booleanYes;
|
|
2447
|
+
obj._booleanNo = this._booleanNo;
|
|
2448
|
+
obj._objectModelType = this._objectModelType;
|
|
2449
|
+
obj._objectTitleProperty = this._objectTitleProperty;
|
|
2450
|
+
obj._locale = this._locale;
|
|
2451
|
+
obj._currencyCode = this._currencyCode;
|
|
2452
|
+
obj._currencyDisplay = this._currencyDisplay;
|
|
2453
|
+
obj._currencyFromProperty = this._currencyFromProperty;
|
|
2454
|
+
obj._displayFormat = this._displayFormat;
|
|
2455
|
+
obj._headerClassName = this._headerClassName;
|
|
2456
|
+
obj._className = this._className;
|
|
2457
|
+
obj._width = this._width;
|
|
2458
|
+
obj._minWidth = this._minWidth;
|
|
2459
|
+
obj._maxWidth = this._maxWidth;
|
|
2460
|
+
obj._hasCopyToClipboard = this._hasCopyToClipboard;
|
|
2461
|
+
obj._template = this._template;
|
|
2462
|
+
obj._getter = this._getter;
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
class ColumnDynamicDescriptor extends ColumnDescriptor {
|
|
2466
|
+
// private _filterStatus;
|
|
2467
|
+
constructor(table, property) {
|
|
2468
|
+
super(table, property);
|
|
2469
|
+
this._visibility = true;
|
|
2470
|
+
this._table = table;
|
|
2471
|
+
}
|
|
2472
|
+
get visibility() {
|
|
2473
|
+
return this._visibility;
|
|
2474
|
+
}
|
|
2475
|
+
/**
|
|
2476
|
+
* sets column's title and returns this column
|
|
2477
|
+
* @param title title to be set
|
|
2478
|
+
* @param override should column title if all ready set?
|
|
2479
|
+
*/
|
|
2480
|
+
withTitle(title, override = false) {
|
|
2481
|
+
if (this._title == null || override) {
|
|
2482
|
+
this._title = title;
|
|
2483
|
+
}
|
|
2484
|
+
return this;
|
|
2485
|
+
}
|
|
2486
|
+
/**
|
|
2487
|
+
* defines automatic type and returns this column
|
|
2488
|
+
* @param value
|
|
2489
|
+
*/
|
|
2490
|
+
withAutomaticType(value) {
|
|
2491
|
+
TableviewUtil.stringColumnConverter(this, value);
|
|
2492
|
+
return this;
|
|
2493
|
+
}
|
|
2494
|
+
/**
|
|
2495
|
+
* sets visibility state for column and returns this column
|
|
2496
|
+
* @param visibility
|
|
2497
|
+
*/
|
|
2498
|
+
withVisibility(visibility) {
|
|
2499
|
+
this._visibility = visibility;
|
|
2500
|
+
return this;
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* creates deep copy of column dynamic descriptor
|
|
2504
|
+
*/
|
|
2505
|
+
copy() {
|
|
2506
|
+
const descriptor = new ColumnDynamicDescriptor(this._table, this._property);
|
|
2507
|
+
this.copyFieldsTo(descriptor);
|
|
2210
2508
|
descriptor._title = this._title;
|
|
2211
|
-
descriptor.
|
|
2212
|
-
descriptor
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
descriptor
|
|
2216
|
-
|
|
2217
|
-
descriptor._booleanAsIcon = this._booleanAsIcon;
|
|
2218
|
-
descriptor._booleanYes = this._booleanYes;
|
|
2219
|
-
descriptor._booleanNo = this._booleanNo;
|
|
2220
|
-
descriptor._objectModelType = this._objectModelType;
|
|
2221
|
-
descriptor._objectTitleProperty = this._objectTitleProperty;
|
|
2222
|
-
descriptor._locale = this._locale;
|
|
2223
|
-
descriptor._currencyCode = this._currencyCode;
|
|
2224
|
-
descriptor._currencyDisplay = this._currencyDisplay;
|
|
2225
|
-
descriptor._currencyFromProperty = this._currencyFromProperty;
|
|
2226
|
-
descriptor._displayFormat = this._displayFormat;
|
|
2227
|
-
descriptor._headerClassName = this._headerClassName;
|
|
2228
|
-
descriptor._className = this._className;
|
|
2229
|
-
descriptor._width = this._width;
|
|
2230
|
-
descriptor._minWidth = this._minWidth;
|
|
2231
|
-
descriptor._maxWidth = this._maxWidth;
|
|
2232
|
-
descriptor._hasCopyToClipboard = this._hasCopyToClipboard;
|
|
2233
|
-
descriptor._template = this._template;
|
|
2234
|
-
descriptor._getter = this._getter;
|
|
2509
|
+
descriptor._visibility = this._visibility;
|
|
2510
|
+
return descriptor;
|
|
2511
|
+
}
|
|
2512
|
+
toColumnDescriptor(tableDescriptor) {
|
|
2513
|
+
const descriptor = new ColumnDescriptor(tableDescriptor, this._property);
|
|
2514
|
+
this.copyFieldsTo(descriptor);
|
|
2235
2515
|
return descriptor;
|
|
2236
2516
|
}
|
|
2237
2517
|
}
|
|
@@ -2242,9 +2522,37 @@ class EditorDescriptor {
|
|
|
2242
2522
|
this._groups = [];
|
|
2243
2523
|
this._fields = [];
|
|
2244
2524
|
this._disabled = false;
|
|
2525
|
+
this._modelType = modelType;
|
|
2245
2526
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
2246
2527
|
this._tableviewEditorType = tableviewEditorType;
|
|
2247
2528
|
}
|
|
2529
|
+
/**
|
|
2530
|
+
* auto generated editor descriptor based on openapi definition
|
|
2531
|
+
* generates all fields from definition
|
|
2532
|
+
* @param modelType class type
|
|
2533
|
+
* @param idProperty
|
|
2534
|
+
* @param titleProperty
|
|
2535
|
+
* @param tableEditorType
|
|
2536
|
+
*/
|
|
2537
|
+
static from(modelType, idProperty, titleProperty, tableEditorType = TableviewTypeEnum.None) {
|
|
2538
|
+
return EditorDescriptor.fromModelWithAttributes(modelType, TableviewUtil.getAttributeDefMap(modelType), titleProperty, idProperty, tableEditorType);
|
|
2539
|
+
}
|
|
2540
|
+
/**
|
|
2541
|
+
* auto generated editor descriptor based on openapi definition
|
|
2542
|
+
* generates only selected fields
|
|
2543
|
+
* @param modelType class type
|
|
2544
|
+
* @param attributes list of selected properties to generate fields based on
|
|
2545
|
+
* @param idProperty
|
|
2546
|
+
* @param titleProperty
|
|
2547
|
+
* @param tableEditorType
|
|
2548
|
+
*/
|
|
2549
|
+
static fromModelWithAttributes(modelType, attributes, idProperty, titleProperty, tableEditorType = TableviewTypeEnum.None) {
|
|
2550
|
+
const descriptor = new EditorDescriptor(modelType, idProperty, titleProperty, tableEditorType);
|
|
2551
|
+
attributes
|
|
2552
|
+
.filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array'))
|
|
2553
|
+
.forEach(attr => descriptor.upsertFieldFromAttributeDef(attr, descriptor.fields.find(col => col.property === attr.name)));
|
|
2554
|
+
return descriptor;
|
|
2555
|
+
}
|
|
2248
2556
|
get model() {
|
|
2249
2557
|
return this._model;
|
|
2250
2558
|
}
|
|
@@ -2292,20 +2600,23 @@ class EditorDescriptor {
|
|
|
2292
2600
|
this.addFieldDescriptor(field);
|
|
2293
2601
|
return field;
|
|
2294
2602
|
}
|
|
2603
|
+
/**
|
|
2604
|
+
* removes filed if exists in descriptor
|
|
2605
|
+
* @param property field name
|
|
2606
|
+
*/
|
|
2295
2607
|
removeField(property) {
|
|
2296
2608
|
const fieldIdx = this._fields.findIndex(f => f.property === property);
|
|
2297
2609
|
if (fieldIdx < 0) {
|
|
2298
2610
|
throw new Error(`Field ${property} does not exist.`);
|
|
2299
2611
|
}
|
|
2300
|
-
const
|
|
2301
|
-
|
|
2302
|
-
const groupFieldIdx = field.group.fields.findIndex(f => f instanceof AFieldDescriptor && f.property === property);
|
|
2612
|
+
for (const group of this._groups) {
|
|
2613
|
+
const groupFieldIdx = group.fields.findIndex(f => f instanceof AFieldDescriptor && f.property === property);
|
|
2303
2614
|
if (groupFieldIdx >= 0) {
|
|
2304
|
-
|
|
2615
|
+
group.fields.splice(groupFieldIdx, 1);
|
|
2616
|
+
break;
|
|
2305
2617
|
}
|
|
2306
2618
|
}
|
|
2307
2619
|
this._fields.splice(fieldIdx, 1);
|
|
2308
|
-
return this;
|
|
2309
2620
|
}
|
|
2310
2621
|
getField(property) {
|
|
2311
2622
|
var _a;
|
|
@@ -2381,6 +2692,76 @@ class EditorDescriptor {
|
|
|
2381
2692
|
this.createTabGroup(EditorDescriptor.defaultGroupName, 'general.general');
|
|
2382
2693
|
}
|
|
2383
2694
|
}
|
|
2695
|
+
/**
|
|
2696
|
+
* modifies selected field
|
|
2697
|
+
* do not use it for enums! (use withFieldModifiedEnum instead)
|
|
2698
|
+
* @param property field name
|
|
2699
|
+
* @param fieldType new field type for selected field
|
|
2700
|
+
* @param args additional parameters for field
|
|
2701
|
+
*/
|
|
2702
|
+
withFieldModifiedType(property, fieldType, ...args) {
|
|
2703
|
+
const attribute = TableviewUtil.getAttributeDefMap(this._modelType).find(attribute => attribute.name === property);
|
|
2704
|
+
if (attribute) {
|
|
2705
|
+
attribute.fieldType = fieldType;
|
|
2706
|
+
this.upsertFieldFromAttributeDef(attribute, this.fields.find(fi => fi.property === property), ...args);
|
|
2707
|
+
}
|
|
2708
|
+
return this;
|
|
2709
|
+
}
|
|
2710
|
+
/**
|
|
2711
|
+
* modifies selected field with enum type
|
|
2712
|
+
* @param property field property name
|
|
2713
|
+
* @param enumType type of enum for new field
|
|
2714
|
+
* @param optionsTitlePath
|
|
2715
|
+
* @param values
|
|
2716
|
+
* @param nameAsValue
|
|
2717
|
+
*/
|
|
2718
|
+
withFieldModifiedEnum(property, enumType, optionsTitlePath, values, nameAsValue = false) {
|
|
2719
|
+
const attribute = TableviewUtil.getAttributeDefMap(this._modelType).find(a => a.name === property);
|
|
2720
|
+
if (attribute) {
|
|
2721
|
+
attribute.fieldType = FieldInputTypeEnum.Radio;
|
|
2722
|
+
const field = this.fields.find(f => f.property === property);
|
|
2723
|
+
if (field && field instanceof FieldInputDescriptor) {
|
|
2724
|
+
field.asRadioFromEnum(enumType !== null && enumType !== void 0 ? enumType : ObjectSerializer.get().findEnum(attribute.type), optionsTitlePath, values, nameAsValue);
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
return this;
|
|
2728
|
+
}
|
|
2729
|
+
/**
|
|
2730
|
+
* adds lookup to given field
|
|
2731
|
+
* @param property field property name
|
|
2732
|
+
* @param modelType model type of field
|
|
2733
|
+
* @param lookupProvider provider to be added to field
|
|
2734
|
+
* @param titleProperty
|
|
2735
|
+
*/
|
|
2736
|
+
withFieldModifiedLookup(property, modelType, lookupProvider, titleProperty) {
|
|
2737
|
+
this.removeField(property);
|
|
2738
|
+
const field = this.addFieldLookup(property, modelType).asAutocomplete().withLookupDataProvider(lookupProvider);
|
|
2739
|
+
if (titleProperty) {
|
|
2740
|
+
field.withItemsLabelProperty(titleProperty);
|
|
2741
|
+
}
|
|
2742
|
+
return this;
|
|
2743
|
+
}
|
|
2744
|
+
/**
|
|
2745
|
+
* generates field based on attribute definition, used for auto model
|
|
2746
|
+
* @param attribute definition
|
|
2747
|
+
* @param field optional, if defined will be replaced, otherwise new will be generated
|
|
2748
|
+
* @param args additional arguments
|
|
2749
|
+
*/
|
|
2750
|
+
upsertFieldFromAttributeDef(attribute, field, ...args) {
|
|
2751
|
+
var _a;
|
|
2752
|
+
if (field == null) {
|
|
2753
|
+
field = this.addField(attribute.name);
|
|
2754
|
+
}
|
|
2755
|
+
if (field instanceof FieldInputDescriptor) {
|
|
2756
|
+
if (attribute.enumType) {
|
|
2757
|
+
return field.asRadioFromEnum(attribute.enumType);
|
|
2758
|
+
}
|
|
2759
|
+
else {
|
|
2760
|
+
return field.asType((_a = attribute.fieldType) !== null && _a !== void 0 ? _a : TableviewUtil.toFieldInputTypeFromColumnType(attribute.columnType), ...args);
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
return field;
|
|
2764
|
+
}
|
|
2384
2765
|
}
|
|
2385
2766
|
EditorDescriptor.defaultGroupName = '_default';
|
|
2386
2767
|
|
|
@@ -2453,9 +2834,6 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
|
|
|
2453
2834
|
get property() {
|
|
2454
2835
|
return this._property;
|
|
2455
2836
|
}
|
|
2456
|
-
get group() {
|
|
2457
|
-
return this._group;
|
|
2458
|
-
}
|
|
2459
2837
|
get label() {
|
|
2460
2838
|
return this._label;
|
|
2461
2839
|
}
|
|
@@ -2619,6 +2997,39 @@ class FieldInputDescriptor extends AFieldDescriptor {
|
|
|
2619
2997
|
this._fileMultiple = false;
|
|
2620
2998
|
this._fileMaxFileSize = 500000;
|
|
2621
2999
|
}
|
|
3000
|
+
/**
|
|
3001
|
+
* converts field to given type with additional arguments
|
|
3002
|
+
* @param fieldType field type enum
|
|
3003
|
+
* @param args any additional arguments for field (optional)
|
|
3004
|
+
*/
|
|
3005
|
+
asType(fieldType, ...args) {
|
|
3006
|
+
switch (fieldType) {
|
|
3007
|
+
case FieldInputTypeEnum.Hidden:
|
|
3008
|
+
return this.asHidden();
|
|
3009
|
+
case FieldInputTypeEnum.Label:
|
|
3010
|
+
return this.asLabel();
|
|
3011
|
+
case FieldInputTypeEnum.Textarea:
|
|
3012
|
+
return this.asTextarea(...args);
|
|
3013
|
+
case FieldInputTypeEnum.Number:
|
|
3014
|
+
return this.asNumber();
|
|
3015
|
+
case FieldInputTypeEnum.Currency:
|
|
3016
|
+
return this.asCurrency(...args);
|
|
3017
|
+
case FieldInputTypeEnum.Switch:
|
|
3018
|
+
return this.asSwitch();
|
|
3019
|
+
case FieldInputTypeEnum.Radio:
|
|
3020
|
+
return this.asRadio(args[0], args[1]);
|
|
3021
|
+
case FieldInputTypeEnum.Datepicker:
|
|
3022
|
+
return this.asDatePicker(...args);
|
|
3023
|
+
case FieldInputTypeEnum.Mask:
|
|
3024
|
+
return this.asMask(args[0], args[1]);
|
|
3025
|
+
case FieldInputTypeEnum.File:
|
|
3026
|
+
return this.asFile(...args);
|
|
3027
|
+
case FieldInputTypeEnum.Custom:
|
|
3028
|
+
return this.asCustomComponent(args[0]);
|
|
3029
|
+
case FieldInputTypeEnum.Text:
|
|
3030
|
+
return this.asText();
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
2622
3033
|
get fieldType() {
|
|
2623
3034
|
return this._fieldType;
|
|
2624
3035
|
}
|
|
@@ -3153,6 +3564,10 @@ class AFieldGroupDescriptor extends AGenericFieldDescriptor {
|
|
|
3153
3564
|
this._name = `${this.baseName}${name}`;
|
|
3154
3565
|
this._default = name === EditorDescriptor.defaultGroupName;
|
|
3155
3566
|
}
|
|
3567
|
+
removeField(property, filterFunction) {
|
|
3568
|
+
this._fields = filterFunction(this._fields);
|
|
3569
|
+
return this._fields;
|
|
3570
|
+
}
|
|
3156
3571
|
get title() {
|
|
3157
3572
|
return this._title;
|
|
3158
3573
|
}
|
|
@@ -3304,9 +3719,33 @@ class TableDescriptor {
|
|
|
3304
3719
|
this._size = TableSizeEnum.Large;
|
|
3305
3720
|
this._hasHover = true;
|
|
3306
3721
|
this._hasGridlines = false;
|
|
3722
|
+
this._autoGenerated = false;
|
|
3723
|
+
this._modelType = modelType;
|
|
3307
3724
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
3308
3725
|
this._dataKeyProperty = (_a = idProperty !== null && idProperty !== void 0 ? idProperty : ModelUtil.findIdAttribute(modelType)) !== null && _a !== void 0 ? _a : undefined;
|
|
3309
3726
|
}
|
|
3727
|
+
/**
|
|
3728
|
+
* generates descriptor based on modelType attribute definition
|
|
3729
|
+
* @param modelType class type
|
|
3730
|
+
* @param idProperty
|
|
3731
|
+
* @param titleProperty
|
|
3732
|
+
*/
|
|
3733
|
+
static from(modelType, idProperty, titleProperty) {
|
|
3734
|
+
return TableDescriptor.fromModelWithAttributes(modelType, TableviewUtil.getAttributeDefMap(modelType), idProperty, titleProperty);
|
|
3735
|
+
}
|
|
3736
|
+
/**
|
|
3737
|
+
* generates descriptor base on given attribute definition
|
|
3738
|
+
* @param modelType class type
|
|
3739
|
+
* @param attributes attributes from which descriptor is generated
|
|
3740
|
+
* @param idProperty
|
|
3741
|
+
* @param titleProperty
|
|
3742
|
+
*/
|
|
3743
|
+
static fromModelWithAttributes(modelType, attributes, idProperty, titleProperty) {
|
|
3744
|
+
const descriptor = new TableDescriptor(modelType, idProperty, titleProperty);
|
|
3745
|
+
descriptor._autoGenerated = true;
|
|
3746
|
+
attributes.filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array')).forEach(attr => descriptor.upsertColumnFromAttributeDef(attr));
|
|
3747
|
+
return descriptor;
|
|
3748
|
+
}
|
|
3310
3749
|
get filterDisplay() {
|
|
3311
3750
|
return this._filterDisplay;
|
|
3312
3751
|
}
|
|
@@ -3361,6 +3800,18 @@ class TableDescriptor {
|
|
|
3361
3800
|
get hasGridlines() {
|
|
3362
3801
|
return this._hasGridlines;
|
|
3363
3802
|
}
|
|
3803
|
+
get rowClassName() {
|
|
3804
|
+
return this._rowClassName;
|
|
3805
|
+
}
|
|
3806
|
+
get rowClassNameMapFn() {
|
|
3807
|
+
return this._rowClassNameMapFn;
|
|
3808
|
+
}
|
|
3809
|
+
get headerClassName() {
|
|
3810
|
+
return this._headerClassName;
|
|
3811
|
+
}
|
|
3812
|
+
getColumn(property) {
|
|
3813
|
+
return this._columns.find(col => col.property === property);
|
|
3814
|
+
}
|
|
3364
3815
|
addColumnDescriptor(column) {
|
|
3365
3816
|
this._columns.push(column);
|
|
3366
3817
|
return this;
|
|
@@ -3400,6 +3851,10 @@ class TableDescriptor {
|
|
|
3400
3851
|
this._columns.push(column);
|
|
3401
3852
|
return column;
|
|
3402
3853
|
}
|
|
3854
|
+
removeColumn(property) {
|
|
3855
|
+
const columndIdx = this._columns.findIndex(c => c.property === property);
|
|
3856
|
+
this._columns.splice(columndIdx, 1);
|
|
3857
|
+
}
|
|
3403
3858
|
withFilterDisplay(filterDisplayType) {
|
|
3404
3859
|
this._filterDisplay = filterDisplayType;
|
|
3405
3860
|
return this;
|
|
@@ -3462,28 +3917,255 @@ class TableDescriptor {
|
|
|
3462
3917
|
this._hasGridlines = gridlines;
|
|
3463
3918
|
return this;
|
|
3464
3919
|
}
|
|
3920
|
+
withRowClassName(rowClassName, classNameMapFn) {
|
|
3921
|
+
this._rowClassName = rowClassName;
|
|
3922
|
+
this._rowClassNameMapFn = classNameMapFn;
|
|
3923
|
+
return this;
|
|
3924
|
+
}
|
|
3925
|
+
withHeaderClassName(headerClassName) {
|
|
3926
|
+
this._headerClassName = headerClassName;
|
|
3927
|
+
return this;
|
|
3928
|
+
}
|
|
3929
|
+
copyFieldsTo(obj) {
|
|
3930
|
+
obj._title = this._title;
|
|
3931
|
+
obj._hideHeader = this._hideHeader;
|
|
3932
|
+
obj._dataKeyProperty = this._dataKeyProperty;
|
|
3933
|
+
obj._hasDefaultSort = this._hasDefaultSort;
|
|
3934
|
+
obj._defaultSortProperty = this._defaultSortProperty.map(p => p);
|
|
3935
|
+
obj._defaultSortAsc = this._defaultSortAsc.map(p => p);
|
|
3936
|
+
obj._filterDisplay = this._filterDisplay;
|
|
3937
|
+
obj._className = this._className;
|
|
3938
|
+
obj._size = this._size;
|
|
3939
|
+
obj._tableFullHeightOffset = this._tableFullHeightOffset;
|
|
3940
|
+
obj._rowHeight = this._rowHeight;
|
|
3941
|
+
obj._hasHover = this._hasHover;
|
|
3942
|
+
obj._hasGridlines = this._hasGridlines;
|
|
3943
|
+
}
|
|
3465
3944
|
copy() {
|
|
3466
3945
|
const descriptor = new TableDescriptor(this.model.type, this.model.idPropertyName, this.model.titlePropertyName);
|
|
3946
|
+
this.copyFieldsTo(descriptor);
|
|
3467
3947
|
descriptor._columns = this.columns.map(c => c.copy());
|
|
3468
|
-
descriptor
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3948
|
+
return descriptor;
|
|
3949
|
+
}
|
|
3950
|
+
/**
|
|
3951
|
+
* generates column based on attributes
|
|
3952
|
+
* @param attribute attribute map
|
|
3953
|
+
* @param column if provided, replaced by new, otherwise new is created
|
|
3954
|
+
* @param args additional parameters
|
|
3955
|
+
*/
|
|
3956
|
+
upsertColumnFromAttributeDef(attribute, column, ...args) {
|
|
3957
|
+
if (column == null) {
|
|
3958
|
+
column = this.addColumn(attribute.name);
|
|
3959
|
+
}
|
|
3960
|
+
if (attribute.columnType === ColumnTypeEnum.Enum && args.length === 0) {
|
|
3961
|
+
args = [attribute.enumType];
|
|
3962
|
+
}
|
|
3963
|
+
column = column.asType(attribute.columnType, ...args);
|
|
3964
|
+
if (attribute.classType) {
|
|
3965
|
+
column.withObjectProperty(attribute.classType).withSort();
|
|
3966
|
+
}
|
|
3967
|
+
else {
|
|
3968
|
+
column.withSort().withFilter();
|
|
3969
|
+
}
|
|
3970
|
+
return column;
|
|
3971
|
+
}
|
|
3972
|
+
/**
|
|
3973
|
+
* defines modified type of column
|
|
3974
|
+
* DO NOT USE with enum (use withCustomEnumType)
|
|
3975
|
+
* @param property column name
|
|
3976
|
+
* @param columnType modified type
|
|
3977
|
+
* @param args additional attributes
|
|
3978
|
+
*/
|
|
3979
|
+
withColumnModifiedType(property, columnType, ...args) {
|
|
3980
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
3981
|
+
if (attributeDef != null) {
|
|
3982
|
+
attributeDef.columnType = columnType !== null && columnType !== void 0 ? columnType : attributeDef.columnType;
|
|
3983
|
+
this.upsertColumnFromAttributeDef(attributeDef, this.columns.find(col => col.property === attributeDef.name), ...args);
|
|
3984
|
+
}
|
|
3985
|
+
return this;
|
|
3986
|
+
}
|
|
3987
|
+
/**
|
|
3988
|
+
* defines custom enum type for column
|
|
3989
|
+
* @param property column name
|
|
3990
|
+
* @param enumType
|
|
3991
|
+
*/
|
|
3992
|
+
withColumnModifiedEnum(property, enumType) {
|
|
3993
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
3994
|
+
if (attributeDef != null) {
|
|
3995
|
+
attributeDef.columnType = ColumnTypeEnum.Enum;
|
|
3996
|
+
this.upsertColumnFromAttributeDef(attributeDef, this.columns.find(col => col.property === property), enumType !== null && enumType !== void 0 ? enumType : ObjectSerializer.get().findEnum(attributeDef.type));
|
|
3997
|
+
}
|
|
3998
|
+
return this;
|
|
3999
|
+
}
|
|
4000
|
+
/**
|
|
4001
|
+
* modifies column with class and lookup provider
|
|
4002
|
+
* @param property column name
|
|
4003
|
+
* @param lookupProvider lookupProvider for class
|
|
4004
|
+
* @param itemsLabelProperty
|
|
4005
|
+
* @param filterProperty
|
|
4006
|
+
*/
|
|
4007
|
+
withColumnModifiedLookup(property, lookupProvider, itemsLabelProperty, filterProperty) {
|
|
4008
|
+
const column = this.columns.find(col => col.property === property);
|
|
4009
|
+
if (column) {
|
|
4010
|
+
column.withFilterLookup().withLookupDataProvider(lookupProvider);
|
|
4011
|
+
if (column instanceof FilterLookupDescriptor) {
|
|
4012
|
+
if (itemsLabelProperty) {
|
|
4013
|
+
column.withItemsLabelProperty(itemsLabelProperty);
|
|
4014
|
+
}
|
|
4015
|
+
if (filterProperty) {
|
|
4016
|
+
column.withFilterProperty(filterProperty);
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
return this;
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
class TableDynamicDescriptor extends TableDescriptor {
|
|
4024
|
+
constructor(idProperty, titleProperty) {
|
|
4025
|
+
super({}, idProperty, titleProperty);
|
|
4026
|
+
this._excludedColumns = [];
|
|
4027
|
+
this._filterColumns = [];
|
|
4028
|
+
this._sortColumns = [];
|
|
4029
|
+
this._sortColumnMode = TableDynamicColumnsModeEnum.EXCLUDE;
|
|
4030
|
+
this._filterColumnMode = TableDynamicColumnsModeEnum.EXCLUDE;
|
|
4031
|
+
this._columns = [];
|
|
4032
|
+
this.withTitle('Dynamic table');
|
|
4033
|
+
}
|
|
4034
|
+
get columns() {
|
|
4035
|
+
return this._columns;
|
|
4036
|
+
}
|
|
4037
|
+
/**
|
|
4038
|
+
* defines excluded columns when generating descriptor
|
|
4039
|
+
* @param excludedColumn names of excluded columns
|
|
4040
|
+
*/
|
|
4041
|
+
withColumnsExcluded(excludedColumn) {
|
|
4042
|
+
this._excludedColumns = excludedColumn;
|
|
4043
|
+
return this;
|
|
4044
|
+
}
|
|
4045
|
+
/**
|
|
4046
|
+
* defines column properties on which sort is defined or not depending on sortColumnMode
|
|
4047
|
+
* @param sortOnColumns column names
|
|
4048
|
+
* @param sortColumnMode INCLUDE_ONLY (default) only given columns will have sort, EXCLUDE given columns will NOT have sort
|
|
4049
|
+
*/
|
|
4050
|
+
withColumnsSort(sortOnColumns, sortColumnMode = TableDynamicColumnsModeEnum.INCLUDE_ONLY) {
|
|
4051
|
+
this._sortColumnMode = sortColumnMode;
|
|
4052
|
+
this._sortColumns = sortOnColumns;
|
|
4053
|
+
return this;
|
|
4054
|
+
}
|
|
4055
|
+
/**
|
|
4056
|
+
* defines column properties on which filter is defined or not depending on filterColumnMode
|
|
4057
|
+
* @param filterOnColumn column names
|
|
4058
|
+
* @param filterColumnMode INCLUDE_ONLY (default) only given columns will have filter, EXCLUDE given columns will NOT have filter
|
|
4059
|
+
*/
|
|
4060
|
+
withColumnsFilter(filterOnColumn, filterColumnMode = TableDynamicColumnsModeEnum.INCLUDE_ONLY) {
|
|
4061
|
+
this._filterColumnMode = filterColumnMode;
|
|
4062
|
+
this._filterColumns = filterOnColumn;
|
|
4063
|
+
return this;
|
|
4064
|
+
}
|
|
4065
|
+
/**
|
|
4066
|
+
* sets given type to column with given property and returns this table
|
|
4067
|
+
* @param property column's property
|
|
4068
|
+
* @param type custom type for column
|
|
4069
|
+
* @param args addition arguments for column
|
|
4070
|
+
*/
|
|
4071
|
+
withColumnModifiedType(property, type, ...args) {
|
|
4072
|
+
var _a;
|
|
4073
|
+
const column = (_a = this._columns.find(col => property === col.property)) !== null && _a !== void 0 ? _a : this.addColumn(property).withTitle(property);
|
|
4074
|
+
if (column) {
|
|
4075
|
+
column.asType(type, ...args);
|
|
4076
|
+
}
|
|
4077
|
+
return this;
|
|
4078
|
+
}
|
|
4079
|
+
/**
|
|
4080
|
+
* sets title to column with given property and returns this table
|
|
4081
|
+
* @param property column's property
|
|
4082
|
+
* @param title column's title
|
|
4083
|
+
*/
|
|
4084
|
+
withColumnTitle(property, title) {
|
|
4085
|
+
var _a;
|
|
4086
|
+
const column = (_a = this._columns.find(col => property === col.property)) !== null && _a !== void 0 ? _a : this.addColumn(property);
|
|
4087
|
+
column.withTitle(title, true);
|
|
4088
|
+
return this;
|
|
4089
|
+
}
|
|
4090
|
+
/**
|
|
4091
|
+
* generates columns defined on table based on data fetched from api
|
|
4092
|
+
* @param data data from api
|
|
4093
|
+
*/
|
|
4094
|
+
toTableDescriptorFromData(data) {
|
|
4095
|
+
const tableDescriptor = this.toTableDescriptor();
|
|
4096
|
+
if (data.pageData == null || data.pageData.length == 0) {
|
|
4097
|
+
return tableDescriptor;
|
|
4098
|
+
}
|
|
4099
|
+
const objectModel = data.pageData[0];
|
|
4100
|
+
const entries = Object.entries(objectModel)
|
|
4101
|
+
.filter(([key]) => !this._excludedColumns.includes(key))
|
|
4102
|
+
.filter(([, value]) => !Array.isArray(value)); //exclude arrays and sets
|
|
4103
|
+
for (const [key, value] of entries) {
|
|
4104
|
+
const metaColumn = this._columns.find(col => col.property === key);
|
|
4105
|
+
let column;
|
|
4106
|
+
if (metaColumn) {
|
|
4107
|
+
if (!metaColumn.visibility) {
|
|
4108
|
+
continue;
|
|
4109
|
+
}
|
|
4110
|
+
column = metaColumn.toColumnDescriptor(tableDescriptor);
|
|
4111
|
+
tableDescriptor.addColumnDescriptor(column);
|
|
4112
|
+
}
|
|
4113
|
+
else {
|
|
4114
|
+
column = tableDescriptor.addColumn(key).withTitle(key);
|
|
4115
|
+
TableviewUtil.stringColumnConverter(column, value);
|
|
4116
|
+
}
|
|
4117
|
+
const elementOfSortColumns = this._sortColumns.includes(column.property);
|
|
4118
|
+
if ((this._sortColumnMode === TableDynamicColumnsModeEnum.EXCLUDE && !elementOfSortColumns) ||
|
|
4119
|
+
(this._sortColumnMode === TableDynamicColumnsModeEnum.INCLUDE_ONLY && elementOfSortColumns)) {
|
|
4120
|
+
column.withSort();
|
|
4121
|
+
}
|
|
4122
|
+
const elementOfFilterColumns = this._filterColumns.includes(column.property);
|
|
4123
|
+
if ((this._filterColumnMode === TableDynamicColumnsModeEnum.EXCLUDE && !elementOfFilterColumns) ||
|
|
4124
|
+
(this._filterColumnMode === TableDynamicColumnsModeEnum.INCLUDE_ONLY && elementOfFilterColumns)) {
|
|
4125
|
+
column.withFilter();
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
return tableDescriptor;
|
|
4129
|
+
}
|
|
4130
|
+
/**
|
|
4131
|
+
* adds ColumnDynamicDescriptor to this table
|
|
4132
|
+
* @param property column's property
|
|
4133
|
+
*/
|
|
4134
|
+
addColumn(property) {
|
|
4135
|
+
const column = new ColumnDynamicDescriptor(this, property);
|
|
4136
|
+
this._columns.push(column);
|
|
4137
|
+
return column;
|
|
4138
|
+
}
|
|
4139
|
+
removeColumn(property) {
|
|
4140
|
+
var _a;
|
|
4141
|
+
const column = (_a = this.columns.find(col => col.property === property)) !== null && _a !== void 0 ? _a : this.addColumn(property);
|
|
4142
|
+
column.withVisibility(false);
|
|
4143
|
+
return this;
|
|
4144
|
+
}
|
|
4145
|
+
/**
|
|
4146
|
+
* creates deep copy of table dynamic descriptor
|
|
4147
|
+
*/
|
|
4148
|
+
copy() {
|
|
4149
|
+
const descriptor = new TableDynamicDescriptor(this.model.idPropertyName, this.model.titlePropertyName);
|
|
4150
|
+
this.copyFieldsTo(descriptor);
|
|
4151
|
+
descriptor._columns = this.columns.map(c => c.copy());
|
|
4152
|
+
descriptor._excludedColumns = [...this._excludedColumns];
|
|
4153
|
+
descriptor._filterColumns = [...this._filterColumns];
|
|
4154
|
+
descriptor._sortColumns = [...this._sortColumns];
|
|
4155
|
+
descriptor._filterColumnMode = this._filterColumnMode;
|
|
4156
|
+
descriptor._sortColumnMode = this._sortColumnMode;
|
|
4157
|
+
return descriptor;
|
|
4158
|
+
}
|
|
4159
|
+
toTableDescriptor() {
|
|
4160
|
+
const descriptor = new TableDescriptor({}, this.model.idPropertyName, this.model.titlePropertyName);
|
|
4161
|
+
this.copyFieldsTo(descriptor);
|
|
3481
4162
|
return descriptor;
|
|
3482
4163
|
}
|
|
3483
4164
|
}
|
|
3484
4165
|
|
|
3485
4166
|
class TableviewDescriptor {
|
|
3486
4167
|
constructor(modelType, idProperty, titleProperty) {
|
|
4168
|
+
this._modelType = modelType;
|
|
3487
4169
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
3488
4170
|
this._table = new TableDescriptor(modelType, idProperty, titleProperty);
|
|
3489
4171
|
this._viewEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewTypeEnum.View);
|
|
@@ -3492,6 +4174,38 @@ class TableviewDescriptor {
|
|
|
3492
4174
|
this._editEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewTypeEnum.Edit);
|
|
3493
4175
|
this._tableTitle = `${this._model.typeName}.name`;
|
|
3494
4176
|
}
|
|
4177
|
+
/**
|
|
4178
|
+
* generates descriptor from attribute definition of openaapi model
|
|
4179
|
+
* @param modelType class type
|
|
4180
|
+
* @param idProperty
|
|
4181
|
+
* @param titleProperty
|
|
4182
|
+
*/
|
|
4183
|
+
static from(modelType, idProperty, titleProperty) {
|
|
4184
|
+
const descriptor = new TableviewDescriptor(modelType, idProperty, titleProperty);
|
|
4185
|
+
descriptor._table = TableDescriptor.from(modelType, idProperty, titleProperty);
|
|
4186
|
+
descriptor._editEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4187
|
+
descriptor._viewEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4188
|
+
descriptor._addEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4189
|
+
return descriptor;
|
|
4190
|
+
}
|
|
4191
|
+
/**
|
|
4192
|
+
* generates descriptor from given attribute definition
|
|
4193
|
+
* @param modelType class type
|
|
4194
|
+
* @param columnAttributes attribute definition to generate columns
|
|
4195
|
+
* @param fieldAttributes attribute definition to generate fields, if undefined columnDefinition is used, if null editors are not generated
|
|
4196
|
+
* @param idProperty
|
|
4197
|
+
* @param titleProperty
|
|
4198
|
+
*/
|
|
4199
|
+
static fromModelWithDefinition(modelType, columnAttributes, fieldAttributes, idProperty, titleProperty) {
|
|
4200
|
+
const descriptor = new TableviewDescriptor(modelType, idProperty, titleProperty);
|
|
4201
|
+
descriptor._table = TableDescriptor.fromModelWithAttributes(modelType, columnAttributes, idProperty, titleProperty);
|
|
4202
|
+
if (fieldAttributes !== null) {
|
|
4203
|
+
descriptor._editEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes !== null && fieldAttributes !== void 0 ? fieldAttributes : columnAttributes, idProperty, titleProperty);
|
|
4204
|
+
descriptor._viewEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes !== null && fieldAttributes !== void 0 ? fieldAttributes : columnAttributes, idProperty, titleProperty);
|
|
4205
|
+
descriptor._addEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes !== null && fieldAttributes !== void 0 ? fieldAttributes : columnAttributes, idProperty, titleProperty);
|
|
4206
|
+
}
|
|
4207
|
+
return descriptor;
|
|
4208
|
+
}
|
|
3495
4209
|
get table() {
|
|
3496
4210
|
return this._table;
|
|
3497
4211
|
}
|
|
@@ -3514,6 +4228,12 @@ class TableviewDescriptor {
|
|
|
3514
4228
|
this._table = descriptor;
|
|
3515
4229
|
return this;
|
|
3516
4230
|
}
|
|
4231
|
+
withEditorDescriptors(descriptor) {
|
|
4232
|
+
this._viewEditor = descriptor;
|
|
4233
|
+
this._editEditor = descriptor;
|
|
4234
|
+
this._addEditor = descriptor;
|
|
4235
|
+
return this;
|
|
4236
|
+
}
|
|
3517
4237
|
withViewDescriptor(descriptor) {
|
|
3518
4238
|
this._viewEditor = descriptor;
|
|
3519
4239
|
return this;
|
|
@@ -3542,6 +4262,26 @@ class TableviewDescriptor {
|
|
|
3542
4262
|
addColumn(property) {
|
|
3543
4263
|
return this._table.addColumn(property);
|
|
3544
4264
|
}
|
|
4265
|
+
removeColumn(property) {
|
|
4266
|
+
this._table.removeColumn(property);
|
|
4267
|
+
}
|
|
4268
|
+
getField(property, editorType) {
|
|
4269
|
+
switch (editorType) {
|
|
4270
|
+
case TableviewTypeEnum.Edit:
|
|
4271
|
+
return this._editEditor.getField(property);
|
|
4272
|
+
case TableviewTypeEnum.Add:
|
|
4273
|
+
return this._addEditor.getField(property);
|
|
4274
|
+
case TableviewTypeEnum.View:
|
|
4275
|
+
return this._viewEditor.getField(property);
|
|
4276
|
+
case TableviewTypeEnum.None:
|
|
4277
|
+
return null;
|
|
4278
|
+
}
|
|
4279
|
+
}
|
|
4280
|
+
removeField(property) {
|
|
4281
|
+
this._editEditor.removeField(property);
|
|
4282
|
+
this._addEditor.removeField(property);
|
|
4283
|
+
this._viewEditor.removeField(property);
|
|
4284
|
+
}
|
|
3545
4285
|
addColumnNumber(property, displayFormat) {
|
|
3546
4286
|
return this._table.addColumnNumber(property, displayFormat);
|
|
3547
4287
|
}
|
|
@@ -3613,6 +4353,117 @@ class TableviewDescriptor {
|
|
|
3613
4353
|
tableview._editEditor = this._editEditor.copy();
|
|
3614
4354
|
return tableview;
|
|
3615
4355
|
}
|
|
4356
|
+
/**
|
|
4357
|
+
* creates column and field with custom type, for example currency
|
|
4358
|
+
* if field exists, it is replaced
|
|
4359
|
+
* DO NOT USE WITH TYPES WHERE ARGS ARE REQUIRED - ERROR WILL BE THROWN
|
|
4360
|
+
* for enum use withEnumType
|
|
4361
|
+
* for custom class use withClassType
|
|
4362
|
+
* @param property name of field
|
|
4363
|
+
* @param columnType required column type
|
|
4364
|
+
* @param fieldType optional, if not provided it is converted from column type
|
|
4365
|
+
*/
|
|
4366
|
+
withModifiedType(property, columnType, fieldType) {
|
|
4367
|
+
if (columnType === ColumnTypeEnum.Enum) {
|
|
4368
|
+
throw new Error('Do not use with types where args are required');
|
|
4369
|
+
}
|
|
4370
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4371
|
+
if (attributeDef != null) {
|
|
4372
|
+
fieldType !== null && fieldType !== void 0 ? fieldType : (fieldType = TableviewUtil.toFieldInputTypeFromColumnType(columnType));
|
|
4373
|
+
attributeDef.fieldType = fieldType;
|
|
4374
|
+
this._table.withColumnModifiedType(property, columnType);
|
|
4375
|
+
this._editEditor.withFieldModifiedType(property, fieldType);
|
|
4376
|
+
this._addEditor.withFieldModifiedType(property, fieldType);
|
|
4377
|
+
this._viewEditor.withFieldModifiedType(property, fieldType);
|
|
4378
|
+
}
|
|
4379
|
+
return this;
|
|
4380
|
+
}
|
|
4381
|
+
/**
|
|
4382
|
+
* creates column with enum type
|
|
4383
|
+
* if fields exists, it is replaced
|
|
4384
|
+
* @param property property name
|
|
4385
|
+
* @param enumType type of enum
|
|
4386
|
+
* @param fieldType type of field, optional, default is Text
|
|
4387
|
+
*/
|
|
4388
|
+
withModifiedEnum(property, enumType, fieldType) {
|
|
4389
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4390
|
+
if (attributeDef != null) {
|
|
4391
|
+
attributeDef.fieldType = fieldType !== null && fieldType !== void 0 ? fieldType : FieldInputTypeEnum.Text;
|
|
4392
|
+
this._table.withColumnModifiedEnum(property, enumType);
|
|
4393
|
+
this._editEditor.withFieldModifiedEnum(property, enumType);
|
|
4394
|
+
this._viewEditor.withFieldModifiedEnum(property, enumType);
|
|
4395
|
+
this._addEditor.withFieldModifiedEnum(property, enumType);
|
|
4396
|
+
}
|
|
4397
|
+
return this;
|
|
4398
|
+
}
|
|
4399
|
+
/**
|
|
4400
|
+
* generates column with custom class type
|
|
4401
|
+
* field is generated only if lookupProvider is provided
|
|
4402
|
+
* @param property property name
|
|
4403
|
+
* @param modelType class type of object
|
|
4404
|
+
* @param titleProperty
|
|
4405
|
+
* @param lookupProvider
|
|
4406
|
+
* @param itemsLabelProperty
|
|
4407
|
+
* @param filterProperty
|
|
4408
|
+
*/
|
|
4409
|
+
withModifiedLookup(property, modelType, lookupProvider, titleProperty, itemsLabelProperty, filterProperty) {
|
|
4410
|
+
var _a, _b, _c;
|
|
4411
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4412
|
+
if (attributeDef != null) {
|
|
4413
|
+
modelType !== null && modelType !== void 0 ? modelType : (modelType = (_a = attributeDef.classType) !== null && _a !== void 0 ? _a : ObjectSerializer.get().findType(attributeDef.type));
|
|
4414
|
+
titleProperty !== null && titleProperty !== void 0 ? titleProperty : (titleProperty = (_b = ModelUtil.findTitleAttribute(modelType)) !== null && _b !== void 0 ? _b : undefined);
|
|
4415
|
+
itemsLabelProperty !== null && itemsLabelProperty !== void 0 ? itemsLabelProperty : (itemsLabelProperty = titleProperty);
|
|
4416
|
+
attributeDef.columnType = ColumnTypeEnum.String;
|
|
4417
|
+
attributeDef.fieldType = FieldInputTypeEnum.Text;
|
|
4418
|
+
if (lookupProvider != null) {
|
|
4419
|
+
this._table.withColumnModifiedLookup(property, lookupProvider, itemsLabelProperty, filterProperty);
|
|
4420
|
+
this._addEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4421
|
+
this._viewEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4422
|
+
this._editEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4423
|
+
}
|
|
4424
|
+
else {
|
|
4425
|
+
const column = (_c = this._table.getColumn(property)) !== null && _c !== void 0 ? _c : this.addColumn(property);
|
|
4426
|
+
column.withObjectProperty(modelType, titleProperty);
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
return this;
|
|
4430
|
+
}
|
|
4431
|
+
}
|
|
4432
|
+
class TableviewDynamicDescriptor extends TableviewDescriptor {
|
|
4433
|
+
constructor(idProperty, titleProperty) {
|
|
4434
|
+
super({}, idProperty, titleProperty);
|
|
4435
|
+
this._table = new TableDynamicDescriptor(idProperty, titleProperty);
|
|
4436
|
+
super._tableTitle = undefined;
|
|
4437
|
+
}
|
|
4438
|
+
get table() {
|
|
4439
|
+
return this._table;
|
|
4440
|
+
}
|
|
4441
|
+
/**
|
|
4442
|
+
* sets custom table descriptor
|
|
4443
|
+
* @param descriptor
|
|
4444
|
+
*/
|
|
4445
|
+
withTableDescriptor(descriptor) {
|
|
4446
|
+
this._table = descriptor;
|
|
4447
|
+
return this;
|
|
4448
|
+
}
|
|
4449
|
+
/**
|
|
4450
|
+
* sets visibility hidden state to column with given property
|
|
4451
|
+
* equals to be removing in auto and base tableview descriptor
|
|
4452
|
+
* * @param property column's property
|
|
4453
|
+
*/
|
|
4454
|
+
removeColumn(property) {
|
|
4455
|
+
this._table.removeColumn(property);
|
|
4456
|
+
return this;
|
|
4457
|
+
}
|
|
4458
|
+
/**
|
|
4459
|
+
* creates depp copy of tableview object and its children
|
|
4460
|
+
*/
|
|
4461
|
+
copy() {
|
|
4462
|
+
const descriptor = new TableviewDynamicDescriptor(this.model.idPropertyName, this.model.titlePropertyName);
|
|
4463
|
+
descriptor._table = this._table.copy();
|
|
4464
|
+
descriptor._tableTitle = this._tableTitle;
|
|
4465
|
+
return descriptor;
|
|
4466
|
+
}
|
|
3616
4467
|
}
|
|
3617
4468
|
|
|
3618
4469
|
class ButtonDescriptor {
|
|
@@ -4755,7 +5606,6 @@ ObjectSerializer._instance = new ObjectSerializer();
|
|
|
4755
5606
|
|
|
4756
5607
|
class MediusRestUtil {
|
|
4757
5608
|
static fromAngularQueryParamsToMediusQueryParams(params, filterDescriptors, defaultItemsPerPage = 10, defaultOffset = 0) {
|
|
4758
|
-
var _a;
|
|
4759
5609
|
const offset = params['first'] ? parseInt(params['first']) : defaultOffset;
|
|
4760
5610
|
const itemsPerPage = params['rows'] ? parseInt(params['rows']) : defaultItemsPerPage;
|
|
4761
5611
|
const mediusParamsBuilder = MediusQueryParamBuilder.create(itemsPerPage, offset);
|
|
@@ -4788,8 +5638,7 @@ class MediusRestUtil {
|
|
|
4788
5638
|
const filterDescriptor = filterDescriptors.find(f => f.property === field);
|
|
4789
5639
|
const matchMode = MediusRestUtil.getMapping(operator, filterDescriptor === null || filterDescriptor === void 0 ? void 0 : filterDescriptor.filterType, 1);
|
|
4790
5640
|
if (matchMode && filterDescriptor) {
|
|
4791
|
-
|
|
4792
|
-
mediusParamsBuilder.withFilter(fieldFilterProperty, value, valueTo, MediusRestUtil.getMediusFilterMatchTypeFromPrimeMatchMode(matchMode[0]));
|
|
5641
|
+
mediusParamsBuilder.withFilter(filterDescriptor.property, value, valueTo, MediusRestUtil.getMediusFilterMatchTypeFromPrimeMatchMode(matchMode[0]));
|
|
4793
5642
|
}
|
|
4794
5643
|
}
|
|
4795
5644
|
}
|
|
@@ -4846,6 +5695,13 @@ class MediusRestUtil {
|
|
|
4846
5695
|
}
|
|
4847
5696
|
return params;
|
|
4848
5697
|
}
|
|
5698
|
+
static modifyFilterProperties(mediusQueryParams, filterDescriptors) {
|
|
5699
|
+
var _a, _b;
|
|
5700
|
+
for (const filterParam of (_a = mediusQueryParams.filterParams) !== null && _a !== void 0 ? _a : []) {
|
|
5701
|
+
const filterDescriptor = filterDescriptors.find(f => f.property === filterParam.property);
|
|
5702
|
+
filterParam.property = (_b = filterDescriptor === null || filterDescriptor === void 0 ? void 0 : filterDescriptor.filterProperty) !== null && _b !== void 0 ? _b : filterParam.property;
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
4849
5705
|
static fromPrimeLazyLoadEventToMediusQueryParams(event) {
|
|
4850
5706
|
const queryParamBuilder = MediusQueryParamBuilder.create(event.rows, event.first);
|
|
4851
5707
|
// apply sorting
|
|
@@ -5097,6 +5953,7 @@ class ActionParameters {
|
|
|
5097
5953
|
constructor(itemId, item) {
|
|
5098
5954
|
this.itemId = itemId;
|
|
5099
5955
|
this.item = item;
|
|
5956
|
+
this.selectedItems = [];
|
|
5100
5957
|
}
|
|
5101
5958
|
withActionData(actionData) {
|
|
5102
5959
|
this.actionData = actionData;
|
|
@@ -5118,6 +5975,10 @@ class ActionParameters {
|
|
|
5118
5975
|
this.route = route;
|
|
5119
5976
|
return this;
|
|
5120
5977
|
}
|
|
5978
|
+
withSelectedItems(selectedItems) {
|
|
5979
|
+
this.selectedItems = selectedItems;
|
|
5980
|
+
return this;
|
|
5981
|
+
}
|
|
5121
5982
|
}
|
|
5122
5983
|
var ActionInstanceStateEnum;
|
|
5123
5984
|
(function (ActionInstanceStateEnum) {
|
|
@@ -5141,6 +6002,17 @@ var ActionInstanceStateEnum;
|
|
|
5141
6002
|
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishDismissed"] = 17] = "FinishDismissed"; // action was dismissed by user
|
|
5142
6003
|
})(ActionInstanceStateEnum || (ActionInstanceStateEnum = {}));
|
|
5143
6004
|
|
|
6005
|
+
/**
|
|
6006
|
+
* Default categories for tableview actions
|
|
6007
|
+
*/
|
|
6008
|
+
class TableviewActionDefaultCategories {
|
|
6009
|
+
}
|
|
6010
|
+
TableviewActionDefaultCategories.READ = 'read';
|
|
6011
|
+
TableviewActionDefaultCategories.ADD = 'add';
|
|
6012
|
+
TableviewActionDefaultCategories.EDIT = 'edit';
|
|
6013
|
+
TableviewActionDefaultCategories.DELETE = 'delete';
|
|
6014
|
+
TableviewActionDefaultCategories.DETAILS = 'details';
|
|
6015
|
+
|
|
5144
6016
|
class AuthorizationUtil {
|
|
5145
6017
|
static isPermitted(permissions, userRoles) {
|
|
5146
6018
|
switch (permissions.authorizationType) {
|
|
@@ -5597,6 +6469,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
5597
6469
|
}]
|
|
5598
6470
|
}], ctorParameters: function () { return [{ type: MngParametrizePipe }]; } });
|
|
5599
6471
|
|
|
6472
|
+
class MngClassMapPipe {
|
|
6473
|
+
transform(value, classNameMapFn, i) {
|
|
6474
|
+
if (classNameMapFn && typeof classNameMapFn === 'function') {
|
|
6475
|
+
return classNameMapFn(value, i);
|
|
6476
|
+
}
|
|
6477
|
+
else {
|
|
6478
|
+
return value !== null && value !== void 0 ? value : '';
|
|
6479
|
+
}
|
|
6480
|
+
}
|
|
6481
|
+
}
|
|
6482
|
+
MngClassMapPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6483
|
+
MngClassMapPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, name: "mngClassMapPipe" });
|
|
6484
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, decorators: [{
|
|
6485
|
+
type: Pipe,
|
|
6486
|
+
args: [{
|
|
6487
|
+
name: 'mngClassMapPipe',
|
|
6488
|
+
pure: true
|
|
6489
|
+
}]
|
|
6490
|
+
}] });
|
|
6491
|
+
|
|
5600
6492
|
class MngActionExecutorService {
|
|
5601
6493
|
constructor(injector, router, dialogService, confirmationService, translate, configurationService, navigationService, errorMapper, parametrize, defaultEditorDialogComponent) {
|
|
5602
6494
|
this.injector = injector;
|
|
@@ -6587,6 +7479,7 @@ class MngActionComponent {
|
|
|
6587
7479
|
this.isHostHidden = false;
|
|
6588
7480
|
this.inputDisabled = of(false);
|
|
6589
7481
|
this.inputLoading = of(false);
|
|
7482
|
+
this.selectedItems = [];
|
|
6590
7483
|
this.finishEventEmitter = new EventEmitter();
|
|
6591
7484
|
this.loadingSubject = new ReplaySubject(1);
|
|
6592
7485
|
this.$loading = this.loadingSubject.asObservable();
|
|
@@ -6635,8 +7528,11 @@ class MngActionComponent {
|
|
|
6635
7528
|
this.buttonClass = this.action.buttonDescriptor.styleClass.getButtonClass(this.hasNoTitle);
|
|
6636
7529
|
}
|
|
6637
7530
|
ngOnChanges(changes) {
|
|
6638
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6639
|
-
if (!((_b = (_a = changes['item']) === null || _a === void 0 ? void 0 : _a.firstChange) !== null && _b !== void 0 ? _b : true) ||
|
|
7531
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7532
|
+
if (!((_b = (_a = changes['item']) === null || _a === void 0 ? void 0 : _a.firstChange) !== null && _b !== void 0 ? _b : true) ||
|
|
7533
|
+
!((_d = (_c = changes['itemId']) === null || _c === void 0 ? void 0 : _c.firstChange) !== null && _d !== void 0 ? _d : true) ||
|
|
7534
|
+
!((_f = (_e = changes['actionData']) === null || _e === void 0 ? void 0 : _e.firstChange) !== null && _f !== void 0 ? _f : true) ||
|
|
7535
|
+
(this.action.hasItemsSelection && !((_h = (_g = changes['selectedItems']) === null || _g === void 0 ? void 0 : _g.firstChange) !== null && _h !== void 0 ? _h : true))) {
|
|
6640
7536
|
this.processSubscriptions();
|
|
6641
7537
|
}
|
|
6642
7538
|
}
|
|
@@ -6658,11 +7554,16 @@ class MngActionComponent {
|
|
|
6658
7554
|
.withQueryParam(this.queryParam)
|
|
6659
7555
|
.withRoute(this.route)
|
|
6660
7556
|
.withViewContainer(this.viewContainer)
|
|
6661
|
-
.withSourceComponent(this)
|
|
7557
|
+
.withSourceComponent(this)
|
|
7558
|
+
.withSelectedItems(this.selectedItems);
|
|
6662
7559
|
const instance = this.actionExecutor.triggerAction(this.action, parameters);
|
|
6663
7560
|
this.subscriptions.push(instance.result$.subscribe({
|
|
6664
7561
|
next: () => {
|
|
7562
|
+
var _a;
|
|
6665
7563
|
this.finishEventEmitter.next(instance);
|
|
7564
|
+
if (this.action.hasItemsSelection) {
|
|
7565
|
+
(_a = this.viewContainerService) === null || _a === void 0 ? void 0 : _a.triggerTableReload({});
|
|
7566
|
+
}
|
|
6666
7567
|
}
|
|
6667
7568
|
}));
|
|
6668
7569
|
this.subscriptions.push(instance.error$.subscribe({
|
|
@@ -6688,6 +7589,9 @@ class MngActionComponent {
|
|
|
6688
7589
|
.withActionData(this.actionData)
|
|
6689
7590
|
.withViewContainer((_a = this.viewContainer) !== null && _a !== void 0 ? _a : undefined)
|
|
6690
7591
|
.withSourceComponent(this);
|
|
7592
|
+
if (this.action.hasItemsSelection) {
|
|
7593
|
+
parameters.withSelectedItems(this.selectedItems);
|
|
7594
|
+
}
|
|
6691
7595
|
const context = this.actionExecutor.prepareActionContextValidation(this.action, parameters, this.dataProvider);
|
|
6692
7596
|
if (typeof this.action.isVisibleFunction === 'function') {
|
|
6693
7597
|
(_b = this.isVisibleSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
@@ -6723,7 +7627,7 @@ class MngActionComponent {
|
|
|
6723
7627
|
}
|
|
6724
7628
|
}
|
|
6725
7629
|
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 });
|
|
6726
|
-
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 });
|
|
7630
|
+
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 });
|
|
6727
7631
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionComponent, decorators: [{
|
|
6728
7632
|
type: Component,
|
|
6729
7633
|
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"] }]
|
|
@@ -6758,6 +7662,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
6758
7662
|
}], viewContainerInit: [{
|
|
6759
7663
|
type: Input,
|
|
6760
7664
|
args: ['viewContainer']
|
|
7665
|
+
}], selectedItems: [{
|
|
7666
|
+
type: Input
|
|
6761
7667
|
}], finishEventEmitter: [{
|
|
6762
7668
|
type: Output,
|
|
6763
7669
|
args: ['finish']
|
|
@@ -7828,7 +8734,7 @@ class MngActionEditorComponent {
|
|
|
7828
8734
|
}
|
|
7829
8735
|
}
|
|
7830
8736
|
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 });
|
|
7831
|
-
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 });
|
|
8737
|
+
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 });
|
|
7832
8738
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionEditorComponent, decorators: [{
|
|
7833
8739
|
type: Component,
|
|
7834
8740
|
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" }]
|
|
@@ -8190,8 +9096,8 @@ class MngTableColumnFilterComponent {
|
|
|
8190
9096
|
this.primeMatchModes = null;
|
|
8191
9097
|
}
|
|
8192
9098
|
ngOnInit() {
|
|
8193
|
-
var _a;
|
|
8194
|
-
this.primeDefaultMatchMode = this.descriptor.defaultFilterMatchMode;
|
|
9099
|
+
var _a, _b;
|
|
9100
|
+
this.primeDefaultMatchMode = (_a = this.descriptor.defaultFilterMatchMode) !== null && _a !== void 0 ? _a : FilterMatchModeEnum.Equals;
|
|
8195
9101
|
switch (this.descriptor.filterType) {
|
|
8196
9102
|
case FilterTypeEnum.Boolean:
|
|
8197
9103
|
this.primeType = 'boolean';
|
|
@@ -8210,6 +9116,9 @@ class MngTableColumnFilterComponent {
|
|
|
8210
9116
|
this.lookupDescriptor = this.descriptor;
|
|
8211
9117
|
this.primeField = `${this.descriptor.property}${this.lookupDescriptor.itemsValueProperty ? `.${this.lookupDescriptor.itemsValueProperty}` : ''}`;
|
|
8212
9118
|
this.primeMatchModes = [{ value: FilterMatchModeEnum.Equals, label: this.primeConfig.getTranslation(FilterMatchModeEnum.Equals) }];
|
|
9119
|
+
if (this.lookupDescriptor.multiselect) {
|
|
9120
|
+
this.primeDefaultMatchMode = FilterMatchModeEnum.In;
|
|
9121
|
+
}
|
|
8213
9122
|
break;
|
|
8214
9123
|
case FilterTypeEnum.String:
|
|
8215
9124
|
this.primeType = 'text';
|
|
@@ -8221,7 +9130,7 @@ class MngTableColumnFilterComponent {
|
|
|
8221
9130
|
if (!this.primeMatchModes.map(matchMode => matchMode.value).includes(this.primeDefaultMatchMode)) {
|
|
8222
9131
|
this.primeDefaultMatchMode = this.descriptor.matchModes[0];
|
|
8223
9132
|
}
|
|
8224
|
-
this.primeShowMatchMode = ((
|
|
9133
|
+
this.primeShowMatchMode = ((_b = this.primeMatchModes) === null || _b === void 0 ? void 0 : _b.length) > 1;
|
|
8225
9134
|
}
|
|
8226
9135
|
if (this.display === TableFilterDisplayEnum.Menu) {
|
|
8227
9136
|
this.primeDisplay = 'menu';
|
|
@@ -8315,6 +9224,7 @@ class MngTableComponent {
|
|
|
8315
9224
|
this.dataProviderLatestLazyLoadEventVersion = 0;
|
|
8316
9225
|
this.dataProviderLatestQueryParamVersion = 0;
|
|
8317
9226
|
// filter, sort
|
|
9227
|
+
this.hasColumnFilters = false;
|
|
8318
9228
|
this.isFilterChanged = false;
|
|
8319
9229
|
this.isSortChanged = false;
|
|
8320
9230
|
this.filterDescriptors = [];
|
|
@@ -8325,12 +9235,16 @@ class MngTableComponent {
|
|
|
8325
9235
|
this.subscriptions = [];
|
|
8326
9236
|
}
|
|
8327
9237
|
ngOnInit() {
|
|
8328
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
9238
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
8329
9239
|
this.viewContainer = (_b = (_a = this.viewContainerInit) !== null && _a !== void 0 ? _a : this.viewContainerService) !== null && _b !== void 0 ? _b : undefined;
|
|
8330
|
-
|
|
9240
|
+
if (!(this.initialDescriptor instanceof TableDynamicDescriptor)) {
|
|
9241
|
+
this.descriptor = this.initialDescriptor;
|
|
9242
|
+
}
|
|
8331
9243
|
// map row settings
|
|
8332
|
-
this.
|
|
8333
|
-
this.
|
|
9244
|
+
this.filterDescriptors = (_d = (_c = this.descriptor) === null || _c === void 0 ? void 0 : _c.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor)) !== null && _d !== void 0 ? _d : [];
|
|
9245
|
+
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
9246
|
+
this.rows = (_f = (_e = this.descriptor) === null || _e === void 0 ? void 0 : _e.defaultNumRows) !== null && _f !== void 0 ? _f : 25;
|
|
9247
|
+
this.rowsPerPageOptions = (_h = (_g = this.descriptor) === null || _g === void 0 ? void 0 : _g.rowsPerPageOptions) !== null && _h !== void 0 ? _h : [25, 50, 100];
|
|
8334
9248
|
// process actions
|
|
8335
9249
|
for (const action of this.actions) {
|
|
8336
9250
|
switch (action.position) {
|
|
@@ -8344,14 +9258,14 @@ class MngTableComponent {
|
|
|
8344
9258
|
}
|
|
8345
9259
|
this.showInlineActionsColumn = typeof this.columnActionComponent !== 'undefined' || this.rowInlineActions.length > 0;
|
|
8346
9260
|
// define all styles
|
|
8347
|
-
this.className = this.descriptor.className;
|
|
8348
|
-
this.tableFullHeightOffset = (
|
|
8349
|
-
this.rowHeight = (
|
|
9261
|
+
this.className = (_k = (_j = this.descriptor) === null || _j === void 0 ? void 0 : _j.className) !== null && _k !== void 0 ? _k : '';
|
|
9262
|
+
this.tableFullHeightOffset = (_m = (_l = this.descriptor) === null || _l === void 0 ? void 0 : _l.tableFullHeightOffset) !== null && _m !== void 0 ? _m : null;
|
|
9263
|
+
this.rowHeight = (_p = (_o = this.descriptor) === null || _o === void 0 ? void 0 : _o.rowHeight) !== null && _p !== void 0 ? _p : null;
|
|
8350
9264
|
if (typeof this.isColumnClickable === 'undefined') {
|
|
8351
9265
|
// define if cell click is being observed via output
|
|
8352
9266
|
this.isColumnClickable = this.rowClickActions.length > 0 || this.cellClickEventEmitter.observed;
|
|
8353
9267
|
}
|
|
8354
|
-
switch (this.descriptor.size) {
|
|
9268
|
+
switch ((_q = this.descriptor) === null || _q === void 0 ? void 0 : _q.size) {
|
|
8355
9269
|
case TableSizeEnum.Small:
|
|
8356
9270
|
this.className += ' p-datatable-sm';
|
|
8357
9271
|
break;
|
|
@@ -8359,18 +9273,18 @@ class MngTableComponent {
|
|
|
8359
9273
|
this.className += ' p-datatable-lg';
|
|
8360
9274
|
break;
|
|
8361
9275
|
}
|
|
8362
|
-
if (this.descriptor.hasGridlines) {
|
|
9276
|
+
if ((_r = this.descriptor) === null || _r === void 0 ? void 0 : _r.hasGridlines) {
|
|
8363
9277
|
this.className += ' p-datatable-gridlines';
|
|
8364
9278
|
}
|
|
8365
|
-
if (!this.columnActionMinWidth) {
|
|
9279
|
+
if (this.descriptor && !this.columnActionMinWidth) {
|
|
8366
9280
|
this.columnActionMinWidth = StylesUtil.calculateTableColumnActionWidth(this.descriptor, this.rowInlineActions);
|
|
8367
9281
|
}
|
|
8368
9282
|
// check if infinite scroll
|
|
8369
|
-
if (this.descriptor.paginationMode === TablePaginationModeEnum.InfiniteScroll) {
|
|
9283
|
+
if (((_s = this.descriptor) === null || _s === void 0 ? void 0 : _s.paginationMode) === TablePaginationModeEnum.InfiniteScroll) {
|
|
8370
9284
|
this.infiniteScroll = true;
|
|
8371
9285
|
this.scrollHeight = 'flex';
|
|
8372
|
-
this.tableFullHeightOffset = (
|
|
8373
|
-
this.rowHeight = (
|
|
9286
|
+
this.tableFullHeightOffset = (_t = this.descriptor.tableFullHeightOffset) !== null && _t !== void 0 ? _t : 315;
|
|
9287
|
+
this.rowHeight = (_u = this.descriptor.rowHeight) !== null && _u !== void 0 ? _u : 45;
|
|
8374
9288
|
this.useQueryParams = false;
|
|
8375
9289
|
}
|
|
8376
9290
|
// check if data provider is supplied, if is, use it primarily
|
|
@@ -8388,6 +9302,12 @@ class MngTableComponent {
|
|
|
8388
9302
|
if (this.dataProvider.serviceType) {
|
|
8389
9303
|
this.dataProviderService = this.injector.get(this.dataProvider.serviceType);
|
|
8390
9304
|
}
|
|
9305
|
+
const reloadSubscription = this.dataProvider.getAllReload$.subscribe({
|
|
9306
|
+
next: () => {
|
|
9307
|
+
this.reload();
|
|
9308
|
+
}
|
|
9309
|
+
});
|
|
9310
|
+
this.subscriptions.push(reloadSubscription);
|
|
8391
9311
|
}
|
|
8392
9312
|
else {
|
|
8393
9313
|
// if query result is provided, use it as secondary source or else try to use items
|
|
@@ -8405,7 +9325,7 @@ class MngTableComponent {
|
|
|
8405
9325
|
return queryResult;
|
|
8406
9326
|
}));
|
|
8407
9327
|
if (!isObservable(this.items)) {
|
|
8408
|
-
this.itemsSubject.next((
|
|
9328
|
+
this.itemsSubject.next((_v = this.items) !== null && _v !== void 0 ? _v : []);
|
|
8409
9329
|
}
|
|
8410
9330
|
}
|
|
8411
9331
|
if (typeof this.loading !== 'undefined') {
|
|
@@ -8414,7 +9334,7 @@ class MngTableComponent {
|
|
|
8414
9334
|
}
|
|
8415
9335
|
const initialQueryParamMap = this.route.snapshot.queryParamMap;
|
|
8416
9336
|
if (this.useQueryParams &&
|
|
8417
|
-
((!initialQueryParamMap.has('sort') && this.descriptor.hasDefaultSort) ||
|
|
9337
|
+
((!initialQueryParamMap.has('sort') && ((_w = this.descriptor) === null || _w === void 0 ? void 0 : _w.hasDefaultSort)) ||
|
|
8418
9338
|
(!initialQueryParamMap.has('filter') && this.filterDescriptors.some(fd => fd.hasDefaultValue)))) {
|
|
8419
9339
|
// default sort/filters are applied, no additional filtering/sorting is specified in query param
|
|
8420
9340
|
// redirect must be done at first step
|
|
@@ -8464,7 +9384,12 @@ class MngTableComponent {
|
|
|
8464
9384
|
}
|
|
8465
9385
|
reload(emitEvent = false, resetParams = false) {
|
|
8466
9386
|
var _a;
|
|
8467
|
-
|
|
9387
|
+
const queryParamsBuilder = resetParams
|
|
9388
|
+
? MediusQueryParamBuilder.create(this.rowsPerPageOptions[0], 0)
|
|
9389
|
+
: MediusQueryParamBuilder.createFromExisting((_a = this.dataProviderLatestQueryParam) !== null && _a !== void 0 ? _a : new MediusQueryParam())
|
|
9390
|
+
.withItemsPerPage(this.rows)
|
|
9391
|
+
.withItemsOffset(this.offset);
|
|
9392
|
+
this.loadTableWithDataProvider(queryParamsBuilder.build(), emitEvent);
|
|
8468
9393
|
}
|
|
8469
9394
|
onTableLazyLoad(event) {
|
|
8470
9395
|
this.dataProviderLatestLazyLoadEvent = event;
|
|
@@ -8531,9 +9456,17 @@ class MngTableComponent {
|
|
|
8531
9456
|
}
|
|
8532
9457
|
this.dataProviderLatestQueryParam = queryParam;
|
|
8533
9458
|
this.dataProviderLatestQueryParamVersion++;
|
|
9459
|
+
MediusRestUtil.modifyFilterProperties(queryParam, this.filterDescriptors);
|
|
8534
9460
|
this.dataProviderSubscription = (_b = this.dataProvider) === null || _b === void 0 ? void 0 : _b.getAll(queryParam, this.dataProviderService).subscribe({
|
|
8535
9461
|
next: res => {
|
|
8536
9462
|
var _a, _b, _c;
|
|
9463
|
+
if (this.initialDescriptor instanceof TableDynamicDescriptor) {
|
|
9464
|
+
this.descriptor = this.initialDescriptor.toTableDescriptorFromData(res);
|
|
9465
|
+
this.filterDescriptors = this.descriptor.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor);
|
|
9466
|
+
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
9467
|
+
// } else {
|
|
9468
|
+
// this.descriptor = this.initialDescriptor.onDataReceivedTypeBuilding(res);
|
|
9469
|
+
}
|
|
8537
9470
|
if (this.infiniteScroll) {
|
|
8538
9471
|
if (this.isFilterChanged || this.isSortChanged) {
|
|
8539
9472
|
this.dataProviderInfiniteScrollItems = [];
|
|
@@ -8549,6 +9482,7 @@ class MngTableComponent {
|
|
|
8549
9482
|
this.dataProviderLoadingSubject.next(false);
|
|
8550
9483
|
},
|
|
8551
9484
|
error: err => {
|
|
9485
|
+
// TODO: check what happens on error with no model iniside descriptor
|
|
8552
9486
|
NotificationUtil.tableNotificationError(this.translate, this.descriptor, err, this.viewContainer);
|
|
8553
9487
|
const emptyQueryResult = new MediusQueryResult();
|
|
8554
9488
|
emptyQueryResult.pageData = [];
|
|
@@ -8594,7 +9528,7 @@ class MngTableComponent {
|
|
|
8594
9528
|
const applyDefaultFilters = ((_b = (_a = params.filterParams) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0;
|
|
8595
9529
|
this.filterDescriptors.forEach(f => {
|
|
8596
9530
|
let matchMode;
|
|
8597
|
-
if (f.
|
|
9531
|
+
if (f.defaultFilterMatchMode) {
|
|
8598
9532
|
matchMode = f.defaultFilterMatchMode;
|
|
8599
9533
|
}
|
|
8600
9534
|
else {
|
|
@@ -8646,7 +9580,7 @@ class MngTableComponent {
|
|
|
8646
9580
|
return primeFilterMeta;
|
|
8647
9581
|
}
|
|
8648
9582
|
createSortMeta(mediusQueryParam) {
|
|
8649
|
-
var _a, _b, _c;
|
|
9583
|
+
var _a, _b, _c, _d;
|
|
8650
9584
|
let params;
|
|
8651
9585
|
if (!mediusQueryParam) {
|
|
8652
9586
|
params = new MediusQueryParam();
|
|
@@ -8656,7 +9590,7 @@ class MngTableComponent {
|
|
|
8656
9590
|
}
|
|
8657
9591
|
let sortMeta;
|
|
8658
9592
|
const applyDefaultSorts = ((_b = (_a = params.sortProperty) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0;
|
|
8659
|
-
if (applyDefaultSorts && this.descriptor.hasDefaultSort) {
|
|
9593
|
+
if (applyDefaultSorts && ((_c = this.descriptor) === null || _c === void 0 ? void 0 : _c.hasDefaultSort)) {
|
|
8660
9594
|
sortMeta = this.descriptor.defaultSortProperty.map((p, idx) => ({
|
|
8661
9595
|
field: p,
|
|
8662
9596
|
order: this.descriptor.defaultSortAsc[idx] ? 1 : -1
|
|
@@ -8665,7 +9599,7 @@ class MngTableComponent {
|
|
|
8665
9599
|
else {
|
|
8666
9600
|
sortMeta = [];
|
|
8667
9601
|
}
|
|
8668
|
-
(
|
|
9602
|
+
(_d = params.sortProperty) === null || _d === void 0 ? void 0 : _d.forEach((s, idx) => {
|
|
8669
9603
|
var _a, _b, _c, _d;
|
|
8670
9604
|
const existingIndex = sortMeta.findIndex(value => value.field === s);
|
|
8671
9605
|
if (existingIndex > -1) {
|
|
@@ -8702,16 +9636,17 @@ class MngTableComponent {
|
|
|
8702
9636
|
}
|
|
8703
9637
|
}
|
|
8704
9638
|
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 });
|
|
8705
|
-
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 });
|
|
9639
|
+
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 });
|
|
8706
9640
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableComponent, decorators: [{
|
|
8707
9641
|
type: Component,
|
|
8708
|
-
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
|
|
9642
|
+
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" }]
|
|
8709
9643
|
}], ctorParameters: function () {
|
|
8710
9644
|
return [{ type: i0.Injector }, { type: i1.Router }, { type: i1.ActivatedRoute }, { type: i1$2.TranslateService }, { type: MngActionExecutorService }, { type: MngViewContainerComponentService, decorators: [{
|
|
8711
9645
|
type: Optional
|
|
8712
9646
|
}] }];
|
|
8713
|
-
}, propDecorators: {
|
|
8714
|
-
type: Input
|
|
9647
|
+
}, propDecorators: { initialDescriptor: [{
|
|
9648
|
+
type: Input,
|
|
9649
|
+
args: ['descriptor']
|
|
8715
9650
|
}], items: [{
|
|
8716
9651
|
type: Input
|
|
8717
9652
|
}], queryResult: [{
|
|
@@ -8780,6 +9715,8 @@ class MngTableviewComponent {
|
|
|
8780
9715
|
this.toolbarLeftActions = [];
|
|
8781
9716
|
this.toolbarRightActions = [];
|
|
8782
9717
|
this.subscriptions = [];
|
|
9718
|
+
this.hasItemSelectionAction = false;
|
|
9719
|
+
this.selectedItems = [];
|
|
8783
9720
|
}
|
|
8784
9721
|
ngOnInit() {
|
|
8785
9722
|
this.viewContainerService.actions = this.actions;
|
|
@@ -8807,6 +9744,7 @@ class MngTableviewComponent {
|
|
|
8807
9744
|
}
|
|
8808
9745
|
}
|
|
8809
9746
|
this.toolbarRightActions = this.toolbarRightActions.reverse();
|
|
9747
|
+
this.hasItemSelectionAction = [...this.toolbarLeftActions, ...this.toolbarRightActions].some(e => e.hasItemsSelection);
|
|
8810
9748
|
}
|
|
8811
9749
|
ngOnDestroy() {
|
|
8812
9750
|
this.subscriptions.forEach(s => s.unsubscribe());
|
|
@@ -8824,12 +9762,15 @@ class MngTableviewComponent {
|
|
|
8824
9762
|
onTableLoad(event) {
|
|
8825
9763
|
this.tableQueryParam = event.queryParam;
|
|
8826
9764
|
}
|
|
9765
|
+
selectionChange(selectedItems) {
|
|
9766
|
+
this.selectedItems = selectedItems;
|
|
9767
|
+
}
|
|
8827
9768
|
}
|
|
8828
9769
|
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 });
|
|
8829
|
-
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\"
|
|
9770
|
+
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" }] });
|
|
8830
9771
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewComponent, decorators: [{
|
|
8831
9772
|
type: Component,
|
|
8832
|
-
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\"
|
|
9773
|
+
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" }]
|
|
8833
9774
|
}], 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: [{
|
|
8834
9775
|
type: Input
|
|
8835
9776
|
}], dataProvider: [{
|
|
@@ -8842,6 +9783,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
8842
9783
|
}] } });
|
|
8843
9784
|
|
|
8844
9785
|
class AMngTableviewRouteComponent {
|
|
9786
|
+
constructor() {
|
|
9787
|
+
this.route = inject(ActivatedRoute);
|
|
9788
|
+
}
|
|
9789
|
+
get routeData() {
|
|
9790
|
+
return this.route.snapshot.data;
|
|
9791
|
+
}
|
|
8845
9792
|
ngOnInit() {
|
|
8846
9793
|
this.descriptor = this.createTableviewDescriptor();
|
|
8847
9794
|
this.dataProvider = this.createTableviewDataProvider();
|
|
@@ -8855,25 +9802,25 @@ class AMngTableviewRouteComponent {
|
|
|
8855
9802
|
this.createActionDescriptorForDelete(),
|
|
8856
9803
|
this.createActionDescriptorForRefresh(),
|
|
8857
9804
|
this.createActionDescriptorForExport()
|
|
8858
|
-
];
|
|
9805
|
+
].filter(e => e != null);
|
|
8859
9806
|
}
|
|
8860
9807
|
createActionDescriptorForDetails(descriptor = this.descriptor.viewEditor) {
|
|
8861
|
-
return new ActionEditorDetailsDescriptor(descriptor);
|
|
9808
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasDetails ? new ActionEditorDetailsDescriptor(descriptor) : null;
|
|
8862
9809
|
}
|
|
8863
9810
|
createActionDescriptorForAdd(descriptor = this.descriptor.addEditor) {
|
|
8864
|
-
return new ActionEditorAddDescriptor(descriptor);
|
|
9811
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasAdd ? new ActionEditorAddDescriptor(descriptor) : null;
|
|
8865
9812
|
}
|
|
8866
9813
|
createActionDescriptorForEdit(descriptor = this.descriptor.editEditor) {
|
|
8867
|
-
return new ActionEditorEditDescriptor(descriptor);
|
|
9814
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasEdit ? new ActionEditorEditDescriptor(descriptor) : null;
|
|
8868
9815
|
}
|
|
8869
9816
|
createActionDescriptorForDelete(descriptor = this.descriptor.model) {
|
|
8870
|
-
return new ActionDeleteDescriptor(descriptor);
|
|
9817
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasDelete ? new ActionDeleteDescriptor(descriptor) : null;
|
|
8871
9818
|
}
|
|
8872
9819
|
createActionDescriptorForExport(descriptor = this.descriptor.model) {
|
|
8873
9820
|
const action = new ActionDescriptor(descriptor, 'export')
|
|
8874
9821
|
.withRunFunction(ctx => {
|
|
8875
9822
|
const queryParamBuilder = ctx.parameters.queryParam ? MediusQueryParamBuilder.createFromExisting(ctx.parameters.queryParam) : MediusQueryParamBuilder.create();
|
|
8876
|
-
queryParamBuilder.withItemsOffset(0).withItemsPerPage(
|
|
9823
|
+
queryParamBuilder.withItemsOffset(0).withItemsPerPage(500);
|
|
8877
9824
|
ctx.parameters.withQueryParam(queryParamBuilder.build());
|
|
8878
9825
|
return ActionDataProviderUtil.runGetAllOrFail(ctx).pipe(map(res => {
|
|
8879
9826
|
var _a, _b;
|
|
@@ -8892,7 +9839,7 @@ class AMngTableviewRouteComponent {
|
|
|
8892
9839
|
.withPosition(ActionPositionEnum.ToolbarRight)
|
|
8893
9840
|
.withPermissionsRouteType(Permissions.ActionTypes.READ)
|
|
8894
9841
|
.withRunNotificationSuccess(undefined, undefined, false)
|
|
8895
|
-
.withRunFunction(ctx => {
|
|
9842
|
+
.withRunFunction((ctx) => {
|
|
8896
9843
|
ctx.parameters.viewContainer.triggerTableReload({});
|
|
8897
9844
|
return of(null);
|
|
8898
9845
|
});
|
|
@@ -8904,16 +9851,9 @@ AMngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.
|
|
|
8904
9851
|
AMngTableviewRouteComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: AMngTableviewRouteComponent, ngImport: i0 });
|
|
8905
9852
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: AMngTableviewRouteComponent, decorators: [{
|
|
8906
9853
|
type: Directive
|
|
8907
|
-
}] });
|
|
9854
|
+
}], ctorParameters: function () { return []; } });
|
|
8908
9855
|
|
|
8909
9856
|
class MngTableviewRouteComponent extends AMngTableviewRouteComponent {
|
|
8910
|
-
constructor(route) {
|
|
8911
|
-
super();
|
|
8912
|
-
this.route = route;
|
|
8913
|
-
}
|
|
8914
|
-
get routeData() {
|
|
8915
|
-
return this.route.snapshot.data;
|
|
8916
|
-
}
|
|
8917
9857
|
createTableviewDescriptor() {
|
|
8918
9858
|
var _a, _b;
|
|
8919
9859
|
if (this.descriptorInit) {
|
|
@@ -8946,12 +9886,12 @@ class MngTableviewRouteComponent extends AMngTableviewRouteComponent {
|
|
|
8946
9886
|
(_a = this.tableviewComponent) === null || _a === void 0 ? void 0 : _a.reloadTable();
|
|
8947
9887
|
}
|
|
8948
9888
|
}
|
|
8949
|
-
MngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, deps:
|
|
9889
|
+
MngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
8950
9890
|
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"] }] });
|
|
8951
9891
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, decorators: [{
|
|
8952
9892
|
type: Component,
|
|
8953
9893
|
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" }]
|
|
8954
|
-
}],
|
|
9894
|
+
}], propDecorators: { descriptorInit: [{
|
|
8955
9895
|
type: Input,
|
|
8956
9896
|
args: ['descriptor']
|
|
8957
9897
|
}], dataProviderInit: [{
|
|
@@ -9283,7 +10223,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
9283
10223
|
}
|
|
9284
10224
|
}
|
|
9285
10225
|
MngFormlyFieldTableDialogFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, deps: [{ token: MngActionExecutorService }], target: i0.ɵɵFactoryTarget.Component });
|
|
9286
|
-
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 });
|
|
10226
|
+
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 });
|
|
9287
10227
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, decorators: [{
|
|
9288
10228
|
type: Component,
|
|
9289
10229
|
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"] }]
|
|
@@ -10412,6 +11352,7 @@ const declarations = [
|
|
|
10412
11352
|
MngParametrizePipe,
|
|
10413
11353
|
MngGetterPipe,
|
|
10414
11354
|
MngTemplatePipe,
|
|
11355
|
+
MngClassMapPipe,
|
|
10415
11356
|
// layout components
|
|
10416
11357
|
MngBreadcrumbComponent,
|
|
10417
11358
|
MngFooterComponent,
|
|
@@ -10535,6 +11476,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10535
11476
|
MngParametrizePipe,
|
|
10536
11477
|
MngGetterPipe,
|
|
10537
11478
|
MngTemplatePipe,
|
|
11479
|
+
MngClassMapPipe,
|
|
10538
11480
|
// layout components
|
|
10539
11481
|
MngBreadcrumbComponent,
|
|
10540
11482
|
MngFooterComponent,
|
|
@@ -10656,6 +11598,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10656
11598
|
MngParametrizePipe,
|
|
10657
11599
|
MngGetterPipe,
|
|
10658
11600
|
MngTemplatePipe,
|
|
11601
|
+
MngClassMapPipe,
|
|
10659
11602
|
// layout components
|
|
10660
11603
|
MngBreadcrumbComponent,
|
|
10661
11604
|
MngFooterComponent,
|
|
@@ -11354,6 +12297,7 @@ class TableviewRouteBuilder {
|
|
|
11354
12297
|
this.editPath = ':itemId/edit';
|
|
11355
12298
|
this.hasAdd = true;
|
|
11356
12299
|
this.addPath = 'add';
|
|
12300
|
+
this.hasDelete = true;
|
|
11357
12301
|
}
|
|
11358
12302
|
static fromComponent(path, component) {
|
|
11359
12303
|
const inst = new TableviewRouteBuilder(path);
|
|
@@ -11381,6 +12325,15 @@ class TableviewRouteBuilder {
|
|
|
11381
12325
|
}
|
|
11382
12326
|
return inst;
|
|
11383
12327
|
}
|
|
12328
|
+
withReadOnly(permissions) {
|
|
12329
|
+
if (permissions) {
|
|
12330
|
+
this.withPermissions(permissions);
|
|
12331
|
+
}
|
|
12332
|
+
this.withAdd(false);
|
|
12333
|
+
this.withEdit(false);
|
|
12334
|
+
this.withDelete(false);
|
|
12335
|
+
return this;
|
|
12336
|
+
}
|
|
11384
12337
|
withDetails(hasDetails = true, permissions, path) {
|
|
11385
12338
|
this.hasDetails = hasDetails;
|
|
11386
12339
|
if (permissions) {
|
|
@@ -11411,24 +12364,31 @@ class TableviewRouteBuilder {
|
|
|
11411
12364
|
}
|
|
11412
12365
|
return this;
|
|
11413
12366
|
}
|
|
12367
|
+
withDelete(hasDelete = true, permissions) {
|
|
12368
|
+
this.hasDelete = hasDelete;
|
|
12369
|
+
if (permissions) {
|
|
12370
|
+
this.withPermissions(undefined, undefined, undefined, permissions);
|
|
12371
|
+
}
|
|
12372
|
+
return this;
|
|
12373
|
+
}
|
|
11414
12374
|
withPermissions(read, add, edit, delet, details) {
|
|
11415
12375
|
if (!this.permissions) {
|
|
11416
12376
|
this.permissions = {};
|
|
11417
12377
|
}
|
|
11418
12378
|
if (read) {
|
|
11419
|
-
this.permissions[
|
|
12379
|
+
this.permissions[TableviewActionDefaultCategories.READ] = read;
|
|
11420
12380
|
}
|
|
11421
12381
|
if (add) {
|
|
11422
|
-
this.permissions[
|
|
12382
|
+
this.permissions[TableviewActionDefaultCategories.ADD] = add;
|
|
11423
12383
|
}
|
|
11424
12384
|
if (edit) {
|
|
11425
|
-
this.permissions[
|
|
12385
|
+
this.permissions[TableviewActionDefaultCategories.EDIT] = edit;
|
|
11426
12386
|
}
|
|
11427
12387
|
if (delet) {
|
|
11428
|
-
this.permissions[
|
|
12388
|
+
this.permissions[TableviewActionDefaultCategories.DELETE] = delet;
|
|
11429
12389
|
}
|
|
11430
12390
|
if (details) {
|
|
11431
|
-
this.permissions[
|
|
12391
|
+
this.permissions[TableviewActionDefaultCategories.DETAILS] = details;
|
|
11432
12392
|
}
|
|
11433
12393
|
return this;
|
|
11434
12394
|
}
|
|
@@ -11465,35 +12425,42 @@ class TableviewRouteBuilder {
|
|
|
11465
12425
|
if (this.permissions) {
|
|
11466
12426
|
routeData.tableviewPermissions = Object.assign({}, this.permissions);
|
|
11467
12427
|
}
|
|
12428
|
+
routeData.tableviewActions = {
|
|
12429
|
+
hasAdd: this.hasAdd,
|
|
12430
|
+
hasEdit: this.hasEdit,
|
|
12431
|
+
hasDetails: this.hasDetails,
|
|
12432
|
+
hasDelete: this.hasDelete
|
|
12433
|
+
};
|
|
11468
12434
|
tableviewRouteBuilder.withData(routeData);
|
|
11469
|
-
if ((_a = this.permissions) === null || _a === void 0 ? void 0 : _a[
|
|
11470
|
-
tableviewRouteBuilder.withPermissions(this.permissions[
|
|
12435
|
+
if ((_a = this.permissions) === null || _a === void 0 ? void 0 : _a[TableviewActionDefaultCategories.READ]) {
|
|
12436
|
+
tableviewRouteBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.READ]);
|
|
11471
12437
|
}
|
|
11472
12438
|
// list route
|
|
11473
12439
|
const rootChildRouteBuilder = RouteBuilder.create('', MngActionRouteComponent);
|
|
11474
|
-
|
|
11475
|
-
|
|
12440
|
+
rootChildRouteBuilder.withData(Object.assign({}, routeData));
|
|
12441
|
+
if ((_b = this.permissions) === null || _b === void 0 ? void 0 : _b[TableviewActionDefaultCategories.READ]) {
|
|
12442
|
+
rootChildRouteBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.READ]);
|
|
11476
12443
|
}
|
|
11477
12444
|
tableviewRouteBuilder.addChildBuilder(rootChildRouteBuilder);
|
|
11478
12445
|
// add route
|
|
11479
12446
|
if (this.hasAdd) {
|
|
11480
12447
|
const routeBuilder = RouteBuilder.create(this.addPath, MngActionRouteComponent);
|
|
11481
|
-
if ((_c = this.permissions) === null || _c === void 0 ? void 0 : _c[
|
|
11482
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12448
|
+
if ((_c = this.permissions) === null || _c === void 0 ? void 0 : _c[TableviewActionDefaultCategories.ADD]) {
|
|
12449
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.ADD]);
|
|
11483
12450
|
}
|
|
11484
12451
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11485
12452
|
}
|
|
11486
12453
|
if (this.hasDetails) {
|
|
11487
12454
|
const routeBuilder = RouteBuilder.create(this.detailsPath, MngActionRouteComponent);
|
|
11488
|
-
if ((_d = this.permissions) === null || _d === void 0 ? void 0 : _d[
|
|
11489
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12455
|
+
if ((_d = this.permissions) === null || _d === void 0 ? void 0 : _d[TableviewActionDefaultCategories.DETAILS]) {
|
|
12456
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.DETAILS]);
|
|
11490
12457
|
}
|
|
11491
12458
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11492
12459
|
}
|
|
11493
12460
|
if (this.hasEdit) {
|
|
11494
12461
|
const routeBuilder = RouteBuilder.create(this.editPath, MngActionRouteComponent);
|
|
11495
|
-
if ((_e = this.permissions) === null || _e === void 0 ? void 0 : _e[
|
|
11496
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12462
|
+
if ((_e = this.permissions) === null || _e === void 0 ? void 0 : _e[TableviewActionDefaultCategories.EDIT]) {
|
|
12463
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.EDIT]);
|
|
11497
12464
|
}
|
|
11498
12465
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11499
12466
|
}
|
|
@@ -11509,5 +12476,5 @@ class TableviewRouteBuilder {
|
|
|
11509
12476
|
* Generated bundle index. Do not edit.
|
|
11510
12477
|
*/
|
|
11511
12478
|
|
|
11512
|
-
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 };
|
|
12479
|
+
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, 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_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, 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 };
|
|
11513
12480
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|