@nettyapps/ntybase 21.1.13 → 21.1.15

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.
@@ -1334,6 +1334,7 @@ class NettyAgGridBase extends NettyAppsBase {
1334
1334
  commonService = inject(CommonService);
1335
1335
  sysFunctionProxy = inject(SysfunctionProxy);
1336
1336
  environment = inject(EnvironmentProxy);
1337
+ routerActive = inject(ActivatedRoute);
1337
1338
  // Button action management variables
1338
1339
  menuValid = signal(true, ...(ngDevMode ? [{ debugName: "menuValid" }] : [])); // true: Filter editbox is not visible so the menus are visible
1339
1340
  refreshButtonValid = signal(false, ...(ngDevMode ? [{ debugName: "refreshButtonValid" }] : [])); // true: Refresh button is enabled
@@ -1347,11 +1348,44 @@ class NettyAgGridBase extends NettyAppsBase {
1347
1348
  allowDelete = signal(false, ...(ngDevMode ? [{ debugName: "allowDelete" }] : []));
1348
1349
  allowLog = signal(false, ...(ngDevMode ? [{ debugName: "allowLog" }] : []));
1349
1350
  allowRead = signal(true, ...(ngDevMode ? [{ debugName: "allowRead" }] : []));
1351
+ // Parse query parameters
1352
+ // Parse query parameters
1353
+ queryParameterGUID = toSignal(this.routerActive.queryParamMap.pipe(map((params) => params.get('parameters')), map((value) => this.parseOrReturnValue(value))), {
1354
+ initialValue: null, // set initial value to null
1355
+ });
1356
+ queryParameterType = toSignal(this.routerActive.queryParamMap.pipe(map((params) => params.get('type')), map((value) => this.parseOrReturnValue(value))), {
1357
+ initialValue: null, // set initial value to null
1358
+ });
1350
1359
  // ---------------------------------------------------
1351
1360
  // --- RECORD LIST ---
1352
1361
  // ---------------------------------------------------
1353
1362
  recordList = signal([], ...(ngDevMode ? [{ debugName: "recordList" }] : []));
1354
1363
  record = null;
1364
+ constructor() {
1365
+ super();
1366
+ effect(() => {
1367
+ if (this.hasValidValue(this.componantParameterGUID())) {
1368
+ this.parameterGUID.set(this.componantParameterGUID());
1369
+ }
1370
+ else if (this.hasValidValue(this.queryParameterGUID())) {
1371
+ this.parameterGUID.set(this.queryParameterGUID());
1372
+ }
1373
+ if (this.hasValidValue(this.componantParameterType())) {
1374
+ this.parameterType.set(this.componantParameterType());
1375
+ }
1376
+ else if (this.hasValidValue(this.queryParameterType())) {
1377
+ this.parameterType.set(this.queryParameterType());
1378
+ }
1379
+ if (this.hasValidValue(this.parameterGUID())) {
1380
+ this.setFilter();
1381
+ this.loadData();
1382
+ }
1383
+ else if (!this._isPopupValid()) {
1384
+ // Clear right side nav if parameterGUID is not provided
1385
+ this.commonService.clearOutlet();
1386
+ }
1387
+ });
1388
+ }
1355
1389
  // ***************************************************************
1356
1390
  // *** METHODS For optional overide ***
1357
1391
  // ***************************************************************
@@ -1431,6 +1465,31 @@ class NettyAgGridBase extends NettyAppsBase {
1431
1465
  return true;
1432
1466
  }
1433
1467
  }
1468
+ /**
1469
+ * Validates if the given value is equal to null,undefined or ''
1470
+ * @param value
1471
+ * @returns true if has a valid value
1472
+ */
1473
+ hasValidValue(value) {
1474
+ if (value == null || value == undefined) {
1475
+ return false;
1476
+ }
1477
+ if (value == '') {
1478
+ return false;
1479
+ }
1480
+ return true;
1481
+ }
1482
+ parseOrReturnValue(value) {
1483
+ if (value) {
1484
+ try {
1485
+ return JSON.parse(value); // parse json
1486
+ }
1487
+ catch (e) {
1488
+ return value; // not a json retun value
1489
+ }
1490
+ }
1491
+ return null;
1492
+ }
1434
1493
  // *********************************************************
1435
1494
  // *** AG Grid Management ***
1436
1495
  // *********************************************************
@@ -1646,32 +1705,11 @@ class NettyAgGridBase extends NettyAppsBase {
1646
1705
  }
1647
1706
  // ---------------------------------------------
1648
1707
  // --- Functions to Show / Hide Grid Columns ---
1649
- // ---------------------------------------------
1708
+ // ---------------------------------------------
1650
1709
  onShowHideColumns() {
1651
1710
  this.gridColumnsVisible.update((a) => !a);
1652
1711
  this.initAgGrid();
1653
1712
  }
1654
- // showHideColumnsAsync() {
1655
- // setTimeout(() => this.showHideColumns(), 400);
1656
- // }
1657
- // showHideColumns() {
1658
- // var fields = this.columnDefs()
1659
- // .filter((columnDef: any) => columnDef.ntyHide === 'x')
1660
- // .map((columnDef: any) => columnDef.field);
1661
- // this.gridApi?.setColumnsVisible(fields, this.gridColumnsVisible());
1662
- // }
1663
- // showHideEmbeddedColumnsAsync() {
1664
- // setTimeout(() => this.showHideEmbeddedColumns(), 100);
1665
- // }
1666
- // showHideEmbeddedColumns() {
1667
- // if (this.columnDefs() == undefined || this.columnDefs() == null) {
1668
- // return;
1669
- // }
1670
- // var fields = this.columnDefs()
1671
- // .filter((columnDef: any) => columnDef.ntyEmbeddedHide == 'x')
1672
- // .map((columnDef: any) => columnDef.field);
1673
- // this.gridApi?.setColumnsVisible(fields, !this._isEmbedded());
1674
- // }
1675
1713
  isHidden(isEmbeddedHide, isVisibleHide) {
1676
1714
  const isEmbedded = this._isEmbedded();
1677
1715
  const isVisibleSwitchOn = this.gridColumnsVisible();
@@ -1716,13 +1754,13 @@ class NettyAgGridBase extends NettyAppsBase {
1716
1754
  };
1717
1755
  console.log(message, inputs);
1718
1756
  }
1719
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, deps: null, target: i0.ɵɵFactoryTarget.Component });
1757
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1720
1758
  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 });
1721
1759
  }
1722
1760
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, decorators: [{
1723
1761
  type: Component,
1724
1762
  args: [{ selector: 'ntybase-ag-grid-base', imports: [], template: ``, host: { 'ntybase-id': 'NettyAgGridBase' } }]
1725
- }], 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 }] }] } });
1763
+ }], 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 }] }] } });
1726
1764
 
1727
1765
  class ButtonRenderer {
1728
1766
  params = null;
@@ -1879,15 +1917,7 @@ class NettyAgGridListBase extends NettyAgGridBase {
1879
1917
  // ********************************************
1880
1918
  // Services
1881
1919
  router = inject(Router);
1882
- routerActive = inject(ActivatedRoute);
1883
1920
  dialog = inject(MatDialog);
1884
- // Parse query parameters
1885
- queryParameterGUID = toSignal(this.routerActive.queryParamMap.pipe(map((params) => params.get('parameters')), map((value) => this.parseOrReturnValue(value))), {
1886
- initialValue: null, // set initial value to null
1887
- });
1888
- queryParameterType = toSignal(this.routerActive.queryParamMap.pipe(map((params) => params.get('type')), map((value) => this.parseOrReturnValue(value))), {
1889
- initialValue: null, // set initial value to null
1890
- });
1891
1921
  openInPopup = signal(false, ...(ngDevMode ? [{ debugName: "openInPopup" }] : [])); // true: Open add / edit component in popup
1892
1922
  // ---------------------------------------------------
1893
1923
  // --- RECORD LIST ---
@@ -1908,17 +1938,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
1908
1938
  await this.nettyAgGridService.copyGridUserPereferenceToLocal(this.preferenceType());
1909
1939
  await this.AfterOnInit();
1910
1940
  }
1911
- parseOrReturnValue(value) {
1912
- if (value) {
1913
- try {
1914
- return JSON.parse(value); // parse json
1915
- }
1916
- catch (e) {
1917
- return value; // not a json retun value
1918
- }
1919
- }
1920
- return null;
1921
- }
1922
1941
  gotoURL(routePrefix, rightSidenav = [], parameters, type, dialogComponent = null, isNewTab = false, isPopup = this._isEmbedded()) {
1923
1942
  const baseHref = this.environment.getBaseHref().endsWith('/')
1924
1943
  ? this.environment.getBaseHref().slice(0, -1) // Sondaki / işaretini kaldır
@@ -2018,28 +2037,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
2018
2037
  this.translateService.onLangChange.subscribe(() => {
2019
2038
  this.setAgGridTranslations();
2020
2039
  });
2021
- effect(() => {
2022
- if (this.hasValidValue(this.componantParameterGUID())) {
2023
- this.parameterGUID.set(this.componantParameterGUID());
2024
- }
2025
- else if (this.hasValidValue(this.queryParameterGUID())) {
2026
- this.parameterGUID.set(this.queryParameterGUID());
2027
- }
2028
- if (this.hasValidValue(this.componantParameterType())) {
2029
- this.parameterType.set(this.componantParameterType());
2030
- }
2031
- else if (this.hasValidValue(this.queryParameterType())) {
2032
- this.parameterType.set(this.queryParameterType());
2033
- }
2034
- if (this.hasValidValue(this.parameterGUID())) {
2035
- this.setFilter();
2036
- this.loadData();
2037
- }
2038
- else if (!this._isPopupValid()) {
2039
- // Clear right side nav if parameterGUID is not provided
2040
- this.commonService.clearOutlet();
2041
- }
2042
- });
2043
2040
  effect(() => {
2044
2041
  const update = this.commonService.updates();
2045
2042
  if (!update || !this.gridApi)
@@ -2081,20 +2078,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
2081
2078
  }
2082
2079
  });
2083
2080
  }
2084
- /**
2085
- * Validates if the given value is equal to null,undefined or ''
2086
- * @param value
2087
- * @returns true if has a valid value
2088
- */
2089
- hasValidValue(value) {
2090
- if (value == null || value == undefined) {
2091
- return false;
2092
- }
2093
- if (value == '') {
2094
- return false;
2095
- }
2096
- return true;
2097
- }
2098
2081
  // *********************************************************
2099
2082
  // *** Data Management Functions ***
2100
2083
  // *********************************************************