@nettyapps/ntybase 21.1.14 → 21.1.16

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.
@@ -385,11 +385,22 @@ class AlertService {
385
385
  }
386
386
  // For error notifications
387
387
  showError(error, customComponent = ErrorAlert, duration = 5000, width = 'auto', height = 'auto') {
388
- const dialogData = (typeof error === 'object' && error.errors)
389
- ? error
390
- : { message: this.getErrorMessage(error) };
388
+ let componentToOpen = customComponent;
389
+ let actualError = error;
390
+ // Handle (message, error) pattern where second arg is mistakenly an error object instead of a component
391
+ if (typeof error === 'string' && customComponent && typeof customComponent === 'object') {
392
+ actualError = { message: error, details: customComponent };
393
+ componentToOpen = ErrorAlert;
394
+ }
395
+ else if (typeof customComponent !== 'function') {
396
+ // Ensure we always have a component to open
397
+ componentToOpen = ErrorAlert;
398
+ }
399
+ const dialogData = (typeof actualError === 'object' && actualError.errors)
400
+ ? actualError
401
+ : { message: this.getErrorMessage(actualError) };
391
402
  return new Promise((resolve) => {
392
- const dialogRef = this.dialog.open(customComponent, {
403
+ const dialogRef = this.dialog.open(componentToOpen, {
393
404
  width: width,
394
405
  height: height,
395
406
  maxWidth: '95vw',
@@ -404,10 +415,14 @@ class AlertService {
404
415
  });
405
416
  }
406
417
  getErrorMessage(error) {
418
+ if (!error)
419
+ return '';
407
420
  if (typeof error === 'string')
408
- return error;
421
+ return this.translate.instant(error);
409
422
  if (error.error && typeof error.error === 'string')
410
- return error.error;
423
+ return this.translate.instant(error.error);
424
+ if (error.error && error.error.message)
425
+ return error.error.message;
411
426
  if (error.message)
412
427
  return error.message;
413
428
  return JSON.stringify(error);
@@ -1639,6 +1654,8 @@ class NettyAgGridBase extends NettyAppsBase {
1639
1654
  this.nettyAgGridService.setAgGridTranslations(this.gridApi);
1640
1655
  }
1641
1656
  initAgGrid_extension() {
1657
+ if (this.gridApi == null || this.gridApi == undefined)
1658
+ return;
1642
1659
  if (this.allowEdit() == false && this._isPopupValid() == false) {
1643
1660
  this.columnDefs().pop();
1644
1661
  this.columnDefs().shift();
@@ -1705,7 +1722,11 @@ class NettyAgGridBase extends NettyAppsBase {
1705
1722
  }
1706
1723
  // ---------------------------------------------
1707
1724
  // --- Functions to Show / Hide Grid Columns ---
1708
- // ---------------------------------------------
1725
+ // ---------------------------------------------
1726
+ onShowHideColumns() {
1727
+ this.gridColumnsVisible.update((a) => !a);
1728
+ this.initAgGrid();
1729
+ }
1709
1730
  isHidden(isEmbeddedHide, isVisibleHide) {
1710
1731
  const isEmbedded = this._isEmbedded();
1711
1732
  const isVisibleSwitchOn = this.gridColumnsVisible();
@@ -4654,5 +4675,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
4654
4675
  * Generated bundle index. Do not edit.
4655
4676
  */
4656
4677
 
4657
- export { AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ENVIRONMENT_CONFIG, EnvironmentInfo, EnvironmentInfoService, ExcelImportBase, ForgotPassword, Guid, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridBase, NettyAgGridListBase, NettyAgGridListFilterBase, NettyAgGridLogBase, NettyAgGridSaveBase, NettyAgGridService, NettyAppsBase, NettyAppsFilterBase, NettyBaseApp, NettyHelper, NettyImageService, NettyMenuService, NtyLoadingComponent, NtyLoadingInterceptor, NtyLoadingService, Ntybase, NtybaseModule, PageTitle, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService, ntyAuthenticationInterceptor };
4678
+ export { AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ENVIRONMENT_CONFIG, EnvironmentInfo, EnvironmentInfoService, ErrorAlert, ExcelImportBase, ForgotPassword, Guid, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridBase, NettyAgGridListBase, NettyAgGridListFilterBase, NettyAgGridLogBase, NettyAgGridSaveBase, NettyAgGridService, NettyAppsBase, NettyAppsFilterBase, NettyBaseApp, NettyHelper, NettyImageService, NettyMenuService, NtyLoadingComponent, NtyLoadingInterceptor, NtyLoadingService, Ntybase, NtybaseModule, PageTitle, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService, ntyAuthenticationInterceptor };
4658
4679
  //# sourceMappingURL=nettyapps-ntybase.mjs.map