@nettyapps/ntybase 0.1.15 → 0.1.16
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/fesm2022/nettyapps-ntybase.mjs +75 -15
- package/fesm2022/nettyapps-ntybase.mjs.map +1 -1
- package/index.d.ts +17 -6
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import * as i2$1 from '@nettyapps/ntycontract';
|
|
|
10
10
|
import { EnvironmentProxy } from '@nettyapps/ntycontract';
|
|
11
11
|
import * as i1$5 from '@angular/common';
|
|
12
12
|
import { DatePipe, Location, DecimalPipe, CommonModule, TitleCasePipe } from '@angular/common';
|
|
13
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
13
14
|
import * as i3$1 from '@ngx-translate/core';
|
|
14
15
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
15
16
|
import { Buffer } from 'buffer';
|
|
@@ -1190,9 +1191,12 @@ class NettyAgGridBase {
|
|
|
1190
1191
|
readOnly = input(false, ...(ngDevMode ? [{ debugName: "readOnly" }] : []));
|
|
1191
1192
|
popupFilterValid = input(false, ...(ngDevMode ? [{ debugName: "popupFilterValid" }] : []));
|
|
1192
1193
|
popupValid = input(false, ...(ngDevMode ? [{ debugName: "popupValid" }] : []));
|
|
1193
|
-
params = input(''
|
|
1194
|
-
parameters = input(''
|
|
1194
|
+
// params = input<any>('');
|
|
1195
|
+
// parameters = input<string>('');
|
|
1195
1196
|
isEmbedded = input(false, ...(ngDevMode ? [{ debugName: "isEmbedded" }] : []));
|
|
1197
|
+
// Parameters pass when the component is embeded into an other
|
|
1198
|
+
componantParameterGUID = input('', ...(ngDevMode ? [{ debugName: "componantParameterGUID" }] : []));
|
|
1199
|
+
componantParameterType = input('', ...(ngDevMode ? [{ debugName: "componantParameterType" }] : []));
|
|
1196
1200
|
// Authentication
|
|
1197
1201
|
authenticationList = [];
|
|
1198
1202
|
// User access writes
|
|
@@ -1241,6 +1245,16 @@ class NettyAgGridBase {
|
|
|
1241
1245
|
dialog = inject(MatDialog);
|
|
1242
1246
|
sysFunctionProxy = inject(SysfunctionProxy);
|
|
1243
1247
|
environment = inject(EnvironmentProxy);
|
|
1248
|
+
// Parse query parameters
|
|
1249
|
+
queryParameterGUID = toSignal(this.routerActive.queryParamMap.pipe(map(params => params.get('parameter')), map(value => this.parseOrReturnValue(value))), {
|
|
1250
|
+
initialValue: null // set initial value to null
|
|
1251
|
+
});
|
|
1252
|
+
queryParameterType = toSignal(this.routerActive.queryParamMap.pipe(map(params => params.get('type')), map(value => this.parseOrReturnValue(value))), {
|
|
1253
|
+
initialValue: null // set initial value to null
|
|
1254
|
+
});
|
|
1255
|
+
// Query Parameters can be provide as parameters
|
|
1256
|
+
parameterGUID = signal('', ...(ngDevMode ? [{ debugName: "parameterGUID" }] : []));
|
|
1257
|
+
parameterType = signal('', ...(ngDevMode ? [{ debugName: "parameterType" }] : []));
|
|
1244
1258
|
initAgGrid_extension() {
|
|
1245
1259
|
if (this.allowEdit() == false && (this.popupValid() ?? false) == false) {
|
|
1246
1260
|
this.columnDefs().pop();
|
|
@@ -1397,21 +1411,31 @@ class NettyAgGridBase {
|
|
|
1397
1411
|
// Load user grid preferences
|
|
1398
1412
|
await this.nettyAgGridService.copyGridUserPereferenceToLocal(this.preferenceType());
|
|
1399
1413
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
if (changes['parameters']) {
|
|
1405
|
-
const parameters = changes['parameters'].currentValue;
|
|
1406
|
-
if (parameters) {
|
|
1407
|
-
this.params =
|
|
1408
|
-
typeof parameters === 'string' ? JSON.parse(parameters) : parameters;
|
|
1414
|
+
parseOrReturnValue(value) {
|
|
1415
|
+
if (value) {
|
|
1416
|
+
try {
|
|
1417
|
+
return JSON.parse(value); // parse json
|
|
1409
1418
|
}
|
|
1410
|
-
|
|
1411
|
-
|
|
1419
|
+
catch (e) {
|
|
1420
|
+
return value; // not a json retun value
|
|
1412
1421
|
}
|
|
1413
1422
|
}
|
|
1423
|
+
return null;
|
|
1414
1424
|
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Handle input changes for route parameters
|
|
1427
|
+
*/
|
|
1428
|
+
// public ngOnChanges(changes: SimpleChanges): void {
|
|
1429
|
+
// if (changes['parameters']) {
|
|
1430
|
+
// const parameters = changes['parameters'].currentValue;
|
|
1431
|
+
// if (parameters) {
|
|
1432
|
+
// this.params =
|
|
1433
|
+
// typeof parameters === 'string' ? JSON.parse(parameters) : parameters;
|
|
1434
|
+
// } else {
|
|
1435
|
+
// this.commonService.clearOutlet();
|
|
1436
|
+
// }
|
|
1437
|
+
// }
|
|
1438
|
+
// }
|
|
1415
1439
|
// Common grid ready handler
|
|
1416
1440
|
onGridReady(params) {
|
|
1417
1441
|
this.gridApi = params.api;
|
|
@@ -1546,6 +1570,27 @@ class NettyAgGridBase {
|
|
|
1546
1570
|
this.translateService.onLangChange.subscribe(() => {
|
|
1547
1571
|
this.setAgGridTranslations();
|
|
1548
1572
|
});
|
|
1573
|
+
effect(() => {
|
|
1574
|
+
if (this.hasValidValue(this.componantParameterGUID())) {
|
|
1575
|
+
this.parameterGUID.set(this.componantParameterGUID());
|
|
1576
|
+
}
|
|
1577
|
+
else if (this.hasValidValue(this.queryParameterGUID())) {
|
|
1578
|
+
this.parameterGUID.set(this.queryParameterGUID());
|
|
1579
|
+
}
|
|
1580
|
+
if (this.hasValidValue(this.componantParameterType())) {
|
|
1581
|
+
this.parameterType.set(this.componantParameterType());
|
|
1582
|
+
}
|
|
1583
|
+
else if (this.hasValidValue(this.queryParameterType())) {
|
|
1584
|
+
this.parameterType.set(this.queryParameterType());
|
|
1585
|
+
}
|
|
1586
|
+
// Clear right side nav if parameterGUID is not provided
|
|
1587
|
+
if (this.hasValidValue(this.parameterGUID)) {
|
|
1588
|
+
this.setFilter();
|
|
1589
|
+
}
|
|
1590
|
+
else {
|
|
1591
|
+
this.commonService.clearOutlet();
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1549
1594
|
effect(() => {
|
|
1550
1595
|
const update = this.commonService.updates();
|
|
1551
1596
|
if (!update || !this.gridApi)
|
|
@@ -1560,6 +1605,20 @@ class NettyAgGridBase {
|
|
|
1560
1605
|
}
|
|
1561
1606
|
});
|
|
1562
1607
|
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Validates if the given value is equal to null,undefined or ''
|
|
1610
|
+
* @param value
|
|
1611
|
+
* @returns true if has a valid value
|
|
1612
|
+
*/
|
|
1613
|
+
hasValidValue(value) {
|
|
1614
|
+
if (value == null || value == undefined) {
|
|
1615
|
+
return false;
|
|
1616
|
+
}
|
|
1617
|
+
if (value == '') {
|
|
1618
|
+
return false;
|
|
1619
|
+
}
|
|
1620
|
+
return true;
|
|
1621
|
+
}
|
|
1563
1622
|
setAgGridTranslations() {
|
|
1564
1623
|
if (this.gridApi) {
|
|
1565
1624
|
this.gridApi.setGridOption('localeText', {
|
|
@@ -1735,13 +1794,14 @@ class NettyAgGridBase {
|
|
|
1735
1794
|
onFilterTextBoxVisibilityChange(isOpen) {
|
|
1736
1795
|
this.menuValid.set(!isOpen);
|
|
1737
1796
|
}
|
|
1797
|
+
setFilter() { } //override this to set a filter
|
|
1738
1798
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: NettyAgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1739
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.11", type: NettyAgGridBase, 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 },
|
|
1799
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.11", type: NettyAgGridBase, 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 }, isEmbedded: { classPropertyName: "isEmbedded", publicName: "isEmbedded", 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 } }, outputs: { selectedElement: "selectedElement" }, ngImport: i0, template: "<p>ag-grid-base works!</p>\n", styles: [""] });
|
|
1740
1800
|
}
|
|
1741
1801
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: NettyAgGridBase, decorators: [{
|
|
1742
1802
|
type: Component,
|
|
1743
1803
|
args: [{ selector: 'ntybase-ag-grid-base', imports: [], template: "<p>ag-grid-base works!</p>\n" }]
|
|
1744
|
-
}], ctorParameters: () => [], propDecorators: { readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], popupFilterValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupFilterValid", required: false }] }], popupValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupValid", required: false }] }],
|
|
1804
|
+
}], ctorParameters: () => [], propDecorators: { readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], popupFilterValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupFilterValid", required: false }] }], popupValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupValid", required: false }] }], isEmbedded: [{ type: i0.Input, args: [{ isSignal: true, alias: "isEmbedded", required: false }] }], componantParameterGUID: [{ type: i0.Input, args: [{ isSignal: true, alias: "componantParameterGUID", required: false }] }], componantParameterType: [{ type: i0.Input, args: [{ isSignal: true, alias: "componantParameterType", required: false }] }], selectedElement: [{ type: i0.Output, args: ["selectedElement"] }] } });
|
|
1745
1805
|
|
|
1746
1806
|
class NettyAgGridSaveBase {
|
|
1747
1807
|
// Services
|