@nettyapps/ntybase 21.0.24 → 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
|
}
|
|
@@ -3053,6 +3083,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
3053
3083
|
args: [{ providedIn: 'root' }]
|
|
3054
3084
|
}] });
|
|
3055
3085
|
|
|
3086
|
+
/**
|
|
3087
|
+
* Nty Authentication Interceptor. This interceptor is used to intercept HTTP requests and add authentication headers.
|
|
3088
|
+
* It's coded as functional interceptor for better performance.
|
|
3089
|
+
* @param req
|
|
3090
|
+
* @param next
|
|
3091
|
+
* @returns
|
|
3092
|
+
*/
|
|
3093
|
+
const ntyAuthenticationInterceptor = (req, next) => {
|
|
3094
|
+
const router = inject(Router);
|
|
3095
|
+
const credentialsService = inject(CredentialsService);
|
|
3096
|
+
const environmentProxy = inject(EnvironmentProxy);
|
|
3097
|
+
const urlHelperService = inject(UrlHelperService);
|
|
3098
|
+
if (req.headers.get('No-Auth') == 'True')
|
|
3099
|
+
return next(req.clone());
|
|
3100
|
+
let token = credentialsService.token;
|
|
3101
|
+
if (token != null) {
|
|
3102
|
+
let appName = environmentProxy.getApplicationName();
|
|
3103
|
+
const clonedreq = req.clone({
|
|
3104
|
+
headers: req.headers.set('Authorization', 'Bearer ' + token)
|
|
3105
|
+
// .set("NettyAppName",appName)
|
|
3106
|
+
});
|
|
3107
|
+
return next(clonedreq).pipe(catchError((error) => {
|
|
3108
|
+
if (error instanceof HttpErrorResponse && error.status === 401) {
|
|
3109
|
+
// Handle 401 error, e.g., navigate to the login page
|
|
3110
|
+
router.navigate(['/login'], {
|
|
3111
|
+
queryParams: {
|
|
3112
|
+
redirect: urlHelperService.cleanUrl(router.url),
|
|
3113
|
+
},
|
|
3114
|
+
replaceUrl: true,
|
|
3115
|
+
});
|
|
3116
|
+
// Return an observable with a successful response
|
|
3117
|
+
return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
|
|
3118
|
+
}
|
|
3119
|
+
if (error instanceof HttpErrorResponse && error.status === 403) {
|
|
3120
|
+
router.navigate(['/forbidden'], {
|
|
3121
|
+
state: { attemptedUrl: router.url }, // Orijinal URL'i state olarak geçme
|
|
3122
|
+
});
|
|
3123
|
+
return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
|
|
3124
|
+
}
|
|
3125
|
+
if (error instanceof HttpErrorResponse && error.status === 428) {
|
|
3126
|
+
// Handle 428 error, e.g., navigate to the login page
|
|
3127
|
+
router.navigate(['/mfalogin'], {
|
|
3128
|
+
queryParams: {
|
|
3129
|
+
redirect: urlHelperService.cleanUrl(router.url),
|
|
3130
|
+
},
|
|
3131
|
+
replaceUrl: true,
|
|
3132
|
+
});
|
|
3133
|
+
// Return an observable with a successful response
|
|
3134
|
+
return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
|
|
3135
|
+
}
|
|
3136
|
+
// For other errors, re-throw the error to propagate it further
|
|
3137
|
+
return throwError(() => error);
|
|
3138
|
+
}));
|
|
3139
|
+
}
|
|
3140
|
+
else {
|
|
3141
|
+
return next(req.clone()).pipe(catchError((error) => {
|
|
3142
|
+
if (error instanceof HttpErrorResponse && error.status === 401) {
|
|
3143
|
+
// Handle 401 error, e.g., navigate to the login page
|
|
3144
|
+
router.navigate(['/login'], {
|
|
3145
|
+
queryParams: {
|
|
3146
|
+
redirect: urlHelperService.cleanUrl(router.url),
|
|
3147
|
+
},
|
|
3148
|
+
replaceUrl: true,
|
|
3149
|
+
});
|
|
3150
|
+
// Return an observable with a successful response
|
|
3151
|
+
return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
|
|
3152
|
+
}
|
|
3153
|
+
if (error instanceof HttpErrorResponse && error.status === 403) {
|
|
3154
|
+
router.navigate(['/forbidden'], {
|
|
3155
|
+
state: { attemptedUrl: router.url }, // Orijinal URL'i state olarak geçme
|
|
3156
|
+
});
|
|
3157
|
+
return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
|
|
3158
|
+
}
|
|
3159
|
+
if (error instanceof HttpErrorResponse && error.status === 428) {
|
|
3160
|
+
// Handle 428 error, e.g., navigate to the login page
|
|
3161
|
+
router.navigate(['/mfalogin'], {
|
|
3162
|
+
queryParams: {
|
|
3163
|
+
redirect: urlHelperService.cleanUrl(router.url),
|
|
3164
|
+
},
|
|
3165
|
+
replaceUrl: true,
|
|
3166
|
+
});
|
|
3167
|
+
// Return an observable with a successful response
|
|
3168
|
+
return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
|
|
3169
|
+
}
|
|
3170
|
+
// For other errors, re-throw the error to propagate it further
|
|
3171
|
+
return throwError(() => error);
|
|
3172
|
+
}));
|
|
3173
|
+
}
|
|
3174
|
+
};
|
|
3175
|
+
|
|
3056
3176
|
class LoginDto {
|
|
3057
3177
|
userName = '';
|
|
3058
3178
|
password = '';
|
|
@@ -3916,6 +4036,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
3916
4036
|
type: Input
|
|
3917
4037
|
}] } });
|
|
3918
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
|
+
class NtyLoadingService {
|
|
4108
|
+
requestCount = 0;
|
|
4109
|
+
isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
4110
|
+
show() {
|
|
4111
|
+
this.requestCount++;
|
|
4112
|
+
if (this.requestCount > 0) {
|
|
4113
|
+
this.isLoading.set(true);
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
hide() {
|
|
4117
|
+
this.requestCount--;
|
|
4118
|
+
if (this.requestCount <= 0) {
|
|
4119
|
+
this.requestCount = 0;
|
|
4120
|
+
this.isLoading.set(false);
|
|
4121
|
+
}
|
|
4122
|
+
}
|
|
4123
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NtyLoadingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4124
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NtyLoadingService, providedIn: 'root' });
|
|
4125
|
+
}
|
|
4126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NtyLoadingService, decorators: [{
|
|
4127
|
+
type: Injectable,
|
|
4128
|
+
args: [{
|
|
4129
|
+
providedIn: 'root',
|
|
4130
|
+
}]
|
|
4131
|
+
}] });
|
|
4132
|
+
|
|
4133
|
+
const NtyLoadingInterceptor = (req, next) => {
|
|
4134
|
+
const loadingService = inject(NtyLoadingService);
|
|
4135
|
+
// Optional: Skip specific URLs if needed (e.g. background polling)
|
|
4136
|
+
// if (req.url.includes('/silent-api')) return next(req);
|
|
4137
|
+
loadingService.show();
|
|
4138
|
+
return next(req).pipe(tap(() => loadingService.hide()), // Handle success
|
|
4139
|
+
catchError((error) => {
|
|
4140
|
+
loadingService.hide(); // Handle error
|
|
4141
|
+
return throwError(() => error);
|
|
4142
|
+
}));
|
|
4143
|
+
};
|
|
4144
|
+
|
|
3919
4145
|
class NettyMenuService {
|
|
3920
4146
|
http = inject(HttpClient);
|
|
3921
4147
|
environmentProxy = inject(EnvironmentProxy);
|
|
@@ -3965,5 +4191,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
3965
4191
|
* Generated bundle index. Do not edit.
|
|
3966
4192
|
*/
|
|
3967
4193
|
|
|
3968
|
-
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, Ntybase, NtybaseModule, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService };
|
|
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 };
|
|
3969
4195
|
//# sourceMappingURL=nettyapps-ntybase.mjs.map
|