@nettyapps/ntybase 21.0.25 → 21.0.26

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.
@@ -3,7 +3,7 @@ import { Component, Injectable, inject, NgModule, Inject, signal, input, output,
3
3
  import * as i1$3 from '@angular/common/http';
4
4
  import { HttpErrorResponse, HttpResponse, HTTP_INTERCEPTORS, HttpClient, HttpHeaders } from '@angular/common/http';
5
5
  import { of, throwError, lastValueFrom, map, catchError as catchError$1, Subject, finalize, take as take$1, takeUntil } from 'rxjs';
6
- import { catchError, map as map$1, take } from 'rxjs/operators';
6
+ import { catchError, map as map$1, take, tap } from 'rxjs/operators';
7
7
  import { Router, ActivatedRoute } from '@angular/router';
8
8
  import * as i2$1 from '@nettyapps/ntycontract';
9
9
  import { EnvironmentProxy } from '@nettyapps/ntycontract';
@@ -1350,6 +1350,7 @@ class NettyAgGridBase extends NettyAppsBase {
1350
1350
  columnDefs = signal(null, ...(ngDevMode ? [{ debugName: "columnDefs" }] : []));
1351
1351
  userColumnDefs = signal(null, ...(ngDevMode ? [{ debugName: "userColumnDefs" }] : []));
1352
1352
  groupMembersColumnDefs = signal(null, ...(ngDevMode ? [{ debugName: "groupMembersColumnDefs" }] : []));
1353
+ gridColumnsVisible = signal(true, ...(ngDevMode ? [{ debugName: "gridColumnsVisible" }] : []));
1353
1354
  // Framework components
1354
1355
  frameworkComponents = null;
1355
1356
  // Selection management
@@ -1782,6 +1783,7 @@ class NettyAgGridBase extends NettyAppsBase {
1782
1783
  else {
1783
1784
  this.isFilterExpanded.set(this.isFilterValid());
1784
1785
  }
1786
+ this.showHideEmbeddedColumnsAsync();
1785
1787
  });
1786
1788
  }
1787
1789
  onReverseIsFilterValid() {
@@ -1985,6 +1987,34 @@ class NettyAgGridBase extends NettyAppsBase {
1985
1987
  popupClose() {
1986
1988
  this.selectedElement.emit(null);
1987
1989
  }
1990
+ // ---------------------------------------------
1991
+ // --- Functions to Show / Hide Grid Columns ---
1992
+ // ---------------------------------------------
1993
+ onShowHideColumns() {
1994
+ this.gridColumnsVisible.update(a => !a);
1995
+ this.showHideColumnsAsync();
1996
+ }
1997
+ showHideColumnsAsync() {
1998
+ setTimeout(() => this.showHideColumns(), 400);
1999
+ }
2000
+ showHideColumns() {
2001
+ var fields = this.columnDefs()
2002
+ .filter((columnDef) => columnDef.ntyHide === 'x')
2003
+ .map((columnDef) => columnDef.field);
2004
+ this.gridApi.setColumnsVisible(fields, this.gridColumnsVisible());
2005
+ }
2006
+ showHideEmbeddedColumnsAsync() {
2007
+ setTimeout(() => this.showHideEmbeddedColumns(), 100);
2008
+ }
2009
+ showHideEmbeddedColumns() {
2010
+ if (this.columnDefs == undefined || this.columnDefs == null) {
2011
+ return;
2012
+ }
2013
+ var fields = this.columnDefs()
2014
+ .filter((columnDef) => columnDef.ntyEmbeddedHide == 'x')
2015
+ .map((columnDef) => columnDef.field);
2016
+ this.gridApi.setColumnsVisible(fields, !this.isEmbedded);
2017
+ }
1988
2018
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1989
2019
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NettyAgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", isSignal: true, isRequired: false, transformFunction: null }, isEmbedded: { classPropertyName: "isEmbedded", publicName: "isEmbedded", isSignal: true, isRequired: false, transformFunction: null }, componantParameterGUID: { classPropertyName: "componantParameterGUID", publicName: "componantParameterGUID", isSignal: true, isRequired: false, transformFunction: null }, componantParameterType: { classPropertyName: "componantParameterType", publicName: "componantParameterType", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onElementSelect: "onElementSelect", selectedElement: "selectedElement" }, usesInheritance: true, ngImport: i0, template: "<p>ag-grid-base works!</p>\n", styles: [""] });
1990
2020
  }
@@ -4006,6 +4036,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
4006
4036
  type: Input
4007
4037
  }] } });
4008
4038
 
4039
+ // Library: @nettyapps/ntybase
4040
+ function ntyEnvironmentConfigFactory(envService) {
4041
+ // SSR Kontrolü (Node.js tarafında window yoktur)
4042
+ if (typeof window !== 'undefined') {
4043
+ const cachedConfig = window.__env?.fullConfig;
4044
+ if (cachedConfig) {
4045
+ return cachedConfig;
4046
+ }
4047
+ }
4048
+ // Bulamazsa servisten al (servis de token'dan aldığı default'u döndürecek)
4049
+ return envService.getEnvironment();
4050
+ }
4051
+
4052
+ function ntyInitializeEnvironment(envLoader) {
4053
+ return () => {
4054
+ return envLoader.loadEnvironment().then((config) => {
4055
+ // Global erişim için (window) ataması
4056
+ if (typeof window !== 'undefined') {
4057
+ window.__env = window.__env || {};
4058
+ window.__env.fullConfig = config;
4059
+ }
4060
+ return config;
4061
+ });
4062
+ };
4063
+ }
4064
+
4065
+ // 1. Bir Token Tanımlayın
4066
+ const NETTY_APP_ENVIRONMENT = new InjectionToken('NETTY_APP_ENVIRONMENT');
4067
+ class NtyEnvironmentService {
4068
+ defaultEnv;
4069
+ // 2. Token'ı Inject Edin
4070
+ constructor(defaultEnv) {
4071
+ this.defaultEnv = defaultEnv;
4072
+ }
4073
+ async loadEnvironment() {
4074
+ if (!window.__env?.nettyUrls) {
4075
+ await this.loadEnvScript();
4076
+ if (!window.__env?.nettyUrls) {
4077
+ throw new Error('env.js not found!');
4078
+ }
4079
+ }
4080
+ return { ...this.defaultEnv, nettyUrls: window.__env.nettyUrls };
4081
+ }
4082
+ loadEnvScript() {
4083
+ return new Promise((resolve, reject) => {
4084
+ const script = document.createElement('script');
4085
+ script.src = 'assets/env.js';
4086
+ script.onload = () => resolve();
4087
+ script.onerror = () => reject(new Error('Failed to load env.js'));
4088
+ document.head.appendChild(script);
4089
+ });
4090
+ }
4091
+ getEnvironment() {
4092
+ return { ...this.defaultEnv, nettyUrls: window.__env.nettyUrls };
4093
+ }
4094
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NtyEnvironmentService, deps: [{ token: NETTY_APP_ENVIRONMENT }], target: i0.ɵɵFactoryTarget.Injectable });
4095
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NtyEnvironmentService, providedIn: 'root' });
4096
+ }
4097
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NtyEnvironmentService, decorators: [{
4098
+ type: Injectable,
4099
+ args: [{
4100
+ providedIn: 'root',
4101
+ }]
4102
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
4103
+ type: Inject,
4104
+ args: [NETTY_APP_ENVIRONMENT]
4105
+ }] }] });
4106
+
4009
4107
  class NtyLoadingService {
4010
4108
  requestCount = 0;
4011
4109
  isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
@@ -4037,8 +4135,10 @@ const NtyLoadingInterceptor = (req, next) => {
4037
4135
  // Optional: Skip specific URLs if needed (e.g. background polling)
4038
4136
  // if (req.url.includes('/silent-api')) return next(req);
4039
4137
  loadingService.show();
4040
- return next(req).pipe(finalize(() => {
4041
- loadingService.hide();
4138
+ return next(req).pipe(tap(() => loadingService.hide()), // Handle success
4139
+ catchError((error) => {
4140
+ loadingService.hide(); // Handle error
4141
+ return throwError(() => error);
4042
4142
  }));
4043
4143
  };
4044
4144
 
@@ -4091,5 +4191,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
4091
4191
  * Generated bundle index. Do not edit.
4092
4192
  */
4093
4193
 
4094
- export { AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ENVIRONMENT_CONFIG, EnvironmentInfo, EnvironmentInfoService, ExcelImportBase, ForgotPassword, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridBase, NettyAgGridSaveBase, NettyAgGridService, NettyAppsBase, NettyBaseApp, NettyHelper, NettyImageService, NettyMenuService, NtyLoadingInterceptor, Ntybase, NtybaseModule, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService, ntyAuthenticationInterceptor };
4194
+ export { AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ENVIRONMENT_CONFIG, EnvironmentInfo, EnvironmentInfoService, ExcelImportBase, ForgotPassword, Login, LoginDto, MFACodeDto, MfaLogin, NETTY_APP_ENVIRONMENT, NettyAgGridBase, NettyAgGridSaveBase, NettyAgGridService, NettyAppsBase, NettyBaseApp, NettyHelper, NettyImageService, NettyMenuService, NtyEnvironmentService, NtyLoadingInterceptor, Ntybase, NtybaseModule, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService, ntyAuthenticationInterceptor, ntyEnvironmentConfigFactory, ntyInitializeEnvironment };
4095
4195
  //# sourceMappingURL=nettyapps-ntybase.mjs.map