@mediusinc/mng-commons 0.2.8 → 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/README.md +46 -0
- package/assets/i18n/en.json +202 -151
- package/assets/i18n/sl.json +202 -151
- package/esm2020/lib/api/utils/object-serializer.util.mjs +12 -7
- package/esm2020/lib/components/action/dialog/action-dialog.component.mjs +2 -2
- package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +2 -4
- package/esm2020/lib/components/form/editor/form-editor.component.mjs +1 -1
- package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +9 -8
- package/esm2020/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +3 -3
- package/esm2020/lib/components/layout/menu-item.component.mjs +59 -17
- package/esm2020/lib/components/tableview/services/tableview.component.service.mjs +1 -1
- 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/components/tableview/table/table.component.mjs +5 -4
- package/esm2020/lib/components/tableview/tableview.component.mjs +1 -1
- package/esm2020/lib/config/formly.config.mjs +10 -1
- package/esm2020/lib/data-providers/base.data-provider.mjs +1 -8
- package/esm2020/lib/descriptors/editor.descriptor.mjs +113 -66
- package/esm2020/lib/descriptors/table.descriptor.mjs +130 -42
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +9 -6
- package/esm2020/lib/mng-commons.module.mjs +8 -2
- package/esm2020/lib/models/enum.model.mjs +2 -0
- package/esm2020/lib/models/index.mjs +3 -1
- package/esm2020/lib/models/menu.model.mjs +2 -0
- package/esm2020/lib/pipes/enum.pipe.mjs +22 -0
- package/esm2020/lib/pipes/i18n-property.pipe.mjs +18 -0
- package/esm2020/lib/pipes/index.mjs +3 -1
- package/esm2020/lib/router/route-builder.mjs +86 -17
- package/esm2020/lib/services/commons.service.mjs +1 -1
- package/esm2020/lib/types/type.decorator.mjs +7 -1
- package/esm2020/lib/types/type.model.mjs +1 -1
- package/esm2020/lib/utils/editor-formly.util.mjs +10 -1
- package/esm2020/lib/utils/enum.util.mjs +82 -0
- package/esm2020/lib/utils/i18n.util.mjs +38 -26
- package/esm2020/lib/utils/index.mjs +2 -1
- package/esm2020/lib/utils/type.util.mjs +39 -2
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/mediusinc-mng-commons.mjs +643 -197
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +637 -196
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/api/utils/object-serializer.util.d.ts +1 -0
- package/lib/components/layout/menu-item.component.d.ts +13 -5
- package/lib/components/tableview/table/column-value/column-value.component.d.ts +1 -0
- package/lib/data-providers/base.data-provider.d.ts +0 -3
- package/lib/descriptors/editor.descriptor.d.ts +43 -28
- package/lib/descriptors/table.descriptor.d.ts +37 -16
- package/lib/descriptors/tableview.descriptor.d.ts +9 -8
- package/lib/mng-commons.module.d.ts +70 -68
- package/lib/models/enum.model.d.ts +5 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/menu.model.d.ts +25 -0
- package/lib/pipes/enum.pipe.d.ts +7 -0
- package/lib/pipes/i18n-property.pipe.d.ts +8 -0
- package/lib/pipes/index.d.ts +2 -0
- package/lib/router/route-builder.d.ts +9 -5
- package/lib/services/commons.service.d.ts +6 -6
- package/lib/types/type.decorator.d.ts +2 -0
- package/lib/types/type.model.d.ts +2 -2
- package/lib/utils/enum.util.d.ts +50 -0
- package/lib/utils/i18n.util.d.ts +6 -2
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/type.util.d.ts +22 -1
- package/package.json +2 -2
- package/public-api.d.ts +1 -0
- package/scss/mng-overrides/_layout_forms.scss +5 -0
package/README.md
CHANGED
|
@@ -112,3 +112,49 @@ Dodajanje MNG Commons slik v `assets` na končnem projektu se uredi z konfigurac
|
|
|
112
112
|
}
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
## Custom Formly validatorji
|
|
116
|
+
|
|
117
|
+
Validatorje lahko dodajamo samostojno na polja, ali pa na skupine polj.
|
|
118
|
+
|
|
119
|
+
Dodajanje se v obeh primerih razlikuje.
|
|
120
|
+
- validator na polje lahko dodamo preko polja, kjer mu podamo ime, funkcijo in sporočilo za validacijo.
|
|
121
|
+
```typescript
|
|
122
|
+
serviceChannelsTableviewDescriptor.addField('cost.code')
|
|
123
|
+
.withValidator('codeValidator', control => control.value, (err, field) => 'error message');
|
|
124
|
+
```
|
|
125
|
+
- validator na skupine lahko dodamo preko
|
|
126
|
+
```typescript
|
|
127
|
+
serviceChannelsTableviewDescriptor.createFieldGroup('Service cost', 'ServiceChannelDto.fieldGroups.serviceCost')
|
|
128
|
+
.withValidator('serviceCostAllOrNoneFieldsRequired', this.serviceCostAllOrNoneFieldsRequired);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Ko dodajamo na grupe, moramo registrirati tudi globalno sporočilo za validacijo v `formly-translate.extension.ts`, kjer mora biti ime sporočila za validacijo enako kot napaka, ki jo nastavljamo v samem validatorju.
|
|
132
|
+
```typescript
|
|
133
|
+
export function formlyConfigProvider(translate: TranslateService): ConfigOption {
|
|
134
|
+
return {
|
|
135
|
+
validationMessages: [
|
|
136
|
+
{ name: 'required', message: getRequiredValidationMessage(translate)},
|
|
137
|
+
...
|
|
138
|
+
// naše sporočilo, ki se imenuje serviceCostAllOrNoneFieldsRequired
|
|
139
|
+
{ name: 'serviceCostAllOrNoneFieldsRequired', message: serviceCostAllOrNoneFieldsRequiredValidatorMessage(translate)}
|
|
140
|
+
],
|
|
141
|
+
extras: { lazyRender: true },
|
|
142
|
+
wrappers: formlyWrappersConfig,
|
|
143
|
+
types: formlyTypesConfig
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function serviceCostAllOrNoneFieldsRequired(control: AbstractControl): boolean {
|
|
148
|
+
const { code, value, description } = control.value.cost;
|
|
149
|
+
const costControl = control.get('cost');
|
|
150
|
+
|
|
151
|
+
// tu vmes je še druga koda
|
|
152
|
+
|
|
153
|
+
// nastavimo enako napako, kot je ime sporočila
|
|
154
|
+
costControl.get('code').setErrors({serviceCostAllOrNoneFieldsRequired: true});
|
|
155
|
+
costControl.get('value').setErrors({serviceCostAllOrNoneFieldsRequired: true});
|
|
156
|
+
costControl.get('description').setErrors({serviceCostAllOrNoneFieldsRequired: true});
|
|
157
|
+
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
```
|
package/assets/i18n/en.json
CHANGED
|
@@ -1,160 +1,211 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
2
|
+
"app": {
|
|
3
|
+
"name": "Angular Commons",
|
|
4
|
+
"owner": "Medius"
|
|
5
|
+
},
|
|
6
|
+
"general": {
|
|
7
|
+
"yes": "Yes",
|
|
8
|
+
"no": "No",
|
|
9
|
+
"save": "Save",
|
|
10
|
+
"cancel": "Cancel",
|
|
11
|
+
"close": "Close",
|
|
12
|
+
"add": "Add",
|
|
13
|
+
"addItem": "Add {{item}}",
|
|
14
|
+
"edit": "Edit",
|
|
15
|
+
"delete": "Delete",
|
|
16
|
+
"export": "Export",
|
|
17
|
+
"returnHome": "Go back to home",
|
|
18
|
+
"confirmation": "Confirmation",
|
|
19
|
+
"success": "Success",
|
|
20
|
+
"successMessage": "Operation successful.",
|
|
21
|
+
"error": "Error",
|
|
22
|
+
"errorMessage": "Unknown error{{errorMessage}}",
|
|
23
|
+
"general": "General"
|
|
24
|
+
},
|
|
25
|
+
"languages": {
|
|
26
|
+
"en": "English",
|
|
27
|
+
"sl": "Slovenski"
|
|
28
|
+
},
|
|
29
|
+
"mngTopbar": {
|
|
30
|
+
"profile": "Profile",
|
|
31
|
+
"settings": "Settings",
|
|
32
|
+
"logout": "Logout"
|
|
33
|
+
},
|
|
34
|
+
"mngTable": {
|
|
35
|
+
"search": "Search...",
|
|
36
|
+
"noItems": "No items",
|
|
37
|
+
"paginationMsg": "Showing {first} to {last} of {totalRecords} entries",
|
|
38
|
+
"selectToFilter": "Select to filter ...",
|
|
39
|
+
"searchToFilter": "Search to filter ...",
|
|
40
|
+
"typeToFilter": "Type to filter ..."
|
|
41
|
+
},
|
|
42
|
+
"mngEditor": {
|
|
43
|
+
"invalidFormToastTitle": "Error in form",
|
|
44
|
+
"invalidFormToastMessage": "Form is not valid, please check and correct inserted values.",
|
|
45
|
+
"validation": {
|
|
46
|
+
"required": "{{field}} is required.",
|
|
47
|
+
"minlength": "{{field}} must be at least {{min}} characters long.",
|
|
48
|
+
"maxlength": "{{field}} must be at most {{max}} characters long.",
|
|
49
|
+
"pattern": "{{field}} must match the pattern {{pattern}}.",
|
|
50
|
+
"email": "{{field}} is not valid email."
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"mngAutocomplete": {
|
|
54
|
+
"noMatches": "No mathces"
|
|
55
|
+
},
|
|
56
|
+
"mngAction": {
|
|
57
|
+
"functions": {
|
|
58
|
+
"run": {
|
|
59
|
+
"title": "Action"
|
|
60
|
+
},
|
|
61
|
+
"fetch": {
|
|
62
|
+
"title": "Fetch"
|
|
63
|
+
},
|
|
64
|
+
"submit": {
|
|
65
|
+
"title": "Submit"
|
|
66
66
|
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"details": {
|
|
70
|
+
"dialog": {
|
|
71
|
+
"title": "{{modelName}}: {{itemTitle}}"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"add": {
|
|
75
|
+
"title": "Add",
|
|
76
|
+
"dialog": {
|
|
77
|
+
"title": "Add {{modelName}}"
|
|
67
78
|
},
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
79
|
+
"success": {
|
|
80
|
+
"title": "Added",
|
|
81
|
+
"message": "{{itemTitle}} created successfully."
|
|
72
82
|
},
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
83
|
+
"error": {
|
|
84
|
+
"title": "Error",
|
|
85
|
+
"message": "Failed to add {{itemTitle}}{{errorMessage}}"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"edit": {
|
|
89
|
+
"dialog": {
|
|
90
|
+
"title": "Edit {{modelName}}: {{itemTitle}}"
|
|
91
|
+
},
|
|
92
|
+
"success": {
|
|
93
|
+
"title": "Edit {{modelName}}",
|
|
94
|
+
"message": "Changes for {{itemTitle}} saved successfully."
|
|
86
95
|
},
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"error": {
|
|
96
|
-
"title": "Error",
|
|
97
|
-
"message": "Failed to execute {{functionTitle}}{{errorMessage}}"
|
|
98
|
-
}
|
|
96
|
+
"error": {
|
|
97
|
+
"title": "Error",
|
|
98
|
+
"message": "Failed to execute {{functionTitle}}{{errorMessage}}"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"delete": {
|
|
102
|
+
"confirm": {
|
|
103
|
+
"message": "Are you sure you want to delete {{itemTitle}}?"
|
|
99
104
|
},
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
"success": {
|
|
105
|
-
"title": "Deleted",
|
|
106
|
-
"message": "{{itemTitle}} deleted successfully."
|
|
107
|
-
},
|
|
108
|
-
"error": {
|
|
109
|
-
"title": "Error",
|
|
110
|
-
"message": "Failed to delete {{itemTitle}}{{errorMessage}}"
|
|
111
|
-
}
|
|
105
|
+
"success": {
|
|
106
|
+
"title": "Deleted",
|
|
107
|
+
"message": "{{itemTitle}} deleted successfully."
|
|
112
108
|
},
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"notContains": "Not contains",
|
|
117
|
-
"endsWith": "Ends with",
|
|
118
|
-
"equals": "Equals",
|
|
119
|
-
"notEquals": "Not equals",
|
|
120
|
-
"noFilter": "No Filter",
|
|
121
|
-
"lt": "Less than",
|
|
122
|
-
"lte": "Less than or equal to",
|
|
123
|
-
"gt": "Greater than",
|
|
124
|
-
"gte": "Greater than or equal to",
|
|
125
|
-
"is": "Is",
|
|
126
|
-
"isNot": "Is not",
|
|
127
|
-
"before": "Before",
|
|
128
|
-
"after": "After",
|
|
129
|
-
"dateIs": "Date is",
|
|
130
|
-
"dateIsNot": "Date is not",
|
|
131
|
-
"dateBefore": "Date is before",
|
|
132
|
-
"dateAfter": "Date is after",
|
|
133
|
-
"clear": "Clear",
|
|
134
|
-
"apply": "Apply",
|
|
135
|
-
"matchAll": "Match All",
|
|
136
|
-
"matchAny": "Match Any",
|
|
137
|
-
"addRule": "Add Rule",
|
|
138
|
-
"removeRule": "Remove Rule",
|
|
139
|
-
"accept": "Yes",
|
|
140
|
-
"reject": "No",
|
|
141
|
-
"choose": "Choose",
|
|
142
|
-
"upload": "Upload",
|
|
143
|
-
"cancel": "Cancel",
|
|
144
|
-
"dayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
145
|
-
"dayNamesShort": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
146
|
-
"dayNamesMin": ["Su","Mo","Tu","We","Th","Fr","Sa"],
|
|
147
|
-
"monthNames": ["January","February","March","April","May","June","July","August","September","October","November","December"],
|
|
148
|
-
"monthNamesShort": ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
|
149
|
-
"dateFormat": "mm/dd/yy",
|
|
150
|
-
"firstDayOfWeek": 0,
|
|
151
|
-
"today": "Today",
|
|
152
|
-
"weekHeader": "Wk",
|
|
153
|
-
"weak": "Weak",
|
|
154
|
-
"medium": "Medium",
|
|
155
|
-
"strong": "Strong",
|
|
156
|
-
"passwordPrompt": "Enter a password",
|
|
157
|
-
"emptyMessage": "No results found",
|
|
158
|
-
"emptyFilterMessage": "No results found"
|
|
109
|
+
"error": {
|
|
110
|
+
"title": "Error",
|
|
111
|
+
"message": "Failed to delete {{itemTitle}}{{errorMessage}}"
|
|
159
112
|
}
|
|
113
|
+
},
|
|
114
|
+
"mngPrime": {
|
|
115
|
+
"startsWith": "Starts with",
|
|
116
|
+
"contains": "Contains",
|
|
117
|
+
"notContains": "Not contains",
|
|
118
|
+
"endsWith": "Ends with",
|
|
119
|
+
"equals": "Equals",
|
|
120
|
+
"notEquals": "Not equals",
|
|
121
|
+
"noFilter": "No Filter",
|
|
122
|
+
"lt": "Less than",
|
|
123
|
+
"lte": "Less than or equal to",
|
|
124
|
+
"gt": "Greater than",
|
|
125
|
+
"gte": "Greater than or equal to",
|
|
126
|
+
"is": "Is",
|
|
127
|
+
"isNot": "Is not",
|
|
128
|
+
"before": "Before",
|
|
129
|
+
"after": "After",
|
|
130
|
+
"dateIs": "Date is",
|
|
131
|
+
"dateIsNot": "Date is not",
|
|
132
|
+
"dateBefore": "Date is before",
|
|
133
|
+
"dateAfter": "Date is after",
|
|
134
|
+
"clear": "Clear",
|
|
135
|
+
"apply": "Apply",
|
|
136
|
+
"matchAll": "Match All",
|
|
137
|
+
"matchAny": "Match Any",
|
|
138
|
+
"addRule": "Add Rule",
|
|
139
|
+
"removeRule": "Remove Rule",
|
|
140
|
+
"accept": "Yes",
|
|
141
|
+
"reject": "No",
|
|
142
|
+
"choose": "Choose",
|
|
143
|
+
"upload": "Upload",
|
|
144
|
+
"cancel": "Cancel",
|
|
145
|
+
"dayNames": [
|
|
146
|
+
"Sunday",
|
|
147
|
+
"Monday",
|
|
148
|
+
"Tuesday",
|
|
149
|
+
"Wednesday",
|
|
150
|
+
"Thursday",
|
|
151
|
+
"Friday",
|
|
152
|
+
"Saturday"
|
|
153
|
+
],
|
|
154
|
+
"dayNamesShort": [
|
|
155
|
+
"Sun",
|
|
156
|
+
"Mon",
|
|
157
|
+
"Tue",
|
|
158
|
+
"Wed",
|
|
159
|
+
"Thu",
|
|
160
|
+
"Fri",
|
|
161
|
+
"Sat"
|
|
162
|
+
],
|
|
163
|
+
"dayNamesMin": [
|
|
164
|
+
"Su",
|
|
165
|
+
"Mo",
|
|
166
|
+
"Tu",
|
|
167
|
+
"We",
|
|
168
|
+
"Th",
|
|
169
|
+
"Fr",
|
|
170
|
+
"Sa"
|
|
171
|
+
],
|
|
172
|
+
"monthNames": [
|
|
173
|
+
"January",
|
|
174
|
+
"February",
|
|
175
|
+
"March",
|
|
176
|
+
"April",
|
|
177
|
+
"May",
|
|
178
|
+
"June",
|
|
179
|
+
"July",
|
|
180
|
+
"August",
|
|
181
|
+
"September",
|
|
182
|
+
"October",
|
|
183
|
+
"November",
|
|
184
|
+
"December"
|
|
185
|
+
],
|
|
186
|
+
"monthNamesShort": [
|
|
187
|
+
"Jan",
|
|
188
|
+
"Feb",
|
|
189
|
+
"Mar",
|
|
190
|
+
"Apr",
|
|
191
|
+
"May",
|
|
192
|
+
"Jun",
|
|
193
|
+
"Jul",
|
|
194
|
+
"Aug",
|
|
195
|
+
"Sep",
|
|
196
|
+
"Oct",
|
|
197
|
+
"Nov",
|
|
198
|
+
"Dec"
|
|
199
|
+
],
|
|
200
|
+
"dateFormat": "mm/dd/yy",
|
|
201
|
+
"firstDayOfWeek": 0,
|
|
202
|
+
"today": "Today",
|
|
203
|
+
"weekHeader": "Wk",
|
|
204
|
+
"weak": "Weak",
|
|
205
|
+
"medium": "Medium",
|
|
206
|
+
"strong": "Strong",
|
|
207
|
+
"passwordPrompt": "Enter a password",
|
|
208
|
+
"emptyMessage": "No results found",
|
|
209
|
+
"emptyFilterMessage": "No results found"
|
|
210
|
+
}
|
|
160
211
|
}
|