@akcelik/strct 3.1.0 → 3.1.1
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.
|
@@ -11603,12 +11603,18 @@ class StrctDatagrid {
|
|
|
11603
11603
|
somePageSelected = computed(() => !this.allPageSelected() &&
|
|
11604
11604
|
this.selectionRows().some((r) => this.selected().has(this.idOf(r))), /* @ts-ignore */
|
|
11605
11605
|
...(ngDevMode ? [{ debugName: "somePageSelected" }] : /* istanbul ignore next */ []));
|
|
11606
|
-
/** Resolve a row's stable identity
|
|
11606
|
+
/** Resolve a row's stable identity: its `rowId` value, or the row object
|
|
11607
|
+
* itself when there is no `rowId` or it resolves to null/undefined. */
|
|
11607
11608
|
idOf(row) {
|
|
11608
11609
|
const id = this.rowId();
|
|
11609
11610
|
if (id == null)
|
|
11610
11611
|
return row;
|
|
11611
|
-
|
|
11612
|
+
const resolved = typeof id === 'function' ? id(row) : row[id];
|
|
11613
|
+
// An unresolvable id must not collapse rows onto one another: a Set holds
|
|
11614
|
+
// `undefined` once, so every row missing the field would share one
|
|
11615
|
+
// identity — select one, select them all. `??`, not `||`: 0 and '' are
|
|
11616
|
+
// legitimate ids.
|
|
11617
|
+
return resolved ?? row;
|
|
11612
11618
|
}
|
|
11613
11619
|
rowKey(row) {
|
|
11614
11620
|
return this.idOf(row);
|