@nettyapps/ntybase 21.1.37 → 21.1.39

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,14 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Injectable, inject, NgModule, signal, input, computed, effect, output, afterRenderEffect, linkedSignal, ViewChild, model, Input, InjectionToken, Optional, Inject } from '@angular/core';
3
- import * as i1$3 from '@angular/common/http';
4
- import { HttpErrorResponse, HttpResponse, HTTP_INTERCEPTORS, HttpClient, HttpHeaders } from '@angular/common/http';
5
- import { of, throwError, Subject, lastValueFrom, map, catchError as catchError$1, finalize, take as take$1, takeUntil } from 'rxjs';
6
- import { catchError, map as map$1, take, finalize as finalize$1 } from 'rxjs/operators';
7
- import { Router, ActivatedRoute } from '@angular/router';
8
- import * as i2$1 from '@nettyapps/ntycontract';
9
- import { EnvironmentProxy, injectNettyStandardProxy, injectNettyStandardLogProxy, injectNettyStandardFilterProxy } from '@nettyapps/ntycontract';
10
- import { DatePipe, CommonModule, Location, DecimalPipe } from '@angular/common';
2
+ import { inject, Component, Injectable, signal, input, computed, effect, model, output, afterRenderEffect, NgModule, linkedSignal, ViewChild, Input, InjectionToken, Optional, Inject } from '@angular/core';
11
3
  import { Buffer } from 'buffer';
4
+ import { Subject, lastValueFrom, map, catchError, throwError, of, finalize, take as take$1, takeUntil } from 'rxjs';
12
5
  import * as i1 from '@angular/material/dialog';
13
6
  import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angular/material/dialog';
14
7
  import * as i3 from '@angular/material/divider';
@@ -19,420 +12,152 @@ import * as i1$2 from '@angular/material/snack-bar';
19
12
  import { MatSnackBarModule } from '@angular/material/snack-bar';
20
13
  import * as i1$1 from '@ngx-translate/core';
21
14
  import { TranslateModule, TranslateService } from '@ngx-translate/core';
15
+ import { CommonModule, DatePipe, Location, DecimalPipe } from '@angular/common';
22
16
  import { Title } from '@angular/platform-browser';
23
- import { Mutex } from 'async-mutex';
24
- import { themeQuartz, StatusBarModule, ClipboardModule, ExcelExportModule, ColumnMenuModule, ContextMenuModule, CellSelectionModule, RowSelectionModule, SetFilterModule, MultiFilterModule } from 'ag-grid-enterprise';
25
- import { toSignal } from '@angular/core/rxjs-interop';
17
+ import * as i2$2 from '@nettyapps/ntycontract';
18
+ import { injectNettyStandardFilterProxy, EnvironmentProxy, injectNettyStandardProxy, injectNettyStandardLogProxy } from '@nettyapps/ntycontract';
19
+ import { I18nService } from '@nettyapps/ntyi18n';
20
+ import { ExcelLogViewer } from '@nettyapps/ntyux';
21
+ import { Router, ActivatedRoute } from '@angular/router';
26
22
  import { ModuleRegistry, AllCommunityModule, ClientSideRowModelModule, HighlightChangesModule, TextFilterModule, NumberFilterModule, DateFilterModule } from 'ag-grid-community';
27
- import * as i2$2 from '@angular/material/tooltip';
23
+ import { themeQuartz, StatusBarModule, ClipboardModule, ExcelExportModule, ColumnMenuModule, ContextMenuModule, CellSelectionModule, RowSelectionModule, SetFilterModule, MultiFilterModule } from 'ag-grid-enterprise';
24
+ import * as i2$1 from '@angular/material/tooltip';
28
25
  import { MatTooltipModule } from '@angular/material/tooltip';
29
26
  import * as i2$3 from '@angular/material/menu';
30
27
  import { MatMenuModule } from '@angular/material/menu';
31
- import * as XLSX from 'xlsx';
32
- import { I18nService } from '@nettyapps/ntyi18n';
28
+ import * as i1$3 from '@angular/common/http';
29
+ import { HttpClient, HttpErrorResponse, HttpResponse, HTTP_INTERCEPTORS, HttpHeaders } from '@angular/common/http';
30
+ import { Mutex } from 'async-mutex';
31
+ import { toSignal } from '@angular/core/rxjs-interop';
32
+ import { catchError as catchError$1, map as map$1, take, finalize as finalize$1 } from 'rxjs/operators';
33
33
  import * as i1$4 from '@angular/forms';
34
34
  import { FormBuilder, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
35
35
  import * as i3$1 from '@angular/material/input';
36
36
  import { MatInputModule } from '@angular/material/input';
37
37
  import { MatFormFieldModule } from '@angular/material/form-field';
38
38
 
39
- class Ntybase {
40
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Ntybase, deps: [], target: i0.ɵɵFactoryTarget.Component });
41
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Ntybase, isStandalone: false, selector: "lib-ntybase", ngImport: i0, template: `
42
- <p>
43
- ntybase works!
44
- </p>
45
- `, isInline: true, styles: [""] });
39
+ class ConfirmDialog {
40
+ dialogRef = inject((MatDialogRef));
41
+ data = inject(MAT_DIALOG_DATA);
42
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfirmDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
43
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: ConfirmDialog, isStandalone: true, selector: "ntybase-confirm-dialog", ngImport: i0, template: "<div class=\"dialog-container\">\n <h2 mat-dialog-title class=\"dialog-title\">\n <mat-icon color=\"warn\" class=\"warning-icon\">warning</mat-icon>\n <span>{{data.title | translate}}</span>\n </h2>\n\n <mat-divider class=\"divider\"></mat-divider>\n\n <mat-dialog-content class=\"dialog-content\">\n <p class=\"message\">{{data.message | translate}}</p>\n </mat-dialog-content>\n\n <mat-dialog-actions align=\"end\" class=\"dialog-actions\">\n <button mat-stroked-button [mat-dialog-close]=\"false\" class=\"btn-cancel\">\n {{'@btnCancel' | translate}}\n </button>\n <button\n mat-flat-button\n color=\"warn\"\n [mat-dialog-close]=\"true\"\n class=\"btn-ok\"\n >\n {{'@btnOK' | translate}}\n </button>\n </mat-dialog-actions>\n</div>\n", styles: [".dialog-container{display:flex;flex-direction:column;min-width:400px;max-width:90vw;padding:24px;border-radius:12px!important}.dialog-title{display:flex;align-items:center;margin:0 0 12px;padding:0;color:var(--mat-sys-primary)}.dialog-title span{margin-left:8px}.warning-icon{color:var(--mat-sys-primary);transform:scale(1.2)}.divider{margin:8px 0 16px;border-top-color:var(--mat-sys-primary)}.dialog-content{padding:8px 0 24px;margin:0;color:var(--mat-sys-primary);line-height:1.6}.dialog-content .message{margin:0;white-space:pre-wrap}.dialog-actions{padding:16px 0 0;margin:0;gap:8px}.btn-ok{padding:8px 16px;border-radius:6px;font-weight:500;background-color:var(--mat-sys-primary);color:var(--mat-sys-primary-container)}.btn-cancel{padding:8px 16px;border-radius:6px;color:var(--mat-sys-secondary-container);background-color:var(--mat-sys-secondary)}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatSnackBarModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i3.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] });
46
44
  }
47
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Ntybase, decorators: [{
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfirmDialog, decorators: [{
48
46
  type: Component,
49
- args: [{ selector: 'lib-ntybase', standalone: false, template: `
50
- <p>
51
- ntybase works!
52
- </p>
53
- ` }]
47
+ args: [{ selector: 'ntybase-confirm-dialog', imports: [MatDialogModule, MatSnackBarModule, MatIconModule, MatDividerModule, TranslateModule], template: "<div class=\"dialog-container\">\n <h2 mat-dialog-title class=\"dialog-title\">\n <mat-icon color=\"warn\" class=\"warning-icon\">warning</mat-icon>\n <span>{{data.title | translate}}</span>\n </h2>\n\n <mat-divider class=\"divider\"></mat-divider>\n\n <mat-dialog-content class=\"dialog-content\">\n <p class=\"message\">{{data.message | translate}}</p>\n </mat-dialog-content>\n\n <mat-dialog-actions align=\"end\" class=\"dialog-actions\">\n <button mat-stroked-button [mat-dialog-close]=\"false\" class=\"btn-cancel\">\n {{'@btnCancel' | translate}}\n </button>\n <button\n mat-flat-button\n color=\"warn\"\n [mat-dialog-close]=\"true\"\n class=\"btn-ok\"\n >\n {{'@btnOK' | translate}}\n </button>\n </mat-dialog-actions>\n</div>\n", styles: [".dialog-container{display:flex;flex-direction:column;min-width:400px;max-width:90vw;padding:24px;border-radius:12px!important}.dialog-title{display:flex;align-items:center;margin:0 0 12px;padding:0;color:var(--mat-sys-primary)}.dialog-title span{margin-left:8px}.warning-icon{color:var(--mat-sys-primary);transform:scale(1.2)}.divider{margin:8px 0 16px;border-top-color:var(--mat-sys-primary)}.dialog-content{padding:8px 0 24px;margin:0;color:var(--mat-sys-primary);line-height:1.6}.dialog-content .message{margin:0;white-space:pre-wrap}.dialog-actions{padding:16px 0 0;margin:0;gap:8px}.btn-ok{padding:8px 16px;border-radius:6px;font-weight:500;background-color:var(--mat-sys-primary);color:var(--mat-sys-primary-container)}.btn-cancel{padding:8px 16px;border-radius:6px;color:var(--mat-sys-secondary-container);background-color:var(--mat-sys-secondary)}\n"] }]
54
48
  }] });
55
49
 
56
- const credentialsKey = 'credentials';
57
- class CredentialsService {
58
- _credentials = null;
59
- constructor() {
60
- const savedCredentials = sessionStorage.getItem(credentialsKey) ||
61
- localStorage.getItem(credentialsKey);
62
- if (savedCredentials) {
63
- this._credentials = JSON.parse(savedCredentials);
64
- }
50
+ class ErrorAlert {
51
+ dialogRef = inject((MatDialogRef));
52
+ data = inject(MAT_DIALOG_DATA);
53
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorAlert, deps: [], target: i0.ɵɵFactoryTarget.Component });
54
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: ErrorAlert, isStandalone: true, selector: "ntybase-error-alert", ngImport: i0, template: "<div class=\"error-dialog-container\">\n <div class=\"header\">\n <mat-icon color=\"error\">error_outline</mat-icon>\n <h2 class=\"error-title\">{{ data.title }}</h2>\n </div>\n\n <div class=\"error-content\">\n <p>{{ data.message }}</p>\n </div>\n\n <mat-dialog-actions class=\"dialog-actions\">\n <button mat-flat-button [mat-dialog-close]=\"true\" class=\"btn-ok\">\n {{'@btnOK' | translate}}\n </button>\n </mat-dialog-actions>\n</div>\n", styles: [".error-dialog-container{padding:40px 32px;text-align:center;min-width:380px;max-width:450px;background:var(--mat-sys-primary);border-radius:20px;box-shadow:0 15px 35px #00000012}.error-dialog-container .header{display:flex;flex-direction:column;align-items:center;gap:12px}.error-dialog-container .header mat-icon{font-size:52px;width:52px;height:52px;color:var(--mat-sys-inverse-primary);margin-bottom:8px}.error-dialog-container .header .error-title{margin:0;font-size:1.4rem;font-weight:700;color:var(--mat-sys-surface);letter-spacing:-.02em}.error-dialog-container .error-content{margin:24px 0 32px;font-size:1rem;line-height:1.6;color:var(--mat-sys-surface)}.error-dialog-container .dialog-actions{display:flex;justify-content:center;padding:0;margin:0}.error-dialog-container .btn-ok{min-width:120px;padding:12px 24px;font-weight:600;font-size:1rem;border-radius:10px;background:var(--mat-sys-inverse-primary);color:var(--mat-sys-primary);border:none;cursor:pointer;transition:all .2s ease}.error-dialog-container .btn-ok:hover{background:var(--mat-sys-inverse-primary);opacity:.9;box-shadow:0 5px 15px #0000001a}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] });
55
+ }
56
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorAlert, decorators: [{
57
+ type: Component,
58
+ args: [{ selector: 'ntybase-error-alert', imports: [MatDialogModule, MatIconModule, CommonModule, TranslateModule], template: "<div class=\"error-dialog-container\">\n <div class=\"header\">\n <mat-icon color=\"error\">error_outline</mat-icon>\n <h2 class=\"error-title\">{{ data.title }}</h2>\n </div>\n\n <div class=\"error-content\">\n <p>{{ data.message }}</p>\n </div>\n\n <mat-dialog-actions class=\"dialog-actions\">\n <button mat-flat-button [mat-dialog-close]=\"true\" class=\"btn-ok\">\n {{'@btnOK' | translate}}\n </button>\n </mat-dialog-actions>\n</div>\n", styles: [".error-dialog-container{padding:40px 32px;text-align:center;min-width:380px;max-width:450px;background:var(--mat-sys-primary);border-radius:20px;box-shadow:0 15px 35px #00000012}.error-dialog-container .header{display:flex;flex-direction:column;align-items:center;gap:12px}.error-dialog-container .header mat-icon{font-size:52px;width:52px;height:52px;color:var(--mat-sys-inverse-primary);margin-bottom:8px}.error-dialog-container .header .error-title{margin:0;font-size:1.4rem;font-weight:700;color:var(--mat-sys-surface);letter-spacing:-.02em}.error-dialog-container .error-content{margin:24px 0 32px;font-size:1rem;line-height:1.6;color:var(--mat-sys-surface)}.error-dialog-container .dialog-actions{display:flex;justify-content:center;padding:0;margin:0}.error-dialog-container .btn-ok{min-width:120px;padding:12px 24px;font-weight:600;font-size:1rem;border-radius:10px;background:var(--mat-sys-inverse-primary);color:var(--mat-sys-primary);border:none;cursor:pointer;transition:all .2s ease}.error-dialog-container .btn-ok:hover{background:var(--mat-sys-inverse-primary);opacity:.9;box-shadow:0 5px 15px #0000001a}\n"] }]
59
+ }] });
60
+
61
+ // alert.service.ts
62
+ class AlertService {
63
+ snackBar;
64
+ dialog;
65
+ translate;
66
+ constructor(snackBar, dialog, translate) {
67
+ this.snackBar = snackBar;
68
+ this.dialog = dialog;
69
+ this.translate = translate;
65
70
  }
66
- /**
67
- * Checks is the user is authenticated.
68
- * @return True if the user is authenticated.
69
- */
70
- isAuthenticated() {
71
- return !!this.credentials;
71
+ // For simple notifications
72
+ showAlert(message, action, duration = 3000) {
73
+ const actionText = action ? action : '@btnOK';
74
+ this.snackBar.open(this.translate.instant(message), this.translate.instant(actionText), { duration });
72
75
  }
73
- /**
74
- * Gets the user credentials.
75
- * @return The user credentials or null if the user is not authenticated.
76
- */
77
- get credentials() {
78
- return this._credentials;
76
+ showWarning(message, action, duration = 3000) {
77
+ const actionText = action ? action : '@btnOK';
78
+ this.snackBar.open(this.translate.instant(message), this.translate.instant(actionText), { duration });
79
79
  }
80
- get token() {
81
- return this._credentials?.token ?? null;
80
+ // For confirmation dialogs
81
+ showConfirm(message) {
82
+ return new Promise((resolve) => {
83
+ const dialogRef = this.dialog.open(ConfirmDialog, {
84
+ width: 'auto',
85
+ height: 'auto',
86
+ data: {
87
+ message: message,
88
+ title: '@confirmation',
89
+ },
90
+ });
91
+ dialogRef.afterClosed().subscribe((result) => {
92
+ resolve(!!result);
93
+ });
94
+ });
82
95
  }
83
- /**
84
- * Sets the user credentials.
85
- * The credentials may be persisted across sessions by setting the `remember` parameter to true.
86
- * Otherwise, the credentials are only persisted for the current session.
87
- * @param credentials The user credentials.
88
- * @param remember True to remember credentials across sessions.
89
- */
90
- setCredentials(credentials, remember) {
91
- this._credentials = credentials || null;
92
- if (credentials) {
93
- const storage = remember ? localStorage : sessionStorage;
94
- storage.setItem(credentialsKey, JSON.stringify(credentials));
95
- }
96
- else {
97
- sessionStorage.removeItem(credentialsKey);
98
- localStorage.removeItem(credentialsKey);
99
- }
96
+ // For success notifications
97
+ showSuccess(message, duration = 3000) {
98
+ this.snackBar.open(this.translate.instant(message), this.translate.instant('@btnOK'), {
99
+ duration,
100
+ panelClass: ['success-snackbar'],
101
+ horizontalPosition: 'right',
102
+ verticalPosition: 'bottom',
103
+ });
100
104
  }
101
- /** Get Credentials
102
- *
103
- * @returns
104
- */
105
- getCredentials() {
106
- let _credentialsString = sessionStorage.getItem(credentialsKey);
107
- if (_credentialsString == null || _credentialsString == '') {
108
- _credentialsString = localStorage.getItem(credentialsKey);
109
- }
110
- return JSON.parse(_credentialsString ?? '');
105
+ /**
106
+ * Displays an error dialog with flexible parameters.
107
+ * Intelligently extracts meaningful C# error messages or falls back to a translation key.
108
+ * * Supported usages:
109
+ * - showError('@fallbackKey', err)
110
+ * - showError(err)
111
+ * - showError(err, '@fallbackKey')
112
+ * - showError('@fallbackKey')
113
+ */
114
+ showError(arg1, arg2, customComponent = ErrorAlert, width = 'auto', height = 'auto') {
115
+ const isArg1Str = typeof arg1 === 'string';
116
+ const fallbackKey = isArg1Str ? arg1 : (typeof arg2 === 'string' ? arg2 : '');
117
+ const errorObj = isArg1Str ? arg2 : arg1;
118
+ // Open the Dialog
119
+ return new Promise((resolve) => {
120
+ this.dialog.open(customComponent, {
121
+ width, height, maxWidth: '95vw',
122
+ data: {
123
+ message: this.getErrorMessage(errorObj, fallbackKey),
124
+ title: this.translate.instant('@errorOccurred'),
125
+ },
126
+ }).afterClosed().subscribe(() => resolve());
127
+ });
111
128
  }
112
- /** Get the token if available otherwise return empty string
113
- *
114
- * @returns
115
- */
116
- getToken() {
117
- try {
118
- let _credentials = this.getCredentials();
119
- return _credentials.token;
129
+ getErrorMessage(errorObj, fallbackKey) {
130
+ if (!errorObj) {
131
+ return fallbackKey ? this.translate.instant(fallbackKey) : this.translate.instant('@errorOccurred');
120
132
  }
121
- catch (error) {
122
- return '';
133
+ const data = errorObj.error ?? errorObj;
134
+ const isStr = typeof data === 'string';
135
+ const backendMessage = isStr ? data : (data?.message || data?.details || JSON.stringify(data));
136
+ const isMeaningful = isStr ? !data.startsWith('<') : !!(data?.message || data?.details);
137
+ if (fallbackKey) {
138
+ return isMeaningful ? backendMessage : this.translate.instant(fallbackKey);
123
139
  }
140
+ return backendMessage;
124
141
  }
125
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CredentialsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
126
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CredentialsService, providedIn: 'root' });
142
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AlertService, deps: [{ token: i1$2.MatSnackBar }, { token: i1.MatDialog }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
143
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AlertService, providedIn: 'root' });
127
144
  }
128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CredentialsService, decorators: [{
145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AlertService, decorators: [{
129
146
  type: Injectable,
130
147
  args: [{
131
148
  providedIn: 'root',
132
149
  }]
133
- }], ctorParameters: () => [] });
150
+ }], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: i1.MatDialog }, { type: i1$1.TranslateService }] });
134
151
 
135
- class UrlHelperService {
136
- router = inject(Router);
137
- cleanUrl(url) {
138
- let result = url
139
- .replace('/mfalogin?redirect=', '')
140
- .replace('/mfalogin?redirect=', '')
141
- .replace('/mfalogin?redirect=', '')
142
- .replace('/login?redirect=', '')
143
- .replace('/login?redirect=', '')
144
- .replace('/login?redirect=', '')
145
- .replace(new RegExp('%25', 'g'), '%')
146
- .replace(new RegExp('%25', 'g'), '%')
147
- .replace(new RegExp('%25', 'g'), '%')
148
- .replace(new RegExp('%25', 'g'), '%')
149
- .replace(new RegExp('%25', 'g'), '%')
150
- .replace(new RegExp('%25', 'g'), '%')
151
- .replace(new RegExp('%22', 'g'), '"')
152
- .replace(new RegExp('%3F', 'g'), '?')
153
- .replace(new RegExp('%3D', 'g'), '=')
154
- .replace(new RegExp('%2F', 'g'), '/')
155
- .replace(new RegExp('%26', 'g'), '&')
156
- .replace(new RegExp('/mfalogin?redirect=', 'g'), '')
157
- .replace(new RegExp('/login?redirect=', 'g'), '');
158
- console.log('url:', url);
159
- console.log('result:', result);
160
- // return url;
161
- return result;
162
- }
163
- navigate(url) {
164
- let urlParts = url.split('?');
165
- if (urlParts.length == 1) {
166
- return this.router.navigate(urlParts, { replaceUrl: true });
167
- }
168
- let parameters = urlParts[1].split('&');
169
- return this.router.navigate([urlParts[0]], {
170
- queryParams: {
171
- parameters: parameters[0]?.replace('parameters=', '') ?? '',
172
- type: parameters[1]?.replace('type=', '') ?? '',
173
- },
174
- replaceUrl: true,
175
- });
152
+ class PageTitle {
153
+ title = signal('', ...(ngDevMode ? [{ debugName: "title" }] : []));
154
+ setTitle(newTitle) {
155
+ this.title.set(newTitle);
176
156
  }
177
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UrlHelperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
178
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UrlHelperService, providedIn: 'root' });
157
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
158
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, providedIn: 'root' });
179
159
  }
180
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UrlHelperService, decorators: [{
181
- type: Injectable,
182
- args: [{
183
- providedIn: 'root',
184
- }]
185
- }] });
186
-
187
- class AuthenticationInterceptor {
188
- router = inject(Router);
189
- credentialsService = inject(CredentialsService);
190
- environmentProxy = inject(EnvironmentProxy);
191
- urlHelperService = inject(UrlHelperService);
192
- intercept(req, next) {
193
- if (req.headers.get('No-Auth') == 'True')
194
- return next.handle(req.clone());
195
- let token = this.credentialsService.token;
196
- if (token != null) {
197
- let appName = this.environmentProxy.getApplicationName();
198
- const clonedreq = req.clone({
199
- headers: req.headers.set('Authorization', 'Bearer ' + token),
200
- // .set("NettyAppName",appName)
201
- });
202
- return next.handle(clonedreq).pipe(catchError((error) => {
203
- if (error instanceof HttpErrorResponse && error.status === 401) {
204
- // Handle 401 error, e.g., navigate to the login page
205
- this.router.navigate(['/login'], {
206
- queryParams: {
207
- redirect: this.urlHelperService.cleanUrl(this.router.url),
208
- },
209
- replaceUrl: true,
210
- });
211
- // Return an observable with a successful response
212
- return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
213
- }
214
- if (error instanceof HttpErrorResponse && error.status === 403) {
215
- this.router.navigate(['/forbidden'], {
216
- state: { attemptedUrl: this.router.url }, // Orijinal URL'i state olarak geçme
217
- });
218
- return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
219
- }
220
- if (error instanceof HttpErrorResponse && error.status === 428) {
221
- // Handle 428 error, e.g., navigate to the login page
222
- this.router.navigate(['/mfalogin'], {
223
- queryParams: {
224
- redirect: this.urlHelperService.cleanUrl(this.router.url),
225
- },
226
- replaceUrl: true,
227
- });
228
- // Return an observable with a successful response
229
- return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
230
- }
231
- // For other errors, re-throw the error to propagate it further
232
- return throwError(() => error);
233
- }));
234
- }
235
- else {
236
- return next.handle(req.clone()).pipe(catchError((error) => {
237
- if (error instanceof HttpErrorResponse && error.status === 401) {
238
- // Handle 401 error, e.g., navigate to the login page
239
- this.router.navigate(['/login'], {
240
- queryParams: {
241
- redirect: this.urlHelperService.cleanUrl(this.router.url),
242
- },
243
- replaceUrl: true,
244
- });
245
- // Return an observable with a successful response
246
- return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
247
- }
248
- if (error instanceof HttpErrorResponse && error.status === 403) {
249
- this.router.navigate(['/forbidden'], {
250
- state: { attemptedUrl: this.router.url }, // Orijinal URL'i state olarak geçme
251
- });
252
- return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
253
- }
254
- if (error instanceof HttpErrorResponse && error.status === 428) {
255
- // Handle 428 error, e.g., navigate to the login page
256
- this.router.navigate(['/mfalogin'], {
257
- queryParams: {
258
- redirect: this.urlHelperService.cleanUrl(this.router.url),
259
- },
260
- replaceUrl: true,
261
- });
262
- // Return an observable with a successful response
263
- return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
264
- }
265
- // For other errors, re-throw the error to propagate it further
266
- return throwError(() => error);
267
- }));
268
- }
269
- }
270
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AuthenticationInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
271
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AuthenticationInterceptor });
272
- }
273
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AuthenticationInterceptor, decorators: [{
274
- type: Injectable
275
- }] });
276
-
277
- class CanDeactivateGuard {
278
- canDeactivate(component) {
279
- return component.canDeactivate ? component.canDeactivate() : true;
280
- }
281
- }
282
-
283
- class NtybaseModule {
284
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtybaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
285
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: NtybaseModule, declarations: [Ntybase], exports: [Ntybase] });
286
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtybaseModule, providers: [
287
- {
288
- provide: HTTP_INTERCEPTORS,
289
- useClass: AuthenticationInterceptor,
290
- multi: true,
291
- },
292
- [CanDeactivateGuard],
293
- DatePipe,
294
- ] });
295
- }
296
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtybaseModule, decorators: [{
297
- type: NgModule,
298
- args: [{
299
- declarations: [Ntybase],
300
- imports: [],
301
- exports: [Ntybase],
302
- providers: [
303
- {
304
- provide: HTTP_INTERCEPTORS,
305
- useClass: AuthenticationInterceptor,
306
- multi: true,
307
- },
308
- [CanDeactivateGuard],
309
- DatePipe,
310
- ],
311
- }]
312
- }] });
313
-
314
- class ConfirmDialog {
315
- dialogRef = inject((MatDialogRef));
316
- data = inject(MAT_DIALOG_DATA);
317
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfirmDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
318
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: ConfirmDialog, isStandalone: true, selector: "ntybase-confirm-dialog", ngImport: i0, template: "<div class=\"dialog-container\">\n <h2 mat-dialog-title class=\"dialog-title\">\n <mat-icon color=\"warn\" class=\"warning-icon\">warning</mat-icon>\n <span>{{data.title | translate}}</span>\n </h2>\n\n <mat-divider class=\"divider\"></mat-divider>\n\n <mat-dialog-content class=\"dialog-content\">\n <p class=\"message\">{{data.message | translate}}</p>\n </mat-dialog-content>\n\n <mat-dialog-actions align=\"end\" class=\"dialog-actions\">\n <button mat-stroked-button [mat-dialog-close]=\"false\" class=\"btn-cancel\">\n {{'@btnCancel' | translate}}\n </button>\n <button\n mat-flat-button\n color=\"warn\"\n [mat-dialog-close]=\"true\"\n class=\"btn-ok\"\n >\n {{'@btnOK' | translate}}\n </button>\n </mat-dialog-actions>\n</div>\n", styles: [".dialog-container{display:flex;flex-direction:column;min-width:400px;max-width:90vw;padding:24px;border-radius:12px!important}.dialog-title{display:flex;align-items:center;margin:0 0 12px;padding:0;color:var(--mat-sys-primary)}.dialog-title span{margin-left:8px}.warning-icon{color:var(--mat-sys-primary);transform:scale(1.2)}.divider{margin:8px 0 16px;border-top-color:var(--mat-sys-primary)}.dialog-content{padding:8px 0 24px;margin:0;color:var(--mat-sys-primary);line-height:1.6}.dialog-content .message{margin:0;white-space:pre-wrap}.dialog-actions{padding:16px 0 0;margin:0;gap:8px}.btn-ok{padding:8px 16px;border-radius:6px;font-weight:500;background-color:var(--mat-sys-primary);color:var(--mat-sys-primary-container)}.btn-cancel{padding:8px 16px;border-radius:6px;color:var(--mat-sys-secondary-container);background-color:var(--mat-sys-secondary)}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatSnackBarModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i3.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] });
319
- }
320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfirmDialog, decorators: [{
321
- type: Component,
322
- args: [{ selector: 'ntybase-confirm-dialog', imports: [MatDialogModule, MatSnackBarModule, MatIconModule, MatDividerModule, TranslateModule], template: "<div class=\"dialog-container\">\n <h2 mat-dialog-title class=\"dialog-title\">\n <mat-icon color=\"warn\" class=\"warning-icon\">warning</mat-icon>\n <span>{{data.title | translate}}</span>\n </h2>\n\n <mat-divider class=\"divider\"></mat-divider>\n\n <mat-dialog-content class=\"dialog-content\">\n <p class=\"message\">{{data.message | translate}}</p>\n </mat-dialog-content>\n\n <mat-dialog-actions align=\"end\" class=\"dialog-actions\">\n <button mat-stroked-button [mat-dialog-close]=\"false\" class=\"btn-cancel\">\n {{'@btnCancel' | translate}}\n </button>\n <button\n mat-flat-button\n color=\"warn\"\n [mat-dialog-close]=\"true\"\n class=\"btn-ok\"\n >\n {{'@btnOK' | translate}}\n </button>\n </mat-dialog-actions>\n</div>\n", styles: [".dialog-container{display:flex;flex-direction:column;min-width:400px;max-width:90vw;padding:24px;border-radius:12px!important}.dialog-title{display:flex;align-items:center;margin:0 0 12px;padding:0;color:var(--mat-sys-primary)}.dialog-title span{margin-left:8px}.warning-icon{color:var(--mat-sys-primary);transform:scale(1.2)}.divider{margin:8px 0 16px;border-top-color:var(--mat-sys-primary)}.dialog-content{padding:8px 0 24px;margin:0;color:var(--mat-sys-primary);line-height:1.6}.dialog-content .message{margin:0;white-space:pre-wrap}.dialog-actions{padding:16px 0 0;margin:0;gap:8px}.btn-ok{padding:8px 16px;border-radius:6px;font-weight:500;background-color:var(--mat-sys-primary);color:var(--mat-sys-primary-container)}.btn-cancel{padding:8px 16px;border-radius:6px;color:var(--mat-sys-secondary-container);background-color:var(--mat-sys-secondary)}\n"] }]
323
- }] });
324
-
325
- class ErrorAlert {
326
- dialogRef = inject((MatDialogRef));
327
- data = inject(MAT_DIALOG_DATA);
328
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorAlert, deps: [], target: i0.ɵɵFactoryTarget.Component });
329
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: ErrorAlert, isStandalone: true, selector: "ntybase-error-alert", ngImport: i0, template: "<div class=\"error-dialog-container\">\n <div class=\"header\">\n <mat-icon color=\"error\">error_outline</mat-icon>\n <h2 class=\"error-title\">{{ data.title }}</h2>\n </div>\n\n <div class=\"error-content\">\n <p>{{ data.message }}</p>\n </div>\n\n <mat-dialog-actions class=\"dialog-actions\">\n <button mat-flat-button [mat-dialog-close]=\"true\" class=\"btn-ok\">\n {{'@btnOK' | translate}}\n </button>\n </mat-dialog-actions>\n</div>\n", styles: [".error-dialog-container{padding:40px 32px;text-align:center;min-width:380px;max-width:450px;background:var(--mat-sys-primary);border-radius:20px;box-shadow:0 15px 35px #00000012}.error-dialog-container .header{display:flex;flex-direction:column;align-items:center;gap:12px}.error-dialog-container .header mat-icon{font-size:52px;width:52px;height:52px;color:var(--mat-sys-inverse-primary);margin-bottom:8px}.error-dialog-container .header .error-title{margin:0;font-size:1.4rem;font-weight:700;color:var(--mat-sys-surface);letter-spacing:-.02em}.error-dialog-container .error-content{margin:24px 0 32px;font-size:1rem;line-height:1.6;color:var(--mat-sys-surface)}.error-dialog-container .dialog-actions{display:flex;justify-content:center;padding:0;margin:0}.error-dialog-container .btn-ok{min-width:120px;padding:12px 24px;font-weight:600;font-size:1rem;border-radius:10px;background:var(--mat-sys-inverse-primary);color:var(--mat-sys-primary);border:none;cursor:pointer;transition:all .2s ease}.error-dialog-container .btn-ok:hover{background:var(--mat-sys-inverse-primary);opacity:.9;box-shadow:0 5px 15px #0000001a}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] });
330
- }
331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorAlert, decorators: [{
332
- type: Component,
333
- args: [{ selector: 'ntybase-error-alert', imports: [MatDialogModule, MatIconModule, CommonModule, TranslateModule], template: "<div class=\"error-dialog-container\">\n <div class=\"header\">\n <mat-icon color=\"error\">error_outline</mat-icon>\n <h2 class=\"error-title\">{{ data.title }}</h2>\n </div>\n\n <div class=\"error-content\">\n <p>{{ data.message }}</p>\n </div>\n\n <mat-dialog-actions class=\"dialog-actions\">\n <button mat-flat-button [mat-dialog-close]=\"true\" class=\"btn-ok\">\n {{'@btnOK' | translate}}\n </button>\n </mat-dialog-actions>\n</div>\n", styles: [".error-dialog-container{padding:40px 32px;text-align:center;min-width:380px;max-width:450px;background:var(--mat-sys-primary);border-radius:20px;box-shadow:0 15px 35px #00000012}.error-dialog-container .header{display:flex;flex-direction:column;align-items:center;gap:12px}.error-dialog-container .header mat-icon{font-size:52px;width:52px;height:52px;color:var(--mat-sys-inverse-primary);margin-bottom:8px}.error-dialog-container .header .error-title{margin:0;font-size:1.4rem;font-weight:700;color:var(--mat-sys-surface);letter-spacing:-.02em}.error-dialog-container .error-content{margin:24px 0 32px;font-size:1rem;line-height:1.6;color:var(--mat-sys-surface)}.error-dialog-container .dialog-actions{display:flex;justify-content:center;padding:0;margin:0}.error-dialog-container .btn-ok{min-width:120px;padding:12px 24px;font-weight:600;font-size:1rem;border-radius:10px;background:var(--mat-sys-inverse-primary);color:var(--mat-sys-primary);border:none;cursor:pointer;transition:all .2s ease}.error-dialog-container .btn-ok:hover{background:var(--mat-sys-inverse-primary);opacity:.9;box-shadow:0 5px 15px #0000001a}\n"] }]
334
- }] });
335
-
336
- // alert.service.ts
337
- class AlertService {
338
- snackBar;
339
- dialog;
340
- translate;
341
- constructor(snackBar, dialog, translate) {
342
- this.snackBar = snackBar;
343
- this.dialog = dialog;
344
- this.translate = translate;
345
- }
346
- // For simple notifications
347
- showAlert(message, action, duration = 3000) {
348
- const actionText = action ? action : '@btnOK';
349
- this.snackBar.open(this.translate.instant(message), this.translate.instant(actionText), { duration });
350
- }
351
- showWarning(message, action, duration = 3000) {
352
- const actionText = action ? action : '@btnOK';
353
- this.snackBar.open(this.translate.instant(message), this.translate.instant(actionText), { duration });
354
- }
355
- // For confirmation dialogs
356
- showConfirm(message) {
357
- return new Promise((resolve) => {
358
- const dialogRef = this.dialog.open(ConfirmDialog, {
359
- width: 'auto',
360
- height: 'auto',
361
- data: {
362
- message: message,
363
- title: '@confirmation',
364
- },
365
- });
366
- dialogRef.afterClosed().subscribe((result) => {
367
- resolve(!!result);
368
- });
369
- });
370
- }
371
- // For success notifications
372
- showSuccess(message, duration = 3000) {
373
- this.snackBar.open(this.translate.instant(message), this.translate.instant('@btnOK'), {
374
- duration,
375
- panelClass: ['success-snackbar'],
376
- horizontalPosition: 'right',
377
- verticalPosition: 'bottom',
378
- });
379
- }
380
- /**
381
- * Displays an error dialog with flexible parameters.
382
- * Intelligently extracts meaningful C# error messages or falls back to a translation key.
383
- * * Supported usages:
384
- * - showError('@fallbackKey', err)
385
- * - showError(err)
386
- * - showError(err, '@fallbackKey')
387
- * - showError('@fallbackKey')
388
- */
389
- showError(arg1, arg2, customComponent = ErrorAlert, width = 'auto', height = 'auto') {
390
- const isArg1Str = typeof arg1 === 'string';
391
- const fallbackKey = isArg1Str ? arg1 : (typeof arg2 === 'string' ? arg2 : '');
392
- const errorObj = isArg1Str ? arg2 : arg1;
393
- // Open the Dialog
394
- return new Promise((resolve) => {
395
- this.dialog.open(customComponent, {
396
- width, height, maxWidth: '95vw',
397
- data: {
398
- message: this.getErrorMessage(errorObj, fallbackKey),
399
- title: this.translate.instant('@errorOccurred'),
400
- },
401
- }).afterClosed().subscribe(() => resolve());
402
- });
403
- }
404
- getErrorMessage(errorObj, fallbackKey) {
405
- if (!errorObj) {
406
- return fallbackKey ? this.translate.instant(fallbackKey) : this.translate.instant('@errorOccurred');
407
- }
408
- const data = errorObj.error ?? errorObj;
409
- const isStr = typeof data === 'string';
410
- const backendMessage = isStr ? data : (data?.message || data?.details || JSON.stringify(data));
411
- const isMeaningful = isStr ? !data.startsWith('<') : !!(data?.message || data?.details);
412
- if (fallbackKey) {
413
- return isMeaningful ? backendMessage : this.translate.instant(fallbackKey);
414
- }
415
- return backendMessage;
416
- }
417
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AlertService, deps: [{ token: i1$2.MatSnackBar }, { token: i1.MatDialog }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
418
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AlertService, providedIn: 'root' });
419
- }
420
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AlertService, decorators: [{
421
- type: Injectable,
422
- args: [{
423
- providedIn: 'root',
424
- }]
425
- }], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: i1.MatDialog }, { type: i1$1.TranslateService }] });
426
-
427
- class PageTitle {
428
- title = signal('', ...(ngDevMode ? [{ debugName: "title" }] : []));
429
- setTitle(newTitle) {
430
- this.title.set(newTitle);
431
- }
432
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
433
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, providedIn: 'root' });
434
- }
435
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, decorators: [{
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, decorators: [{
436
161
  type: Injectable,
437
162
  args: [{
438
163
  providedIn: 'root',
@@ -546,55 +271,456 @@ class NettyAppsBase {
546
271
  if (fileData == null) {
547
272
  return;
548
273
  }
549
- if (fileName == null) {
550
- return;
274
+ if (fileName == null) {
275
+ return;
276
+ }
277
+ // Create a Blob from the Text
278
+ const blob = new Blob([fileData], { type: 'text/plain' });
279
+ // Create a download link
280
+ const url = window.URL.createObjectURL(blob);
281
+ const a = document.createElement('a');
282
+ document.body.appendChild(a);
283
+ a.style.display = 'none';
284
+ a.href = url;
285
+ a.download = fileName ?? 'filename';
286
+ // Trigger the download
287
+ a.click();
288
+ // Clean up
289
+ window.URL.revokeObjectURL(url);
290
+ document.body.removeChild(a);
291
+ }
292
+ /**
293
+ * Download file where the data is provided as blob
294
+ * @param data - Array Buffer data
295
+ * @param type - type of the document.
296
+ */
297
+ downloadBlobFile(data, type, fileName) {
298
+ let blob = new Blob([data], { type: type });
299
+ let downloadLink = document.createElement('a');
300
+ downloadLink.href = window.URL.createObjectURL(blob);
301
+ downloadLink.setAttribute('download', fileName);
302
+ document.body.appendChild(downloadLink);
303
+ downloadLink.click();
304
+ downloadLink.parentNode?.removeChild(downloadLink);
305
+ }
306
+ // ---------------------------------
307
+ // --- INTERFACE IMPLEMENTATIONS ---
308
+ // ---------------------------------
309
+ onDestroy$ = new Subject();
310
+ ngOnDestroy() {
311
+ //Called once, before the instance is destroyed.
312
+ //Add 'implements OnDestroy' to the class.
313
+ this.onDestroy$.next();
314
+ this.onDestroy$.complete();
315
+ }
316
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
317
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: NettyAppsBase, isStandalone: true, selector: "ntybase-netty-apps-base", inputs: { embedded: { classPropertyName: "embedded", publicName: "embedded", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true });
318
+ }
319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsBase, decorators: [{
320
+ type: Component,
321
+ args: [{ selector: 'ntybase-netty-apps-base', imports: [], template: `` }]
322
+ }], ctorParameters: () => [], propDecorators: { embedded: [{ type: i0.Input, args: [{ isSignal: true, alias: "embedded", required: false }] }] } });
323
+
324
+ class NettyAppsFilterBase extends NettyAppsBase {
325
+ // *********************************************************
326
+ // *** Input / Output ***
327
+ // *********************************************************
328
+ isFilterExpanded = model(true, ...(ngDevMode ? [{ debugName: "isFilterExpanded" }] : []));
329
+ filteredRecords = output();
330
+ filterSelectionChanged = output();
331
+ refresh = input(0, ...(ngDevMode ? [{ debugName: "refresh" }] : []));
332
+ fileName = input('nettyapps_', ...(ngDevMode ? [{ debugName: "fileName" }] : []));
333
+ // *********************************************************
334
+ // *** Service ***
335
+ // *********************************************************
336
+ filterProxy = injectNettyStandardFilterProxy(this.componentName());
337
+ // *********************************************************
338
+ // *** Signals ***
339
+ // *********************************************************
340
+ currentItem = signal(this.createNewFilter(), ...(ngDevMode ? [{ debugName: "currentItem" }] : []));
341
+ // *********************************************************
342
+ // *** Constructor ***
343
+ // *********************************************************
344
+ constructor() {
345
+ super();
346
+ effect(() => {
347
+ if (this.refresh() > 0) {
348
+ this.onApply();
349
+ }
350
+ });
351
+ }
352
+ // *********************************************************
353
+ // *** Functions ***
354
+ // *********************************************************
355
+ async ngOnInit() {
356
+ this.afterOnInit();
357
+ }
358
+ onApply() {
359
+ this.filterSelectionChanged.emit(this.currentItem());
360
+ this.filterProxy.selectFilter(this.currentItem()).subscribe({
361
+ next: (result) => {
362
+ this.filteredRecords.emit(result);
363
+ this.isFilterExpanded.set(false);
364
+ },
365
+ error: (err) => this.alertService.showError('@dataLoadFailed', err),
366
+ });
367
+ }
368
+ onReset() {
369
+ this.filterProxy.initFilter().subscribe({
370
+ next: (filter) => {
371
+ this.currentItem.set(filter);
372
+ this.filterSelectionChanged.emit(this.currentItem());
373
+ },
374
+ error: (err) => this.alertService.showError('@dataLoadFailed', err),
375
+ });
376
+ }
377
+ onExport() {
378
+ this.filterSelectionChanged.emit(this.currentItem());
379
+ this.filterProxy.downloadXLS(this.currentItem()).subscribe({
380
+ next: (response) => {
381
+ this.downloadBlobFile(response, 'application/zip', this.translateService.instant('@00000072') + '.zip');
382
+ },
383
+ error: (err) => this.alertService.showError('@dataLoadFailed', err),
384
+ });
385
+ }
386
+ async afterOnInit() { }
387
+ // *****************************************
388
+ // *** Logging Functions ***
389
+ // *****************************************
390
+ logInputs(message) {
391
+ if (!message || message.length < 1) {
392
+ message = 'NettyAppsFilterBase - Inputs log';
393
+ }
394
+ const inputs = {
395
+ "isFilterExpanded": this.isFilterExpanded(),
396
+ "refresh": this.refresh(),
397
+ "fileName": this.fileName(),
398
+ };
399
+ console.log(message, inputs);
400
+ }
401
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsFilterBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
402
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: NettyAppsFilterBase, isStandalone: true, selector: "ntybase-netty-apps-base", inputs: { isFilterExpanded: { classPropertyName: "isFilterExpanded", publicName: "isFilterExpanded", isSignal: true, isRequired: false, transformFunction: null }, refresh: { classPropertyName: "refresh", publicName: "refresh", isSignal: true, isRequired: false, transformFunction: null }, fileName: { classPropertyName: "fileName", publicName: "fileName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isFilterExpanded: "isFilterExpandedChange", filteredRecords: "filteredRecords", filterSelectionChanged: "filterSelectionChanged" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
403
+ }
404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsFilterBase, decorators: [{
405
+ type: Component,
406
+ args: [{ selector: 'ntybase-netty-apps-base', imports: [], template: `` }]
407
+ }], ctorParameters: () => [], propDecorators: { isFilterExpanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "isFilterExpanded", required: false }] }, { type: i0.Output, args: ["isFilterExpandedChange"] }], filteredRecords: [{ type: i0.Output, args: ["filteredRecords"] }], filterSelectionChanged: [{ type: i0.Output, args: ["filterSelectionChanged"] }], refresh: [{ type: i0.Input, args: [{ isSignal: true, alias: "refresh", required: false }] }], fileName: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileName", required: false }] }] } });
408
+
409
+ class NettyBaseApp {
410
+ i18nService = inject(I18nService);
411
+ alertService = inject(AlertService);
412
+ async loadBaseTranslations() {
413
+ try {
414
+ const enUSBase = await import('./nettyapps-ntybase-en-USbase-Bl-neyoj.mjs');
415
+ const trTRBase = await import('./nettyapps-ntybase-tr-TRbase-CO4HBOmj.mjs');
416
+ this.i18nService.addTranslations('English', enUSBase.default);
417
+ this.i18nService.addTranslations('Türkçe', trTRBase.default);
418
+ }
419
+ catch (error) {
420
+ this.alertService.showError('Error loading base translations in component:', error);
421
+ throw error;
422
+ }
423
+ }
424
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyBaseApp, deps: [], target: i0.ɵɵFactoryTarget.Component });
425
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: NettyBaseApp, isStandalone: true, selector: "ntybase-netty-base-app", ngImport: i0, template: "", styles: [""] });
426
+ }
427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyBaseApp, decorators: [{
428
+ type: Component,
429
+ args: [{ selector: 'ntybase-netty-base-app', imports: [], template: "" }]
430
+ }] });
431
+
432
+ class ParseLog {
433
+ rowIndex = 0; // Excel line no (1-based)
434
+ message = ""; // Error or info message (fallback)
435
+ level = "INFO";
436
+ messageKey; // i18n translation key
437
+ messageParams; // parameters for translation
438
+ init() {
439
+ this.rowIndex = 0;
440
+ this.message = "";
441
+ this.level = "INFO";
442
+ this.messageKey = undefined;
443
+ this.messageParams = undefined;
444
+ }
445
+ compare(other) { return this; }
446
+ getPK() { return this.rowIndex; }
447
+ setPK(pk) { this.rowIndex = pk; }
448
+ }
449
+
450
+ class ExcelParserError extends Error {
451
+ key;
452
+ params;
453
+ constructor(key, params) {
454
+ super(key);
455
+ this.key = key;
456
+ this.params = params;
457
+ this.name = 'ExcelParserError';
458
+ }
459
+ }
460
+ class ExcelParser {
461
+ mappings;
462
+ constructor(mappings) {
463
+ this.mappings = mappings;
464
+ }
465
+ async parse(file, options) {
466
+ // PERFORMANS: XLSX library only loads at parse time!
467
+ const XLSX = await import('xlsx');
468
+ const sheetIndex = options?.sheetIndex ?? 0;
469
+ const headerRowIndex = options?.headerRowIndex ?? 0; // 0-based
470
+ return new Promise((resolve, reject) => {
471
+ const reader = new FileReader();
472
+ reader.onload = (e) => {
473
+ try {
474
+ const data = new Uint8Array(e.target?.result);
475
+ const workbook = XLSX.read(data, { type: 'array' });
476
+ if (!workbook.SheetNames[sheetIndex]) {
477
+ throw new ExcelParserError('@EXCEL_PARSER.sheetNotFound', { index: sheetIndex });
478
+ }
479
+ const sheetName = workbook.SheetNames[sheetIndex];
480
+ const sheet = workbook.Sheets[sheetName];
481
+ const rows = XLSX.utils.sheet_to_json(sheet, { header: 1 });
482
+ const logs = [];
483
+ const result = [];
484
+ // Skip headerline
485
+ const dataRows = rows.slice(headerRowIndex + 1);
486
+ dataRows.forEach((row, i) => {
487
+ // Skip empty lines
488
+ if (!row || row.length === 0)
489
+ return;
490
+ const obj = {};
491
+ let hasError = false;
492
+ const actualRowIndex = headerRowIndex + i + 2; // Excel line no (1-based)
493
+ this.mappings.forEach(m => {
494
+ let rawValue = row[m.index];
495
+ if ((rawValue === undefined || rawValue === null || rawValue === '') && m.defaultValue !== undefined) {
496
+ rawValue = m.defaultValue;
497
+ logs.push(Object.assign(new ParseLog(), {
498
+ rowIndex: actualRowIndex,
499
+ message: `Boş alan için default değer atandı: ${String(m.prop)}`,
500
+ level: 'INFO',
501
+ messageKey: '@EXCEL_PARSER.defaultValueSet',
502
+ messageParams: { prop: String(m.prop) }
503
+ }));
504
+ }
505
+ if (m.required && (rawValue === undefined || rawValue === null || rawValue === '')) {
506
+ logs.push(Object.assign(new ParseLog(), {
507
+ rowIndex: actualRowIndex,
508
+ message: `Zorunlu alan boş: ${String(m.prop)}`,
509
+ level: 'ERROR',
510
+ messageKey: '@EXCEL_PARSER.requiredFieldMissing',
511
+ messageParams: { prop: String(m.prop) }
512
+ }));
513
+ hasError = true;
514
+ }
515
+ try {
516
+ obj[m.prop] = m.converter ? m.converter(rawValue) : rawValue;
517
+ }
518
+ catch (err) {
519
+ logs.push(Object.assign(new ParseLog(), {
520
+ rowIndex: actualRowIndex,
521
+ message: `Tip dönüşüm hatası: ${String(m.prop)} -> ${rawValue}`,
522
+ level: 'ERROR',
523
+ messageKey: '@EXCEL_PARSER.conversionError',
524
+ messageParams: { prop: String(m.prop), value: rawValue }
525
+ }));
526
+ hasError = true;
527
+ }
528
+ });
529
+ if (!hasError) {
530
+ result.push(obj);
531
+ }
532
+ else {
533
+ logs.push(Object.assign(new ParseLog(), {
534
+ rowIndex: actualRowIndex,
535
+ message: `Satır atlandı`,
536
+ level: 'WARN',
537
+ messageKey: '@EXCEL_PARSER.rowSkipped'
538
+ }));
539
+ }
540
+ });
541
+ resolve({ data: result, logs });
542
+ }
543
+ catch (error) {
544
+ reject(error);
545
+ }
546
+ };
547
+ reader.onerror = () => reject(reader.error);
548
+ reader.readAsArrayBuffer(file);
549
+ });
550
+ }
551
+ async generateSampleExcel(options) {
552
+ const sampleCount = options?.sampleCount ?? 5;
553
+ const fileName = (options?.fileName ?? 'sample-import.xlsx').endsWith('.xlsx')
554
+ ? (options?.fileName ?? 'sample-import.xlsx')
555
+ : `${options?.fileName}.xlsx`;
556
+ const sheetName = (options?.sheetName ?? 'Sample').substring(0, 15);
557
+ const XLSX = await import('xlsx');
558
+ // Header row: property names according to column order
559
+ const headers = this.mappings.map(m => m.headerName || String(m.prop));
560
+ const rows = [];
561
+ for (let i = 1; i <= sampleCount; i++) {
562
+ const row = this.mappings.map(m => {
563
+ if (m.sampleValue !== undefined) {
564
+ // Use sampleValue if it exists
565
+ return typeof m.sampleValue === 'function'
566
+ ? m.sampleValue(i) // if it's a function, generate value based on index
567
+ : m.sampleValue; // if it's a constant value, use it directly
568
+ }
569
+ });
570
+ rows.push(row);
571
+ }
572
+ const worksheet = XLSX.utils.aoa_to_sheet([headers, ...rows]);
573
+ const workbook = XLSX.utils.book_new();
574
+ XLSX.utils.book_append_sheet(workbook, worksheet, sheetName);
575
+ XLSX.writeFile(workbook, fileName);
576
+ }
577
+ }
578
+
579
+ class ButtonRenderer {
580
+ params = null;
581
+ label = '';
582
+ type = '';
583
+ toggleValue = null;
584
+ editValid = false;
585
+ historyValid = false;
586
+ lineValid = false;
587
+ popupSelectValid = false;
588
+ popupEditValid = false;
589
+ toggleValid = false;
590
+ toggle_icon = '';
591
+ none = false;
592
+ addValid = false;
593
+ deleteValid = false;
594
+ agInit(params) {
595
+ this.params = params;
596
+ this.type = this.params.type || null;
597
+ this.label = this.params.label || null;
598
+ this.toggleValue = this.params.value || null;
599
+ switch (this.toggleValue) {
600
+ case true:
601
+ this.toggle_icon = 'select_check_box';
602
+ break;
603
+ case false:
604
+ this.toggle_icon = 'check_box_outline_blank';
605
+ break;
606
+ default:
607
+ this.toggle_icon = '';
608
+ break;
609
+ }
610
+ this.resetValids();
611
+ switch (this.type.toLowerCase().trim()) {
612
+ case 'edit':
613
+ this.editValid = true;
614
+ break;
615
+ case 'log':
616
+ this.historyValid = true;
617
+ break;
618
+ case 'line':
619
+ this.lineValid = true;
620
+ break;
621
+ case 'popupselect':
622
+ this.popupSelectValid = true;
623
+ break;
624
+ case 'toggle':
625
+ this.toggleValid = true;
626
+ break;
627
+ case 'none':
628
+ this.none = true;
629
+ break;
630
+ case 'add':
631
+ this.addValid = true;
632
+ break;
633
+ case 'delete':
634
+ this.deleteValid = true;
635
+ break;
636
+ default:
637
+ this.popupEditValid = true;
638
+ break;
639
+ }
640
+ }
641
+ /** Refresh the display
642
+ *
643
+ * @param params
644
+ * @returns
645
+ */
646
+ refresh(params) {
647
+ return false;
648
+ }
649
+ resetValids() {
650
+ this.editValid = false;
651
+ this.historyValid = false;
652
+ this.lineValid = false;
653
+ this.popupSelectValid = false;
654
+ this.popupEditValid = false;
655
+ this.toggleValid = false;
656
+ }
657
+ onClick(event) {
658
+ if (this.params.onClick instanceof Function) {
659
+ // put anything into params u want pass into parents component
660
+ const params = {
661
+ event: event,
662
+ rowData: this.params.node.data,
663
+ type: this.type,
664
+ // ...something
665
+ };
666
+ this.params.onClick(params);
667
+ }
668
+ }
669
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ButtonRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
670
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: ButtonRenderer, isStandalone: true, selector: "ntybase-button-renderer", host: { attributes: { "ntybase-id": "ButtonRenderer" } }, ngImport: i0, template: "@if (editValid || popupEditValid) {\n<mat-icon\n class=\"cursor center edit\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"4000\"\n >edit</mat-icon\n>\n} @if (historyValid) {\n<mat-icon\n class=\"cursor center-log\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >log</mat-icon\n>\n} @if (historyValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >history</mat-icon\n>\n} @if (lineValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n} @if (popupSelectValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >content_copy</mat-icon\n>\n} @if (toggleValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >{{toggleValue ? 'check_box' : 'check_box_outline_blank'}}</mat-icon\n>\n} @if (none) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n} @if (addValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >playlist_add</mat-icon\n>\n} @if (deleteValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >delete_outline</mat-icon\n>\n}\n", styles: [".cursor{cursor:pointer}.center{display:flex;justify-content:center;align-items:center;width:100%}.center-log{display:flex;justify-content:center;align-items:center;margin-bottom:-12px}.edit{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatMenuModule }] });
671
+ }
672
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ButtonRenderer, decorators: [{
673
+ type: Component,
674
+ args: [{ selector: 'ntybase-button-renderer', imports: [MatIconModule, MatTooltipModule, MatMenuModule], host: { 'ntybase-id': 'ButtonRenderer' }, template: "@if (editValid || popupEditValid) {\n<mat-icon\n class=\"cursor center edit\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"4000\"\n >edit</mat-icon\n>\n} @if (historyValid) {\n<mat-icon\n class=\"cursor center-log\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >log</mat-icon\n>\n} @if (historyValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >history</mat-icon\n>\n} @if (lineValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n} @if (popupSelectValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >content_copy</mat-icon\n>\n} @if (toggleValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >{{toggleValue ? 'check_box' : 'check_box_outline_blank'}}</mat-icon\n>\n} @if (none) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n} @if (addValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >playlist_add</mat-icon\n>\n} @if (deleteValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >delete_outline</mat-icon\n>\n}\n", styles: [".cursor{cursor:pointer}.center{display:flex;justify-content:center;align-items:center;width:100%}.center-log{display:flex;justify-content:center;align-items:center;margin-bottom:-12px}.edit{margin-top:8px}\n"] }]
675
+ }] });
676
+
677
+ class CheckboxRenderer {
678
+ params = null;
679
+ label = '';
680
+ type = '';
681
+ supportClick = false;
682
+ checked = null;
683
+ agInit(params) {
684
+ this.onProcess(params);
685
+ }
686
+ refresh(params) {
687
+ if (params != null) {
688
+ this.onProcess(params);
551
689
  }
552
- // Create a Blob from the Text
553
- const blob = new Blob([fileData], { type: 'text/plain' });
554
- // Create a download link
555
- const url = window.URL.createObjectURL(blob);
556
- const a = document.createElement('a');
557
- document.body.appendChild(a);
558
- a.style.display = 'none';
559
- a.href = url;
560
- a.download = fileName ?? 'filename';
561
- // Trigger the download
562
- a.click();
563
- // Clean up
564
- window.URL.revokeObjectURL(url);
565
- document.body.removeChild(a);
690
+ return true;
566
691
  }
567
- /**
568
- * Download file where the data is provided as blob
569
- * @param data - Array Buffer data
570
- * @param type - type of the document.
571
- */
572
- downloadBlobFile(data, type, fileName) {
573
- let blob = new Blob([data], { type: type });
574
- let downloadLink = document.createElement('a');
575
- downloadLink.href = window.URL.createObjectURL(blob);
576
- downloadLink.setAttribute('download', fileName);
577
- document.body.appendChild(downloadLink);
578
- downloadLink.click();
579
- downloadLink.parentNode?.removeChild(downloadLink);
692
+ onProcess(params) {
693
+ this.params = params;
694
+ this.checked = this.params.value ?? false;
695
+ this.type = this.params.type || null;
696
+ this.label = this.params.label || null;
697
+ if (this.type != null) {
698
+ if (this.type.toLowerCase().trim() == 'click') {
699
+ this.supportClick = true;
700
+ }
701
+ }
580
702
  }
581
- // ---------------------------------
582
- // --- INTERFACE IMPLEMENTATIONS ---
583
- // ---------------------------------
584
- onDestroy$ = new Subject();
585
- ngOnDestroy() {
586
- //Called once, before the instance is destroyed.
587
- //Add 'implements OnDestroy' to the class.
588
- this.onDestroy$.next();
589
- this.onDestroy$.complete();
703
+ onClick(event) {
704
+ this.checked = !this.checked;
705
+ if (this.params.onClick instanceof Function) {
706
+ // put anything into params u want pass into parents component
707
+ const params = {
708
+ event: event,
709
+ rowData: this.params.node.data,
710
+ type: this.type,
711
+ checked: this.checked,
712
+ // ...something
713
+ };
714
+ this.params.onClick(params);
715
+ }
590
716
  }
591
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
592
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: NettyAppsBase, isStandalone: true, selector: "ntybase-netty-apps-base", inputs: { embedded: { classPropertyName: "embedded", publicName: "embedded", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true });
717
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CheckboxRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
718
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: CheckboxRenderer, isStandalone: true, selector: "ntybase-checkbox-renderer", host: { attributes: { "ntybase-id": "CheckboxRenderer" } }, ngImport: i0, template: "@if (supportClick) {\n<input\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n} @if (!supportClick) {\n<input id=\"checkbox\" type=\"checkbox\" [checked]=\"params.value\" disabled />\n}\n\n<label for=\"checkbox\">{{label}}</label>\n", styles: [""] });
593
719
  }
594
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsBase, decorators: [{
720
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CheckboxRenderer, decorators: [{
595
721
  type: Component,
596
- args: [{ selector: 'ntybase-netty-apps-base', imports: [], template: `` }]
597
- }], ctorParameters: () => [], propDecorators: { embedded: [{ type: i0.Input, args: [{ isSignal: true, alias: "embedded", required: false }] }] } });
722
+ args: [{ selector: 'ntybase-checkbox-renderer', imports: [], host: { 'ntybase-id': 'CheckboxRenderer' }, template: "@if (supportClick) {\n<input\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n} @if (!supportClick) {\n<input id=\"checkbox\" type=\"checkbox\" [checked]=\"params.value\" disabled />\n}\n\n<label for=\"checkbox\">{{label}}</label>\n" }]
723
+ }] });
598
724
 
599
725
  class NettyHelper {
600
726
  /**
@@ -1280,12 +1406,12 @@ class SysfunctionProxy {
1280
1406
  securityDto.formCode = formCode;
1281
1407
  securityDto.application = this.environmentProxy.getApplicationName();
1282
1408
  let call$ = this.http.post(sysFunctionsURL, securityDto);
1283
- return call$.pipe(map((result) => result), catchError$1((error) => {
1409
+ return call$.pipe(map((result) => result), catchError((error) => {
1284
1410
  let errorMessage = error.message; //.error.title;
1285
1411
  return throwError(() => new Error(errorMessage ?? ''));
1286
1412
  }));
1287
1413
  }
1288
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SysfunctionProxy, deps: [{ token: i1$3.HttpClient }, { token: i2$1.EnvironmentProxy }], target: i0.ɵɵFactoryTarget.Injectable });
1414
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SysfunctionProxy, deps: [{ token: i1$3.HttpClient }, { token: i2$2.EnvironmentProxy }], target: i0.ɵɵFactoryTarget.Injectable });
1289
1415
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SysfunctionProxy, providedIn: 'root' });
1290
1416
  }
1291
1417
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SysfunctionProxy, decorators: [{
@@ -1293,7 +1419,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
1293
1419
  args: [{
1294
1420
  providedIn: 'root',
1295
1421
  }]
1296
- }], ctorParameters: () => [{ type: i1$3.HttpClient }, { type: i2$1.EnvironmentProxy }] });
1422
+ }], ctorParameters: () => [{ type: i1$3.HttpClient }, { type: i2$2.EnvironmentProxy }] });
1297
1423
 
1298
1424
  class NettyAgGridBase extends NettyAppsBase {
1299
1425
  FILTER_MODE_KEY = 'nettyapps_filter_mode';
@@ -1775,169 +1901,23 @@ class NettyAgGridBase extends NettyAppsBase {
1775
1901
  }
1776
1902
  const inputs = {
1777
1903
  "authenticationList": this.authenticationList,
1778
- "accessRightsProcessed": this.accessRightsProcessed(),
1779
- "readOnly": this.readOnly(),
1780
- "allowAdd": this.allowAdd(),
1781
- "allowEdit": this.allowEdit(),
1782
- "allowDelete": this.allowDelete(),
1783
- "allowLog": this.allowLog(),
1784
- "allowRead": this.allowRead(),
1785
- };
1786
- console.log(message, inputs);
1787
- }
1788
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1789
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: NettyAgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", 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 }, agGridSelectionMode: { classPropertyName: "agGridSelectionMode", publicName: "agGridSelectionMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onElementSelect: "onElementSelect", selectedElement: "selectedElement" }, host: { attributes: { "ntybase-id": "NettyAgGridBase" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
1790
- }
1791
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, decorators: [{
1792
- type: Component,
1793
- args: [{ selector: 'ntybase-ag-grid-base', imports: [], template: ``, host: { 'ntybase-id': 'NettyAgGridBase' } }]
1794
- }], ctorParameters: () => [], propDecorators: { popupFilterValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupFilterValid", required: false }] }], popupValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupValid", required: false }] }], componantParameterGUID: [{ type: i0.Input, args: [{ isSignal: true, alias: "componantParameterGUID", required: false }] }], componantParameterType: [{ type: i0.Input, args: [{ isSignal: true, alias: "componantParameterType", required: false }] }], onElementSelect: [{ type: i0.Output, args: ["onElementSelect"] }], selectedElement: [{ type: i0.Output, args: ["selectedElement"] }], agGridSelectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "agGridSelectionMode", required: false }] }] } });
1795
-
1796
- class ButtonRenderer {
1797
- params = null;
1798
- label = '';
1799
- type = '';
1800
- toggleValue = null;
1801
- editValid = false;
1802
- historyValid = false;
1803
- lineValid = false;
1804
- popupSelectValid = false;
1805
- popupEditValid = false;
1806
- toggleValid = false;
1807
- toggle_icon = '';
1808
- none = false;
1809
- addValid = false;
1810
- deleteValid = false;
1811
- agInit(params) {
1812
- this.params = params;
1813
- this.type = this.params.type || null;
1814
- this.label = this.params.label || null;
1815
- this.toggleValue = this.params.value || null;
1816
- switch (this.toggleValue) {
1817
- case true:
1818
- this.toggle_icon = 'select_check_box';
1819
- break;
1820
- case false:
1821
- this.toggle_icon = 'check_box_outline_blank';
1822
- break;
1823
- default:
1824
- this.toggle_icon = '';
1825
- break;
1826
- }
1827
- this.resetValids();
1828
- switch (this.type.toLowerCase().trim()) {
1829
- case 'edit':
1830
- this.editValid = true;
1831
- break;
1832
- case 'log':
1833
- this.historyValid = true;
1834
- break;
1835
- case 'line':
1836
- this.lineValid = true;
1837
- break;
1838
- case 'popupselect':
1839
- this.popupSelectValid = true;
1840
- break;
1841
- case 'toggle':
1842
- this.toggleValid = true;
1843
- break;
1844
- case 'none':
1845
- this.none = true;
1846
- break;
1847
- case 'add':
1848
- this.addValid = true;
1849
- break;
1850
- case 'delete':
1851
- this.deleteValid = true;
1852
- break;
1853
- default:
1854
- this.popupEditValid = true;
1855
- break;
1856
- }
1857
- }
1858
- /** Refresh the display
1859
- *
1860
- * @param params
1861
- * @returns
1862
- */
1863
- refresh(params) {
1864
- return false;
1865
- }
1866
- resetValids() {
1867
- this.editValid = false;
1868
- this.historyValid = false;
1869
- this.lineValid = false;
1870
- this.popupSelectValid = false;
1871
- this.popupEditValid = false;
1872
- this.toggleValid = false;
1873
- }
1874
- onClick(event) {
1875
- if (this.params.onClick instanceof Function) {
1876
- // put anything into params u want pass into parents component
1877
- const params = {
1878
- event: event,
1879
- rowData: this.params.node.data,
1880
- type: this.type,
1881
- // ...something
1882
- };
1883
- this.params.onClick(params);
1884
- }
1885
- }
1886
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ButtonRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
1887
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: ButtonRenderer, isStandalone: true, selector: "ntybase-button-renderer", host: { attributes: { "ntybase-id": "ButtonRenderer" } }, ngImport: i0, template: "@if (editValid || popupEditValid) {\n<mat-icon\n class=\"cursor center edit\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"4000\"\n >edit</mat-icon\n>\n} @if (historyValid) {\n<mat-icon\n class=\"cursor center-log\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >log</mat-icon\n>\n} @if (historyValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >history</mat-icon\n>\n} @if (lineValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n} @if (popupSelectValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >content_copy</mat-icon\n>\n} @if (toggleValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >{{toggleValue ? 'check_box' : 'check_box_outline_blank'}}</mat-icon\n>\n} @if (none) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n} @if (addValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >playlist_add</mat-icon\n>\n} @if (deleteValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >delete_outline</mat-icon\n>\n}\n", styles: [".cursor{cursor:pointer}.center{display:flex;justify-content:center;align-items:center;width:100%}.center-log{display:flex;justify-content:center;align-items:center;margin-bottom:-12px}.edit{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2$2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatMenuModule }] });
1888
- }
1889
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ButtonRenderer, decorators: [{
1890
- type: Component,
1891
- args: [{ selector: 'ntybase-button-renderer', imports: [MatIconModule, MatTooltipModule, MatMenuModule], host: { 'ntybase-id': 'ButtonRenderer' }, template: "@if (editValid || popupEditValid) {\n<mat-icon\n class=\"cursor center edit\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"4000\"\n >edit</mat-icon\n>\n} @if (historyValid) {\n<mat-icon\n class=\"cursor center-log\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >log</mat-icon\n>\n} @if (historyValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >history</mat-icon\n>\n} @if (lineValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n} @if (popupSelectValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >content_copy</mat-icon\n>\n} @if (toggleValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >{{toggleValue ? 'check_box' : 'check_box_outline_blank'}}</mat-icon\n>\n} @if (none) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n} @if (addValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >playlist_add</mat-icon\n>\n} @if (deleteValid) {\n<mat-icon\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >delete_outline</mat-icon\n>\n}\n", styles: [".cursor{cursor:pointer}.center{display:flex;justify-content:center;align-items:center;width:100%}.center-log{display:flex;justify-content:center;align-items:center;margin-bottom:-12px}.edit{margin-top:8px}\n"] }]
1892
- }] });
1893
-
1894
- class CheckboxRenderer {
1895
- params = null;
1896
- label = '';
1897
- type = '';
1898
- supportClick = false;
1899
- checked = null;
1900
- agInit(params) {
1901
- this.onProcess(params);
1902
- }
1903
- refresh(params) {
1904
- if (params != null) {
1905
- this.onProcess(params);
1906
- }
1907
- return true;
1908
- }
1909
- onProcess(params) {
1910
- this.params = params;
1911
- this.checked = this.params.value ?? false;
1912
- this.type = this.params.type || null;
1913
- this.label = this.params.label || null;
1914
- if (this.type != null) {
1915
- if (this.type.toLowerCase().trim() == 'click') {
1916
- this.supportClick = true;
1917
- }
1918
- }
1919
- }
1920
- onClick(event) {
1921
- this.checked = !this.checked;
1922
- if (this.params.onClick instanceof Function) {
1923
- // put anything into params u want pass into parents component
1924
- const params = {
1925
- event: event,
1926
- rowData: this.params.node.data,
1927
- type: this.type,
1928
- checked: this.checked,
1929
- // ...something
1930
- };
1931
- this.params.onClick(params);
1932
- }
1904
+ "accessRightsProcessed": this.accessRightsProcessed(),
1905
+ "readOnly": this.readOnly(),
1906
+ "allowAdd": this.allowAdd(),
1907
+ "allowEdit": this.allowEdit(),
1908
+ "allowDelete": this.allowDelete(),
1909
+ "allowLog": this.allowLog(),
1910
+ "allowRead": this.allowRead(),
1911
+ };
1912
+ console.log(message, inputs);
1933
1913
  }
1934
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CheckboxRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
1935
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: CheckboxRenderer, isStandalone: true, selector: "ntybase-checkbox-renderer", host: { attributes: { "ntybase-id": "CheckboxRenderer" } }, ngImport: i0, template: "@if (supportClick) {\n<input\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n} @if (!supportClick) {\n<input id=\"checkbox\" type=\"checkbox\" [checked]=\"params.value\" disabled />\n}\n\n<label for=\"checkbox\">{{label}}</label>\n", styles: [""] });
1914
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1915
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: NettyAgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", 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 }, agGridSelectionMode: { classPropertyName: "agGridSelectionMode", publicName: "agGridSelectionMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onElementSelect: "onElementSelect", selectedElement: "selectedElement" }, host: { attributes: { "ntybase-id": "NettyAgGridBase" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
1936
1916
  }
1937
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CheckboxRenderer, decorators: [{
1917
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, decorators: [{
1938
1918
  type: Component,
1939
- args: [{ selector: 'ntybase-checkbox-renderer', imports: [], host: { 'ntybase-id': 'CheckboxRenderer' }, template: "@if (supportClick) {\n<input\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n} @if (!supportClick) {\n<input id=\"checkbox\" type=\"checkbox\" [checked]=\"params.value\" disabled />\n}\n\n<label for=\"checkbox\">{{label}}</label>\n" }]
1940
- }] });
1919
+ args: [{ selector: 'ntybase-ag-grid-base', imports: [], template: ``, host: { 'ntybase-id': 'NettyAgGridBase' } }]
1920
+ }], ctorParameters: () => [], propDecorators: { popupFilterValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupFilterValid", required: false }] }], popupValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupValid", required: false }] }], componantParameterGUID: [{ type: i0.Input, args: [{ isSignal: true, alias: "componantParameterGUID", required: false }] }], componantParameterType: [{ type: i0.Input, args: [{ isSignal: true, alias: "componantParameterType", required: false }] }], onElementSelect: [{ type: i0.Output, args: ["onElementSelect"] }], selectedElement: [{ type: i0.Output, args: ["selectedElement"] }], agGridSelectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "agGridSelectionMode", required: false }] }] } });
1941
1921
 
1942
1922
  ModuleRegistry.registerModules([AllCommunityModule, StatusBarModule, ClientSideRowModelModule, ClipboardModule, ExcelExportModule, ColumnMenuModule,
1943
1923
  ContextMenuModule, CellSelectionModule, HighlightChangesModule, RowSelectionModule, SetFilterModule, MultiFilterModule, TextFilterModule, NumberFilterModule, DateFilterModule]);
@@ -2064,110 +2044,437 @@ class NettyAgGridListBase extends NettyAgGridBase {
2064
2044
  if (savedMode !== null) {
2065
2045
  this.openInPopup.set(JSON.parse(savedMode) === true);
2066
2046
  }
2067
- this.translateService.onLangChange.subscribe(() => {
2068
- this.setAgGridTranslations();
2047
+ this.translateService.onLangChange.subscribe(() => {
2048
+ this.setAgGridTranslations();
2049
+ });
2050
+ effect(() => {
2051
+ const update = this.commonService.updates();
2052
+ if (!update || !this.gridApi)
2053
+ return;
2054
+ if (update.type === this.getEntityType?.()) {
2055
+ switch (update.action) {
2056
+ case 'add':
2057
+ case 'update':
2058
+ this.updateRowInGrid(update.data, this.pkFieldName());
2059
+ break;
2060
+ }
2061
+ }
2062
+ });
2063
+ effect(() => { this.onElementSelect.emit(this.selectedRows()); });
2064
+ // Manage filter expanded state
2065
+ effect(() => {
2066
+ this._isEmbedded();
2067
+ this.initAgGrid();
2068
+ });
2069
+ effect(() => {
2070
+ const isEmbedded = this._isEmbedded();
2071
+ const currentPref = this.preferenceType();
2072
+ const currentSearch = this.searchValueName();
2073
+ if (isEmbedded) {
2074
+ if (currentPref && !currentPref.endsWith('_isEmbedded')) {
2075
+ this.preferenceType.set(`${currentPref}_isEmbedded`);
2076
+ }
2077
+ if (currentSearch && !currentSearch.endsWith('_isEmbedded')) {
2078
+ this.searchValueName.set(`${currentSearch}_isEmbedded`);
2079
+ }
2080
+ }
2081
+ else {
2082
+ if (currentPref?.endsWith('_isEmbedded')) {
2083
+ this.preferenceType.set(currentPref.replace('_isEmbedded', ''));
2084
+ }
2085
+ if (currentSearch?.endsWith('_isEmbedded')) {
2086
+ this.searchValueName.set(currentSearch.replace('_isEmbedded', ''));
2087
+ }
2088
+ }
2089
+ });
2090
+ }
2091
+ // *********************************************************
2092
+ // *** Data Management Functions ***
2093
+ // *********************************************************
2094
+ loadData() {
2095
+ this.nettyAppsProxy.select(this.record).subscribe({
2096
+ next: (data) => {
2097
+ this.setData(data, false);
2098
+ },
2099
+ error: (err) => this.alertService.showError('@dataLoadFailed', err),
2100
+ });
2101
+ }
2102
+ async deleteSelected() {
2103
+ if (!this.gridApi)
2104
+ return;
2105
+ const selectedNodes = this.gridApi.getSelectedNodes();
2106
+ if (selectedNodes.length === 0) {
2107
+ await this.alertService.showAlert('@pleaseSelectRowToDelete');
2108
+ return;
2109
+ }
2110
+ const confirmed = await this.alertService.showConfirm('@confirmDeleteSelectedRecords');
2111
+ if (confirmed) {
2112
+ const selectedRows = selectedNodes.map((node) => node.data);
2113
+ this.deleteRows(selectedRows);
2114
+ }
2115
+ }
2116
+ deleteRows(rows) {
2117
+ this.nettyAppsProxy.deleteList(rows).subscribe({
2118
+ next: () => {
2119
+ this.gridApi.applyTransaction({ remove: rows });
2120
+ this.alertService.showSuccess('@recordDeletedSuccessfully');
2121
+ },
2122
+ error: (err) => this.alertService.showError(err),
2123
+ });
2124
+ }
2125
+ // *****************************************
2126
+ // *** Logging Functions ***
2127
+ // *****************************************
2128
+ logInputs(message) {
2129
+ if (!message || message.length < 1) {
2130
+ message = 'AgGridListBase - Inputs log';
2131
+ }
2132
+ const inputs = {
2133
+ "popupFilterValid": this.popupFilterValid(),
2134
+ "_isPopupFilterValid": this._isPopupFilterValid(),
2135
+ "popupValid": this.popupValid(),
2136
+ "_isPopupValid": this._isPopupValid(),
2137
+ "componantParameterGUID": this.componantParameterGUID(),
2138
+ "componantParameterType": this.componantParameterType(),
2139
+ "embedded": this.embedded(),
2140
+ "_isEmbedded": this._isEmbedded(),
2141
+ };
2142
+ console.log(message, inputs);
2143
+ }
2144
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridListBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
2145
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: NettyAgGridListBase, isStandalone: true, selector: "ntybase-ag-grid-list-base", host: { attributes: { "ntybase-id": "NettyAgGridListBase" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
2146
+ }
2147
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridListBase, decorators: [{
2148
+ type: Component,
2149
+ args: [{ selector: 'ntybase-ag-grid-list-base', imports: [], template: ``, host: { 'ntybase-id': 'NettyAgGridListBase' } }]
2150
+ }], ctorParameters: () => [] });
2151
+
2152
+ class ExcelImportBase extends NettyAgGridListBase {
2153
+ isFileSelectionHidden = signal(false, ...(ngDevMode ? [{ debugName: "isFileSelectionHidden" }] : []));
2154
+ isFileValid = signal(false, ...(ngDevMode ? [{ debugName: "isFileValid" }] : []));
2155
+ logs = signal([], ...(ngDevMode ? [{ debugName: "logs" }] : []));
2156
+ hasLogs = computed(() => this.logs().length > 0, ...(ngDevMode ? [{ debugName: "hasLogs" }] : []));
2157
+ logDialog = inject(MatDialog);
2158
+ parser = new ExcelParser([]);
2159
+ // override methods
2160
+ onBtnClick(e) { }
2161
+ loadData() { }
2162
+ // Methods
2163
+ onFilesSelected(evt) {
2164
+ const files = Array.isArray(evt) ? evt : evt.target.files;
2165
+ if (!files || files.length !== 1) {
2166
+ return;
2167
+ }
2168
+ const file = files[0];
2169
+ if (file) {
2170
+ this.recordList.set([]);
2171
+ this.logs.set([]);
2172
+ this.parser.parse(file).then(result => {
2173
+ this.recordList.set(result.data);
2174
+ this.logs.set(result.logs);
2175
+ this.isFileSelectionHidden.set(true);
2176
+ if (result.logs.length > 0)
2177
+ this.showLogs();
2178
+ });
2179
+ }
2180
+ }
2181
+ downloadSampleExcel() {
2182
+ this.parser.generateSampleExcel();
2183
+ }
2184
+ showLogs() {
2185
+ const dialogRef = this.logDialog.open(ExcelLogViewer, {
2186
+ height: '70%',
2187
+ width: '90%',
2188
+ maxWidth: '100vw',
2189
+ maxHeight: '100vh'
2190
+ });
2191
+ dialogRef.componentInstance.setParseData(this.logs());
2192
+ dialogRef.componentInstance.selectedElement.subscribe((element) => {
2193
+ dialogRef.close();
2194
+ });
2195
+ }
2196
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ExcelImportBase, deps: null, target: i0.ɵɵFactoryTarget.Component });
2197
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: ExcelImportBase, isStandalone: true, selector: "ntybase-excel-import-base", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
2198
+ }
2199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ExcelImportBase, decorators: [{
2200
+ type: Component,
2201
+ args: [{ selector: 'ntybase-excel-import-base', imports: [], template: `` }]
2202
+ }] });
2203
+
2204
+ class Ntybase {
2205
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Ntybase, deps: [], target: i0.ɵɵFactoryTarget.Component });
2206
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Ntybase, isStandalone: false, selector: "lib-ntybase", ngImport: i0, template: `
2207
+ <p>
2208
+ ntybase works!
2209
+ </p>
2210
+ `, isInline: true, styles: [""] });
2211
+ }
2212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Ntybase, decorators: [{
2213
+ type: Component,
2214
+ args: [{ selector: 'lib-ntybase', standalone: false, template: `
2215
+ <p>
2216
+ ntybase works!
2217
+ </p>
2218
+ ` }]
2219
+ }] });
2220
+
2221
+ const credentialsKey = 'credentials';
2222
+ class CredentialsService {
2223
+ _credentials = null;
2224
+ constructor() {
2225
+ const savedCredentials = sessionStorage.getItem(credentialsKey) ||
2226
+ localStorage.getItem(credentialsKey);
2227
+ if (savedCredentials) {
2228
+ this._credentials = JSON.parse(savedCredentials);
2229
+ }
2230
+ }
2231
+ /**
2232
+ * Checks is the user is authenticated.
2233
+ * @return True if the user is authenticated.
2234
+ */
2235
+ isAuthenticated() {
2236
+ return !!this.credentials;
2237
+ }
2238
+ /**
2239
+ * Gets the user credentials.
2240
+ * @return The user credentials or null if the user is not authenticated.
2241
+ */
2242
+ get credentials() {
2243
+ return this._credentials;
2244
+ }
2245
+ get token() {
2246
+ return this._credentials?.token ?? null;
2247
+ }
2248
+ /**
2249
+ * Sets the user credentials.
2250
+ * The credentials may be persisted across sessions by setting the `remember` parameter to true.
2251
+ * Otherwise, the credentials are only persisted for the current session.
2252
+ * @param credentials The user credentials.
2253
+ * @param remember True to remember credentials across sessions.
2254
+ */
2255
+ setCredentials(credentials, remember) {
2256
+ this._credentials = credentials || null;
2257
+ if (credentials) {
2258
+ const storage = remember ? localStorage : sessionStorage;
2259
+ storage.setItem(credentialsKey, JSON.stringify(credentials));
2260
+ }
2261
+ else {
2262
+ sessionStorage.removeItem(credentialsKey);
2263
+ localStorage.removeItem(credentialsKey);
2264
+ }
2265
+ }
2266
+ /** Get Credentials
2267
+ *
2268
+ * @returns
2269
+ */
2270
+ getCredentials() {
2271
+ let _credentialsString = sessionStorage.getItem(credentialsKey);
2272
+ if (_credentialsString == null || _credentialsString == '') {
2273
+ _credentialsString = localStorage.getItem(credentialsKey);
2274
+ }
2275
+ return JSON.parse(_credentialsString ?? '');
2276
+ }
2277
+ /** Get the token if available otherwise return empty string
2278
+ *
2279
+ * @returns
2280
+ */
2281
+ getToken() {
2282
+ try {
2283
+ let _credentials = this.getCredentials();
2284
+ return _credentials.token;
2285
+ }
2286
+ catch (error) {
2287
+ return '';
2288
+ }
2289
+ }
2290
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CredentialsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2291
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CredentialsService, providedIn: 'root' });
2292
+ }
2293
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CredentialsService, decorators: [{
2294
+ type: Injectable,
2295
+ args: [{
2296
+ providedIn: 'root',
2297
+ }]
2298
+ }], ctorParameters: () => [] });
2299
+
2300
+ class UrlHelperService {
2301
+ router = inject(Router);
2302
+ cleanUrl(url) {
2303
+ let result = url
2304
+ .replace('/mfalogin?redirect=', '')
2305
+ .replace('/mfalogin?redirect=', '')
2306
+ .replace('/mfalogin?redirect=', '')
2307
+ .replace('/login?redirect=', '')
2308
+ .replace('/login?redirect=', '')
2309
+ .replace('/login?redirect=', '')
2310
+ .replace(new RegExp('%25', 'g'), '%')
2311
+ .replace(new RegExp('%25', 'g'), '%')
2312
+ .replace(new RegExp('%25', 'g'), '%')
2313
+ .replace(new RegExp('%25', 'g'), '%')
2314
+ .replace(new RegExp('%25', 'g'), '%')
2315
+ .replace(new RegExp('%25', 'g'), '%')
2316
+ .replace(new RegExp('%22', 'g'), '"')
2317
+ .replace(new RegExp('%3F', 'g'), '?')
2318
+ .replace(new RegExp('%3D', 'g'), '=')
2319
+ .replace(new RegExp('%2F', 'g'), '/')
2320
+ .replace(new RegExp('%26', 'g'), '&')
2321
+ .replace(new RegExp('/mfalogin?redirect=', 'g'), '')
2322
+ .replace(new RegExp('/login?redirect=', 'g'), '');
2323
+ console.log('url:', url);
2324
+ console.log('result:', result);
2325
+ // return url;
2326
+ return result;
2327
+ }
2328
+ navigate(url) {
2329
+ let urlParts = url.split('?');
2330
+ if (urlParts.length == 1) {
2331
+ return this.router.navigate(urlParts, { replaceUrl: true });
2332
+ }
2333
+ let parameters = urlParts[1].split('&');
2334
+ return this.router.navigate([urlParts[0]], {
2335
+ queryParams: {
2336
+ parameters: parameters[0]?.replace('parameters=', '') ?? '',
2337
+ type: parameters[1]?.replace('type=', '') ?? '',
2338
+ },
2339
+ replaceUrl: true,
2069
2340
  });
2070
- effect(() => {
2071
- const update = this.commonService.updates();
2072
- if (!update || !this.gridApi)
2073
- return;
2074
- if (update.type === this.getEntityType?.()) {
2075
- switch (update.action) {
2076
- case 'add':
2077
- case 'update':
2078
- this.updateRowInGrid(update.data, this.pkFieldName());
2079
- break;
2341
+ }
2342
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UrlHelperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2343
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UrlHelperService, providedIn: 'root' });
2344
+ }
2345
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UrlHelperService, decorators: [{
2346
+ type: Injectable,
2347
+ args: [{
2348
+ providedIn: 'root',
2349
+ }]
2350
+ }] });
2351
+
2352
+ class AuthenticationInterceptor {
2353
+ router = inject(Router);
2354
+ credentialsService = inject(CredentialsService);
2355
+ environmentProxy = inject(EnvironmentProxy);
2356
+ urlHelperService = inject(UrlHelperService);
2357
+ intercept(req, next) {
2358
+ if (req.headers.get('No-Auth') == 'True')
2359
+ return next.handle(req.clone());
2360
+ let token = this.credentialsService.token;
2361
+ if (token != null) {
2362
+ let appName = this.environmentProxy.getApplicationName();
2363
+ const clonedreq = req.clone({
2364
+ headers: req.headers.set('Authorization', 'Bearer ' + token),
2365
+ // .set("NettyAppName",appName)
2366
+ });
2367
+ return next.handle(clonedreq).pipe(catchError$1((error) => {
2368
+ if (error instanceof HttpErrorResponse && error.status === 401) {
2369
+ // Handle 401 error, e.g., navigate to the login page
2370
+ this.router.navigate(['/login'], {
2371
+ queryParams: {
2372
+ redirect: this.urlHelperService.cleanUrl(this.router.url),
2373
+ },
2374
+ replaceUrl: true,
2375
+ });
2376
+ // Return an observable with a successful response
2377
+ return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
2080
2378
  }
2081
- }
2082
- });
2083
- effect(() => { this.onElementSelect.emit(this.selectedRows()); });
2084
- // Manage filter expanded state
2085
- effect(() => {
2086
- this._isEmbedded();
2087
- this.initAgGrid();
2088
- });
2089
- effect(() => {
2090
- const isEmbedded = this._isEmbedded();
2091
- const currentPref = this.preferenceType();
2092
- const currentSearch = this.searchValueName();
2093
- if (isEmbedded) {
2094
- if (currentPref && !currentPref.endsWith('_isEmbedded')) {
2095
- this.preferenceType.set(`${currentPref}_isEmbedded`);
2379
+ if (error instanceof HttpErrorResponse && error.status === 403) {
2380
+ this.router.navigate(['/forbidden'], {
2381
+ state: { attemptedUrl: this.router.url }, // Orijinal URL'i state olarak geçme
2382
+ });
2383
+ return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
2096
2384
  }
2097
- if (currentSearch && !currentSearch.endsWith('_isEmbedded')) {
2098
- this.searchValueName.set(`${currentSearch}_isEmbedded`);
2385
+ if (error instanceof HttpErrorResponse && error.status === 428) {
2386
+ // Handle 428 error, e.g., navigate to the login page
2387
+ this.router.navigate(['/mfalogin'], {
2388
+ queryParams: {
2389
+ redirect: this.urlHelperService.cleanUrl(this.router.url),
2390
+ },
2391
+ replaceUrl: true,
2392
+ });
2393
+ // Return an observable with a successful response
2394
+ return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
2099
2395
  }
2100
- }
2101
- else {
2102
- if (currentPref?.endsWith('_isEmbedded')) {
2103
- this.preferenceType.set(currentPref.replace('_isEmbedded', ''));
2396
+ // For other errors, re-throw the error to propagate it further
2397
+ return throwError(() => error);
2398
+ }));
2399
+ }
2400
+ else {
2401
+ return next.handle(req.clone()).pipe(catchError$1((error) => {
2402
+ if (error instanceof HttpErrorResponse && error.status === 401) {
2403
+ // Handle 401 error, e.g., navigate to the login page
2404
+ this.router.navigate(['/login'], {
2405
+ queryParams: {
2406
+ redirect: this.urlHelperService.cleanUrl(this.router.url),
2407
+ },
2408
+ replaceUrl: true,
2409
+ });
2410
+ // Return an observable with a successful response
2411
+ return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
2104
2412
  }
2105
- if (currentSearch?.endsWith('_isEmbedded')) {
2106
- this.searchValueName.set(currentSearch.replace('_isEmbedded', ''));
2413
+ if (error instanceof HttpErrorResponse && error.status === 403) {
2414
+ this.router.navigate(['/forbidden'], {
2415
+ state: { attemptedUrl: this.router.url }, // Orijinal URL'i state olarak geçme
2416
+ });
2417
+ return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
2107
2418
  }
2108
- }
2109
- });
2110
- }
2111
- // *********************************************************
2112
- // *** Data Management Functions ***
2113
- // *********************************************************
2114
- loadData() {
2115
- this.nettyAppsProxy.select(this.record).subscribe({
2116
- next: (data) => {
2117
- this.setData(data, false);
2118
- },
2119
- error: (err) => this.alertService.showError('@dataLoadFailed', err),
2120
- });
2121
- }
2122
- async deleteSelected() {
2123
- if (!this.gridApi)
2124
- return;
2125
- const selectedNodes = this.gridApi.getSelectedNodes();
2126
- if (selectedNodes.length === 0) {
2127
- await this.alertService.showAlert('@pleaseSelectRowToDelete');
2128
- return;
2129
- }
2130
- const confirmed = await this.alertService.showConfirm('@confirmDeleteSelectedRecords');
2131
- if (confirmed) {
2132
- const selectedRows = selectedNodes.map((node) => node.data);
2133
- this.deleteRows(selectedRows);
2419
+ if (error instanceof HttpErrorResponse && error.status === 428) {
2420
+ // Handle 428 error, e.g., navigate to the login page
2421
+ this.router.navigate(['/mfalogin'], {
2422
+ queryParams: {
2423
+ redirect: this.urlHelperService.cleanUrl(this.router.url),
2424
+ },
2425
+ replaceUrl: true,
2426
+ });
2427
+ // Return an observable with a successful response
2428
+ return of(new HttpResponse({ status: 200, body: { message: 'Success' } }));
2429
+ }
2430
+ // For other errors, re-throw the error to propagate it further
2431
+ return throwError(() => error);
2432
+ }));
2134
2433
  }
2135
2434
  }
2136
- deleteRows(rows) {
2137
- this.nettyAppsProxy.deleteList(rows).subscribe({
2138
- next: () => {
2139
- this.gridApi.applyTransaction({ remove: rows });
2140
- this.alertService.showSuccess('@recordDeletedSuccessfully');
2141
- },
2142
- error: (err) => this.alertService.showError(err),
2143
- });
2144
- }
2145
- // *****************************************
2146
- // *** Logging Functions ***
2147
- // *****************************************
2148
- logInputs(message) {
2149
- if (!message || message.length < 1) {
2150
- message = 'AgGridListBase - Inputs log';
2151
- }
2152
- const inputs = {
2153
- "popupFilterValid": this.popupFilterValid(),
2154
- "_isPopupFilterValid": this._isPopupFilterValid(),
2155
- "popupValid": this.popupValid(),
2156
- "_isPopupValid": this._isPopupValid(),
2157
- "componantParameterGUID": this.componantParameterGUID(),
2158
- "componantParameterType": this.componantParameterType(),
2159
- "embedded": this.embedded(),
2160
- "_isEmbedded": this._isEmbedded(),
2161
- };
2162
- console.log(message, inputs);
2435
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AuthenticationInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2436
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AuthenticationInterceptor });
2437
+ }
2438
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AuthenticationInterceptor, decorators: [{
2439
+ type: Injectable
2440
+ }] });
2441
+
2442
+ class CanDeactivateGuard {
2443
+ canDeactivate(component) {
2444
+ return component.canDeactivate ? component.canDeactivate() : true;
2163
2445
  }
2164
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridListBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
2165
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: NettyAgGridListBase, isStandalone: true, selector: "ntybase-ag-grid-list-base", host: { attributes: { "ntybase-id": "NettyAgGridListBase" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
2166
2446
  }
2167
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridListBase, decorators: [{
2168
- type: Component,
2169
- args: [{ selector: 'ntybase-ag-grid-list-base', imports: [], template: ``, host: { 'ntybase-id': 'NettyAgGridListBase' } }]
2170
- }], ctorParameters: () => [] });
2447
+
2448
+ class NtybaseModule {
2449
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtybaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2450
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: NtybaseModule, declarations: [Ntybase], exports: [Ntybase] });
2451
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtybaseModule, providers: [
2452
+ {
2453
+ provide: HTTP_INTERCEPTORS,
2454
+ useClass: AuthenticationInterceptor,
2455
+ multi: true,
2456
+ },
2457
+ [CanDeactivateGuard],
2458
+ DatePipe,
2459
+ ] });
2460
+ }
2461
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtybaseModule, decorators: [{
2462
+ type: NgModule,
2463
+ args: [{
2464
+ declarations: [Ntybase],
2465
+ imports: [],
2466
+ exports: [Ntybase],
2467
+ providers: [
2468
+ {
2469
+ provide: HTTP_INTERCEPTORS,
2470
+ useClass: AuthenticationInterceptor,
2471
+ multi: true,
2472
+ },
2473
+ [CanDeactivateGuard],
2474
+ DatePipe,
2475
+ ],
2476
+ }]
2477
+ }] });
2171
2478
 
2172
2479
  class Guid {
2173
2480
  value = this.empty;
@@ -2727,45 +3034,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
2727
3034
  type: Component,
2728
3035
  args: [{ selector: 'ntybase-ag-grid-save-base', imports: [], template: `` }]
2729
3036
  }], ctorParameters: () => [], propDecorators: { parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "parameters", required: false }] }], saveForm: [{
2730
- type: ViewChild,
2731
- args: ['saveForm']
2732
- }] } });
2733
-
2734
- class ExcelImportBase extends NettyAgGridListBase {
2735
- dataList = [];
2736
- wopts = { bookType: 'xlsx', type: 'array' };
2737
- fileName = 'PayrollJournalTrans.xlsx';
2738
- isDataValidated = false;
2739
- /*******************************
2740
- *** EXCEL UPLOAD FUNCTIONS ***
2741
- *******************************/
2742
- onFileChange(evt) {
2743
- /* wire up file reader */
2744
- const target = evt.target;
2745
- if (target.files.length !== 1) {
2746
- throw new Error('Cannot use multiple files');
2747
- }
2748
- const reader = new FileReader();
2749
- reader.onload = (e) => {
2750
- /* read workbook */
2751
- const bstr = e.target.result;
2752
- const wb = XLSX.read(bstr, { type: 'binary' });
2753
- /* grab first sheet */
2754
- const wsname = wb.SheetNames[0];
2755
- const ws = wb.Sheets[wsname];
2756
- /* save data */
2757
- this.dataList = XLSX.utils.sheet_to_json(ws, { header: 1 });
2758
- console.log('dataList:', this.dataList);
2759
- };
2760
- reader.readAsBinaryString(target.files[0]);
2761
- }
2762
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ExcelImportBase, deps: null, target: i0.ɵɵFactoryTarget.Component });
2763
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: ExcelImportBase, isStandalone: true, selector: "ntybase-excel-import-base", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
2764
- }
2765
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ExcelImportBase, decorators: [{
2766
- type: Component,
2767
- args: [{ selector: 'ntybase-excel-import-base', imports: [], template: `` }]
2768
- }] });
3037
+ type: ViewChild,
3038
+ args: ['saveForm']
3039
+ }] } });
2769
3040
 
2770
3041
  class RangeDateTimeFilter {
2771
3042
  params;
@@ -3565,7 +3836,7 @@ const ntyAuthenticationInterceptor = (req, next) => {
3565
3836
  headers: req.headers.set('Authorization', 'Bearer ' + token)
3566
3837
  // .set("NettyAppName",appName)
3567
3838
  });
3568
- return next(clonedreq).pipe(catchError((error) => {
3839
+ return next(clonedreq).pipe(catchError$1((error) => {
3569
3840
  if (error instanceof HttpErrorResponse && error.status === 401) {
3570
3841
  // Handle 401 error, e.g., navigate to the login page
3571
3842
  router.navigate(['/login'], {
@@ -3599,7 +3870,7 @@ const ntyAuthenticationInterceptor = (req, next) => {
3599
3870
  }));
3600
3871
  }
3601
3872
  else {
3602
- return next(req.clone()).pipe(catchError((error) => {
3873
+ return next(req.clone()).pipe(catchError$1((error) => {
3603
3874
  if (error instanceof HttpErrorResponse && error.status === 401) {
3604
3875
  // Handle 401 error, e.g., navigate to the login page
3605
3876
  router.navigate(['/login'], {
@@ -3692,7 +3963,7 @@ class AuthenticationService {
3692
3963
  // Parse JWT
3693
3964
  this.credentialsService.setCredentials(data, context.remember);
3694
3965
  return data;
3695
- }), take(1), catchError((error) => {
3966
+ }), take(1), catchError$1((error) => {
3696
3967
  let errorMessage = '';
3697
3968
  switch (error.status) {
3698
3969
  case '404':
@@ -3756,7 +4027,7 @@ class AuthenticationService {
3756
4027
  });
3757
4028
  return mfaCodeCall$.pipe(map$1((message) => {
3758
4029
  return message;
3759
- }), take(1), catchError((error) => {
4030
+ }), take(1), catchError$1((error) => {
3760
4031
  let errorMessage = '';
3761
4032
  errorMessage =
3762
4033
  error.status +
@@ -3780,7 +4051,7 @@ class AuthenticationService {
3780
4051
  console.log('mfaCodeUrl', mfaCodeUrl);
3781
4052
  return resendMFACodeCall$.pipe(map$1((message) => {
3782
4053
  return message;
3783
- }), take(1), catchError((error) => {
4054
+ }), take(1), catchError$1((error) => {
3784
4055
  let errorMessage = '';
3785
4056
  errorMessage =
3786
4057
  error.status +
@@ -3819,7 +4090,7 @@ class AuthenticationService {
3819
4090
  // and saves the credentials into localstorage
3820
4091
  return loginCall$.pipe(map$1((message) => {
3821
4092
  return message;
3822
- }), take(1), catchError((error) => {
4093
+ }), take(1), catchError$1((error) => {
3823
4094
  let errorMessage = '';
3824
4095
  errorMessage =
3825
4096
  error.status +
@@ -4176,7 +4447,7 @@ class PasswordProxy {
4176
4447
  });
4177
4448
  return resertPasswordCall$.pipe(map((message) => {
4178
4449
  return message;
4179
- }), take$1(1), catchError$1((error) => {
4450
+ }), take$1(1), catchError((error) => {
4180
4451
  let errorMessage = '';
4181
4452
  errorMessage =
4182
4453
  error.status +
@@ -4365,29 +4636,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
4365
4636
  }]
4366
4637
  }] });
4367
4638
 
4368
- class NettyBaseApp {
4369
- i18nService = inject(I18nService);
4370
- alertService = inject(AlertService);
4371
- async loadBaseTranslations() {
4372
- try {
4373
- const enUSBase = await import('./nettyapps-ntybase-en-USbase-C1t7F-R0.mjs');
4374
- const trTRBase = await import('./nettyapps-ntybase-tr-TRbase-BXQ_UTZY.mjs');
4375
- this.i18nService.addTranslations('English', enUSBase.default);
4376
- this.i18nService.addTranslations('Türkçe', trTRBase.default);
4377
- }
4378
- catch (error) {
4379
- this.alertService.showError('Error loading base translations in component:', error);
4380
- throw error;
4381
- }
4382
- }
4383
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyBaseApp, deps: [], target: i0.ɵɵFactoryTarget.Component });
4384
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: NettyBaseApp, isStandalone: true, selector: "ntybase-netty-base-app", ngImport: i0, template: "", styles: [""] });
4385
- }
4386
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyBaseApp, decorators: [{
4387
- type: Component,
4388
- args: [{ selector: 'ntybase-netty-base-app', imports: [], template: "" }]
4389
- }] });
4390
-
4391
4639
  class EnvironmentInfo {
4392
4640
  showNettyInfo = true;
4393
4641
  environmentProxy = inject(EnvironmentProxy);
@@ -4559,238 +4807,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
4559
4807
  }]
4560
4808
  }] });
4561
4809
 
4562
- class NettyAppsFilterBase extends NettyAppsBase {
4563
- // *********************************************************
4564
- // *** Input / Output ***
4565
- // *********************************************************
4566
- isFilterExpanded = model(true, ...(ngDevMode ? [{ debugName: "isFilterExpanded" }] : []));
4567
- filteredRecords = output();
4568
- filterSelectionChanged = output();
4569
- refresh = input(0, ...(ngDevMode ? [{ debugName: "refresh" }] : []));
4570
- fileName = input('nettyapps_', ...(ngDevMode ? [{ debugName: "fileName" }] : []));
4571
- // *********************************************************
4572
- // *** Service ***
4573
- // *********************************************************
4574
- filterProxy = injectNettyStandardFilterProxy(this.componentName());
4575
- // *********************************************************
4576
- // *** Signals ***
4577
- // *********************************************************
4578
- currentItem = signal(this.createNewFilter(), ...(ngDevMode ? [{ debugName: "currentItem" }] : []));
4579
- // *********************************************************
4580
- // *** Constructor ***
4581
- // *********************************************************
4582
- constructor() {
4583
- super();
4584
- effect(() => {
4585
- if (this.refresh() > 0) {
4586
- this.onApply();
4587
- }
4588
- });
4589
- }
4590
- // *********************************************************
4591
- // *** Functions ***
4592
- // *********************************************************
4593
- async ngOnInit() {
4594
- this.afterOnInit();
4595
- }
4596
- onApply() {
4597
- this.filterSelectionChanged.emit(this.currentItem());
4598
- this.filterProxy.selectFilter(this.currentItem()).subscribe({
4599
- next: (result) => {
4600
- this.filteredRecords.emit(result);
4601
- this.isFilterExpanded.set(false);
4602
- },
4603
- error: (err) => this.alertService.showError('@dataLoadFailed', err),
4604
- });
4605
- }
4606
- onReset() {
4607
- this.filterProxy.initFilter().subscribe({
4608
- next: (filter) => {
4609
- this.currentItem.set(filter);
4610
- this.filterSelectionChanged.emit(this.currentItem());
4611
- },
4612
- error: (err) => this.alertService.showError('@dataLoadFailed', err),
4613
- });
4614
- }
4615
- onExport() {
4616
- this.filterSelectionChanged.emit(this.currentItem());
4617
- this.filterProxy.downloadXLS(this.currentItem()).subscribe({
4618
- next: (response) => {
4619
- this.downloadBlobFile(response, 'application/zip', this.translateService.instant('@00000072') + '.zip');
4620
- },
4621
- error: (err) => this.alertService.showError('@dataLoadFailed', err),
4622
- });
4623
- }
4624
- async afterOnInit() { }
4625
- // *****************************************
4626
- // *** Logging Functions ***
4627
- // *****************************************
4628
- logInputs(message) {
4629
- if (!message || message.length < 1) {
4630
- message = 'NettyAppsFilterBase - Inputs log';
4631
- }
4632
- const inputs = {
4633
- "isFilterExpanded": this.isFilterExpanded(),
4634
- "refresh": this.refresh(),
4635
- "fileName": this.fileName(),
4636
- };
4637
- console.log(message, inputs);
4638
- }
4639
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsFilterBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
4640
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: NettyAppsFilterBase, isStandalone: true, selector: "ntybase-netty-apps-base", inputs: { isFilterExpanded: { classPropertyName: "isFilterExpanded", publicName: "isFilterExpanded", isSignal: true, isRequired: false, transformFunction: null }, refresh: { classPropertyName: "refresh", publicName: "refresh", isSignal: true, isRequired: false, transformFunction: null }, fileName: { classPropertyName: "fileName", publicName: "fileName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isFilterExpanded: "isFilterExpandedChange", filteredRecords: "filteredRecords", filterSelectionChanged: "filterSelectionChanged" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
4641
- }
4642
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsFilterBase, decorators: [{
4643
- type: Component,
4644
- args: [{ selector: 'ntybase-netty-apps-base', imports: [], template: `` }]
4645
- }], ctorParameters: () => [], propDecorators: { isFilterExpanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "isFilterExpanded", required: false }] }, { type: i0.Output, args: ["isFilterExpandedChange"] }], filteredRecords: [{ type: i0.Output, args: ["filteredRecords"] }], filterSelectionChanged: [{ type: i0.Output, args: ["filterSelectionChanged"] }], refresh: [{ type: i0.Input, args: [{ isSignal: true, alias: "refresh", required: false }] }], fileName: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileName", required: false }] }] } });
4646
-
4647
- class ParseLog {
4648
- rowIndex = 0; // Excel line no (1-based)
4649
- message = ""; // Error or info message (fallback)
4650
- level = "INFO";
4651
- messageKey; // i18n translation key
4652
- messageParams; // parameters for translation
4653
- init() {
4654
- this.rowIndex = 0;
4655
- this.message = "";
4656
- this.level = "INFO";
4657
- this.messageKey = undefined;
4658
- this.messageParams = undefined;
4659
- }
4660
- compare(other) { return this; }
4661
- getPK() { return this.rowIndex; }
4662
- setPK(pk) { this.rowIndex = pk; }
4663
- }
4664
-
4665
- class ExcelParserError extends Error {
4666
- key;
4667
- params;
4668
- constructor(key, params) {
4669
- super(key);
4670
- this.key = key;
4671
- this.params = params;
4672
- this.name = 'ExcelParserError';
4673
- }
4674
- }
4675
- class ExcelParser {
4676
- mappings;
4677
- constructor(mappings) {
4678
- this.mappings = mappings;
4679
- }
4680
- async parse(file, options) {
4681
- // PERFORMANS: XLSX library only loads at parse time!
4682
- const XLSX = await import('xlsx');
4683
- const sheetIndex = options?.sheetIndex ?? 0;
4684
- const headerRowIndex = options?.headerRowIndex ?? 0; // 0-based
4685
- return new Promise((resolve, reject) => {
4686
- const reader = new FileReader();
4687
- reader.onload = (e) => {
4688
- try {
4689
- const data = new Uint8Array(e.target?.result);
4690
- const workbook = XLSX.read(data, { type: 'array' });
4691
- if (!workbook.SheetNames[sheetIndex]) {
4692
- throw new ExcelParserError('@EXCEL_PARSER.sheetNotFound', { index: sheetIndex });
4693
- }
4694
- const sheetName = workbook.SheetNames[sheetIndex];
4695
- const sheet = workbook.Sheets[sheetName];
4696
- const rows = XLSX.utils.sheet_to_json(sheet, { header: 1 });
4697
- const logs = [];
4698
- const result = [];
4699
- // Skip headerline
4700
- const dataRows = rows.slice(headerRowIndex + 1);
4701
- dataRows.forEach((row, i) => {
4702
- // Skip empty lines
4703
- if (!row || row.length === 0)
4704
- return;
4705
- const obj = {};
4706
- let hasError = false;
4707
- const actualRowIndex = headerRowIndex + i + 2; // Excel line no (1-based)
4708
- this.mappings.forEach(m => {
4709
- let rawValue = row[m.index];
4710
- if ((rawValue === undefined || rawValue === null || rawValue === '') && m.defaultValue !== undefined) {
4711
- rawValue = m.defaultValue;
4712
- logs.push(Object.assign(new ParseLog(), {
4713
- rowIndex: actualRowIndex,
4714
- message: `Boş alan için default değer atandı: ${String(m.prop)}`,
4715
- level: 'INFO',
4716
- messageKey: '@EXCEL_PARSER.defaultValueSet',
4717
- messageParams: { prop: String(m.prop) }
4718
- }));
4719
- }
4720
- if (m.required && (rawValue === undefined || rawValue === null || rawValue === '')) {
4721
- logs.push(Object.assign(new ParseLog(), {
4722
- rowIndex: actualRowIndex,
4723
- message: `Zorunlu alan boş: ${String(m.prop)}`,
4724
- level: 'ERROR',
4725
- messageKey: '@EXCEL_PARSER.requiredFieldMissing',
4726
- messageParams: { prop: String(m.prop) }
4727
- }));
4728
- hasError = true;
4729
- }
4730
- try {
4731
- obj[m.prop] = m.converter ? m.converter(rawValue) : rawValue;
4732
- }
4733
- catch (err) {
4734
- logs.push(Object.assign(new ParseLog(), {
4735
- rowIndex: actualRowIndex,
4736
- message: `Tip dönüşüm hatası: ${String(m.prop)} -> ${rawValue}`,
4737
- level: 'ERROR',
4738
- messageKey: '@EXCEL_PARSER.conversionError',
4739
- messageParams: { prop: String(m.prop), value: rawValue }
4740
- }));
4741
- hasError = true;
4742
- }
4743
- });
4744
- if (!hasError) {
4745
- result.push(obj);
4746
- }
4747
- else {
4748
- logs.push(Object.assign(new ParseLog(), {
4749
- rowIndex: actualRowIndex,
4750
- message: `Satır atlandı`,
4751
- level: 'WARN',
4752
- messageKey: '@EXCEL_PARSER.rowSkipped'
4753
- }));
4754
- }
4755
- });
4756
- resolve({ data: result, logs });
4757
- }
4758
- catch (error) {
4759
- reject(error);
4760
- }
4761
- };
4762
- reader.onerror = () => reject(reader.error);
4763
- reader.readAsArrayBuffer(file);
4764
- });
4765
- }
4766
- async generateSampleExcel(options) {
4767
- const sampleCount = options?.sampleCount ?? 5;
4768
- const fileName = (options?.fileName ?? 'sample-import.xlsx').endsWith('.xlsx')
4769
- ? (options?.fileName ?? 'sample-import.xlsx')
4770
- : `${options?.fileName}.xlsx`;
4771
- const sheetName = (options?.sheetName ?? 'Sample').substring(0, 15);
4772
- const XLSX = await import('xlsx');
4773
- // Header row: property names according to column order
4774
- const headers = this.mappings.map(m => m.headerName || String(m.prop));
4775
- const rows = [];
4776
- for (let i = 1; i <= sampleCount; i++) {
4777
- const row = this.mappings.map(m => {
4778
- if (m.sampleValue !== undefined) {
4779
- // Use sampleValue if it exists
4780
- return typeof m.sampleValue === 'function'
4781
- ? m.sampleValue(i) // if it's a function, generate value based on index
4782
- : m.sampleValue; // if it's a constant value, use it directly
4783
- }
4784
- });
4785
- rows.push(row);
4786
- }
4787
- const worksheet = XLSX.utils.aoa_to_sheet([headers, ...rows]);
4788
- const workbook = XLSX.utils.book_new();
4789
- XLSX.utils.book_append_sheet(workbook, worksheet, sheetName);
4790
- XLSX.writeFile(workbook, fileName);
4791
- }
4792
- }
4793
-
4794
4810
  // converters.ts
4795
4811
  // Sayı dönüştürücü (hem . hem , destekler)
4796
4812
  const toNumber = (v) => {