@nettyapps/ntybase 0.0.1 → 0.0.3

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.
package/index.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { OnDestroy, OnInit, ElementRef } from '@angular/core';
2
+ import { OnInit, OnChanges, SimpleChanges, DoCheck, OnDestroy, ElementRef } from '@angular/core';
3
3
  import { TranslateService } from '@ngx-translate/core';
4
4
  import { Observable, Subject } from 'rxjs';
5
5
  import { Theme as Theme$1, GridApi, GridOptions, StatusPanelDef, GridReadyEvent } from 'ag-grid-community';
6
+ import { MatDialog, MatDialogRef } from '@angular/material/dialog';
6
7
  import { Router, ActivatedRoute, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanDeactivate } from '@angular/router';
7
8
  import { MatSnackBar } from '@angular/material/snack-bar';
8
- import { MatDialog, MatDialogRef } from '@angular/material/dialog';
9
9
  import { HttpClient, HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http';
10
10
  import { EnvironmentProxy } from '@nettyapps/ntycontract';
11
+ import { NgForm, FormGroup, FormControl } from '@angular/forms';
12
+ import * as XLSX from 'xlsx';
11
13
  import { ICellRendererAngularComp } from 'ag-grid-angular';
12
- import { FormGroup, FormControl } from '@angular/forms';
13
14
  import { I18nService } from '@nettyapps/ntyi18n';
14
15
  import { MatAutocompleteTrigger, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
15
16
  import { ErrorStateMatcher } from '@angular/material/core';
@@ -120,13 +121,26 @@ declare class CommonService {
120
121
  private location;
121
122
  private datePipe;
122
123
  private alertService;
124
+ protected dialog: MatDialog;
123
125
  rightSidenavOpen: _angular_core.WritableSignal<boolean>;
124
126
  toggleRightSidenav(open: boolean): void;
127
+ /**
128
+ * Normalizes Turkish text for search and comparison operations by converting
129
+ * Turkish special characters to their English equivalents and lowercasing.
130
+ *
131
+ */
125
132
  normalizeTurkish(text: string): string;
126
133
  /**
127
134
  * Gets the clean URL path without fragments or query params
128
135
  */
129
136
  getCleanUrlPath(): string;
137
+ /**
138
+ * Clears the right sidenav outlet and resets the UI state.
139
+ * Removes the right sidenav route while keeping the main content and query parameters.
140
+ * Also collapses the sidenav and closes any open dialogs.
141
+ */
142
+ clearOutlet(): void;
143
+ ngOnDestroy(): void;
130
144
  /** Merge columns with the given seperator
131
145
  *
132
146
  * @param columns string array to merge
@@ -174,11 +188,11 @@ declare class CommonService {
174
188
  /** Read-only Signal for external components to observe updates */
175
189
  updates: _angular_core.Signal<{
176
190
  type: string;
177
- action: "add" | "update" | "delete";
191
+ action: "add" | "update";
178
192
  data: any;
179
193
  } | null>;
180
194
  /** Broadcasts grid data changes to subscribers */
181
- notifyUpdate(type: string, action: 'add' | 'update' | 'delete', data: any): void;
195
+ notifyUpdate(type: string, action: 'add' | 'update', data: any): void;
182
196
  /** User is not allowed to access the page
183
197
  *
184
198
  */
@@ -196,7 +210,7 @@ declare class AlertService {
196
210
  showAlert(message: string, action?: string, duration?: number): void;
197
211
  showConfirm(message: string): Promise<boolean>;
198
212
  showSuccess(message: string, duration?: number): void;
199
- showError(message: string, duration?: number): void;
213
+ showError(error: any, duration?: number): void;
200
214
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AlertService, never>;
201
215
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AlertService>;
202
216
  }
@@ -226,11 +240,12 @@ declare class SysfunctionProxy {
226
240
 
227
241
  declare abstract class AgGridBase<T extends {
228
242
  [key: string]: any;
229
- }> {
243
+ }> implements OnInit, OnChanges {
230
244
  readOnly: _angular_core.InputSignal<boolean>;
231
245
  popupFilterValid: _angular_core.InputSignal<boolean>;
232
246
  popupValid: _angular_core.InputSignal<boolean>;
233
247
  params: _angular_core.InputSignal<any>;
248
+ parameters: _angular_core.InputSignal<string>;
234
249
  protected authenticationList: Array<NettySecurity>;
235
250
  protected accessRightsProcessed: _angular_core.WritableSignal<boolean>;
236
251
  allowAdd: _angular_core.WritableSignal<boolean>;
@@ -276,6 +291,14 @@ declare abstract class AgGridBase<T extends {
276
291
  statusBar: {
277
292
  statusPanels: StatusPanelDef[];
278
293
  };
294
+ /**
295
+ * Component initialization lifecycle hook
296
+ */
297
+ ngOnInit(): Promise<void>;
298
+ /**
299
+ * Handle input changes for route parameters
300
+ */
301
+ ngOnChanges(changes: SimpleChanges): void;
279
302
  protected onGridReady(params: GridReadyEvent): void;
280
303
  onFirstDataRendered(params: any): void;
281
304
  saveGrid(params: any): void;
@@ -285,8 +308,6 @@ declare abstract class AgGridBase<T extends {
285
308
  * Handle back button click
286
309
  */
287
310
  backClicked(): void;
288
- deleteSelected(): Promise<void>;
289
- refreshData(): Promise<void>;
290
311
  gotoURL(routePrefix: string[], rightSidenav: string[] | undefined, parameters: string, type?: string, isNewTab?: boolean, embedded?: boolean, dialogComponent?: any): void;
291
312
  popupGotoURL(urlSegments: string[]): void;
292
313
  /**
@@ -304,34 +325,34 @@ declare abstract class AgGridBase<T extends {
304
325
  * @param idField The field name that serves as unique identifier (default: 'id')
305
326
  */
306
327
  protected updateRowInGrid(rowData: T, idField?: string): void;
307
- /**
308
- * Delete a row from the grid
309
- * @param rowData The row to delete
310
- */
311
- protected deleteRowFromGrid(rowData: T): void;
328
+ deleteSelected(): Promise<void>;
329
+ refreshData(): Promise<void>;
312
330
  setAccessRights(): Promise<boolean>;
313
- protected abstract loadData(): void;
331
+ protected abstract loadData(filter?: string): void;
332
+ protected abstract initAgGrid(): void;
314
333
  protected onBtnClick?(e: T): void;
315
- protected abstract loadFreshData(): Promise<T[]>;
316
- protected abstract deleteRows(rows: T[]): void;
334
+ protected deleteRows?(rows: T[]): void;
317
335
  protected getEntityType?(): string;
336
+ protected selectedData?(): void;
318
337
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AgGridBase<any>, never>;
319
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgGridBase<any>, "ntybase-ag-grid-base", never, { "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "popupFilterValid": { "alias": "popupFilterValid"; "required": false; "isSignal": true; }; "popupValid": { "alias": "popupValid"; "required": false; "isSignal": true; }; "params": { "alias": "params"; "required": false; "isSignal": true; }; "filterField": { "alias": "filterField"; "required": false; "isSignal": true; }; "filterFieldValue": { "alias": "filterFieldValue"; "required": false; "isSignal": true; }; "filterFieldNumeric": { "alias": "filterFieldNumeric"; "required": false; "isSignal": true; }; "filterFieldEquality": { "alias": "filterFieldEquality"; "required": false; "isSignal": true; }; }, { "selectedElement": "selectedElement"; }, never, never, true, never>;
338
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgGridBase<any>, "ntybase-ag-grid-base", never, { "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "popupFilterValid": { "alias": "popupFilterValid"; "required": false; "isSignal": true; }; "popupValid": { "alias": "popupValid"; "required": false; "isSignal": true; }; "params": { "alias": "params"; "required": false; "isSignal": true; }; "parameters": { "alias": "parameters"; "required": false; "isSignal": true; }; "filterField": { "alias": "filterField"; "required": false; "isSignal": true; }; "filterFieldValue": { "alias": "filterFieldValue"; "required": false; "isSignal": true; }; "filterFieldNumeric": { "alias": "filterFieldNumeric"; "required": false; "isSignal": true; }; "filterFieldEquality": { "alias": "filterFieldEquality"; "required": false; "isSignal": true; }; }, { "selectedElement": "selectedElement"; }, never, never, true, never>;
320
339
  }
321
340
 
322
341
  type UserViewMode = 'fullscreen' | 'sidenav' | 'dialog';
323
- declare abstract class AgGridSaveBase<T> {
342
+ declare abstract class AgGridSaveBase<T> implements DoCheck {
324
343
  protected router: Router;
325
344
  protected route: ActivatedRoute;
326
345
  protected commonService: CommonService;
327
346
  protected alertService: AlertService;
347
+ viewMode: _angular_core.WritableSignal<UserViewMode>;
348
+ parameters: _angular_core.InputSignal<string>;
349
+ embedded: _angular_core.InputSignal<boolean>;
328
350
  currentItem: _angular_core.WritableSignal<T>;
329
351
  initialItem: T;
330
352
  formChanged: boolean;
331
- viewMode: _angular_core.WritableSignal<UserViewMode>;
353
+ saveForm: NgForm;
332
354
  protected dialogRef: MatDialogRef<any, any> | null;
333
355
  protected dialogData: any;
334
- embedded: _angular_core.InputSignal<boolean>;
335
356
  closeAfterSave: _angular_core.ModelSignal<boolean>;
336
357
  setCloseAfterSave(value: boolean): void;
337
358
  updateValid: _angular_core.WritableSignal<boolean>;
@@ -340,6 +361,15 @@ declare abstract class AgGridSaveBase<T> {
340
361
  * Determine view mode based on current route
341
362
  */
342
363
  protected determineViewMode(): void;
364
+ /**
365
+ * Set data to the form while preserving any unsaved changes
366
+ * @param item - Data object of type T to populate the form
367
+ */
368
+ protected initializeFormData(item: T): void;
369
+ /**
370
+ * @param data - Data to populate the new instance
371
+ */
372
+ protected createItemInstance(data: Partial<T>): T;
343
373
  /**
344
374
  * Check for form changes
345
375
  */
@@ -349,13 +379,30 @@ declare abstract class AgGridSaveBase<T> {
349
379
  * Check if can deactivate component
350
380
  */
351
381
  canDeactivate(): Promise<boolean>;
382
+ protected getGuidFromParameters(): string;
383
+ ngOnChanges(changes: SimpleChanges): void;
352
384
  /**
353
385
  * Close sidenav or navigate back
354
386
  */
355
387
  closeSidenav(): void;
356
388
  backClicked(): void;
389
+ protected abstract loadDetailData(): void;
357
390
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AgGridSaveBase<any>, never>;
358
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgGridSaveBase<any>, "ntybase-ag-grid-save-base", never, { "embedded": { "alias": "embedded"; "required": false; "isSignal": true; }; "closeAfterSave": { "alias": "closeAfterSave"; "required": false; "isSignal": true; }; }, { "closeAfterSave": "closeAfterSaveChange"; }, never, never, true, never>;
391
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgGridSaveBase<any>, "ntybase-ag-grid-save-base", never, { "parameters": { "alias": "parameters"; "required": false; "isSignal": true; }; "embedded": { "alias": "embedded"; "required": false; "isSignal": true; }; "closeAfterSave": { "alias": "closeAfterSave"; "required": false; "isSignal": true; }; }, { "closeAfterSave": "closeAfterSaveChange"; }, never, never, true, never>;
392
+ }
393
+
394
+ type AOA = string[][];
395
+ declare abstract class ExcelImportBase extends AgGridBase<any> {
396
+ protected dataList: AOA;
397
+ protected wopts: XLSX.WritingOptions;
398
+ protected fileName: string;
399
+ protected isDataValidated: boolean;
400
+ /*******************************
401
+ *** EXCEL UPLOAD FUNCTIONS ***
402
+ *******************************/
403
+ onFileChange(evt: any): void;
404
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ExcelImportBase, never>;
405
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ExcelImportBase, "ntybase-excel-import-base", never, {}, {}, never, never, true, never>;
359
406
  }
360
407
 
361
408
  declare class ButtonRenderer implements ICellRendererAngularComp {
@@ -736,7 +783,7 @@ declare class LeftSidenav implements OnInit {
736
783
  }
737
784
 
738
785
  interface AppTheme {
739
- name: 'light' | 'dark' | 'system';
786
+ name: 'light' | 'dark';
740
787
  icon: string;
741
788
  }
742
789
  declare class Theme {
@@ -744,7 +791,7 @@ declare class Theme {
744
791
  private themes;
745
792
  selectedTheme: _angular_core.Signal<AppTheme | undefined>;
746
793
  getThemes(): AppTheme[];
747
- setTheme(theme: 'light' | 'dark' | 'system'): void;
794
+ setTheme(theme: 'light' | 'dark'): void;
748
795
  constructor();
749
796
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Theme, never>;
750
797
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<Theme>;
@@ -867,6 +914,11 @@ declare class Guid {
867
914
  static emptyWhenNull(guid: any): any;
868
915
  }
869
916
 
917
+ declare class Filter {
918
+ value: any;
919
+ text: any;
920
+ }
921
+
870
922
  declare class NettyMenuService {
871
923
  private http;
872
924
  private environmentProxy;
@@ -878,5 +930,5 @@ declare class NettyMenuService {
878
930
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<NettyMenuService>;
879
931
  }
880
932
 
881
- export { AgGridBase, AgGridSaveBase, AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, AutoComplete, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, ColorPalette, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ForgotPassword, Guid, HttpError403, HttpError404, LeftSidenav, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridService, NettyHelper, NettyMenuService, Ntybase, NtybaseModule, SelectionItem, Theme, Toolbar, UrlHelperService };
933
+ export { AgGridBase, AgGridSaveBase, AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, AutoComplete, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, ColorPalette, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ExcelImportBase, Filter, ForgotPassword, Guid, HttpError403, HttpError404, LeftSidenav, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridService, NettyHelper, NettyMenuService, Ntybase, NtybaseModule, SelectionItem, Theme, Toolbar, UrlHelperService };
882
934
  export type { AppTheme, CanComponentDeactivate, ColorTheme, Credentials, LoginContext, MFACodeContext, UserViewMode };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@nettyapps/ntybase",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "peerDependencies": {
5
- "@angular/common": "^20.0.0",
6
- "@angular/core": "^20.0.0"
5
+ "@angular/common": "^20.1.7",
6
+ "@angular/core": "^20.1.7"
7
7
  },
8
8
  "dependencies": {
9
9
  "tslib": "^2.3.0"
Binary file