mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
33 lines
1.2 KiB
import { _ViewRepeaterOperation } from './_recycle-view-repeater-strategy-chunk.mjs';
|
|
|
|
class _DisposeViewRepeaterStrategy {
|
|
applyChanges(changes, viewContainerRef, itemContextFactory, itemValueResolver, itemViewChanged) {
|
|
changes.forEachOperation((record, adjustedPreviousIndex, currentIndex) => {
|
|
let view;
|
|
let operation;
|
|
if (record.previousIndex == null) {
|
|
const insertContext = itemContextFactory(record, adjustedPreviousIndex, currentIndex);
|
|
view = viewContainerRef.createEmbeddedView(insertContext.templateRef, insertContext.context, insertContext.index);
|
|
operation = _ViewRepeaterOperation.INSERTED;
|
|
} else if (currentIndex == null) {
|
|
viewContainerRef.remove(adjustedPreviousIndex);
|
|
operation = _ViewRepeaterOperation.REMOVED;
|
|
} else {
|
|
view = viewContainerRef.get(adjustedPreviousIndex);
|
|
viewContainerRef.move(view, currentIndex);
|
|
operation = _ViewRepeaterOperation.MOVED;
|
|
}
|
|
if (itemViewChanged) {
|
|
itemViewChanged({
|
|
context: view?.context,
|
|
operation,
|
|
record
|
|
});
|
|
}
|
|
});
|
|
}
|
|
detach() {}
|
|
}
|
|
|
|
export { _DisposeViewRepeaterStrategy };
|
|
//# sourceMappingURL=_dispose-view-repeater-strategy-chunk.mjs.map
|
|
|