ng-ipa-library 1.4.5 → 1.4.8
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 -8
- package/esm2020/lib/ipa-form/ipa-form.service.mjs +2 -2
- package/esm2020/lib/models/apiResponse.mjs +1 -1
- package/esm2020/lib/share-button/share-button.component.mjs +10 -8
- package/fesm2015/ng-ipa-library.mjs +34 -16
- package/fesm2015/ng-ipa-library.mjs.map +1 -1
- package/fesm2020/ng-ipa-library.mjs +33 -15
- package/fesm2020/ng-ipa-library.mjs.map +1 -1
- package/lib/core/interceptors/error.interceptor.d.ts +3 -1
- package/lib/models/apiResponse.d.ts +1 -0
- package/package.json +1 -1
|
@@ -108,7 +108,7 @@ class IPAFormService {
|
|
|
108
108
|
static validHijriDate(control) {
|
|
109
109
|
const date = control.value;
|
|
110
110
|
const isValid = IPAFormService.checkHijriDateValid(date);
|
|
111
|
-
return isValid
|
|
111
|
+
return isValid || !date
|
|
112
112
|
? null
|
|
113
113
|
: {
|
|
114
114
|
ngbDate: {
|
|
@@ -1140,13 +1140,15 @@ class ShareButtonComponent {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
ngAfterViewInit() {
|
|
1142
1142
|
const elements = document.getElementsByClassName('sb-show-icon');
|
|
1143
|
-
elements[0].
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1143
|
+
if (!elements[0].getAttribute('id')) {
|
|
1144
|
+
elements[0].setAttribute('type', 'button');
|
|
1145
|
+
elements[0].setAttribute('id', 'IPAShareBtn');
|
|
1146
|
+
const label = document.createElement('label');
|
|
1147
|
+
label.innerHTML = this.btnLabel;
|
|
1148
|
+
label.classList.add('sm-share-title');
|
|
1149
|
+
label.classList.add('me-1');
|
|
1150
|
+
elements[0].before(label);
|
|
1151
|
+
}
|
|
1150
1152
|
}
|
|
1151
1153
|
}
|
|
1152
1154
|
ShareButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -1384,17 +1386,13 @@ class ErrorInterceptor {
|
|
|
1384
1386
|
};
|
|
1385
1387
|
switch (response.statusCode) {
|
|
1386
1388
|
case 500:
|
|
1387
|
-
|
|
1388
|
-
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1389
|
-
toastr.onShown.subscribe(() => {
|
|
1390
|
-
this.addCopyButton(response.message + '\n' + msg);
|
|
1391
|
-
});
|
|
1389
|
+
this.show500ErrorMsg(response, toastrConfig);
|
|
1392
1390
|
break;
|
|
1393
1391
|
default:
|
|
1394
|
-
this.
|
|
1392
|
+
this.showErrorMsg(response, toastrConfig);
|
|
1395
1393
|
break;
|
|
1396
1394
|
}
|
|
1397
|
-
return throwError(error);
|
|
1395
|
+
return throwError(() => error);
|
|
1398
1396
|
}));
|
|
1399
1397
|
}
|
|
1400
1398
|
isException(req) {
|
|
@@ -1405,6 +1403,26 @@ class ErrorInterceptor {
|
|
|
1405
1403
|
}
|
|
1406
1404
|
return false;
|
|
1407
1405
|
}
|
|
1406
|
+
showErrorMsg(response, toastrConfig) {
|
|
1407
|
+
if (response.errors && response.errors.length > 0) {
|
|
1408
|
+
toastrConfig.enableHtml = true;
|
|
1409
|
+
let msg = '';
|
|
1410
|
+
response.errors.forEach((error) => {
|
|
1411
|
+
msg += `<li>${error}</li>`;
|
|
1412
|
+
});
|
|
1413
|
+
this.toastrService.error(`<ul>${msg}</ul>`, response.message, toastrConfig);
|
|
1414
|
+
}
|
|
1415
|
+
else {
|
|
1416
|
+
this.toastrService.error('', response.message, toastrConfig);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
show500ErrorMsg(response, toastrConfig) {
|
|
1420
|
+
const msg = response.innerException + ' ' + (response.stackTrace ?? '');
|
|
1421
|
+
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1422
|
+
toastr.onShown.subscribe(() => {
|
|
1423
|
+
this.addCopyButton(response.message + '\n' + msg);
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1408
1426
|
addCopyButton(message) {
|
|
1409
1427
|
const messageToast = document.getElementsByClassName('toast-message')[0];
|
|
1410
1428
|
const icon = document.createElement('i');
|