@rangertechnologies/ngnxt 2.1.142 → 2.1.143
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/esm2022/environments/version.mjs +2 -2
- package/esm2022/lib/components/datatable/datatable.component.mjs +78 -35
- package/fesm2022/rangertechnologies-ngnxt.mjs +78 -35
- package/fesm2022/rangertechnologies-ngnxt.mjs.map +1 -1
- package/lib/components/datatable/datatable.component.d.ts +7 -6
- package/package.json +1 -1
- package/rangertechnologies-ngnxt-2.1.143.tgz +0 -0
- package/rangertechnologies-ngnxt-2.1.142.tgz +0 -0
|
@@ -5457,7 +5457,11 @@ class NxtDatatable {
|
|
|
5457
5457
|
this.dropdownActionButton = (this.actionButtonArray?.buttonArray && this.actionButtonArray?.buttonArray?.length > 0) ? this.actionButtonArray?.buttonArray?.slice(this.actionButtonArray?.size) : [];
|
|
5458
5458
|
this.selection = new SelectionModel(true, []);
|
|
5459
5459
|
if (!this.totalRecords && this.data && this.isPagination) {
|
|
5460
|
-
|
|
5460
|
+
const pageIndex = Number(this.pageIndex) || 0;
|
|
5461
|
+
const pageSize = Number(this.pageSize) || 10;
|
|
5462
|
+
const start = (pageIndex - 1) * pageSize;
|
|
5463
|
+
const end = start + pageSize;
|
|
5464
|
+
this.dataSource.data = this.data?.slice(start, end) || [];
|
|
5461
5465
|
}
|
|
5462
5466
|
else if (!this.isPagination) {
|
|
5463
5467
|
this.dataSource.data = this.data;
|
|
@@ -5545,7 +5549,7 @@ class NxtDatatable {
|
|
|
5545
5549
|
});
|
|
5546
5550
|
this.computeSummaryValues();
|
|
5547
5551
|
}
|
|
5548
|
-
this.searchConfigs && this.searchBoxValue ? this.emptySearch(this.searchBoxValue) : ''; // SKS17APR25 update search box value
|
|
5552
|
+
this.searchConfigs && this.searchBoxValue ? this.emptySearch(this.searchBoxValue) : this.applyFilter(this.tableParams?.tableSearch, 'onChange'); // SKS17APR25 update search box value
|
|
5549
5553
|
}
|
|
5550
5554
|
ngOnInit() {
|
|
5551
5555
|
this.dataSource = { data: [] }; // or use a proper data structure
|
|
@@ -5705,7 +5709,11 @@ class NxtDatatable {
|
|
|
5705
5709
|
this.sFilterData = [...this.data];
|
|
5706
5710
|
this.dataSource.data = this.originalData;
|
|
5707
5711
|
if (!this.configPagination && this.data && this.isPagination) {
|
|
5708
|
-
|
|
5712
|
+
const pageIndex = Number(this.pageIndex) || 0;
|
|
5713
|
+
const pageSize = Number(this.pageSize) || 10;
|
|
5714
|
+
const start = (pageIndex - 1) * pageSize;
|
|
5715
|
+
const end = start + pageSize;
|
|
5716
|
+
this.dataSource.data = this.data?.slice(start, end) || [];
|
|
5709
5717
|
}
|
|
5710
5718
|
else if (!this.isPagination) {
|
|
5711
5719
|
this.dataSource.data = this.data;
|
|
@@ -5839,7 +5847,11 @@ class NxtDatatable {
|
|
|
5839
5847
|
});
|
|
5840
5848
|
this.dataSource.data = this.data; // Update dataSource
|
|
5841
5849
|
if (!this.totalRecords && this.data && this.isPagination) {
|
|
5842
|
-
|
|
5850
|
+
const pageIndex = Number(this.pageIndex) || 0;
|
|
5851
|
+
const pageSize = Number(this.pageSize) || 10;
|
|
5852
|
+
const start = (pageIndex - 1) * pageSize;
|
|
5853
|
+
const end = start + pageSize;
|
|
5854
|
+
this.dataSource.data = this.data?.slice(start, end) || [];
|
|
5843
5855
|
}
|
|
5844
5856
|
else if (!this.isPagination) {
|
|
5845
5857
|
this.dataSource.data = this.data;
|
|
@@ -5886,7 +5898,7 @@ class NxtDatatable {
|
|
|
5886
5898
|
this.computeSummaryValues();
|
|
5887
5899
|
}
|
|
5888
5900
|
// SKS15FEB25 Custom sort function
|
|
5889
|
-
sortData(column, sortingState, currentState) {
|
|
5901
|
+
sortData(column, sortingState, currentState, from) {
|
|
5890
5902
|
// Define sorting states
|
|
5891
5903
|
const sortingStates = ['asc', 'desc', 'none'];
|
|
5892
5904
|
if (!this.configPagination || this.dataSource.data.length === this.totalRecords) {
|
|
@@ -5946,7 +5958,11 @@ class NxtDatatable {
|
|
|
5946
5958
|
this.dataSource.data = data;
|
|
5947
5959
|
}
|
|
5948
5960
|
else {
|
|
5949
|
-
|
|
5961
|
+
const pageIndex = Number(this.pageIndex) || 0;
|
|
5962
|
+
const pageSize = Number(this.pageSize) || 10;
|
|
5963
|
+
const start = (pageIndex - 1) * pageSize;
|
|
5964
|
+
const end = start + pageSize;
|
|
5965
|
+
this.dataSource.data = this.filterBoxData ? this.filterBoxData?.slice(start, end) || [] : this.data?.slice(start, end) || [];
|
|
5950
5966
|
}
|
|
5951
5967
|
}
|
|
5952
5968
|
else {
|
|
@@ -5963,10 +5979,13 @@ class NxtDatatable {
|
|
|
5963
5979
|
}
|
|
5964
5980
|
localStorage.setItem('NxtDataTable', JSON.stringify({ addRecord: false, pageSize: this.pageSize, pageIndex: this.pageIndex, currentSortColumn: this.currentSortColumn, currentSortDirection: this.currentSortDirection }));
|
|
5965
5981
|
// Only sort if the direction is 'asc' or 'desc'
|
|
5966
|
-
if (currentState !== true)
|
|
5982
|
+
if (currentState !== true && from !== 'onChange')
|
|
5967
5983
|
this.NxtTableEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: this.pageIndex }, tableSearch: { fields: this.displayedColumns, value: this.searchBoxValue }, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
5968
5984
|
}
|
|
5969
|
-
|
|
5985
|
+
if (from !== 'onChange')
|
|
5986
|
+
this.NxtTableParamsEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: this.pageIndex }, tableSearch: this.searchBoxValue, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
5987
|
+
if (from === 'onChange')
|
|
5988
|
+
this.pageParams(this.tableParams?.pagination, 'onChange');
|
|
5970
5989
|
}
|
|
5971
5990
|
onScroll(tableContainer) {
|
|
5972
5991
|
this.isScrolled = tableContainer.scrollTop > 0;
|
|
@@ -5991,20 +6010,23 @@ class NxtDatatable {
|
|
|
5991
6010
|
this.isResized = this.filterDataArray[this.selectedFilter]?.length > 0;
|
|
5992
6011
|
}
|
|
5993
6012
|
// SKS15FEB25 emitting pagr size and index to parent on paginating
|
|
5994
|
-
pageParams(event) {
|
|
5995
|
-
this.pageIndex = event.pageIndex;
|
|
5996
|
-
this.pageSize = event.pageSize;
|
|
6013
|
+
pageParams(event, from) {
|
|
6014
|
+
this.pageIndex = event?.pageIndex || this.pageIndex;
|
|
6015
|
+
this.pageSize = event?.pageSize || this.pageSize;
|
|
5997
6016
|
this.filterTableNos = this.filterBoxData?.length;
|
|
5998
6017
|
if (!this.configPagination || this.dataSource.data.length === this.totalRecords) {
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
const
|
|
6018
|
+
if (from !== 'onChange')
|
|
6019
|
+
this.applyFilter(this.searchBoxValue, 'pageParams');
|
|
6020
|
+
const start = (Number(this.pageIndex) - 1) * Number(this.pageSize);
|
|
6021
|
+
const end = start + Number(this.pageSize);
|
|
6002
6022
|
this.dataSource.data = this.filterBoxData?.slice(start, end);
|
|
6003
6023
|
}
|
|
6004
6024
|
else {
|
|
6005
|
-
|
|
6025
|
+
if (from !== 'onChange')
|
|
6026
|
+
this.NxtTableEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: this.pageIndex }, tableSearch: { fields: this.displayedColumns, value: this.searchBoxValue }, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6006
6027
|
}
|
|
6007
|
-
|
|
6028
|
+
if (from !== 'onChange')
|
|
6029
|
+
this.NxtTableParamsEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: this.pageIndex }, tableSearch: this.searchBoxValue, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6008
6030
|
}
|
|
6009
6031
|
// SKS15FEB25 apply search bar filter using mat
|
|
6010
6032
|
applyFilter(event, from) {
|
|
@@ -6012,7 +6034,7 @@ class NxtDatatable {
|
|
|
6012
6034
|
filterValue ? filterValue = filterValue.trim().toLowerCase() : filterValue = '';
|
|
6013
6035
|
this.searchBoxValue = filterValue;
|
|
6014
6036
|
if (!filterValue) {
|
|
6015
|
-
this.dataSource.data =
|
|
6037
|
+
this.dataSource.data = this.originalData;
|
|
6016
6038
|
}
|
|
6017
6039
|
else {
|
|
6018
6040
|
this.dataSource.data = this.originalData.filter(item => this.displayedColumns.some(column => {
|
|
@@ -6020,7 +6042,7 @@ class NxtDatatable {
|
|
|
6020
6042
|
return value.includes(filterValue);
|
|
6021
6043
|
}));
|
|
6022
6044
|
}
|
|
6023
|
-
if (from !== 'pageParams')
|
|
6045
|
+
if (from !== 'pageParams' && from !== 'onChange')
|
|
6024
6046
|
this.pageIndex = 1;
|
|
6025
6047
|
this.sFilterData = this.dataSource.data;
|
|
6026
6048
|
this.filterTableNos = this.sFilterData?.length;
|
|
@@ -6028,7 +6050,7 @@ class NxtDatatable {
|
|
|
6028
6050
|
const start = (Number(this.pageIndex) - 1) * Number(this.pageSize);
|
|
6029
6051
|
const end = start + Number(this.pageSize);
|
|
6030
6052
|
this.dataSource.data = this.dataSource.data?.slice(start, end);
|
|
6031
|
-
this.filterRetain(this.filterDataArray, from);
|
|
6053
|
+
this.filterRetain(from === 'onChange' ? this.tableParams?.searchFilterData || this.filterDataArray : this.filterDataArray, from);
|
|
6032
6054
|
}
|
|
6033
6055
|
/** SKS15FEB25 Whether the number of selected elements matches the total number of rows. */
|
|
6034
6056
|
isAllSelected() {
|
|
@@ -6075,6 +6097,14 @@ class NxtDatatable {
|
|
|
6075
6097
|
tableClick(data) {
|
|
6076
6098
|
this.tableRowClick.emit(data);
|
|
6077
6099
|
}
|
|
6100
|
+
getNestedValue(obj, path) {
|
|
6101
|
+
if (!obj || !path)
|
|
6102
|
+
return undefined;
|
|
6103
|
+
return path
|
|
6104
|
+
.replace(/\[(\d+)\]/g, '.$1') // turns "members[0]" into "members.0"
|
|
6105
|
+
.split('.')
|
|
6106
|
+
.reduce((acc, part) => (acc && acc[part] !== undefined) ? acc[part] : undefined, obj);
|
|
6107
|
+
}
|
|
6078
6108
|
//SKS15FEB25 Retain the filterdata
|
|
6079
6109
|
filterRetain(filterkey, from) {
|
|
6080
6110
|
if (filterkey && Object.keys(filterkey).length == 0) {
|
|
@@ -6094,14 +6124,17 @@ class NxtDatatable {
|
|
|
6094
6124
|
else {
|
|
6095
6125
|
for (let key of Object.keys(filterkey)) {
|
|
6096
6126
|
if (filterkey[key]) {
|
|
6097
|
-
const data = this.sFilterData.filter((
|
|
6127
|
+
const data = this.sFilterData.filter((item) => {
|
|
6128
|
+
const value = this.getNestedValue(item, key);
|
|
6129
|
+
return filterkey[key].includes(value);
|
|
6130
|
+
});
|
|
6098
6131
|
const data1 = [...this.data, ...data];
|
|
6099
6132
|
this.data = this.removeDuplicates(data1);
|
|
6100
6133
|
}
|
|
6101
6134
|
}
|
|
6102
6135
|
}
|
|
6103
6136
|
}
|
|
6104
|
-
if (from !== 'pageParams')
|
|
6137
|
+
if (from !== 'pageParams' && from !== 'onChange')
|
|
6105
6138
|
this.pageIndex = 1;
|
|
6106
6139
|
const start = (Number(this.pageIndex) - 1) * Number(this.pageSize);
|
|
6107
6140
|
const end = start + Number(this.pageSize);
|
|
@@ -6109,10 +6142,11 @@ class NxtDatatable {
|
|
|
6109
6142
|
this.filterTableNos = this.filterBoxData?.length;
|
|
6110
6143
|
this.dataSource.data = this.data?.slice(start, end);
|
|
6111
6144
|
this.data = this.originalData;
|
|
6112
|
-
this.sortData(this.currentSortColumn, this.currentSortDirection);
|
|
6145
|
+
this.sortData(this.currentSortColumn, this.currentSortDirection, undefined, from);
|
|
6113
6146
|
}
|
|
6114
6147
|
// SKS15FEB25 to remove duplicate object from two arrays (safe stringify)
|
|
6115
6148
|
removeDuplicates(objects) {
|
|
6149
|
+
console.log("removeDuplicates", objects);
|
|
6116
6150
|
const seen = new Set();
|
|
6117
6151
|
const uniqueObjects = [];
|
|
6118
6152
|
const safeStringify = (obj) => {
|
|
@@ -6204,7 +6238,7 @@ class NxtDatatable {
|
|
|
6204
6238
|
return this.hyperLinkColumns?.includes(col) ? true : false;
|
|
6205
6239
|
}
|
|
6206
6240
|
// SKS15FEB25 on add record in table, the 'inlineElement' values will be assigned to the table data
|
|
6207
|
-
addTableRecord(element) {
|
|
6241
|
+
addTableRecord(element, from) {
|
|
6208
6242
|
if (!this.configPagination || this.dataSource.data.length === this.totalRecords) {
|
|
6209
6243
|
var obj = {};
|
|
6210
6244
|
const keys = Object.keys(element);
|
|
@@ -6263,13 +6297,15 @@ class NxtDatatable {
|
|
|
6263
6297
|
else {
|
|
6264
6298
|
const pageIndex = Math.ceil(this.totalRecords / 10);
|
|
6265
6299
|
localStorage.setItem('NxtDataTable', JSON.stringify({ addRecord: true, pageSize: 10, pageIndex: pageIndex, currentSortColumn: this.currentSortColumn, currentSortDirection: this.currentSortDirection }));
|
|
6266
|
-
|
|
6300
|
+
if (from !== 'onChange')
|
|
6301
|
+
this.NxtTableEmit.emit({ pagination: { pageSize: 10, pageIndex: pageIndex }, tableSearch: { fields: this.displayedColumns, value: this.searchBoxValue }, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6267
6302
|
}
|
|
6268
6303
|
if (this.from === 'formBuilder') {
|
|
6269
6304
|
this.emitTableDataValue(this.dataSource.data);
|
|
6270
6305
|
}
|
|
6271
6306
|
this.computeSummaryValues();
|
|
6272
|
-
|
|
6307
|
+
if (from !== 'onChange')
|
|
6308
|
+
this.NxtTableParamsEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: this.pageIndex }, tableSearch: this.searchBoxValue, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6273
6309
|
}
|
|
6274
6310
|
// SKS15FEB25 Action button conditionally displayed function
|
|
6275
6311
|
isConditionMet(element, conditions) {
|
|
@@ -6295,14 +6331,16 @@ class NxtDatatable {
|
|
|
6295
6331
|
return this.timeColumns?.includes(column) ?? false;
|
|
6296
6332
|
}
|
|
6297
6333
|
// SKS15FEB25 config search filter box function
|
|
6298
|
-
onSearch(event) {
|
|
6334
|
+
onSearch(event, from) {
|
|
6299
6335
|
this.searchBoxValue = event; // Update the displayed value in the search box
|
|
6300
6336
|
if (this.searchConfigs || this.dataSource.data.length === this.totalRecords) {
|
|
6301
6337
|
this.pageIndex = 1;
|
|
6302
6338
|
this.pageSize = 10;
|
|
6303
|
-
|
|
6339
|
+
if (from !== 'onChange')
|
|
6340
|
+
this.NxtTableEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: Number(this.pageIndex) }, tableSearch: { fields: this.displayedColumns, value: this.searchBoxValue }, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6304
6341
|
}
|
|
6305
|
-
|
|
6342
|
+
if (from !== 'onChange')
|
|
6343
|
+
this.NxtTableParamsEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: this.pageIndex }, tableSearch: this.searchBoxValue, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6306
6344
|
}
|
|
6307
6345
|
// SKS15FEB25 If the value in the search box is empty, call the onSearch function automatically
|
|
6308
6346
|
emptySearch(event) {
|
|
@@ -6339,7 +6377,7 @@ class NxtDatatable {
|
|
|
6339
6377
|
}
|
|
6340
6378
|
}
|
|
6341
6379
|
// SKS15FEB25 for close search filter box
|
|
6342
|
-
closefilter() {
|
|
6380
|
+
closefilter(from) {
|
|
6343
6381
|
this.pageSize = this.pageSize || 10;
|
|
6344
6382
|
this.pageIndex = 1;
|
|
6345
6383
|
this.filterDataArray[this.selectedFilter] = [];
|
|
@@ -6348,9 +6386,11 @@ class NxtDatatable {
|
|
|
6348
6386
|
this.filterRetain(this.filterDataArray);
|
|
6349
6387
|
}
|
|
6350
6388
|
else {
|
|
6351
|
-
|
|
6389
|
+
if (from !== 'onChange')
|
|
6390
|
+
this.NxtTableEmit.emit({ pagination: { pageSize: 10, pageIndex: 1 }, tableSearch: { fields: this.displayedColumns, value: this.searchBoxValue }, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6352
6391
|
}
|
|
6353
|
-
|
|
6392
|
+
if (from !== 'onChange')
|
|
6393
|
+
this.NxtTableParamsEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: this.pageIndex }, tableSearch: this.searchBoxValue, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6354
6394
|
}
|
|
6355
6395
|
// SKS15FEB25 search filter box checkbox retain
|
|
6356
6396
|
isSelected(event) {
|
|
@@ -6362,7 +6402,8 @@ class NxtDatatable {
|
|
|
6362
6402
|
}
|
|
6363
6403
|
}
|
|
6364
6404
|
// SKS15FEB25 search filter box checkbox select
|
|
6365
|
-
checkedData(event) {
|
|
6405
|
+
checkedData(event, from) {
|
|
6406
|
+
console.log("checkedData", event);
|
|
6366
6407
|
let selectedArray = [];
|
|
6367
6408
|
selectedArray = this.filterDataArray[this.selectedFilter] ? this.filterDataArray[this.selectedFilter] : [];
|
|
6368
6409
|
if (selectedArray && selectedArray.includes(event)) {
|
|
@@ -6376,12 +6417,14 @@ class NxtDatatable {
|
|
|
6376
6417
|
if (this.dataSource.data.length !== this.totalRecords && this.configPagination) {
|
|
6377
6418
|
this.pageIndex = 1;
|
|
6378
6419
|
this.pageSize = 10;
|
|
6379
|
-
|
|
6420
|
+
if (from !== 'onChange')
|
|
6421
|
+
this.NxtTableEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: Number(this.pageIndex) }, tableSearch: { fields: this.displayedColumns, value: this.searchBoxValue }, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6380
6422
|
}
|
|
6381
6423
|
else {
|
|
6382
6424
|
this.filterRetain(this.filterDataArray);
|
|
6383
6425
|
}
|
|
6384
|
-
|
|
6426
|
+
if (from !== 'onChange')
|
|
6427
|
+
this.NxtTableParamsEmit.emit({ pagination: { pageSize: this.pageSize, pageIndex: this.pageIndex }, tableSearch: this.searchBoxValue, searchFilterData: this.filterDataArray, sort: { column: this.currentSortColumn, direction: this.currentSortDirection, listView: this.selectedView } });
|
|
6385
6428
|
}
|
|
6386
6429
|
// SKS15FEB25 action column dropdown buttons close
|
|
6387
6430
|
addClickOutsideListener() {
|
|
@@ -14458,7 +14501,7 @@ const VERSION = {
|
|
|
14458
14501
|
"semver": null,
|
|
14459
14502
|
"suffix": "05a52cb-dirty",
|
|
14460
14503
|
"semverString": null,
|
|
14461
|
-
"version": "2.1.
|
|
14504
|
+
"version": "2.1.143"
|
|
14462
14505
|
};
|
|
14463
14506
|
/* tslint:enable */
|
|
14464
14507
|
|