@nettyapps/ntybase 0.0.1 → 0.0.2

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Injectable, inject, NgModule, Inject, signal, input, output, computed, effect, model, ViewContainerRef, ViewChild, Input, ViewEncapsulation, forwardRef, ChangeDetectionStrategy } from '@angular/core';
2
+ import { Component, Injectable, inject, NgModule, Inject, signal, input, output, computed, effect, model, ViewChild, Input, ViewContainerRef, ViewEncapsulation, forwardRef, ChangeDetectionStrategy } from '@angular/core';
3
3
  import * as i1$2 from '@angular/common/http';
4
4
  import { HttpErrorResponse, HttpResponse, HTTP_INTERCEPTORS, HttpClient, HttpHeaders } from '@angular/common/http';
5
5
  import { of, throwError, lastValueFrom, map, catchError as catchError$1, Subject, finalize, take as take$1, takeUntil } from 'rxjs';
@@ -29,6 +29,7 @@ import * as i3$2 from '@angular/material/tooltip';
29
29
  import { MatTooltipModule } from '@angular/material/tooltip';
30
30
  import * as i3$3 from '@angular/material/menu';
31
31
  import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
32
+ import * as XLSX from 'xlsx';
32
33
  import * as i1$3 from '@angular/forms';
33
34
  import { FormBuilder, Validators, FormsModule, ReactiveFormsModule, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms';
34
35
  import * as i1$4 from '@angular/material/input';
@@ -481,6 +482,7 @@ class CommonService {
481
482
  location = inject(Location);
482
483
  datePipe = inject(DatePipe);
483
484
  alertService = inject(AlertService);
485
+ dialog = inject(MatDialog);
484
486
  rightSidenavOpen = signal(false, ...(ngDevMode ? [{ debugName: "rightSidenavOpen" }] : []));
485
487
  toggleRightSidenav(open) {
486
488
  this.rightSidenavOpen.set(open);
@@ -504,6 +506,29 @@ class CommonService {
504
506
  return (tree.root.children['primary']?.segments.map((s) => s.path).join('/') ||
505
507
  '/');
506
508
  }
509
+ clearOutlet() {
510
+ const currentUrl = this.router.parseUrl(this.router.url);
511
+ const primaryOutlet = currentUrl.root.children['primary'];
512
+ const rightSidenavOutlet = currentUrl.root.children['rightSidenav'];
513
+ if (rightSidenavOutlet) {
514
+ this.router.navigate([
515
+ {
516
+ outlets: {
517
+ rightSidenav: null,
518
+ primary: primaryOutlet ? primaryOutlet.toString() : null,
519
+ },
520
+ },
521
+ ], {
522
+ queryParamsHandling: 'preserve',
523
+ replaceUrl: true,
524
+ });
525
+ }
526
+ this.toggleRightSidenav(false);
527
+ this.dialog.closeAll();
528
+ }
529
+ ngOnDestroy() {
530
+ this.clearOutlet();
531
+ }
507
532
  /** Merge columns with the given seperator
508
533
  *
509
534
  * @param columns string array to merge
@@ -927,6 +952,152 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
927
952
  }]
928
953
  }], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: i2$1.EnvironmentProxy }] });
929
954
 
955
+ class ButtonRenderer {
956
+ params = null;
957
+ label = '';
958
+ type = '';
959
+ toggleValue = null;
960
+ editValid = false;
961
+ historyValid = false;
962
+ lineValid = false;
963
+ popupSelectValid = false;
964
+ popupEditValid = false;
965
+ toggleValid = false;
966
+ toggle_icon = '';
967
+ none = false;
968
+ addValid = false;
969
+ deleteValid = false;
970
+ agInit(params) {
971
+ this.params = params;
972
+ this.type = this.params.type || null;
973
+ this.label = this.params.label || null;
974
+ this.toggleValue = this.params.value || null;
975
+ switch (this.toggleValue) {
976
+ case true:
977
+ this.toggle_icon = 'select_check_box';
978
+ break;
979
+ case false:
980
+ this.toggle_icon = 'check_box_outline_blank';
981
+ break;
982
+ default:
983
+ this.toggle_icon = '';
984
+ break;
985
+ }
986
+ this.resetValids();
987
+ switch (this.type.toLowerCase().trim()) {
988
+ case 'edit':
989
+ this.editValid = true;
990
+ break;
991
+ case 'log':
992
+ this.historyValid = true;
993
+ break;
994
+ case 'line':
995
+ this.lineValid = true;
996
+ break;
997
+ case 'popupselect':
998
+ this.popupSelectValid = true;
999
+ break;
1000
+ case 'toggle':
1001
+ this.toggleValid = true;
1002
+ break;
1003
+ case 'none':
1004
+ this.none = true;
1005
+ break;
1006
+ case 'add':
1007
+ this.addValid = true;
1008
+ break;
1009
+ case 'delete':
1010
+ this.deleteValid = true;
1011
+ break;
1012
+ default:
1013
+ this.popupEditValid = true;
1014
+ break;
1015
+ }
1016
+ }
1017
+ /** Refresh the display
1018
+ *
1019
+ * @param params
1020
+ * @returns
1021
+ */
1022
+ refresh(params) {
1023
+ return false;
1024
+ }
1025
+ resetValids() {
1026
+ this.editValid = false;
1027
+ this.historyValid = false;
1028
+ this.lineValid = false;
1029
+ this.popupSelectValid = false;
1030
+ this.popupEditValid = false;
1031
+ this.toggleValid = false;
1032
+ }
1033
+ onClick(event) {
1034
+ if (this.params.onClick instanceof Function) {
1035
+ // put anything into params u want pass into parents component
1036
+ const params = {
1037
+ event: event,
1038
+ rowData: this.params.node.data,
1039
+ type: this.type,
1040
+ // ...something
1041
+ };
1042
+ this.params.onClick(params);
1043
+ }
1044
+ }
1045
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ButtonRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
1046
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.7", type: ButtonRenderer, isStandalone: true, selector: "ntybase-button-renderer", ngImport: i0, template: "<mat-icon\n *ngIf=\"(editValid || popupEditValid)\"\n class=\"cursor center edit\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"4000\"\n >edit</mat-icon\n>\n\n<mat-icon\n *ngIf=\"historyValid\"\n class=\"cursor center-log\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >log</mat-icon\n>\n\n<mat-icon\n *ngIf=\"historyValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >history</mat-icon\n>\n<mat-icon\n *ngIf=\"lineValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n<mat-icon\n *ngIf=\"popupSelectValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >content_copy</mat-icon\n>\n<mat-icon\n *ngIf=\"toggleValid\"\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<mat-icon\n *ngIf=\"none\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n<mat-icon\n *ngIf=\"addValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >playlist_add</mat-icon\n>\n<mat-icon\n *ngIf=\"deleteValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >delete_outline</mat-icon\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: CommonModule }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3$2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatMenuModule }] });
1047
+ }
1048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ButtonRenderer, decorators: [{
1049
+ type: Component,
1050
+ args: [{ selector: 'ntybase-button-renderer', imports: [MatIconModule, CommonModule, MatTooltipModule, MatMenuModule], template: "<mat-icon\n *ngIf=\"(editValid || popupEditValid)\"\n class=\"cursor center edit\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"4000\"\n >edit</mat-icon\n>\n\n<mat-icon\n *ngIf=\"historyValid\"\n class=\"cursor center-log\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >log</mat-icon\n>\n\n<mat-icon\n *ngIf=\"historyValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >history</mat-icon\n>\n<mat-icon\n *ngIf=\"lineValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n<mat-icon\n *ngIf=\"popupSelectValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >content_copy</mat-icon\n>\n<mat-icon\n *ngIf=\"toggleValid\"\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<mat-icon\n *ngIf=\"none\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n<mat-icon\n *ngIf=\"addValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >playlist_add</mat-icon\n>\n<mat-icon\n *ngIf=\"deleteValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >delete_outline</mat-icon\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"] }]
1051
+ }] });
1052
+
1053
+ class CheckboxRenderer {
1054
+ params = null;
1055
+ label = '';
1056
+ type = '';
1057
+ supportClick = false;
1058
+ checked = null;
1059
+ agInit(params) {
1060
+ this.onProcess(params);
1061
+ }
1062
+ refresh(params) {
1063
+ if (params != null) {
1064
+ this.onProcess(params);
1065
+ }
1066
+ return true;
1067
+ }
1068
+ onProcess(params) {
1069
+ this.params = params;
1070
+ this.checked = this.params.value ?? false;
1071
+ this.type = this.params.type || null;
1072
+ this.label = this.params.label || null;
1073
+ if (this.type != null) {
1074
+ if (this.type.toLowerCase().trim() == 'click') {
1075
+ this.supportClick = true;
1076
+ }
1077
+ }
1078
+ }
1079
+ onClick(event) {
1080
+ this.checked = !this.checked;
1081
+ if (this.params.onClick instanceof Function) {
1082
+ // put anything into params u want pass into parents component
1083
+ const params = {
1084
+ event: event,
1085
+ rowData: this.params.node.data,
1086
+ type: this.type,
1087
+ checked: this.checked,
1088
+ // ...something
1089
+ };
1090
+ this.params.onClick(params);
1091
+ }
1092
+ }
1093
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CheckboxRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
1094
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.7", type: CheckboxRenderer, isStandalone: true, selector: "ntybase-checkbox-renderer", ngImport: i0, template: "<input\n *ngIf=\"supportClick\"\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n<input\n *ngIf=\"!supportClick\"\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"params.value\"\n disabled\n/>\n<label for=\"checkbox\">{{label}}</label>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1095
+ }
1096
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CheckboxRenderer, decorators: [{
1097
+ type: Component,
1098
+ args: [{ selector: 'ntybase-checkbox-renderer', imports: [CommonModule], template: "<input\n *ngIf=\"supportClick\"\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n<input\n *ngIf=\"!supportClick\"\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"params.value\"\n disabled\n/>\n<label for=\"checkbox\">{{label}}</label>\n" }]
1099
+ }] });
1100
+
930
1101
  ModuleRegistry.registerModules([
931
1102
  AllCommunityModule,
932
1103
  StatusBarModule,
@@ -950,6 +1121,7 @@ class AgGridBase {
950
1121
  popupFilterValid = input(false, ...(ngDevMode ? [{ debugName: "popupFilterValid" }] : []));
951
1122
  popupValid = input(false, ...(ngDevMode ? [{ debugName: "popupValid" }] : []));
952
1123
  params = input('', ...(ngDevMode ? [{ debugName: "params" }] : []));
1124
+ parameters = input('', ...(ngDevMode ? [{ debugName: "parameters" }] : []));
953
1125
  // Authentication
954
1126
  authenticationList = [];
955
1127
  // User access writes
@@ -1012,8 +1184,8 @@ class AgGridBase {
1012
1184
  sortable: true,
1013
1185
  resizable: true,
1014
1186
  filter: true,
1015
- minWidth: 120,
1016
- maxWidth: 120,
1187
+ minWidth: 60,
1188
+ maxWidth: 60,
1017
1189
  suppressSizeToFit: true,
1018
1190
  colId: 'editColumn',
1019
1191
  cellRenderer: 'buttonRenderer',
@@ -1277,32 +1449,6 @@ class AgGridBase {
1277
1449
  backClicked() {
1278
1450
  this.commonService.goBack();
1279
1451
  }
1280
- async deleteSelected() {
1281
- if (!this.gridApi)
1282
- return;
1283
- const selectedNodes = this.gridApi.getSelectedNodes();
1284
- if (selectedNodes.length === 0) {
1285
- await this.alertService.showAlert('@PleaseSelectRowToDelete');
1286
- return;
1287
- }
1288
- const confirmed = await this.alertService.showConfirm('@ConfirmDeleteSelectedRecords');
1289
- if (confirmed) {
1290
- const selectedRows = selectedNodes.map((node) => node.data);
1291
- this.deleteRows(selectedRows);
1292
- }
1293
- }
1294
- async refreshData() {
1295
- try {
1296
- const freshData = await this.loadFreshData();
1297
- if (this.gridApi?.setGridOption) {
1298
- this.gridApi.setGridOption('rowData', freshData);
1299
- }
1300
- await this.alertService.showAlert('@DataRefreshedSuccessfully');
1301
- }
1302
- catch (err) {
1303
- this.alertService.showError(err);
1304
- }
1305
- }
1306
1452
  gotoURL(routePrefix, rightSidenav = [], parameters, type, isNewTab = false, embedded = false, dialogComponent) {
1307
1453
  const navigationExtras = {
1308
1454
  queryParams: {
@@ -1333,7 +1479,7 @@ class AgGridBase {
1333
1479
  .afterClosed()
1334
1480
  .subscribe((result) => {
1335
1481
  if (result === 'saved') {
1336
- this.refreshData();
1482
+ this.updateRowInGrid;
1337
1483
  }
1338
1484
  });
1339
1485
  return;
@@ -1377,6 +1523,10 @@ class AgGridBase {
1377
1523
  * - The update type doesn't match
1378
1524
  */
1379
1525
  constructor() {
1526
+ this.frameworkComponents = {
1527
+ buttonRenderer: ButtonRenderer,
1528
+ checkboxRenderer: CheckboxRenderer,
1529
+ };
1380
1530
  effect(() => {
1381
1531
  const update = this.commonService.updates();
1382
1532
  if (!update || !this.gridApi)
@@ -1414,6 +1564,21 @@ class AgGridBase {
1414
1564
  this.loadData(); // Reload all data if row not found
1415
1565
  }
1416
1566
  }
1567
+ async deleteSelected() {
1568
+ if (!this.gridApi)
1569
+ return;
1570
+ const selectedNodes = this.gridApi.getSelectedNodes();
1571
+ if (selectedNodes.length === 0) {
1572
+ await this.alertService.showAlert('@PleaseSelectRowToDelete');
1573
+ return;
1574
+ }
1575
+ const confirmed = await this.alertService.showConfirm('@ConfirmDeleteSelectedRecords');
1576
+ if (confirmed) {
1577
+ const selectedRows = selectedNodes.map((node) => node.data);
1578
+ this.deleteRows?.(selectedRows);
1579
+ this.gridApi.applyTransaction({ remove: selectedRows });
1580
+ }
1581
+ }
1417
1582
  /**
1418
1583
  * Delete a row from the grid
1419
1584
  * @param rowData The row to delete
@@ -1421,6 +1586,18 @@ class AgGridBase {
1421
1586
  deleteRowFromGrid(rowData) {
1422
1587
  this.gridApi.applyTransaction({ remove: [rowData] });
1423
1588
  }
1589
+ async refreshData() {
1590
+ try {
1591
+ const freshData = await this.loadFreshData?.();
1592
+ if (this.gridApi?.setGridOption) {
1593
+ this.gridApi.setGridOption('rowData', freshData);
1594
+ }
1595
+ await this.alertService.showAlert('@DataRefreshedSuccessfully');
1596
+ }
1597
+ catch (err) {
1598
+ this.alertService.showError(err);
1599
+ }
1600
+ }
1424
1601
  async setAccessRights() {
1425
1602
  this.authenticationList = await lastValueFrom(this.sysFunctionProxy.getAuthentication(this.componentName())).catch((e) => {
1426
1603
  return throwError(() => new Error(e));
@@ -1458,7 +1635,7 @@ class AgGridBase {
1458
1635
  return true;
1459
1636
  }
1460
1637
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1461
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, filterField: { classPropertyName: "filterField", publicName: "filterField", isSignal: true, isRequired: false, transformFunction: null }, filterFieldValue: { classPropertyName: "filterFieldValue", publicName: "filterFieldValue", isSignal: true, isRequired: false, transformFunction: null }, filterFieldNumeric: { classPropertyName: "filterFieldNumeric", publicName: "filterFieldNumeric", isSignal: true, isRequired: false, transformFunction: null }, filterFieldEquality: { classPropertyName: "filterFieldEquality", publicName: "filterFieldEquality", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedElement: "selectedElement" }, ngImport: i0, template: "<p>ag-grid-base works!</p>\n", styles: [""] });
1638
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, filterField: { classPropertyName: "filterField", publicName: "filterField", isSignal: true, isRequired: false, transformFunction: null }, filterFieldValue: { classPropertyName: "filterFieldValue", publicName: "filterFieldValue", isSignal: true, isRequired: false, transformFunction: null }, filterFieldNumeric: { classPropertyName: "filterFieldNumeric", publicName: "filterFieldNumeric", isSignal: true, isRequired: false, transformFunction: null }, filterFieldEquality: { classPropertyName: "filterFieldEquality", publicName: "filterFieldEquality", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedElement: "selectedElement" }, ngImport: i0, template: "<p>ag-grid-base works!</p>\n", styles: [""] });
1462
1639
  }
1463
1640
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AgGridBase, decorators: [{
1464
1641
  type: Component,
@@ -1471,10 +1648,12 @@ class AgGridSaveBase {
1471
1648
  route = inject(ActivatedRoute);
1472
1649
  commonService = inject(CommonService);
1473
1650
  alertService = inject(AlertService);
1651
+ parameters = '';
1474
1652
  currentItem = signal({}, ...(ngDevMode ? [{ debugName: "currentItem" }] : []));
1475
1653
  initialItem = {};
1476
1654
  // Form tracking
1477
1655
  formChanged = false;
1656
+ saveForm;
1478
1657
  // Signals
1479
1658
  viewMode = signal('sidenav', ...(ngDevMode ? [{ debugName: "viewMode" }] : []));
1480
1659
  // Dialog related properties
@@ -1549,157 +1728,52 @@ class AgGridSaveBase {
1549
1728
  }
1550
1729
  }
1551
1730
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AgGridSaveBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1552
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AgGridSaveBase, isStandalone: true, selector: "ntybase-ag-grid-save-base", inputs: { embedded: { classPropertyName: "embedded", publicName: "embedded", isSignal: true, isRequired: false, transformFunction: null }, closeAfterSave: { classPropertyName: "closeAfterSave", publicName: "closeAfterSave", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeAfterSave: "closeAfterSaveChange" }, ngImport: i0, template: "<p>ag-grid-save-base works!</p>\n", styles: [""] });
1731
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AgGridSaveBase, isStandalone: true, selector: "ntybase-ag-grid-save-base", inputs: { parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: false, isRequired: false, transformFunction: null }, embedded: { classPropertyName: "embedded", publicName: "embedded", isSignal: true, isRequired: false, transformFunction: null }, closeAfterSave: { classPropertyName: "closeAfterSave", publicName: "closeAfterSave", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeAfterSave: "closeAfterSaveChange" }, viewQueries: [{ propertyName: "saveForm", first: true, predicate: ["saveForm"], descendants: true }], ngImport: i0, template: "<p>ag-grid-save-base works!</p>\n", styles: [""] });
1553
1732
  }
1554
1733
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AgGridSaveBase, decorators: [{
1555
1734
  type: Component,
1556
1735
  args: [{ selector: 'ntybase-ag-grid-save-base', imports: [], template: "<p>ag-grid-save-base works!</p>\n" }]
1557
- }] });
1558
-
1559
- class ButtonRenderer {
1560
- params = null;
1561
- label = '';
1562
- type = '';
1563
- toggleValue = null;
1564
- editValid = false;
1565
- historyValid = false;
1566
- lineValid = false;
1567
- popupSelectValid = false;
1568
- popupEditValid = false;
1569
- toggleValid = false;
1570
- toggle_icon = '';
1571
- none = false;
1572
- addValid = false;
1573
- deleteValid = false;
1574
- agInit(params) {
1575
- this.params = params;
1576
- this.type = this.params.type || null;
1577
- this.label = this.params.label || null;
1578
- this.toggleValue = this.params.value || null;
1579
- switch (this.toggleValue) {
1580
- case true:
1581
- this.toggle_icon = 'select_check_box';
1582
- break;
1583
- case false:
1584
- this.toggle_icon = 'check_box_outline_blank';
1585
- break;
1586
- default:
1587
- this.toggle_icon = '';
1588
- break;
1589
- }
1590
- this.resetValids();
1591
- switch (this.type.toLowerCase().trim()) {
1592
- case 'edit':
1593
- this.editValid = true;
1594
- break;
1595
- case 'log':
1596
- this.historyValid = true;
1597
- break;
1598
- case 'line':
1599
- this.lineValid = true;
1600
- break;
1601
- case 'popupselect':
1602
- this.popupSelectValid = true;
1603
- break;
1604
- case 'toggle':
1605
- this.toggleValid = true;
1606
- break;
1607
- case 'none':
1608
- this.none = true;
1609
- break;
1610
- case 'add':
1611
- this.addValid = true;
1612
- break;
1613
- case 'delete':
1614
- this.deleteValid = true;
1615
- break;
1616
- default:
1617
- this.popupEditValid = true;
1618
- break;
1619
- }
1620
- }
1621
- /** Refresh the display
1622
- *
1623
- * @param params
1624
- * @returns
1625
- */
1626
- refresh(params) {
1627
- return false;
1628
- }
1629
- resetValids() {
1630
- this.editValid = false;
1631
- this.historyValid = false;
1632
- this.lineValid = false;
1633
- this.popupSelectValid = false;
1634
- this.popupEditValid = false;
1635
- this.toggleValid = false;
1636
- }
1637
- onClick(event) {
1638
- if (this.params.onClick instanceof Function) {
1639
- // put anything into params u want pass into parents component
1640
- const params = {
1641
- event: event,
1642
- rowData: this.params.node.data,
1643
- type: this.type,
1644
- // ...something
1645
- };
1646
- this.params.onClick(params);
1647
- }
1648
- }
1649
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ButtonRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
1650
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.7", type: ButtonRenderer, isStandalone: true, selector: "ntybase-button-renderer", ngImport: i0, template: "<mat-icon\n *ngIf=\"(editValid || popupEditValid)\"\n class=\"cursor center edit\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"4000\"\n >edit</mat-icon\n>\n\n<mat-icon\n *ngIf=\"historyValid\"\n class=\"cursor center-log\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >log</mat-icon\n>\n\n<mat-icon\n *ngIf=\"historyValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >history</mat-icon\n>\n<mat-icon\n *ngIf=\"lineValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n<mat-icon\n *ngIf=\"popupSelectValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >content_copy</mat-icon\n>\n<mat-icon\n *ngIf=\"toggleValid\"\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<mat-icon\n *ngIf=\"none\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n<mat-icon\n *ngIf=\"addValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >playlist_add</mat-icon\n>\n<mat-icon\n *ngIf=\"deleteValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >delete_outline</mat-icon\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: CommonModule }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3$2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatMenuModule }] });
1651
- }
1652
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ButtonRenderer, decorators: [{
1653
- type: Component,
1654
- args: [{ selector: 'ntybase-button-renderer', imports: [MatIconModule, CommonModule, MatTooltipModule, MatMenuModule], template: "<mat-icon\n *ngIf=\"(editValid || popupEditValid)\"\n class=\"cursor center edit\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"4000\"\n >edit</mat-icon\n>\n\n<mat-icon\n *ngIf=\"historyValid\"\n class=\"cursor center-log\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >log</mat-icon\n>\n\n<mat-icon\n *ngIf=\"historyValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >history</mat-icon\n>\n<mat-icon\n *ngIf=\"lineValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n<mat-icon\n *ngIf=\"popupSelectValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >content_copy</mat-icon\n>\n<mat-icon\n *ngIf=\"toggleValid\"\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<mat-icon\n *ngIf=\"none\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n [matTooltipShowDelay]=\"3000\"\n >menu_open</mat-icon\n>\n<mat-icon\n *ngIf=\"addValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >playlist_add</mat-icon\n>\n<mat-icon\n *ngIf=\"deleteValid\"\n class=\"cursor center\"\n matTooltip=\"{{label}}\"\n (click)=\"onClick($event)\"\n [matTooltipShowDelay]=\"3000\"\n >delete_outline</mat-icon\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"] }]
1655
- }] });
1736
+ }], propDecorators: { parameters: [{
1737
+ type: Input
1738
+ }], saveForm: [{
1739
+ type: ViewChild,
1740
+ args: ['saveForm']
1741
+ }] } });
1656
1742
 
1657
- class CheckboxRenderer {
1658
- params = null;
1659
- label = '';
1660
- type = '';
1661
- supportClick = false;
1662
- checked = null;
1663
- agInit(params) {
1664
- this.onProcess(params);
1665
- }
1666
- refresh(params) {
1667
- if (params != null) {
1668
- this.onProcess(params);
1669
- }
1670
- return true;
1671
- }
1672
- onProcess(params) {
1673
- this.params = params;
1674
- this.checked = this.params.value ?? false;
1675
- this.type = this.params.type || null;
1676
- this.label = this.params.label || null;
1677
- if (this.type != null) {
1678
- if (this.type.toLowerCase().trim() == 'click') {
1679
- this.supportClick = true;
1680
- }
1681
- }
1682
- }
1683
- onClick(event) {
1684
- this.checked = !this.checked;
1685
- if (this.params.onClick instanceof Function) {
1686
- // put anything into params u want pass into parents component
1687
- const params = {
1688
- event: event,
1689
- rowData: this.params.node.data,
1690
- type: this.type,
1691
- checked: this.checked,
1692
- // ...something
1693
- };
1694
- this.params.onClick(params);
1695
- }
1743
+ class ExcelImportBase extends AgGridBase {
1744
+ dataList = [];
1745
+ wopts = { bookType: 'xlsx', type: 'array' };
1746
+ fileName = 'PayrollJournalTrans.xlsx';
1747
+ isDataValidated = false;
1748
+ /*******************************
1749
+ *** EXCEL UPLOAD FUNCTIONS ***
1750
+ *******************************/
1751
+ onFileChange(evt) {
1752
+ /* wire up file reader */
1753
+ const target = evt.target;
1754
+ if (target.files.length !== 1) {
1755
+ throw new Error('Cannot use multiple files');
1756
+ }
1757
+ const reader = new FileReader();
1758
+ reader.onload = (e) => {
1759
+ /* read workbook */
1760
+ const bstr = e.target.result;
1761
+ const wb = XLSX.read(bstr, { type: 'binary' });
1762
+ /* grab first sheet */
1763
+ const wsname = wb.SheetNames[0];
1764
+ const ws = wb.Sheets[wsname];
1765
+ /* save data */
1766
+ this.dataList = XLSX.utils.sheet_to_json(ws, { header: 1 });
1767
+ console.log('dataList:', this.dataList);
1768
+ };
1769
+ reader.readAsBinaryString(target.files[0]);
1696
1770
  }
1697
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CheckboxRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
1698
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.7", type: CheckboxRenderer, isStandalone: true, selector: "ntybase-checkbox-renderer", ngImport: i0, template: "<input\n *ngIf=\"supportClick\"\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n<input\n *ngIf=\"!supportClick\"\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"params.value\"\n disabled\n/>\n<label for=\"checkbox\">{{label}}</label>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1771
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ExcelImportBase, deps: null, target: i0.ɵɵFactoryTarget.Component });
1772
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.7", type: ExcelImportBase, isStandalone: true, selector: "ntybase-excel-import-base", usesInheritance: true, ngImport: i0, template: "<p>excel-import-base works!</p>\n", styles: [""] });
1699
1773
  }
1700
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CheckboxRenderer, decorators: [{
1774
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ExcelImportBase, decorators: [{
1701
1775
  type: Component,
1702
- args: [{ selector: 'ntybase-checkbox-renderer', imports: [CommonModule], template: "<input\n *ngIf=\"supportClick\"\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n<input\n *ngIf=\"!supportClick\"\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"params.value\"\n disabled\n/>\n<label for=\"checkbox\">{{label}}</label>\n" }]
1776
+ args: [{ selector: 'ntybase-excel-import-base', imports: [], template: "<p>excel-import-base works!</p>\n" }]
1703
1777
  }] });
1704
1778
 
1705
1779
  class AuthenticationGuard {
@@ -2939,7 +3013,7 @@ class AutoCompletePopupMenu {
2939
3013
  return;
2940
3014
  // Split the component path into segments
2941
3015
  const pathSegments = this.componentPath.split('/').filter((p) => p);
2942
- this.GotoNewTab(pathSegments, '', 'new');
3016
+ this.gotoNewTab(pathSegments, '', 'new');
2943
3017
  this.Result.emit('New');
2944
3018
  }
2945
3019
  gotoMain() {
@@ -2947,7 +3021,7 @@ class AutoCompletePopupMenu {
2947
3021
  return;
2948
3022
  // Split the component path into segments
2949
3023
  const pathSegments = this.componentPath.split('/').filter((p) => p);
2950
- this.GotoNewTab(pathSegments, this.recordGuid, 'edit');
3024
+ this.gotoNewTab(pathSegments, this.recordGuid, 'edit');
2951
3025
  this.Result.emit('Main');
2952
3026
  }
2953
3027
  gotoLookup() {
@@ -2955,7 +3029,7 @@ class AutoCompletePopupMenu {
2955
3029
  this.Result.emit('Lookup');
2956
3030
  }
2957
3031
  }
2958
- GotoNewTab(target, params, type) {
3032
+ gotoNewTab(target, params, type) {
2959
3033
  if (!target || target.length === 0)
2960
3034
  return;
2961
3035
  // Construct the URL directly in the format you want
@@ -3283,6 +3357,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
3283
3357
  args: ['autoCompleteInput']
3284
3358
  }] } });
3285
3359
 
3360
+ class Filter {
3361
+ value;
3362
+ text;
3363
+ }
3364
+
3286
3365
  /*
3287
3366
  * Public API Surface of ntybase
3288
3367
  */
@@ -3291,5 +3370,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
3291
3370
  * Generated bundle index. Do not edit.
3292
3371
  */
3293
3372
 
3294
- 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 };
3373
+ 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 };
3295
3374
  //# sourceMappingURL=nettyapps-ntybase.mjs.map