@nettyapps/ntybase 21.1.13 → 21.1.14

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
  // *********************************************************
@@ -1647,31 +1706,6 @@ class NettyAgGridBase extends NettyAppsBase {
1647
1706
  // ---------------------------------------------
1648
1707
  // --- Functions to Show / Hide Grid Columns ---
1649
1708
  // ---------------------------------------------
1650
- onShowHideColumns() {
1651
- this.gridColumnsVisible.update((a) => !a);
1652
- this.initAgGrid();
1653
- }
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
1709
  isHidden(isEmbeddedHide, isVisibleHide) {
1676
1710
  const isEmbedded = this._isEmbedded();
1677
1711
  const isVisibleSwitchOn = this.gridColumnsVisible();
@@ -1716,13 +1750,13 @@ class NettyAgGridBase extends NettyAppsBase {
1716
1750
  };
1717
1751
  console.log(message, inputs);
1718
1752
  }
1719
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, deps: null, target: i0.ɵɵFactoryTarget.Component });
1753
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1720
1754
  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
1755
  }
1722
1756
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAgGridBase, decorators: [{
1723
1757
  type: Component,
1724
1758
  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 }] }] } });
1759
+ }], 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
1760
 
1727
1761
  class ButtonRenderer {
1728
1762
  params = null;
@@ -1879,15 +1913,7 @@ class NettyAgGridListBase extends NettyAgGridBase {
1879
1913
  // ********************************************
1880
1914
  // Services
1881
1915
  router = inject(Router);
1882
- routerActive = inject(ActivatedRoute);
1883
1916
  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
1917
  openInPopup = signal(false, ...(ngDevMode ? [{ debugName: "openInPopup" }] : [])); // true: Open add / edit component in popup
1892
1918
  // ---------------------------------------------------
1893
1919
  // --- RECORD LIST ---
@@ -1908,17 +1934,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
1908
1934
  await this.nettyAgGridService.copyGridUserPereferenceToLocal(this.preferenceType());
1909
1935
  await this.AfterOnInit();
1910
1936
  }
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
1937
  gotoURL(routePrefix, rightSidenav = [], parameters, type, dialogComponent = null, isNewTab = false, isPopup = this._isEmbedded()) {
1923
1938
  const baseHref = this.environment.getBaseHref().endsWith('/')
1924
1939
  ? this.environment.getBaseHref().slice(0, -1) // Sondaki / işaretini kaldır
@@ -2018,28 +2033,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
2018
2033
  this.translateService.onLangChange.subscribe(() => {
2019
2034
  this.setAgGridTranslations();
2020
2035
  });
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
2036
  effect(() => {
2044
2037
  const update = this.commonService.updates();
2045
2038
  if (!update || !this.gridApi)
@@ -2081,20 +2074,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
2081
2074
  }
2082
2075
  });
2083
2076
  }
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
2077
  // *********************************************************
2099
2078
  // *** Data Management Functions ***
2100
2079
  // *********************************************************