@mmstack/primitives 20.13.3 → 20.13.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.
|
@@ -2046,7 +2046,9 @@ function effectiveKeys(arr, getKey, report) {
|
|
|
2046
2046
|
* when the list is reordered.
|
|
2047
2047
|
*
|
|
2048
2048
|
* @param source A `Signal<T[]>` or a function returning `T[]`.
|
|
2049
|
-
* @param mapFn The mapping function. Receives the item
|
|
2049
|
+
* @param mapFn The mapping function. Receives the item, its index as a Signal, and the
|
|
2050
|
+
* entry's key (the effective ordinal key when `duplicateKeys` is enabled, otherwise
|
|
2051
|
+
* the raw key) — stable for the lifetime of the mapped entry.
|
|
2050
2052
|
* @param options Optional configuration:
|
|
2051
2053
|
* - `onDestroy`: A callback invoked when a mapped item is removed from the array.
|
|
2052
2054
|
* - `key`: A custom key extractor for identity matching (e.g. `(item) => item.id`)
|
|
@@ -2123,7 +2125,7 @@ function keyArray(source, mapFn, options = {}) {
|
|
|
2123
2125
|
items[j] = item;
|
|
2124
2126
|
const indexSignal = signal(j, ...(ngDevMode ? [{ debugName: "indexSignal" }] : []));
|
|
2125
2127
|
newIndexes[j] = indexSignal;
|
|
2126
|
-
newMapped[j] = mapFn(item, indexSignal);
|
|
2128
|
+
newMapped[j] = mapFn(item, indexSignal, newKeys ? newKeys[j] : getKey(item));
|
|
2127
2129
|
}
|
|
2128
2130
|
}
|
|
2129
2131
|
else {
|
|
@@ -2176,7 +2178,7 @@ function keyArray(source, mapFn, options = {}) {
|
|
|
2176
2178
|
else {
|
|
2177
2179
|
const indexSignal = signal(j, ...(ngDevMode ? [{ debugName: "indexSignal" }] : []));
|
|
2178
2180
|
newIndexes[j] = indexSignal;
|
|
2179
|
-
newMapped[j] = mapFn(newItems[j], indexSignal);
|
|
2181
|
+
newMapped[j] = mapFn(newItems[j], indexSignal, kNew(j));
|
|
2180
2182
|
}
|
|
2181
2183
|
}
|
|
2182
2184
|
items.length = newLen;
|