@mediusinc/mng-commons 0.2.11 → 0.2.13
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/components/form/dropdown/dropdown.component.mjs +2 -4
- package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +3 -3
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +3 -3
- package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +2 -1
- package/esm2020/lib/descriptors/editor.descriptor.mjs +2 -1
- package/esm2020/lib/descriptors/table.descriptor.mjs +82 -3
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +4 -1
- package/esm2020/lib/mng-commons.module.mjs +5 -2
- package/esm2020/lib/pipes/enum.pipe.mjs +22 -0
- package/esm2020/lib/pipes/index.mjs +2 -1
- package/esm2020/lib/utils/enum.util.mjs +23 -2
- package/fesm2015/mediusinc-mng-commons.mjs +136 -10
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +134 -10
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/tableview/table/column-value/column-value.component.d.ts +1 -0
- package/lib/descriptors/table.descriptor.d.ts +22 -4
- package/lib/descriptors/tableview.descriptor.d.ts +1 -0
- package/lib/mng-commons.module.d.ts +70 -69
- package/lib/pipes/enum.pipe.d.ts +7 -0
- package/lib/pipes/index.d.ts +1 -0
- package/lib/utils/enum.util.d.ts +11 -0
- package/package.json +1 -1
|
@@ -4,8 +4,15 @@ export class EnumUtil {
|
|
|
4
4
|
* @param enumType Enum object.
|
|
5
5
|
*/
|
|
6
6
|
static getConstantNames(enumType) {
|
|
7
|
+
return EnumUtil.getConstantNamesFromEnumObject(enumType);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns array of names for constants in enum.
|
|
11
|
+
* @param enumObj Enum object.
|
|
12
|
+
*/
|
|
13
|
+
static getConstantNamesFromEnumObject(enumObj) {
|
|
7
14
|
// in number enum, the numbers are also represented in objects and should be filtered out
|
|
8
|
-
return Object.keys(
|
|
15
|
+
return Object.keys(enumObj).filter(v => isNaN(+v));
|
|
9
16
|
}
|
|
10
17
|
/**
|
|
11
18
|
* Returns array of string values for constants in enum.
|
|
@@ -57,5 +64,19 @@ export class EnumUtil {
|
|
|
57
64
|
return typeof enumType[value] !== 'undefined' ? enumType[value] : null;
|
|
58
65
|
}
|
|
59
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets constant name for value.
|
|
69
|
+
* @param enumObj Enum object.
|
|
70
|
+
* @param value Value of enum constant.
|
|
71
|
+
*/
|
|
72
|
+
static getConstantNameFromEnumObject(enumObj, value) {
|
|
73
|
+
const enumObjAny = enumObj;
|
|
74
|
+
if (typeof value === 'string') {
|
|
75
|
+
return this.getConstantNamesFromEnumObject(enumObj).find(c => enumObjAny[c] === value) ?? null;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return typeof enumObjAny[value] !== 'undefined' ? enumObjAny[value] : null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
60
81
|
}
|
|
61
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW51bS51dGlsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi91dGlscy9lbnVtLnV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsTUFBTSxPQUFPLFFBQVE7SUFDakI7OztPQUdHO0lBQ0ksTUFBTSxDQUFDLGdCQUFnQixDQUFDLFFBQWtCO1FBQzdDLE9BQU8sUUFBUSxDQUFDLDhCQUE4QixDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQzdELENBQUM7SUFFRDs7O09BR0c7SUFDSSxNQUFNLENBQUMsOEJBQThCLENBQUMs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4gZW51bU9iakFueVtjXSA9PT0gdmFsdWUpID8/IG51bGw7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gdHlwZW9mIGVudW1PYmpBbnlbdmFsdWVdICE9PSAndW5kZWZpbmVkJyA/IChlbnVtT2JqQW55W3ZhbHVlXSBhcyBzdHJpbmcpIDogbnVsbDtcbiAgICAgICAgfVxuICAgIH1cbn1cbiJdfQ==
|
|
@@ -1251,6 +1251,7 @@ class FieldLookupEnumDescriptor extends FieldLookupDescriptor {
|
|
|
1251
1251
|
this.withLookupDataProvider(dataProvider);
|
|
1252
1252
|
this.withItemsLabelProperty('title');
|
|
1253
1253
|
this.withItemsValueProperty('value');
|
|
1254
|
+
this.withDataKeyProperty('value');
|
|
1254
1255
|
}
|
|
1255
1256
|
get enumType() {
|
|
1256
1257
|
return this._enumType;
|
|
@@ -1615,6 +1616,13 @@ class TableDescriptor {
|
|
|
1615
1616
|
this.setDataKeyFromColumn();
|
|
1616
1617
|
return column;
|
|
1617
1618
|
}
|
|
1619
|
+
addColumnEnum(property, enumType, nameAsValue = false, titlePath) {
|
|
1620
|
+
const column = new ColumnDescriptor(this, property);
|
|
1621
|
+
column.asEnum(enumType, nameAsValue, titlePath);
|
|
1622
|
+
this._columns.push(column);
|
|
1623
|
+
this.setDataKeyFromColumn();
|
|
1624
|
+
return column;
|
|
1625
|
+
}
|
|
1618
1626
|
addColumnObject(property, modelType, displayProperty) {
|
|
1619
1627
|
const column = new ColumnDescriptor(this, property);
|
|
1620
1628
|
column.withModelType(modelType);
|
|
@@ -1691,6 +1699,7 @@ class ColumnDescriptor {
|
|
|
1691
1699
|
this._modelType = null;
|
|
1692
1700
|
this._columnType = ColumnDescriptor.TypeEnum.String;
|
|
1693
1701
|
this._isSortEnabled = false;
|
|
1702
|
+
this._enumNameAsValue = false;
|
|
1694
1703
|
this._table = table;
|
|
1695
1704
|
this._property = property;
|
|
1696
1705
|
}
|
|
@@ -1721,6 +1730,15 @@ class ColumnDescriptor {
|
|
|
1721
1730
|
get property() {
|
|
1722
1731
|
return this._property;
|
|
1723
1732
|
}
|
|
1733
|
+
get enumType() {
|
|
1734
|
+
return this._enumType;
|
|
1735
|
+
}
|
|
1736
|
+
get enumTitlePath() {
|
|
1737
|
+
return this._enumTitlePath;
|
|
1738
|
+
}
|
|
1739
|
+
get enumNameAsValue() {
|
|
1740
|
+
return this._enumNameAsValue;
|
|
1741
|
+
}
|
|
1724
1742
|
asType(type = ColumnDescriptor.TypeEnum.String) {
|
|
1725
1743
|
this._columnType = type;
|
|
1726
1744
|
return this;
|
|
@@ -1739,6 +1757,16 @@ class ColumnDescriptor {
|
|
|
1739
1757
|
this._columnType = ColumnDescriptor.TypeEnum.Boolean;
|
|
1740
1758
|
return this;
|
|
1741
1759
|
}
|
|
1760
|
+
asEnum(enumType, nameAsValue = false, titlePath) {
|
|
1761
|
+
this._columnType = ColumnDescriptor.TypeEnum.Enum;
|
|
1762
|
+
this._enumType = enumType;
|
|
1763
|
+
this._enumNameAsValue = nameAsValue;
|
|
1764
|
+
if (typeof titlePath === 'undefined') {
|
|
1765
|
+
titlePath = TypeUtil.findEnumName(enumType);
|
|
1766
|
+
}
|
|
1767
|
+
this._enumTitlePath = titlePath;
|
|
1768
|
+
return this;
|
|
1769
|
+
}
|
|
1742
1770
|
withModelType(modelType) {
|
|
1743
1771
|
this._modelType = modelType;
|
|
1744
1772
|
return this;
|
|
@@ -1753,7 +1781,23 @@ class ColumnDescriptor {
|
|
|
1753
1781
|
}
|
|
1754
1782
|
withFilter() {
|
|
1755
1783
|
this._filterDescriptor = new FilterDescriptor(this._property);
|
|
1756
|
-
|
|
1784
|
+
let filterType;
|
|
1785
|
+
switch (this._columnType) {
|
|
1786
|
+
case ColumnDescriptor.TypeEnum.Number:
|
|
1787
|
+
filterType = FilterDescriptor.TypeEnum.Number;
|
|
1788
|
+
break;
|
|
1789
|
+
case ColumnDescriptor.TypeEnum.Boolean:
|
|
1790
|
+
filterType = FilterDescriptor.TypeEnum.Boolean;
|
|
1791
|
+
break;
|
|
1792
|
+
case ColumnDescriptor.TypeEnum.Date:
|
|
1793
|
+
filterType = FilterDescriptor.TypeEnum.Date;
|
|
1794
|
+
break;
|
|
1795
|
+
case ColumnDescriptor.TypeEnum.String:
|
|
1796
|
+
default:
|
|
1797
|
+
filterType = FilterDescriptor.TypeEnum.String;
|
|
1798
|
+
break;
|
|
1799
|
+
}
|
|
1800
|
+
this._filterDescriptor.asFilterType(filterType);
|
|
1757
1801
|
return this._filterDescriptor;
|
|
1758
1802
|
}
|
|
1759
1803
|
withFilterLookup() {
|
|
@@ -1761,6 +1805,14 @@ class ColumnDescriptor {
|
|
|
1761
1805
|
this._filterDescriptor = filterDescriptor;
|
|
1762
1806
|
return filterDescriptor;
|
|
1763
1807
|
}
|
|
1808
|
+
withFilterLookupEnum(options) {
|
|
1809
|
+
if (this._columnType !== ColumnDescriptor.TypeEnum.Enum || !this._enumType) {
|
|
1810
|
+
throw new Error(`Column ${this._property} is not of type enum or enum type is undefined.`);
|
|
1811
|
+
}
|
|
1812
|
+
const filterDescriptor = new FilterLookupEnumDescriptor(this._property, this._enumType, options, this._enumNameAsValue, this._enumTitlePath);
|
|
1813
|
+
this._filterDescriptor = filterDescriptor;
|
|
1814
|
+
return filterDescriptor;
|
|
1815
|
+
}
|
|
1764
1816
|
withSort(isEnabled = true) {
|
|
1765
1817
|
this._isSortEnabled = isEnabled;
|
|
1766
1818
|
return this;
|
|
@@ -1783,6 +1835,7 @@ class ColumnDescriptor {
|
|
|
1783
1835
|
TypeEnum[TypeEnum["Number"] = 1] = "Number";
|
|
1784
1836
|
TypeEnum[TypeEnum["Boolean"] = 2] = "Boolean";
|
|
1785
1837
|
TypeEnum[TypeEnum["Date"] = 3] = "Date";
|
|
1838
|
+
TypeEnum[TypeEnum["Enum"] = 4] = "Enum";
|
|
1786
1839
|
})(TypeEnum = ColumnDescriptor.TypeEnum || (ColumnDescriptor.TypeEnum = {}));
|
|
1787
1840
|
})(ColumnDescriptor || (ColumnDescriptor = {}));
|
|
1788
1841
|
class FilterDescriptor {
|
|
@@ -1854,6 +1907,7 @@ class FilterDescriptor {
|
|
|
1854
1907
|
TypeEnum[TypeEnum["Boolean"] = 2] = "Boolean";
|
|
1855
1908
|
TypeEnum[TypeEnum["Date"] = 3] = "Date";
|
|
1856
1909
|
TypeEnum[TypeEnum["Lookup"] = 4] = "Lookup";
|
|
1910
|
+
TypeEnum[TypeEnum["LookupEnum"] = 5] = "LookupEnum";
|
|
1857
1911
|
})(TypeEnum = FilterDescriptor.TypeEnum || (FilterDescriptor.TypeEnum = {}));
|
|
1858
1912
|
let MatchModeEnum;
|
|
1859
1913
|
(function (MatchModeEnum) {
|
|
@@ -1960,6 +2014,31 @@ class FilterLookupDescriptor extends FilterDescriptor {
|
|
|
1960
2014
|
descriptor._dataKeyProperty = this._dataKeyProperty;
|
|
1961
2015
|
}
|
|
1962
2016
|
}
|
|
2017
|
+
class FilterLookupEnumDescriptor extends FilterLookupDescriptor {
|
|
2018
|
+
constructor(property, enumType, options, nameAsValue = false, optionsTitlePath) {
|
|
2019
|
+
super(property, null);
|
|
2020
|
+
this._enumType = enumType;
|
|
2021
|
+
if (typeof optionsTitlePath === 'undefined') {
|
|
2022
|
+
optionsTitlePath = TypeUtil.findEnumName(enumType);
|
|
2023
|
+
}
|
|
2024
|
+
const optionEnumValues = Array.isArray(options)
|
|
2025
|
+
? EnumUtil.fromValuesAsEnumValueArray(enumType, options, nameAsValue, optionsTitlePath !== null && optionsTitlePath !== void 0 ? optionsTitlePath : undefined)
|
|
2026
|
+
: EnumUtil.fromConstantsAsEnumValueArray(enumType, nameAsValue, optionsTitlePath !== null && optionsTitlePath !== void 0 ? optionsTitlePath : undefined);
|
|
2027
|
+
const dataProvider = new LookupDataProvider(null).withLookup(() => of(optionEnumValues));
|
|
2028
|
+
this.withLookupDataProvider(dataProvider);
|
|
2029
|
+
this.withItemsLabelProperty('title');
|
|
2030
|
+
this.withItemsValueProperty('value');
|
|
2031
|
+
this.withDataKeyProperty('value');
|
|
2032
|
+
}
|
|
2033
|
+
get enumType() {
|
|
2034
|
+
return this._enumType;
|
|
2035
|
+
}
|
|
2036
|
+
copy() {
|
|
2037
|
+
const field = new FilterLookupEnumDescriptor(this._property, this._enumType, []);
|
|
2038
|
+
this.copyFieldsTo(field);
|
|
2039
|
+
return field;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
1963
2042
|
(function (FilterLookupDescriptor) {
|
|
1964
2043
|
let LookupTypeEnum;
|
|
1965
2044
|
(function (LookupTypeEnum) {
|
|
@@ -2037,6 +2116,9 @@ class TableviewDescriptor {
|
|
|
2037
2116
|
addColumnBoolean(property) {
|
|
2038
2117
|
return this._table.addColumnBoolean(property);
|
|
2039
2118
|
}
|
|
2119
|
+
addColumnEnum(property, enumType, nameAsValue = false, titlePath) {
|
|
2120
|
+
return this._table.addColumnEnum(property, enumType, nameAsValue, titlePath);
|
|
2121
|
+
}
|
|
2040
2122
|
addColumnObject(property, modelType, displayProperty) {
|
|
2041
2123
|
return this._table.addColumnObject(property, modelType, displayProperty);
|
|
2042
2124
|
}
|
|
@@ -2274,8 +2356,15 @@ class EnumUtil {
|
|
|
2274
2356
|
* @param enumType Enum object.
|
|
2275
2357
|
*/
|
|
2276
2358
|
static getConstantNames(enumType) {
|
|
2359
|
+
return EnumUtil.getConstantNamesFromEnumObject(enumType);
|
|
2360
|
+
}
|
|
2361
|
+
/**
|
|
2362
|
+
* Returns array of names for constants in enum.
|
|
2363
|
+
* @param enumObj Enum object.
|
|
2364
|
+
*/
|
|
2365
|
+
static getConstantNamesFromEnumObject(enumObj) {
|
|
2277
2366
|
// in number enum, the numbers are also represented in objects and should be filtered out
|
|
2278
|
-
return Object.keys(
|
|
2367
|
+
return Object.keys(enumObj).filter(v => isNaN(+v));
|
|
2279
2368
|
}
|
|
2280
2369
|
/**
|
|
2281
2370
|
* Returns array of string values for constants in enum.
|
|
@@ -2328,6 +2417,21 @@ class EnumUtil {
|
|
|
2328
2417
|
return typeof enumType[value] !== 'undefined' ? enumType[value] : null;
|
|
2329
2418
|
}
|
|
2330
2419
|
}
|
|
2420
|
+
/**
|
|
2421
|
+
* Gets constant name for value.
|
|
2422
|
+
* @param enumObj Enum object.
|
|
2423
|
+
* @param value Value of enum constant.
|
|
2424
|
+
*/
|
|
2425
|
+
static getConstantNameFromEnumObject(enumObj, value) {
|
|
2426
|
+
var _a;
|
|
2427
|
+
const enumObjAny = enumObj;
|
|
2428
|
+
if (typeof value === 'string') {
|
|
2429
|
+
return (_a = this.getConstantNamesFromEnumObject(enumObj).find(c => enumObjAny[c] === value)) !== null && _a !== void 0 ? _a : null;
|
|
2430
|
+
}
|
|
2431
|
+
else {
|
|
2432
|
+
return typeof enumObjAny[value] !== 'undefined' ? enumObjAny[value] : null;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2331
2435
|
}
|
|
2332
2436
|
|
|
2333
2437
|
class I18nUtil {
|
|
@@ -4374,10 +4478,9 @@ class MngDropdownComponent {
|
|
|
4374
4478
|
}
|
|
4375
4479
|
}
|
|
4376
4480
|
writeValue(obj) {
|
|
4481
|
+
var _a;
|
|
4377
4482
|
this.dropdownFormControl.setValue(obj, { emitEvent: false });
|
|
4378
|
-
|
|
4379
|
-
this.primeDropdown.writeValue(obj);
|
|
4380
|
-
}
|
|
4483
|
+
(_a = this.primeDropdown) === null || _a === void 0 ? void 0 : _a.writeValue(obj);
|
|
4381
4484
|
}
|
|
4382
4485
|
}
|
|
4383
4486
|
MngDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngDropdownComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -4584,10 +4687,10 @@ class MngFormlyFieldDropdownComponent extends FieldType {
|
|
|
4584
4687
|
}
|
|
4585
4688
|
}
|
|
4586
4689
|
MngFormlyFieldDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngFormlyFieldDropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4587
|
-
MngFormlyFieldDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngFormlyFieldDropdownComponent, selector: "mng-formly-field-dropdown", usesInheritance: true, ngImport: i0, template: "<mng-dropdown\n [id]=\"$any(key)\"\n [formControl]=\"dFormControl\"\n [formlyAttributes]=\"field\"\n [placeholder]=\"$any(descriptor.placeholder)\"\n [itemsLabelProperty]=\"$any(descriptor.itemsLabelProperty)\"\n [itemsValueProperty]=\"$any(descriptor.itemsValueProperty)\"\n [showClear]=\"!this.to.required\"\n [dataKeyProperty]=\"$any(descriptor.dataKeyProperty)\">\n</mng-dropdown>\n", components: [{ type: MngDropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "dataKeyProperty", "itemsLabelProperty", "itemsValueProperty", "multiselect", "placeholder", "showClear", "className", "dropdownClassName"], outputs: ["valueChange"] }], directives: [{ type: i2$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4690
|
+
MngFormlyFieldDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngFormlyFieldDropdownComponent, selector: "mng-formly-field-dropdown", usesInheritance: true, ngImport: i0, template: "<mng-dropdown\n [id]=\"$any(key)\"\n [formControl]=\"dFormControl\"\n [formlyAttributes]=\"field\"\n [placeholder]=\"$any(descriptor.placeholder)\"\n [dataProvider]=\"descriptor.dataProvider\"\n [itemsLabelProperty]=\"$any(descriptor.itemsLabelProperty)\"\n [itemsValueProperty]=\"$any(descriptor.itemsValueProperty)\"\n [showClear]=\"!this.to.required\"\n [dataKeyProperty]=\"$any(descriptor.dataKeyProperty)\">\n</mng-dropdown>\n", components: [{ type: MngDropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "dataKeyProperty", "itemsLabelProperty", "itemsValueProperty", "multiselect", "placeholder", "showClear", "className", "dropdownClassName"], outputs: ["valueChange"] }], directives: [{ type: i2$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4588
4691
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngFormlyFieldDropdownComponent, decorators: [{
|
|
4589
4692
|
type: Component,
|
|
4590
|
-
args: [{ selector: 'mng-formly-field-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-dropdown\n [id]=\"$any(key)\"\n [formControl]=\"dFormControl\"\n [formlyAttributes]=\"field\"\n [placeholder]=\"$any(descriptor.placeholder)\"\n [itemsLabelProperty]=\"$any(descriptor.itemsLabelProperty)\"\n [itemsValueProperty]=\"$any(descriptor.itemsValueProperty)\"\n [showClear]=\"!this.to.required\"\n [dataKeyProperty]=\"$any(descriptor.dataKeyProperty)\">\n</mng-dropdown>\n" }]
|
|
4693
|
+
args: [{ selector: 'mng-formly-field-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-dropdown\n [id]=\"$any(key)\"\n [formControl]=\"dFormControl\"\n [formlyAttributes]=\"field\"\n [placeholder]=\"$any(descriptor.placeholder)\"\n [dataProvider]=\"descriptor.dataProvider\"\n [itemsLabelProperty]=\"$any(descriptor.itemsLabelProperty)\"\n [itemsValueProperty]=\"$any(descriptor.itemsValueProperty)\"\n [showClear]=\"!this.to.required\"\n [dataKeyProperty]=\"$any(descriptor.dataKeyProperty)\">\n</mng-dropdown>\n" }]
|
|
4591
4694
|
}] });
|
|
4592
4695
|
|
|
4593
4696
|
class MngTableLoadEvent {
|
|
@@ -4672,10 +4775,10 @@ class MngTableColumnFilterComponent {
|
|
|
4672
4775
|
}
|
|
4673
4776
|
}
|
|
4674
4777
|
MngTableColumnFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngTableColumnFilterComponent, deps: [{ token: i2$1.PrimeNGConfig }], target: i0.ɵɵFactoryTarget.Component });
|
|
4675
|
-
MngTableColumnFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: { descriptor: "descriptor", display: "display" }, ngImport: i0, template: "<p-columnFilter\n class=\"ml-auto\"\n [type]=\"primeType\"\n matchMode=\"equals\"\n [field]=\"descriptor.property\"\n [display]=\"primeDisplay\"\n [matchMode]=\"primeDefaultMatchMode\"\n [matchModeOptions]=\"$any(primeMatchModes)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showMatchModes]=\"true\"\n [showOperator]=\"false\"\n [showAddButton]=\"false\"\n [hideOnClear]=\"true\">\n <ng-template *ngIf=\"lookupDescriptor\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <ng-container [ngSwitch]=\"lookupDescriptor.lookupType\">\n <mng-autocomplete\n *ngSwitchCase=\"lookupTypeAutocomplete\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n (valueChange)=\"autocompleteFilter($event, filterCallback)\">\n </mng-autocomplete>\n <mng-dropdown\n *ngSwitchCase=\"lookupTypeDropdown\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [itemsValueProperty]=\"lookupDescriptor.itemsValueProperty\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"true\"\n (
|
|
4778
|
+
MngTableColumnFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: { descriptor: "descriptor", display: "display" }, ngImport: i0, template: "<p-columnFilter\n class=\"ml-auto\"\n [type]=\"primeType\"\n matchMode=\"equals\"\n [field]=\"descriptor.property\"\n [display]=\"primeDisplay\"\n [matchMode]=\"primeDefaultMatchMode\"\n [matchModeOptions]=\"$any(primeMatchModes)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showMatchModes]=\"true\"\n [showOperator]=\"false\"\n [showAddButton]=\"false\"\n [hideOnClear]=\"true\">\n <ng-template *ngIf=\"lookupDescriptor\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <ng-container [ngSwitch]=\"lookupDescriptor.lookupType\">\n <mng-autocomplete\n *ngSwitchCase=\"lookupTypeAutocomplete\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n (valueChange)=\"autocompleteFilter($event, filterCallback)\">\n </mng-autocomplete>\n <mng-dropdown\n *ngSwitchCase=\"lookupTypeDropdown\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [itemsValueProperty]=\"lookupDescriptor.itemsValueProperty\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"true\"\n (valueChange)=\"filterCallback($event)\">\n </mng-dropdown>\n </ng-container>\n </ng-template>\n</p-columnFilter>\n", components: [{ type: i4$4.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping"] }, { type: MngAutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "dataKeyProperty", "itemsLabelProperty", "multiselect", "placeholder", "className", "dropdownClassName"], outputs: ["valueChange"] }, { type: MngDropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "dataKeyProperty", "itemsLabelProperty", "itemsValueProperty", "multiselect", "placeholder", "showClear", "className", "dropdownClassName"], outputs: ["valueChange"] }], directives: [{ type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i4$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i4$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "translate": i2$2.TranslatePipe } });
|
|
4676
4779
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngTableColumnFilterComponent, decorators: [{
|
|
4677
4780
|
type: Component,
|
|
4678
|
-
args: [{ selector: 'mng-table-column-filter', template: "<p-columnFilter\n class=\"ml-auto\"\n [type]=\"primeType\"\n matchMode=\"equals\"\n [field]=\"descriptor.property\"\n [display]=\"primeDisplay\"\n [matchMode]=\"primeDefaultMatchMode\"\n [matchModeOptions]=\"$any(primeMatchModes)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showMatchModes]=\"true\"\n [showOperator]=\"false\"\n [showAddButton]=\"false\"\n [hideOnClear]=\"true\">\n <ng-template *ngIf=\"lookupDescriptor\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <ng-container [ngSwitch]=\"lookupDescriptor.lookupType\">\n <mng-autocomplete\n *ngSwitchCase=\"lookupTypeAutocomplete\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n (valueChange)=\"autocompleteFilter($event, filterCallback)\">\n </mng-autocomplete>\n <mng-dropdown\n *ngSwitchCase=\"lookupTypeDropdown\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [itemsValueProperty]=\"lookupDescriptor.itemsValueProperty\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"true\"\n (
|
|
4781
|
+
args: [{ selector: 'mng-table-column-filter', template: "<p-columnFilter\n class=\"ml-auto\"\n [type]=\"primeType\"\n matchMode=\"equals\"\n [field]=\"descriptor.property\"\n [display]=\"primeDisplay\"\n [matchMode]=\"primeDefaultMatchMode\"\n [matchModeOptions]=\"$any(primeMatchModes)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showMatchModes]=\"true\"\n [showOperator]=\"false\"\n [showAddButton]=\"false\"\n [hideOnClear]=\"true\">\n <ng-template *ngIf=\"lookupDescriptor\" pTemplate=\"filter\" let-value let-filterCallback=\"filterCallback\">\n <ng-container [ngSwitch]=\"lookupDescriptor.lookupType\">\n <mng-autocomplete\n *ngSwitchCase=\"lookupTypeAutocomplete\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n (valueChange)=\"autocompleteFilter($event, filterCallback)\">\n </mng-autocomplete>\n <mng-dropdown\n *ngSwitchCase=\"lookupTypeDropdown\"\n [ngModel]=\"value\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [dataKeyProperty]=\"lookupDescriptor.dataKeyProperty\"\n [itemsLabelProperty]=\"lookupDescriptor.itemsLabelProperty\"\n [itemsValueProperty]=\"lookupDescriptor.itemsValueProperty\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"true\"\n (valueChange)=\"filterCallback($event)\">\n </mng-dropdown>\n </ng-container>\n </ng-template>\n</p-columnFilter>\n" }]
|
|
4679
4782
|
}], ctorParameters: function () { return [{ type: i2$1.PrimeNGConfig }]; }, propDecorators: { descriptor: [{
|
|
4680
4783
|
type: Input
|
|
4681
4784
|
}], display: [{
|
|
@@ -4742,6 +4845,7 @@ class MngTableColumnValueComponent {
|
|
|
4742
4845
|
this.columnTypeNumber = ColumnDescriptor.TypeEnum.Number;
|
|
4743
4846
|
this.columnTypeBoolean = ColumnDescriptor.TypeEnum.Boolean;
|
|
4744
4847
|
this.columnTypeDate = ColumnDescriptor.TypeEnum.Date;
|
|
4848
|
+
this.columnTypeEnum = ColumnDescriptor.TypeEnum.Enum;
|
|
4745
4849
|
}
|
|
4746
4850
|
}
|
|
4747
4851
|
MngTableColumnValueComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngTableColumnValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -5950,6 +6054,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
|
|
|
5950
6054
|
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" }]
|
|
5951
6055
|
}], ctorParameters: function () { return [{ type: i1.ActivatedRoute }]; } });
|
|
5952
6056
|
|
|
6057
|
+
class MngEnumPipe {
|
|
6058
|
+
transform(value, enumObj, i18nPath, nameAsValue = false) {
|
|
6059
|
+
const enumConstantName = nameAsValue ? value : EnumUtil.getConstantNameFromEnumObject(enumObj, value);
|
|
6060
|
+
if (typeof i18nPath === 'undefined') {
|
|
6061
|
+
i18nPath = TypeUtil.findEnumName(enumObj);
|
|
6062
|
+
}
|
|
6063
|
+
return i18nPath ? `${i18nPath}.${enumConstantName}` : enumConstantName;
|
|
6064
|
+
}
|
|
6065
|
+
}
|
|
6066
|
+
MngEnumPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngEnumPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6067
|
+
MngEnumPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngEnumPipe, name: "enum" });
|
|
6068
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngEnumPipe, decorators: [{
|
|
6069
|
+
type: Pipe,
|
|
6070
|
+
args: [{
|
|
6071
|
+
name: 'enum',
|
|
6072
|
+
pure: true
|
|
6073
|
+
}]
|
|
6074
|
+
}] });
|
|
6075
|
+
|
|
5953
6076
|
function mngCommonsInitializerProvider(mngCommons) {
|
|
5954
6077
|
return () => mngCommons.initialize();
|
|
5955
6078
|
}
|
|
@@ -6204,6 +6327,7 @@ const declarations = [
|
|
|
6204
6327
|
MngTemplateDirective,
|
|
6205
6328
|
// pipes
|
|
6206
6329
|
MngPropertyPathPipe,
|
|
6330
|
+
MngEnumPipe,
|
|
6207
6331
|
MngBooleanPipe,
|
|
6208
6332
|
MngI18nPropertyPipe,
|
|
6209
6333
|
// layout components
|
|
@@ -6296,6 +6420,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
|
|
|
6296
6420
|
MngTemplateDirective,
|
|
6297
6421
|
// pipes
|
|
6298
6422
|
MngPropertyPathPipe,
|
|
6423
|
+
MngEnumPipe,
|
|
6299
6424
|
MngBooleanPipe,
|
|
6300
6425
|
MngI18nPropertyPipe,
|
|
6301
6426
|
// layout components
|
|
@@ -6408,6 +6533,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
|
|
|
6408
6533
|
MngTemplateDirective,
|
|
6409
6534
|
// pipes
|
|
6410
6535
|
MngPropertyPathPipe,
|
|
6536
|
+
MngEnumPipe,
|
|
6411
6537
|
MngBooleanPipe,
|
|
6412
6538
|
MngI18nPropertyPipe,
|
|
6413
6539
|
// layout components
|
|
@@ -6978,5 +7104,5 @@ class RouteBuilder {
|
|
|
6978
7104
|
* Generated bundle index. Do not edit.
|
|
6979
7105
|
*/
|
|
6980
7106
|
|
|
6981
|
-
export { AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngCrudApiService, AMngTableviewRouteComponent, ActionActivationResult, ActionActivationTriggerEnum, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionError, ActionExecContext, ActionLevelEnum, ActionPositionEnum, ActionRunResult, ActionTriggerResult, ActionTypeEnum, ColumnDescriptor, DataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, FieldGroupDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, FieldTabGroupDescriptor, FieldValidator, FilterDescriptor, FilterLookupDescriptor, I18nUtil, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusQueryResultBase, MediusQueryResultWithObject, MediusRestUtil, MngActionComponent, MngActionDialogComponent, MngActionRouteComponent, MngActionService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDropdownComponent, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngFormlyTableWrapperComponent, MngI18nPropertyPipe, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngPropertyPathPipe, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTopbarComponent, ModelDescriptor, ModelUtil, ObjectSerializer, RouteBuilder, RoutesBuilder, TableDescriptor, TableviewComponentService, TableviewDataProvider, TableviewDescriptor, ToastUtil, TypeName, TypeUtil, enumNameDecoratorPropertyName, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngCommonsInitializerProvider, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
7107
|
+
export { AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngCrudApiService, AMngTableviewRouteComponent, ActionActivationResult, ActionActivationTriggerEnum, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionError, ActionExecContext, ActionLevelEnum, ActionPositionEnum, ActionRunResult, ActionTriggerResult, ActionTypeEnum, ColumnDescriptor, DataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, FieldGroupDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, FieldTabGroupDescriptor, FieldValidator, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, I18nUtil, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusQueryResultBase, MediusQueryResultWithObject, MediusRestUtil, MngActionComponent, MngActionDialogComponent, MngActionRouteComponent, MngActionService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDropdownComponent, MngEnumPipe, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngFormlyTableWrapperComponent, MngI18nPropertyPipe, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngPropertyPathPipe, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTopbarComponent, ModelDescriptor, ModelUtil, ObjectSerializer, RouteBuilder, RoutesBuilder, TableDescriptor, TableviewComponentService, TableviewDataProvider, TableviewDescriptor, ToastUtil, TypeName, TypeUtil, enumNameDecoratorPropertyName, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngCommonsInitializerProvider, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
6982
7108
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|