@one-paragon/angular-utilities 2.4.2 → 2.4.4
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.
|
@@ -4409,7 +4409,11 @@ function updateGroupByState(groupedData, { data, groups, expanded, sorts }, firs
|
|
|
4409
4409
|
if (firstRun
|
|
4410
4410
|
|| dataUpdated(data, groups, expanded, sorts)
|
|
4411
4411
|
|| groupsUpdated(groups, expanded, sorts)) {
|
|
4412
|
-
|
|
4412
|
+
const combinedGroupsAndSorts = groups.value.map(g => {
|
|
4413
|
+
const sortForGroup = sorts.value.find(s => s.key === g.key);
|
|
4414
|
+
return { ...g, sort: sortForGroup?.sort || '' };
|
|
4415
|
+
});
|
|
4416
|
+
groupedData = groups.value.length ? getGroupedData(data.value, combinedGroupsAndSorts, metaData) : data.value;
|
|
4413
4417
|
}
|
|
4414
4418
|
else {
|
|
4415
4419
|
let curr = [...sorts.value];
|
|
@@ -4509,7 +4513,11 @@ class GenericTableComponent {
|
|
|
4509
4513
|
const trackBy = this.$trackBy();
|
|
4510
4514
|
if (!trackBy)
|
|
4511
4515
|
return (index, item) => isGroupHeader(item) ? `${item.level}-${item[initIndexSymbol]}` : item[initIndexSymbol];
|
|
4512
|
-
return ((index, item) =>
|
|
4516
|
+
return ((index, item) => {
|
|
4517
|
+
if (isGroupHeader(item))
|
|
4518
|
+
return `${item.level}-${item[initIndexSymbol]}`;
|
|
4519
|
+
return typeof trackBy === 'function' ? trackBy(item) : item[trackBy];
|
|
4520
|
+
});
|
|
4513
4521
|
});
|
|
4514
4522
|
this.$hasFooterMeta = computed(() => this.state.$metaDataArray().some(md => !!md.additional?.footer));
|
|
4515
4523
|
this.$hasCustomFooter = computed(() => this.$columnInfos()?.some(ci => !!ci.customCell?.columnDef?.footerCell));
|
|
@@ -4603,7 +4611,8 @@ class GenericTableComponent {
|
|
|
4603
4611
|
this.$selection = computed(() => {
|
|
4604
4612
|
const trackBy = this.$trackBy();
|
|
4605
4613
|
if (trackBy) {
|
|
4606
|
-
|
|
4614
|
+
const trackByFn = typeof trackBy === 'function' ? trackBy : (item) => item[trackBy];
|
|
4615
|
+
return new SelectionModel(true, [], true, (a, b) => trackByFn(a) === trackByFn(b));
|
|
4607
4616
|
}
|
|
4608
4617
|
return new SelectionModel(true, []);
|
|
4609
4618
|
});
|
|
@@ -4662,7 +4671,12 @@ class GenericTableComponent {
|
|
|
4662
4671
|
if (!selected.length)
|
|
4663
4672
|
return;
|
|
4664
4673
|
const trackBy = this.$trackBy();
|
|
4665
|
-
const trackByFunc = trackBy ?
|
|
4674
|
+
const trackByFunc = trackBy ?
|
|
4675
|
+
(s) => {
|
|
4676
|
+
const trackByFn = typeof trackBy === 'function' ? trackBy : (item) => item[trackBy];
|
|
4677
|
+
return selectableData.every(d => trackByFn(d) !== trackByFn(s));
|
|
4678
|
+
}
|
|
4679
|
+
: s => !selectableData.includes(s);
|
|
4666
4680
|
const removed = selected.filter(trackByFunc);
|
|
4667
4681
|
this.$selection().deselect(...removed);
|
|
4668
4682
|
});
|