ng-ipa-library 1.4.0 → 1.4.3
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/core/interceptors/error.interceptor.mjs +24 -3
- package/esm2020/lib/ipa-form/ipa-form.service.mjs +12 -6
- package/fesm2015/ng-ipa-library.mjs +35 -7
- package/fesm2015/ng-ipa-library.mjs.map +1 -1
- package/fesm2020/ng-ipa-library.mjs +34 -7
- package/fesm2020/ng-ipa-library.mjs.map +1 -1
- package/lib/core/interceptors/error.interceptor.d.ts +2 -0
- package/package.json +1 -1
|
@@ -143,7 +143,8 @@ class IPAFormService {
|
|
|
143
143
|
const config = {
|
|
144
144
|
required: isArabic ? 'هذا الحقل مطلوب' : 'this field required',
|
|
145
145
|
pattern: `${validatorValue.message}`,
|
|
146
|
-
Email: 'خطأ في البريد الالكتروني
|
|
146
|
+
Email: (isArabic ? 'خطأ في البريد الالكتروني ' : 'Invalid email ') +
|
|
147
|
+
'(example@example.com)',
|
|
147
148
|
maxlength: isArabic
|
|
148
149
|
? `تجاوز عدد الحقل المسموح بها (${validatorValue.requiredLength}) حرف`
|
|
149
150
|
: `this field is more than (${validatorValue.requiredLength}) letter`,
|
|
@@ -157,10 +158,15 @@ class IPAFormService {
|
|
|
157
158
|
? `رقم اصغر من أو يساوي ${validatorValue.max}`
|
|
158
159
|
: `number less than or equal (${validatorValue.min})`,
|
|
159
160
|
ngbDate: this.getNgbDatepickerErrorMsg(validatorValue),
|
|
160
|
-
checkId:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
checkId: isArabic
|
|
162
|
+
? 'رقم الهوية أو الاقامة غير صحيح'
|
|
163
|
+
: 'Wrong ID or Iqama number',
|
|
164
|
+
link: (isArabic ? 'الرابط غير صحيح ' : 'Wrong link ') +
|
|
165
|
+
'(http://example.com)',
|
|
166
|
+
linkMP4: (isArabic ? 'رابط MP4 غير صحيح ' : 'Wrong MP4 link ') +
|
|
167
|
+
'(http://example.com/example.mp4)',
|
|
168
|
+
mobileNo: (isArabic ? 'خطأ في رقم الجوال ' : 'Wrong mobile number ') +
|
|
169
|
+
'(05xxxxxxxx)',
|
|
164
170
|
};
|
|
165
171
|
return config[validatorName];
|
|
166
172
|
}
|
|
@@ -1337,13 +1343,19 @@ class ErrorInterceptor {
|
|
|
1337
1343
|
const response = error.error;
|
|
1338
1344
|
const toastrConfig = {
|
|
1339
1345
|
disableTimeOut: true,
|
|
1346
|
+
closeButton: true,
|
|
1347
|
+
tapToDismiss: false,
|
|
1340
1348
|
};
|
|
1341
1349
|
switch (response.statusCode) {
|
|
1342
1350
|
case 500:
|
|
1343
|
-
|
|
1351
|
+
const msg = response.innerException + ' ' + (response.stackTrace ?? '');
|
|
1352
|
+
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1353
|
+
toastr.onShown.subscribe(() => {
|
|
1354
|
+
this.addCopyButton(response.message + '\n' + msg);
|
|
1355
|
+
});
|
|
1344
1356
|
break;
|
|
1345
1357
|
default:
|
|
1346
|
-
this.toastrService.error(response.message,
|
|
1358
|
+
this.toastrService.error('', response.message, toastrConfig);
|
|
1347
1359
|
break;
|
|
1348
1360
|
}
|
|
1349
1361
|
return throwError(error);
|
|
@@ -1357,6 +1369,21 @@ class ErrorInterceptor {
|
|
|
1357
1369
|
}
|
|
1358
1370
|
return false;
|
|
1359
1371
|
}
|
|
1372
|
+
addCopyButton(message) {
|
|
1373
|
+
const messageToast = document.getElementsByClassName('toast-message')[0];
|
|
1374
|
+
const icon = document.createElement('i');
|
|
1375
|
+
icon.classList.add('ms-2', 'fas', 'fa-copy');
|
|
1376
|
+
icon.addEventListener('click', () => {
|
|
1377
|
+
this.copyToClipboard(message);
|
|
1378
|
+
});
|
|
1379
|
+
messageToast.appendChild(icon);
|
|
1380
|
+
}
|
|
1381
|
+
copyToClipboard(message) {
|
|
1382
|
+
navigator.clipboard.writeText(message);
|
|
1383
|
+
this.toastrService.success('تم نسخ الرسالة إلى الحافظة', '', {
|
|
1384
|
+
positionClass: 'toast-bottom-right',
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1360
1387
|
}
|
|
1361
1388
|
ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor, deps: [{ token: ErrorService }, { token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1362
1389
|
ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor });
|