@nettyapps/ntybase 21.0.25 → 21.0.27

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.
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Injectable, inject, NgModule, Inject, signal, input, output, computed, effect, model, ViewChild, InjectionToken, Optional, Input } from '@angular/core';
2
+ import { Component, Injectable, inject, NgModule, Inject, signal, input, output, computed, effect, model, ViewChild, InjectionToken, Optional, Input, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';
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,101 @@ 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
+
4107
+ /**
4108
+ * Uygulamanın environment altyapısını kurar.
4109
+ *
4110
+ * @usage
4111
+ * providers: [
4112
+ * provideNettyEnvironment()
4113
+ * // Not: { provide: NETTY_APP_ENVIRONMENT, useValue: environment } dışarıdan verilmelidir.
4114
+ * ]
4115
+ */
4116
+ function provideNtyEnvironment() {
4117
+ return makeEnvironmentProviders([
4118
+ // 1. EnvironmentService'in kendisi (providedIn: 'root' varsa buraya gerek yok ama zararı da yok)
4119
+ NtyEnvironmentService,
4120
+ // 2. ENVIRONMENT_CONFIG provider'ı
4121
+ {
4122
+ provide: ENVIRONMENT_CONFIG,
4123
+ useFactory: ntyEnvironmentConfigFactory,
4124
+ deps: [NtyEnvironmentService],
4125
+ },
4126
+ // 3. APP_INITIALIZER (Uygulama başlamadan önce env yüklemesi)
4127
+ provideAppInitializer(() => {
4128
+ const initializerFn = ntyInitializeEnvironment(inject(NtyEnvironmentService));
4129
+ return initializerFn();
4130
+ }),
4131
+ ]);
4132
+ }
4133
+
4009
4134
  class NtyLoadingService {
4010
4135
  requestCount = 0;
4011
4136
  isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
@@ -4037,8 +4162,10 @@ const NtyLoadingInterceptor = (req, next) => {
4037
4162
  // Optional: Skip specific URLs if needed (e.g. background polling)
4038
4163
  // if (req.url.includes('/silent-api')) return next(req);
4039
4164
  loadingService.show();
4040
- return next(req).pipe(finalize(() => {
4041
- loadingService.hide();
4165
+ return next(req).pipe(tap(() => loadingService.hide()), // Handle success
4166
+ catchError((error) => {
4167
+ loadingService.hide(); // Handle error
4168
+ return throwError(() => error);
4042
4169
  }));
4043
4170
  };
4044
4171
 
@@ -4091,5 +4218,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
4091
4218
  * Generated bundle index. Do not edit.
4092
4219
  */
4093
4220
 
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 };
4221
+ 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, provideNtyEnvironment };
4095
4222
  //# sourceMappingURL=nettyapps-ntybase.mjs.map