@mediusinc/mng-commons 2.3.1 → 2.4.0-rc.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/assets/i18n/en.json +3 -1
- package/assets/i18n/sl.json +3 -1
- package/esm2020/lib/api/utils/medius-rest.util.mjs +58 -36
- package/esm2020/lib/components/action/editor/action-editor.component.mjs +5 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +7 -1
- package/esm2020/lib/components/form/formly/formly.config.mjs +31 -3
- package/esm2020/lib/components/tableview/table/table.component.mjs +8 -8
- package/esm2020/lib/descriptors/editor/field.descriptor.mjs +8 -1
- package/esm2020/lib/descriptors/filter/filter.descriptor.mjs +3 -3
- package/esm2020/lib/provide-commons.mjs +4 -2
- package/esm2020/lib/services/commons.service.mjs +6 -4
- package/esm2020/lib/services/providers/formly-config.provider.mjs +3 -3
- package/esm2020/lib/validators/field.validator.mjs +33 -0
- package/esm2020/lib/validators/index.mjs +2 -0
- package/fesm2015/mediusinc-mng-commons.mjs +156 -54
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +153 -53
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/api/utils/medius-rest.util.d.ts +19 -8
- package/lib/components/form/formly/formly.config.d.ts +4 -1
- package/lib/components/tableview/table/table.component.d.ts +1 -2
- package/lib/descriptors/filter/filter.descriptor.d.ts +4 -4
- package/lib/services/providers/formly-config.provider.d.ts +2 -1
- package/lib/validators/field.validator.d.ts +3 -0
- package/lib/validators/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1019,7 +1019,43 @@ var TableDynamicColumnsModeEnum;
|
|
|
1019
1019
|
})(TableDynamicColumnsModeEnum || (TableDynamicColumnsModeEnum = {}));
|
|
1020
1020
|
|
|
1021
1021
|
class MediusRestUtil {
|
|
1022
|
-
|
|
1022
|
+
constructor() {
|
|
1023
|
+
// first value is from primeNG, second is for use in query params
|
|
1024
|
+
this.matchModeMapping = [
|
|
1025
|
+
[FilterMatchMode.CONTAINS, 'c', MediusFilterMatchType.Contains, null],
|
|
1026
|
+
[FilterMatchMode.ENDS_WITH, 'ew', MediusFilterMatchType.EndsWith, null],
|
|
1027
|
+
[FilterMatchMode.EQUALS, 'eq', MediusFilterMatchType.Equals, null],
|
|
1028
|
+
[FilterMatchMode.GREATER_THAN, 'gt', MediusFilterMatchType.GreaterThan, null],
|
|
1029
|
+
[FilterMatchMode.LESS_THAN, 'lt', MediusFilterMatchType.SmallerThan, null],
|
|
1030
|
+
[FilterMatchMode.STARTS_WITH, 'sw', MediusFilterMatchType.StartsWith, null],
|
|
1031
|
+
[FilterMatchMode.IN, 'in', MediusFilterMatchType.In, null],
|
|
1032
|
+
[FilterMatchMode.NOT_EQUALS, 'neq', MediusFilterMatchType.NotEquals, null],
|
|
1033
|
+
[FilterMatchMode.BETWEEN, 'ft', MediusFilterMatchType.FromTo, FilterTypeEnum.Date],
|
|
1034
|
+
[FilterMatchMode.DATE_IS, 'dteq', MediusFilterMatchType.Equals, FilterTypeEnum.Date],
|
|
1035
|
+
[FilterMatchMode.DATE_BEFORE, 'lt', MediusFilterMatchType.SmallerThan, FilterTypeEnum.Date],
|
|
1036
|
+
[FilterMatchMode.DATE_AFTER, 'gt', MediusFilterMatchType.GreaterThan, FilterTypeEnum.Date],
|
|
1037
|
+
[FilterMatchMode.DATE_IS_NOT, 'neq', MediusFilterMatchType.NotEquals, FilterTypeEnum.Date]
|
|
1038
|
+
];
|
|
1039
|
+
this.dateTimeInUtc = true;
|
|
1040
|
+
this.dateTimeWithTimezone = true;
|
|
1041
|
+
this.dateTimeWithMillis = true;
|
|
1042
|
+
// empty
|
|
1043
|
+
}
|
|
1044
|
+
static get() {
|
|
1045
|
+
return MediusRestUtil._instance;
|
|
1046
|
+
}
|
|
1047
|
+
configure(config) {
|
|
1048
|
+
if (config.dateTimeInUtc !== undefined) {
|
|
1049
|
+
this.dateTimeInUtc = config.dateTimeInUtc;
|
|
1050
|
+
}
|
|
1051
|
+
if (config.dateTimeWithTimezone !== undefined) {
|
|
1052
|
+
this.dateTimeWithTimezone = config.dateTimeWithTimezone;
|
|
1053
|
+
}
|
|
1054
|
+
if (config.dateTimeWithMillis !== undefined) {
|
|
1055
|
+
this.dateTimeWithMillis = config.dateTimeWithMillis;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
fromAngularQueryParamsToMediusQueryParams(params, filterDescriptors, defaultItemsPerPage = 10, defaultOffset = 0) {
|
|
1023
1059
|
const offset = params['first'] ? parseInt(params['first']) : defaultOffset;
|
|
1024
1060
|
const itemsPerPage = params['rows'] ? parseInt(params['rows']) : defaultItemsPerPage;
|
|
1025
1061
|
const mediusParamsBuilder = MediusQueryParamBuilder.create(itemsPerPage, offset);
|
|
@@ -1054,15 +1090,15 @@ class MediusRestUtil {
|
|
|
1054
1090
|
value = value[0];
|
|
1055
1091
|
}
|
|
1056
1092
|
const filterDescriptor = filterDescriptors.find(f => f.property === field);
|
|
1057
|
-
const matchMode =
|
|
1093
|
+
const matchMode = this.getMapping(operator, filterDescriptor?.filterType, 1);
|
|
1058
1094
|
if (matchMode && filterDescriptor) {
|
|
1059
|
-
mediusParamsBuilder.withFilter(filterDescriptor.property, value, valueTo,
|
|
1095
|
+
mediusParamsBuilder.withFilter(filterDescriptor.property, value, valueTo, this.getMediusFilterMatchTypeFromPrimeMatchMode(matchMode[0]));
|
|
1060
1096
|
}
|
|
1061
1097
|
}
|
|
1062
1098
|
}
|
|
1063
1099
|
return mediusParamsBuilder.build();
|
|
1064
1100
|
}
|
|
1065
|
-
|
|
1101
|
+
fromPrimeLazyLoadEventToAngularQueryParams(event) {
|
|
1066
1102
|
const params = {
|
|
1067
1103
|
first: null,
|
|
1068
1104
|
rows: null,
|
|
@@ -1083,7 +1119,7 @@ class MediusRestUtil {
|
|
|
1083
1119
|
for (const field in event.filters) {
|
|
1084
1120
|
const primeOperator = event.filters[field].matchMode;
|
|
1085
1121
|
let value = event.filters[field].value;
|
|
1086
|
-
const operatorMapping = primeOperator ?
|
|
1122
|
+
const operatorMapping = primeOperator ? this.getMapping(primeOperator, undefined, 0) : undefined;
|
|
1087
1123
|
if (operatorMapping && typeof value !== 'undefined' && value !== null) {
|
|
1088
1124
|
let doAddFilter = false;
|
|
1089
1125
|
if (typeof value === 'string' && value.length > 0) {
|
|
@@ -1125,7 +1161,7 @@ class MediusRestUtil {
|
|
|
1125
1161
|
}
|
|
1126
1162
|
return params;
|
|
1127
1163
|
}
|
|
1128
|
-
|
|
1164
|
+
modifyFilterProperties(mediusQueryParams, filterDescriptors) {
|
|
1129
1165
|
for (const filterParam of mediusQueryParams.filterParams ?? []) {
|
|
1130
1166
|
const filterDescriptor = filterDescriptors.find(f => f.property === filterParam.property);
|
|
1131
1167
|
filterParam.property = filterDescriptor?.filterProperty ?? filterParam.property;
|
|
@@ -1151,24 +1187,25 @@ class MediusRestUtil {
|
|
|
1151
1187
|
// transform dates to correct iso string
|
|
1152
1188
|
if (typeof filterParam.filterValue !== 'undefined') {
|
|
1153
1189
|
if (Array.isArray(filterParam.filterValue)) {
|
|
1154
|
-
filterParam.filterValue = filterParam.filterValue.map(v => DateUtil.toIsoString(v, filterDescriptor.datePickerValueInUtc, filterDescriptor.datePickerValueWithTimezone));
|
|
1190
|
+
filterParam.filterValue = filterParam.filterValue.map(v => DateUtil.toIsoString(v, filterDescriptor.datePickerValueInUtc ?? this.dateTimeInUtc, filterDescriptor.datePickerValueWithTimezone ?? this.dateTimeWithTimezone, this.dateTimeWithMillis, !filterDescriptor.datePickerShowTime));
|
|
1155
1191
|
}
|
|
1156
1192
|
else {
|
|
1157
|
-
|
|
1193
|
+
filterDescriptor.datePickerValueInUtc;
|
|
1194
|
+
filterParam.filterValue = DateUtil.toIsoString(filterParam.filterValue, filterDescriptor.datePickerValueInUtc ?? this.dateTimeInUtc, filterDescriptor.datePickerValueWithTimezone ?? this.dateTimeWithTimezone, this.dateTimeWithMillis, !filterDescriptor.datePickerShowTime);
|
|
1158
1195
|
}
|
|
1159
1196
|
}
|
|
1160
1197
|
if (typeof filterParam.filterValueTo !== 'undefined') {
|
|
1161
1198
|
if (Array.isArray(filterParam.filterValueTo)) {
|
|
1162
|
-
filterParam.filterValueTo = filterParam.filterValueTo.map(v => DateUtil.toIsoString(v, filterDescriptor.datePickerValueInUtc, filterDescriptor.datePickerValueWithTimezone));
|
|
1199
|
+
filterParam.filterValueTo = filterParam.filterValueTo.map(v => DateUtil.toIsoString(v, filterDescriptor.datePickerValueInUtc ?? this.dateTimeInUtc, filterDescriptor.datePickerValueWithTimezone ?? this.dateTimeWithTimezone, this.dateTimeWithMillis, !filterDescriptor.datePickerShowTime));
|
|
1163
1200
|
}
|
|
1164
1201
|
else {
|
|
1165
|
-
filterParam.filterValueTo = DateUtil.toIsoString(filterParam.filterValueTo, filterDescriptor.datePickerValueInUtc, filterDescriptor.datePickerValueWithTimezone);
|
|
1202
|
+
filterParam.filterValueTo = DateUtil.toIsoString(filterParam.filterValueTo, filterDescriptor.datePickerValueInUtc ?? this.dateTimeInUtc, filterDescriptor.datePickerValueWithTimezone ?? this.dateTimeWithTimezone, this.dateTimeWithMillis, !filterDescriptor.datePickerShowTime);
|
|
1166
1203
|
}
|
|
1167
1204
|
}
|
|
1168
1205
|
}
|
|
1169
1206
|
}
|
|
1170
1207
|
}
|
|
1171
|
-
|
|
1208
|
+
fromPrimeLazyLoadEventToMediusQueryParams(event) {
|
|
1172
1209
|
const queryParamBuilder = MediusQueryParamBuilder.create(event.rows, event.first);
|
|
1173
1210
|
// apply sorting
|
|
1174
1211
|
if (event.multiSortMeta) {
|
|
@@ -1179,26 +1216,26 @@ class MediusRestUtil {
|
|
|
1179
1216
|
for (const key of Object.keys(event.filters)) {
|
|
1180
1217
|
const filterEvent = event.filters[key];
|
|
1181
1218
|
if (Array.isArray(filterEvent)) {
|
|
1182
|
-
filterEvent.filter(e => e.value).forEach(e =>
|
|
1219
|
+
filterEvent.filter(e => e.value).forEach(e => this.addMediusFilterFromPrimeFilterMetadata(queryParamBuilder, key, e));
|
|
1183
1220
|
}
|
|
1184
1221
|
else if (typeof filterEvent === 'object') {
|
|
1185
1222
|
if (filterEvent.value) {
|
|
1186
|
-
|
|
1223
|
+
this.addMediusFilterFromPrimeFilterMetadata(queryParamBuilder, key, filterEvent);
|
|
1187
1224
|
}
|
|
1188
1225
|
}
|
|
1189
1226
|
}
|
|
1190
1227
|
}
|
|
1191
1228
|
return queryParamBuilder.build();
|
|
1192
1229
|
}
|
|
1193
|
-
|
|
1194
|
-
const matchType =
|
|
1230
|
+
addMediusFilterFromPrimeFilterMetadata(queryParamBuilder, property, filterMetadata) {
|
|
1231
|
+
const matchType = this.getMediusFilterMatchTypeFromPrimeMatchMode(filterMetadata.matchMode ?? 'equals');
|
|
1195
1232
|
queryParamBuilder.withFilter(property, filterMetadata.value, undefined, matchType);
|
|
1196
1233
|
}
|
|
1197
|
-
|
|
1198
|
-
return
|
|
1234
|
+
getMediusFilterMatchTypeFromPrimeMatchMode(matchMode, dataType) {
|
|
1235
|
+
return this.getMapping(matchMode, dataType)?.[2] ?? MediusFilterMatchType.Equals;
|
|
1199
1236
|
}
|
|
1200
|
-
|
|
1201
|
-
const mappings =
|
|
1237
|
+
getMapping(matchMode, dataType, idx = 0) {
|
|
1238
|
+
const mappings = this.matchModeMapping.filter(m => m[idx] === matchMode && (!dataType || !m[3] || dataType === m[3]));
|
|
1202
1239
|
if (mappings.length === 0) {
|
|
1203
1240
|
return null;
|
|
1204
1241
|
}
|
|
@@ -1210,22 +1247,7 @@ class MediusRestUtil {
|
|
|
1210
1247
|
}
|
|
1211
1248
|
}
|
|
1212
1249
|
}
|
|
1213
|
-
|
|
1214
|
-
MediusRestUtil.matchModeMapping = [
|
|
1215
|
-
[FilterMatchMode.CONTAINS, 'c', MediusFilterMatchType.Contains, null],
|
|
1216
|
-
[FilterMatchMode.ENDS_WITH, 'ew', MediusFilterMatchType.EndsWith, null],
|
|
1217
|
-
[FilterMatchMode.EQUALS, 'eq', MediusFilterMatchType.Equals, null],
|
|
1218
|
-
[FilterMatchMode.GREATER_THAN, 'gt', MediusFilterMatchType.GreaterThan, null],
|
|
1219
|
-
[FilterMatchMode.LESS_THAN, 'lt', MediusFilterMatchType.SmallerThan, null],
|
|
1220
|
-
[FilterMatchMode.STARTS_WITH, 'sw', MediusFilterMatchType.StartsWith, null],
|
|
1221
|
-
[FilterMatchMode.IN, 'in', MediusFilterMatchType.In, null],
|
|
1222
|
-
[FilterMatchMode.NOT_EQUALS, 'neq', MediusFilterMatchType.NotEquals, null],
|
|
1223
|
-
[FilterMatchMode.BETWEEN, 'ft', MediusFilterMatchType.FromTo, FilterTypeEnum.Date],
|
|
1224
|
-
[FilterMatchMode.DATE_IS, 'dteq', MediusFilterMatchType.Equals, FilterTypeEnum.Date],
|
|
1225
|
-
[FilterMatchMode.DATE_BEFORE, 'lt', MediusFilterMatchType.SmallerThan, FilterTypeEnum.Date],
|
|
1226
|
-
[FilterMatchMode.DATE_AFTER, 'gt', MediusFilterMatchType.GreaterThan, FilterTypeEnum.Date],
|
|
1227
|
-
[FilterMatchMode.DATE_IS_NOT, 'neq', MediusFilterMatchType.NotEquals, FilterTypeEnum.Date]
|
|
1228
|
-
];
|
|
1250
|
+
MediusRestUtil._instance = new MediusRestUtil();
|
|
1229
1251
|
|
|
1230
1252
|
class MngFormEditorSubmitEvent {
|
|
1231
1253
|
constructor(formItem) {
|
|
@@ -3291,11 +3313,13 @@ class MngCommonsService {
|
|
|
3291
3313
|
this.setPageTitle();
|
|
3292
3314
|
});
|
|
3293
3315
|
// serialization
|
|
3294
|
-
|
|
3316
|
+
const dateSerializationConfig = {
|
|
3295
3317
|
dateTimeInUtc: this.moduleConfig.serialization?.dateTimeInUtc ?? true,
|
|
3296
3318
|
dateTimeWithTimezone: this.moduleConfig.serialization?.dateTimeWithTimezone ?? true,
|
|
3297
3319
|
dateTimeWithMillis: this.moduleConfig.serialization?.dateTimeWithMillis ?? true
|
|
3298
|
-
}
|
|
3320
|
+
};
|
|
3321
|
+
ObjectSerializer.get().configure(dateSerializationConfig);
|
|
3322
|
+
MediusRestUtil.get().configure(dateSerializationConfig);
|
|
3299
3323
|
}
|
|
3300
3324
|
// MENU actions
|
|
3301
3325
|
menuChangeActiveKey(key) {
|
|
@@ -3765,6 +3789,39 @@ var ButtonStyleRoundedEnum;
|
|
|
3765
3789
|
ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["SQUARE"] = 2] = "SQUARE";
|
|
3766
3790
|
})(ButtonStyleRoundedEnum || (ButtonStyleRoundedEnum = {}));
|
|
3767
3791
|
|
|
3792
|
+
const minDateValidator = (min) => {
|
|
3793
|
+
return (c) => {
|
|
3794
|
+
const date = c?.value;
|
|
3795
|
+
const valid = !date || date >= min;
|
|
3796
|
+
if (!valid) {
|
|
3797
|
+
const newErrors = { ...c.errors, minDate: true };
|
|
3798
|
+
c?.markAsDirty();
|
|
3799
|
+
c.setErrors(newErrors);
|
|
3800
|
+
return newErrors;
|
|
3801
|
+
}
|
|
3802
|
+
if (c?.hasError('minDate')) {
|
|
3803
|
+
c.setErrors({ ...c.errors, minDate: null });
|
|
3804
|
+
}
|
|
3805
|
+
return null;
|
|
3806
|
+
};
|
|
3807
|
+
};
|
|
3808
|
+
const maxDateValidator = (max) => {
|
|
3809
|
+
return (c) => {
|
|
3810
|
+
const date = c?.value;
|
|
3811
|
+
const valid = !date || date <= max;
|
|
3812
|
+
if (!valid) {
|
|
3813
|
+
const newErrors = { ...c.errors, maxDate: true };
|
|
3814
|
+
c?.markAsDirty();
|
|
3815
|
+
c.setErrors(newErrors);
|
|
3816
|
+
return newErrors;
|
|
3817
|
+
}
|
|
3818
|
+
if (c?.hasError('maxDate')) {
|
|
3819
|
+
c.setErrors({ ...c.errors, maxDate: null });
|
|
3820
|
+
}
|
|
3821
|
+
return null;
|
|
3822
|
+
};
|
|
3823
|
+
};
|
|
3824
|
+
|
|
3768
3825
|
class FilterDescriptor {
|
|
3769
3826
|
constructor(property) {
|
|
3770
3827
|
this._filterType = FilterTypeEnum.String;
|
|
@@ -3772,8 +3829,8 @@ class FilterDescriptor {
|
|
|
3772
3829
|
this._matchModes = null;
|
|
3773
3830
|
this._numberUseGrouping = true;
|
|
3774
3831
|
this._datePickerShowTime = false;
|
|
3775
|
-
this._datePickerValueWithTimezone =
|
|
3776
|
-
this._datePickerValueInUtc =
|
|
3832
|
+
this._datePickerValueWithTimezone = undefined;
|
|
3833
|
+
this._datePickerValueInUtc = undefined;
|
|
3777
3834
|
this._className = '';
|
|
3778
3835
|
this._columnClassName = '';
|
|
3779
3836
|
this._columnWidth = null;
|
|
@@ -5813,6 +5870,12 @@ class FieldInputDescriptor extends AFieldDescriptor {
|
|
|
5813
5870
|
this._datePickerMax = max;
|
|
5814
5871
|
this._datePickerShowTime = showTime ?? false;
|
|
5815
5872
|
this._datePickerShowSeconds = showSeconds ?? true;
|
|
5873
|
+
if (min != undefined) {
|
|
5874
|
+
this.withValidation('minDate', minDateValidator(min));
|
|
5875
|
+
}
|
|
5876
|
+
if (max !== undefined) {
|
|
5877
|
+
this.withValidation('maxDate', maxDateValidator(max));
|
|
5878
|
+
}
|
|
5816
5879
|
return this;
|
|
5817
5880
|
}
|
|
5818
5881
|
asMask(mask, slotChar) {
|
|
@@ -10138,7 +10201,9 @@ class MngActionEditorComponent {
|
|
|
10138
10201
|
if (this.dialogConfig) {
|
|
10139
10202
|
requestAnimationFrame(() => {
|
|
10140
10203
|
this.dialogConfig.header = t ?? undefined;
|
|
10141
|
-
this.
|
|
10204
|
+
if (this.action.activationTrigger === ActionActivationTriggerEnum.OnRoute) {
|
|
10205
|
+
this.mngCommonsService.setPageTitle(t ?? undefined);
|
|
10206
|
+
}
|
|
10142
10207
|
});
|
|
10143
10208
|
}
|
|
10144
10209
|
});
|
|
@@ -10885,7 +10950,7 @@ class MngTableComponent {
|
|
|
10885
10950
|
if (this.useQueryParams) {
|
|
10886
10951
|
const rowParams = this.route.snapshot.queryParamMap.get('rows');
|
|
10887
10952
|
const rows = rowParams ? parseInt(rowParams) : this.rows;
|
|
10888
|
-
const mediusQueryParam = MediusRestUtil.fromAngularQueryParamsToMediusQueryParams(this.route.snapshot.queryParams, this.filterDescriptors, this.rows);
|
|
10953
|
+
const mediusQueryParam = MediusRestUtil.get().fromAngularQueryParamsToMediusQueryParams(this.route.snapshot.queryParams, this.filterDescriptors, this.rows);
|
|
10889
10954
|
const event = {};
|
|
10890
10955
|
event.multiSortMeta = this.createSortMeta(mediusQueryParam);
|
|
10891
10956
|
event.filters = this.createFilterMeta(mediusQueryParam);
|
|
@@ -10895,7 +10960,7 @@ class MngTableComponent {
|
|
|
10895
10960
|
.navigate([], {
|
|
10896
10961
|
relativeTo: this.route,
|
|
10897
10962
|
replaceUrl: true,
|
|
10898
|
-
queryParams: MediusRestUtil.fromPrimeLazyLoadEventToAngularQueryParams(event)
|
|
10963
|
+
queryParams: MediusRestUtil.get().fromPrimeLazyLoadEventToAngularQueryParams(event)
|
|
10899
10964
|
})
|
|
10900
10965
|
.then(() => {
|
|
10901
10966
|
this.initializeDataLoadingTriggers();
|
|
@@ -10961,12 +11026,12 @@ class MngTableComponent {
|
|
|
10961
11026
|
this.router.navigate([], {
|
|
10962
11027
|
relativeTo: this.route,
|
|
10963
11028
|
replaceUrl: true,
|
|
10964
|
-
queryParams: MediusRestUtil.fromPrimeLazyLoadEventToAngularQueryParams(event)
|
|
11029
|
+
queryParams: MediusRestUtil.get().fromPrimeLazyLoadEventToAngularQueryParams(event)
|
|
10965
11030
|
});
|
|
10966
11031
|
}
|
|
10967
11032
|
}
|
|
10968
11033
|
else {
|
|
10969
|
-
const mediusQueryParams = event ? MediusRestUtil.fromPrimeLazyLoadEventToMediusQueryParams(event) : new MediusQueryParam();
|
|
11034
|
+
const mediusQueryParams = event ? MediusRestUtil.get().fromPrimeLazyLoadEventToMediusQueryParams(event) : new MediusQueryParam();
|
|
10970
11035
|
this.loadTableWithDataProvider(mediusQueryParams);
|
|
10971
11036
|
}
|
|
10972
11037
|
}
|
|
@@ -11012,7 +11077,7 @@ class MngTableComponent {
|
|
|
11012
11077
|
}
|
|
11013
11078
|
this.dataProviderLatestQueryParam = queryParam;
|
|
11014
11079
|
this.dataProviderLatestQueryParamVersion++;
|
|
11015
|
-
MediusRestUtil.modifyFilterProperties(queryParam, this.filterDescriptors);
|
|
11080
|
+
MediusRestUtil.get().modifyFilterProperties(queryParam, this.filterDescriptors);
|
|
11016
11081
|
this.dataProviderSubscription = this.dataProvider
|
|
11017
11082
|
?.getAll(queryParam, this.dataProviderService, this.descriptor?.isLocalized ? this.mngCommonsService.appDataLanguage ?? undefined : undefined)
|
|
11018
11083
|
.subscribe({
|
|
@@ -11058,7 +11123,7 @@ class MngTableComponent {
|
|
|
11058
11123
|
}
|
|
11059
11124
|
}
|
|
11060
11125
|
loadTableFromRouteUpdate(params) {
|
|
11061
|
-
const mediusQueryParam = MediusRestUtil.fromAngularQueryParamsToMediusQueryParams(params, this.filterDescriptors, this.rows);
|
|
11126
|
+
const mediusQueryParam = MediusRestUtil.get().fromAngularQueryParamsToMediusQueryParams(params, this.filterDescriptors, this.rows);
|
|
11062
11127
|
if (this.dataProviderLatestLazyLoadEventVersion < this.dataProviderLatestQueryParamVersion + 1) {
|
|
11063
11128
|
// update only if new version from query params will be higher
|
|
11064
11129
|
this.updatePrimeSortAndFilter(mediusQueryParam);
|
|
@@ -11129,7 +11194,7 @@ class MngTableComponent {
|
|
|
11129
11194
|
});
|
|
11130
11195
|
params.filterParams?.forEach(f => {
|
|
11131
11196
|
const descriptor = this.filterDescriptors.find(fd => fd.filterProperty === f.property || fd.property === f.property);
|
|
11132
|
-
const matchMode = f.filterMatchType && descriptor ? MediusRestUtil.getMapping(f.filterMatchType, descriptor.filterType, 2)?.[0] : MediusFilterMatchType.Equals;
|
|
11197
|
+
const matchMode = f.filterMatchType && descriptor ? MediusRestUtil.get().getMapping(f.filterMatchType, descriptor.filterType, 2)?.[0] : MediusFilterMatchType.Equals;
|
|
11133
11198
|
if (descriptor && matchMode) {
|
|
11134
11199
|
let filterValue = f.filterValue;
|
|
11135
11200
|
if (descriptor.filterType === FilterTypeEnum.Date && typeof filterValue !== 'undefined') {
|
|
@@ -11793,6 +11858,8 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
11793
11858
|
this.formControl.markAsTouched();
|
|
11794
11859
|
return of(ctx.parameters.item);
|
|
11795
11860
|
})
|
|
11861
|
+
.withRunNotificationSuccess(undefined, undefined, false)
|
|
11862
|
+
.withRunNotificationError(undefined, undefined, false)
|
|
11796
11863
|
.withIsVisibleFunction(() => of(!this.options?.formState.disabled))
|
|
11797
11864
|
.withIsEnabledFunction(() => this.isEnabled$);
|
|
11798
11865
|
addAction.button.withLabel(null).withIcon('pi pi-plus');
|
|
@@ -11819,6 +11886,8 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
11819
11886
|
this.formControl.markAsTouched();
|
|
11820
11887
|
return of(ctx.parameters.item);
|
|
11821
11888
|
})
|
|
11889
|
+
.withRunNotificationSuccess(undefined, undefined, false)
|
|
11890
|
+
.withRunNotificationError(undefined, undefined, false)
|
|
11822
11891
|
.withIsVisibleFunction(ctx => (this.hideActionsForRowWithDefaultLocalization(ctx) ? of(false) : of(!this.formControl?.disabled)))
|
|
11823
11892
|
.withIsEnabledFunction(() => this.isEnabled$);
|
|
11824
11893
|
editAction.button.withLabel(null).withIcon('pi pi-pencil');
|
|
@@ -11853,6 +11922,8 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
11853
11922
|
this.formControl.markAsTouched();
|
|
11854
11923
|
return of(ctxItem);
|
|
11855
11924
|
})
|
|
11925
|
+
.withRunNotificationSuccess(undefined, undefined, false)
|
|
11926
|
+
.withRunNotificationError(undefined, undefined, false)
|
|
11856
11927
|
.withIsVisibleFunction(ctx => (this.hideActionsForRowWithDefaultLocalization(ctx) ? of(false) : of(!this.options?.formState.disabled)))
|
|
11857
11928
|
.withIsEnabledFunction(() => this.isEnabled$);
|
|
11858
11929
|
deleteAction.button.withLabel(null).withIcon('pi pi-trash');
|
|
@@ -13246,7 +13317,33 @@ function getEmailValidationMessage(translate) {
|
|
|
13246
13317
|
return translate.instant('mngEditor.validation.email', { field: fieldName });
|
|
13247
13318
|
};
|
|
13248
13319
|
}
|
|
13249
|
-
|
|
13320
|
+
function getMinDateValidationMessage(translate, datePipe) {
|
|
13321
|
+
return (error, field) => {
|
|
13322
|
+
const inputDescriptor = field.props.descriptor;
|
|
13323
|
+
const minDate = inputDescriptor.datePickerMin;
|
|
13324
|
+
if (!minDate)
|
|
13325
|
+
return '';
|
|
13326
|
+
let dateString = datePipe.transform(minDate, 'dd. MM. yyyy') ?? '';
|
|
13327
|
+
if (inputDescriptor.datePickerShowTime) {
|
|
13328
|
+
dateString += datePipe.transform(minDate, ' HH:mm:ss');
|
|
13329
|
+
}
|
|
13330
|
+
return translate.instant('mngEditor.validation.minDate', { min: dateString });
|
|
13331
|
+
};
|
|
13332
|
+
}
|
|
13333
|
+
function getMaxDateValidationMessage(translate, datePipe) {
|
|
13334
|
+
return (error, field) => {
|
|
13335
|
+
const inputDescriptor = field.props.descriptor;
|
|
13336
|
+
const maxDate = inputDescriptor.datePickerMax;
|
|
13337
|
+
if (!maxDate)
|
|
13338
|
+
return '';
|
|
13339
|
+
let dateString = datePipe.transform(maxDate, 'dd. MM. yyyy') ?? '';
|
|
13340
|
+
if (inputDescriptor.datePickerShowTime) {
|
|
13341
|
+
dateString += datePipe.transform(maxDate, ' HH:mm:ss');
|
|
13342
|
+
}
|
|
13343
|
+
return translate.instant('mngEditor.validation.maxDate', { max: dateString });
|
|
13344
|
+
};
|
|
13345
|
+
}
|
|
13346
|
+
const getFormlyValidationMessages = (translate, datePipe) => {
|
|
13250
13347
|
return [
|
|
13251
13348
|
{ name: 'required', message: getRequiredValidationMessage(translate) },
|
|
13252
13349
|
{ name: 'minLength', message: getMinLengthValidationMessage(translate) },
|
|
@@ -13254,11 +13351,13 @@ const getFormlyValidationMessages = (translate) => {
|
|
|
13254
13351
|
{ name: 'min', message: getMinValidationMessage(translate) },
|
|
13255
13352
|
{ name: 'max', message: getMaxValidationMessage(translate) },
|
|
13256
13353
|
{ name: 'pattern', message: getTextPatternValidationMessage(translate) },
|
|
13257
|
-
{ name: 'email', message: getEmailValidationMessage(translate) }
|
|
13354
|
+
{ name: 'email', message: getEmailValidationMessage(translate) },
|
|
13355
|
+
{ name: 'minDate', message: getMinDateValidationMessage(translate, datePipe) },
|
|
13356
|
+
{ name: 'maxDate', message: getMaxDateValidationMessage(translate, datePipe) }
|
|
13258
13357
|
];
|
|
13259
13358
|
};
|
|
13260
13359
|
|
|
13261
|
-
function mngFormlyConfigProvider(translate, moduleConfig = {}) {
|
|
13360
|
+
function mngFormlyConfigProvider(translate, datePipe, moduleConfig = {}) {
|
|
13262
13361
|
const merge = moduleConfig.formly?.merge ?? true;
|
|
13263
13362
|
let types = formlyTypesConfig;
|
|
13264
13363
|
if (moduleConfig.formly?.types) {
|
|
@@ -13274,7 +13373,7 @@ function mngFormlyConfigProvider(translate, moduleConfig = {}) {
|
|
|
13274
13373
|
}
|
|
13275
13374
|
wrappers = [...wrappers, ...moduleConfig.formly.wrappers];
|
|
13276
13375
|
}
|
|
13277
|
-
let validationMessages = getFormlyValidationMessages(translate);
|
|
13376
|
+
let validationMessages = getFormlyValidationMessages(translate, datePipe);
|
|
13278
13377
|
if (typeof moduleConfig.formly?.getValidationMessages === 'function') {
|
|
13279
13378
|
if (!merge) {
|
|
13280
13379
|
validationMessages = [];
|
|
@@ -13306,6 +13405,7 @@ function provideMngCommons(config) {
|
|
|
13306
13405
|
MngEnumeratePipe,
|
|
13307
13406
|
MngEnumerateAsyncPipe,
|
|
13308
13407
|
MngLocaleDefaultRowClassPipe,
|
|
13408
|
+
DatePipe,
|
|
13309
13409
|
{
|
|
13310
13410
|
provide: MNG_MODULE_CONFIG_IT,
|
|
13311
13411
|
useValue: config
|
|
@@ -13335,7 +13435,7 @@ function provideMngCommons(config) {
|
|
|
13335
13435
|
provide: FORMLY_CONFIG,
|
|
13336
13436
|
multi: true,
|
|
13337
13437
|
useFactory: mngFormlyConfigProvider,
|
|
13338
|
-
deps: [TranslateService, MNG_MODULE_CONFIG_IT]
|
|
13438
|
+
deps: [TranslateService, DatePipe, MNG_MODULE_CONFIG_IT]
|
|
13339
13439
|
},
|
|
13340
13440
|
{
|
|
13341
13441
|
provide: ACTION_EDITOR_DIALOG_COMPONENT_SETTING,
|
|
@@ -14494,5 +14594,5 @@ function EnumName(typeName) {
|
|
|
14494
14594
|
* Generated bundle index. Do not edit.
|
|
14495
14595
|
*/
|
|
14496
14596
|
|
|
14497
|
-
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionButtonDescriptor, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnDisplayTypeEnum, ColumnDynamicDescriptor, ColumnTypeEnum, DataProvider, DateUtil, DefaultMngErrorMapperService, DynamicTableviewDataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, EnumeratePipeI18nHelper, ExportUtils, FieldActionDescriptor, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterLookupTypeEnum, FilterMatchModeEnum, FilterTypeEnum, I18nUtils, IdProperty, JsonPathPipe, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_BROWSER_STORAGE_IT, MNG_COMMONS_INITIALIZER_IT, MNG_DATE_RANGE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationGuard, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngClassMapPipe, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDataLanguageDropdownComponent, MngDateRangeComponent, MngDropdownComponent, MngEnumPipe, MngEnumerateAsyncPipe, MngEnumeratePipe, MngErrorMapperService, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormEvent, MngFormEventTypeEnum, MngFormFieldEvent, MngFormFieldEventComponentSubtype, MngFormFieldEventDialogSubtype, MngFormFieldEventTypeEnum, MngFormlyFieldActionComponent, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldLabelComponent, MngFormlyFieldLookupDialogComponent, MngFormlyFieldNoLabelWrapperComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngGetterPipe, MngI18nPropertyPipe, MngLocaleDefaultRowClassPipe, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngParametrizePipe, MngTableCellClickEvent, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableLoadEvent, MngTableReloadEvent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTemplatePipe, MngTopbarComponent, MngTopbarUserComponent, MngVersionComponent, MngViewContainerComponentService, ModelDescriptor, ModelUtil, NotificationUtil, ObjectSerializer, ObjectUtil, Permissions, RouteBuilder, RoutesBuilder, StringUtil, StyleLevelEnum, StyleSizeEnum, StylesUtil, TableDataProvider, TableDescriptor, TableDynamicColumnsModeEnum, TableDynamicDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewActionDefaultCategories, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewDynamicDescriptor, TableviewEditorTypeEnum, TableviewRouteBuilder, TableviewRouteBuilderInternal, TitleProperty, TypeName, TypeUtil, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxLengthValidationMessage, getMaxValidationMessage, getMinLengthValidationMessage, getMinValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, provideMngCommons, typeMapBase };
|
|
14597
|
+
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionButtonDescriptor, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnDisplayTypeEnum, ColumnDynamicDescriptor, ColumnTypeEnum, DataProvider, DateUtil, DefaultMngErrorMapperService, DynamicTableviewDataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, EnumeratePipeI18nHelper, ExportUtils, FieldActionDescriptor, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterLookupTypeEnum, FilterMatchModeEnum, FilterTypeEnum, I18nUtils, IdProperty, JsonPathPipe, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_BROWSER_STORAGE_IT, MNG_COMMONS_INITIALIZER_IT, MNG_DATE_RANGE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationGuard, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngClassMapPipe, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDataLanguageDropdownComponent, MngDateRangeComponent, MngDropdownComponent, MngEnumPipe, MngEnumerateAsyncPipe, MngEnumeratePipe, MngErrorMapperService, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormEvent, MngFormEventTypeEnum, MngFormFieldEvent, MngFormFieldEventComponentSubtype, MngFormFieldEventDialogSubtype, MngFormFieldEventTypeEnum, MngFormlyFieldActionComponent, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldLabelComponent, MngFormlyFieldLookupDialogComponent, MngFormlyFieldNoLabelWrapperComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngGetterPipe, MngI18nPropertyPipe, MngLocaleDefaultRowClassPipe, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngParametrizePipe, MngTableCellClickEvent, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableLoadEvent, MngTableReloadEvent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTemplatePipe, MngTopbarComponent, MngTopbarUserComponent, MngVersionComponent, MngViewContainerComponentService, ModelDescriptor, ModelUtil, NotificationUtil, ObjectSerializer, ObjectUtil, Permissions, RouteBuilder, RoutesBuilder, StringUtil, StyleLevelEnum, StyleSizeEnum, StylesUtil, TableDataProvider, TableDescriptor, TableDynamicColumnsModeEnum, TableDynamicDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewActionDefaultCategories, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewDynamicDescriptor, TableviewEditorTypeEnum, TableviewRouteBuilder, TableviewRouteBuilderInternal, TitleProperty, TypeName, TypeUtil, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxDateValidationMessage, getMaxLengthValidationMessage, getMaxValidationMessage, getMinDateValidationMessage, getMinLengthValidationMessage, getMinValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, provideMngCommons, typeMapBase };
|
|
14498
14598
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|