@nettyapps/ntybase 21.1.12 → 21.1.13

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, input, computed, signal, output, effect, linkedSignal, ViewChild, model, Input, InjectionToken, Optional, Inject } from '@angular/core';
2
+ import { Component, Injectable, inject, NgModule, signal, input, computed, effect, output, linkedSignal, ViewChild, model, Input, InjectionToken, Optional, Inject } from '@angular/core';
3
3
  import * as i1$3 from '@angular/common/http';
4
4
  import { HttpErrorResponse, HttpResponse, HTTP_INTERCEPTORS, HttpClient, HttpHeaders } from '@angular/common/http';
5
5
  import { of, throwError, Subject, lastValueFrom, map, catchError as catchError$1, finalize, take as take$1, takeUntil } from 'rxjs';
@@ -19,6 +19,7 @@ import * as i1$2 from '@angular/material/snack-bar';
19
19
  import { MatSnackBarModule } from '@angular/material/snack-bar';
20
20
  import * as i1$1 from '@ngx-translate/core';
21
21
  import { TranslateModule, TranslateService } from '@ngx-translate/core';
22
+ import { Title } from '@angular/platform-browser';
22
23
  import { Mutex } from 'async-mutex';
23
24
  import { themeQuartz, StatusBarModule, ClipboardModule, ExcelExportModule, ColumnMenuModule, ContextMenuModule, CellSelectionModule, RowSelectionModule } from 'ag-grid-enterprise';
24
25
  import { toSignal } from '@angular/core/rxjs-interop';
@@ -27,7 +28,6 @@ import * as i2$2 from '@angular/material/tooltip';
27
28
  import { MatTooltipModule } from '@angular/material/tooltip';
28
29
  import * as i2$3 from '@angular/material/menu';
29
30
  import { MatMenuModule } from '@angular/material/menu';
30
- import { Title } from '@angular/platform-browser';
31
31
  import * as XLSX from 'xlsx';
32
32
  import { I18nService } from '@nettyapps/ntyi18n';
33
33
  import * as i1$4 from '@angular/forms';
@@ -422,6 +422,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
422
422
  }]
423
423
  }], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: i1.MatDialog }, { type: i1$1.TranslateService }] });
424
424
 
425
+ class PageTitle {
426
+ title = signal('', ...(ngDevMode ? [{ debugName: "title" }] : []));
427
+ setTitle(newTitle) {
428
+ this.title.set(newTitle);
429
+ }
430
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
431
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, providedIn: 'root' });
432
+ }
433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, decorators: [{
434
+ type: Injectable,
435
+ args: [{
436
+ providedIn: 'root',
437
+ }]
438
+ }] });
439
+
425
440
  class NettyAppsBase {
426
441
  // ********************************************
427
442
  // *** INPUTS ***
@@ -429,10 +444,38 @@ class NettyAppsBase {
429
444
  embedded = input(false, ...(ngDevMode ? [{ debugName: "embedded" }] : [])); // Is the form embedded to an other component
430
445
  _isEmbedded = computed(() => this.embedded() ?? false, ...(ngDevMode ? [{ debugName: "_isEmbedded" }] : []));
431
446
  // ---------------------------------
447
+ // --- PAGE TITLE & STATE ---
448
+ // ---------------------------------
449
+ pageName = signal('', ...(ngDevMode ? [{ debugName: "pageName" }] : []));
450
+ currentPageTitle = computed(() => {
451
+ const name = this.pageName();
452
+ return name ? name.startsWith('@') ? name : `@${name}` : '@Page_Title';
453
+ }, ...(ngDevMode ? [{ debugName: "currentPageTitle" }] : []));
454
+ // ---------------------------------
432
455
  // --- SERVICES ---
433
456
  // ---------------------------------
434
457
  alertService = inject(AlertService);
435
458
  translateService = inject(TranslateService);
459
+ pageTitleService = inject(PageTitle);
460
+ titleService = inject(Title);
461
+ // ---------------------------------
462
+ // --- LIFECYLE ---
463
+ // ---------------------------------
464
+ constructor() {
465
+ effect(() => {
466
+ const name = this.pageName();
467
+ if (name) {
468
+ const translationKey = name.startsWith('@') ? name : `@${name}`;
469
+ this.translateService.stream(translationKey).subscribe((translated) => {
470
+ if (translated == translationKey) {
471
+ translated = name;
472
+ }
473
+ this.titleService.setTitle(`${translated}`);
474
+ this.pageTitleService.setTitle(translated);
475
+ });
476
+ }
477
+ });
478
+ }
436
479
  // ---------------------------------
437
480
  // --- DOWNLOAD METHODS ---
438
481
  // ---------------------------------
@@ -548,7 +591,7 @@ class NettyAppsBase {
548
591
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyAppsBase, decorators: [{
549
592
  type: Component,
550
593
  args: [{ selector: 'ntybase-netty-apps-base', imports: [], template: `` }]
551
- }], propDecorators: { embedded: [{ type: i0.Input, args: [{ isSignal: true, alias: "embedded", required: false }] }] } });
594
+ }], ctorParameters: () => [], propDecorators: { embedded: [{ type: i0.Input, args: [{ isSignal: true, alias: "embedded", required: false }] }] } });
552
595
 
553
596
  class NettyHelper {
554
597
  /**
@@ -1283,7 +1326,6 @@ class NettyAgGridBase extends NettyAppsBase {
1283
1326
  searchValueName = signal('Invalid_searchValue', ...(ngDevMode ? [{ debugName: "searchValueName" }] : []));
1284
1327
  preferenceType = signal('Invalid_columnState', ...(ngDevMode ? [{ debugName: "preferenceType" }] : []));
1285
1328
  searchValue = signal('', ...(ngDevMode ? [{ debugName: "searchValue" }] : []));
1286
- pageName = signal('', ...(ngDevMode ? [{ debugName: "pageName" }] : []));
1287
1329
  // Query Parameters can be provide as parameters
1288
1330
  parameterGUID = signal('', ...(ngDevMode ? [{ debugName: "parameterGUID" }] : []));
1289
1331
  parameterType = signal('', ...(ngDevMode ? [{ debugName: "parameterType" }] : []));
@@ -1828,21 +1870,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
1828
1870
  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" }]
1829
1871
  }] });
1830
1872
 
1831
- class PageTitle {
1832
- title = signal('', ...(ngDevMode ? [{ debugName: "title" }] : []));
1833
- setTitle(newTitle) {
1834
- this.title.set(newTitle);
1835
- }
1836
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1837
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, providedIn: 'root' });
1838
- }
1839
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PageTitle, decorators: [{
1840
- type: Injectable,
1841
- args: [{
1842
- providedIn: 'root',
1843
- }]
1844
- }] });
1845
-
1846
1873
  ModuleRegistry.registerModules([AllCommunityModule, StatusBarModule, ClientSideRowModelModule, ClipboardModule, ExcelExportModule, ColumnMenuModule,
1847
1874
  ContextMenuModule, CellSelectionModule, HighlightChangesModule, RowSelectionModule,]);
1848
1875
  // AgGrid Dark Mode Row Style
@@ -1854,8 +1881,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
1854
1881
  router = inject(Router);
1855
1882
  routerActive = inject(ActivatedRoute);
1856
1883
  dialog = inject(MatDialog);
1857
- titleService = inject(Title);
1858
- pageTitleService = inject(PageTitle);
1859
1884
  // Parse query parameters
1860
1885
  queryParameterGUID = toSignal(this.routerActive.queryParamMap.pipe(map((params) => params.get('parameters')), map((value) => this.parseOrReturnValue(value))), {
1861
1886
  initialValue: null, // set initial value to null
@@ -2014,7 +2039,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
2014
2039
  // Clear right side nav if parameterGUID is not provided
2015
2040
  this.commonService.clearOutlet();
2016
2041
  }
2017
- console.log("effect.", this.parameterGUID());
2018
2042
  });
2019
2043
  effect(() => {
2020
2044
  const update = this.commonService.updates();
@@ -2035,19 +2059,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
2035
2059
  this._isEmbedded();
2036
2060
  this.initAgGrid();
2037
2061
  });
2038
- effect(() => {
2039
- const name = this.pageName();
2040
- if (name) {
2041
- const translationKey = name.startsWith('@') ? name : `@${name}`;
2042
- this.translateService.stream(translationKey).subscribe((translated) => {
2043
- if (translated == translationKey) {
2044
- translated = name;
2045
- }
2046
- this.titleService.setTitle(`${translated}`);
2047
- this.pageTitleService.setTitle(translated);
2048
- });
2049
- }
2050
- });
2051
2062
  effect(() => {
2052
2063
  const isEmbedded = this._isEmbedded();
2053
2064
  const currentPref = this.preferenceType();
@@ -2126,10 +2137,6 @@ class NettyAgGridListBase extends NettyAgGridBase {
2126
2137
  error: (err) => this.alertService.showError(err),
2127
2138
  });
2128
2139
  }
2129
- currentPageTitle = computed(() => {
2130
- const name = this.pageName();
2131
- return name ? name.startsWith('@') ? name : `@${name}` : '@Page_Title';
2132
- }, ...(ngDevMode ? [{ debugName: "currentPageTitle" }] : []));
2133
2140
  // *****************************************
2134
2141
  // *** Logging Functions ***
2135
2142
  // *****************************************
@@ -2157,6 +2164,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
2157
2164
  args: [{ selector: 'ntybase-ag-grid-list-base', imports: [], template: ``, host: { 'ntybase-id': 'NettyAgGridListBase' } }]
2158
2165
  }], ctorParameters: () => [] });
2159
2166
 
2167
+ class Guid {
2168
+ value = this.empty;
2169
+ constructor(value) {
2170
+ if (value) {
2171
+ if (Guid.isValid(value)) {
2172
+ this.value = value;
2173
+ }
2174
+ }
2175
+ }
2176
+ static newGuid() {
2177
+ return new Guid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
2178
+ const r = (Math.random() * 16) | 0;
2179
+ const v = c == 'x' ? r : (r & 0x3) | 0x8;
2180
+ return v.toString(16);
2181
+ }));
2182
+ }
2183
+ /**
2184
+ * return all zeros '00000000-0000-0000-0000-000000000000'
2185
+ */
2186
+ static get empty() {
2187
+ return '00000000-0000-0000-0000-000000000000';
2188
+ }
2189
+ get empty() {
2190
+ return Guid.empty;
2191
+ }
2192
+ static isValid(str) {
2193
+ const validRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;
2194
+ return validRegex.test(str);
2195
+ }
2196
+ toString() {
2197
+ return this.value;
2198
+ }
2199
+ toJSON() {
2200
+ return this.value;
2201
+ }
2202
+ /**
2203
+ * True is guid is empty or not valid
2204
+ * @param str
2205
+ * @returns
2206
+ */
2207
+ static isNullOrEmpty(str) {
2208
+ if (str == null || str == undefined || str.trim() == '' || str == Guid.empty) {
2209
+ return true;
2210
+ }
2211
+ if (!Guid.isValid(str)) {
2212
+ return true;
2213
+ }
2214
+ return false;
2215
+ }
2216
+ /**
2217
+ * True if the guid is valid and not all zeros (empty)
2218
+ * @param str
2219
+ * @returns
2220
+ */
2221
+ static isValidAndNotEmpty(str) {
2222
+ return !Guid.isNullOrEmpty(str);
2223
+ }
2224
+ /**
2225
+ * Return empty guid if the given guid is not valid
2226
+ * @param guid
2227
+ * @returns
2228
+ */
2229
+ static emptyWhenNull(guid) {
2230
+ if (Guid.isValidAndNotEmpty(guid)) {
2231
+ return guid;
2232
+ }
2233
+ return Guid.empty;
2234
+ }
2235
+ }
2236
+
2160
2237
  ModuleRegistry.registerModules([AllCommunityModule, StatusBarModule, ClientSideRowModelModule, ClipboardModule, ExcelExportModule, ColumnMenuModule,
2161
2238
  ContextMenuModule, CellSelectionModule, HighlightChangesModule, RowSelectionModule,]);
2162
2239
  // AgGrid Dark Mode Row Style
@@ -2197,7 +2274,7 @@ class NettyAgGridListFilterBase extends NettyAgGridListBase {
2197
2274
  // *** Data Management Functions ***
2198
2275
  // *********************************************************
2199
2276
  loadData() {
2200
- if (this._displayFilter()) {
2277
+ if (Guid.isNullOrEmpty(this.parameterGUID())) {
2201
2278
  this.setData([], true);
2202
2279
  return;
2203
2280
  }
@@ -4598,5 +4675,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
4598
4675
  * Generated bundle index. Do not edit.
4599
4676
  */
4600
4677
 
4601
- export { AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ENVIRONMENT_CONFIG, EnvironmentInfo, EnvironmentInfoService, ExcelImportBase, ForgotPassword, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridBase, NettyAgGridListBase, NettyAgGridListFilterBase, NettyAgGridLogBase, NettyAgGridSaveBase, NettyAgGridService, NettyAppsBase, NettyAppsFilterBase, NettyBaseApp, NettyHelper, NettyImageService, NettyMenuService, NtyLoadingComponent, NtyLoadingInterceptor, NtyLoadingService, Ntybase, NtybaseModule, PageTitle, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService, ntyAuthenticationInterceptor };
4678
+ export { AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ENVIRONMENT_CONFIG, EnvironmentInfo, EnvironmentInfoService, ExcelImportBase, ForgotPassword, Guid, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridBase, NettyAgGridListBase, NettyAgGridListFilterBase, NettyAgGridLogBase, NettyAgGridSaveBase, NettyAgGridService, NettyAppsBase, NettyAppsFilterBase, NettyBaseApp, NettyHelper, NettyImageService, NettyMenuService, NtyLoadingComponent, NtyLoadingInterceptor, NtyLoadingService, Ntybase, NtybaseModule, PageTitle, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService, ntyAuthenticationInterceptor };
4602
4679
  //# sourceMappingURL=nettyapps-ntybase.mjs.map