@smarterplan/ngx-smarterplan-core 0.3.13 → 0.3.14
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/support-modal/support-modal.component.mjs +5 -4
- package/esm2020/lib/services/validators.service.mjs +8 -5
- package/esm2020/lib/validators/text.directive.mjs +7 -0
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs +17 -7
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs +17 -7
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/lib/services/validators.service.d.ts +1 -1
- package/lib/validators/text.directive.d.ts +2 -0
- package/package.json +1 -1
|
@@ -6155,6 +6155,13 @@ function emailValidator() {
|
|
|
6155
6155
|
};
|
|
6156
6156
|
}
|
|
6157
6157
|
|
|
6158
|
+
function textValidator() {
|
|
6159
|
+
return (control) => {
|
|
6160
|
+
const regex = /[a-zA-Z]/;
|
|
6161
|
+
return !regex.test(control.value) ? { text: control.value } : null;
|
|
6162
|
+
};
|
|
6163
|
+
}
|
|
6164
|
+
|
|
6158
6165
|
class SupportService {
|
|
6159
6166
|
constructor(modalService) {
|
|
6160
6167
|
this.modalService = modalService;
|
|
@@ -6211,16 +6218,19 @@ class ValidatorsService {
|
|
|
6211
6218
|
getError(control) {
|
|
6212
6219
|
if (control.errors) {
|
|
6213
6220
|
if (control.errors.required) {
|
|
6214
|
-
return '
|
|
6221
|
+
return 'errorForm.required';
|
|
6215
6222
|
}
|
|
6216
6223
|
if (control.errors.isEmpty) {
|
|
6217
|
-
return '
|
|
6224
|
+
return 'errorForm.isEmpty';
|
|
6225
|
+
}
|
|
6226
|
+
if (control.errors.text) {
|
|
6227
|
+
return 'errorForm.text';
|
|
6218
6228
|
}
|
|
6219
6229
|
if (control.errors.email) {
|
|
6220
|
-
return '
|
|
6230
|
+
return 'errorForm.email';
|
|
6221
6231
|
}
|
|
6222
6232
|
if (control.errors.maxLength) {
|
|
6223
|
-
return '
|
|
6233
|
+
return 'errorForm.maxLength';
|
|
6224
6234
|
}
|
|
6225
6235
|
}
|
|
6226
6236
|
return '';
|
|
@@ -6277,9 +6287,9 @@ class SupportModalComponent {
|
|
|
6277
6287
|
async iniForm() {
|
|
6278
6288
|
this.currentUser = await this.getCurrentUser();
|
|
6279
6289
|
this.supportForm = this.formBuilder.group({
|
|
6280
|
-
title: ['', [Validators.required, Validators.maxLength(255), noEmptyValidator()]],
|
|
6281
|
-
email: [(this.currentUser ? this.currentUser.email : ''), [Validators.required, emailValidator(), Validators.maxLength(255)]],
|
|
6282
|
-
description: ['', [Validators.required, noEmptyValidator()]],
|
|
6290
|
+
title: ['', [Validators.required, Validators.maxLength(255), noEmptyValidator(), textValidator()]],
|
|
6291
|
+
email: [(this.currentUser ? this.currentUser.email : ''), [Validators.required, emailValidator(), Validators.maxLength(255), textValidator()]],
|
|
6292
|
+
description: ['', [Validators.required, noEmptyValidator(), textValidator()]],
|
|
6283
6293
|
});
|
|
6284
6294
|
this.loading = false;
|
|
6285
6295
|
}
|