in libs/fabric/src/lib/components/details-list/details-list.component.ts [309:333]
private _initDirective(directive: ChangeableItemsDirective<any>, propertyKey: 'columns' | 'groups') {
const transformItemsFunc = this._transformItemsFunction(directive);
const setItems = (mapper: (items: ReadonlyArray<any>) => ReadonlyArray<any>) => {
this[propertyKey] = mapper(this[propertyKey]);
transformItemsFunc(this[propertyKey]);
this.markForCheck();
};
setItems(() => directive.items);
// Subscribe to adding/removing items
this._subscriptions.push(
directive.onItemsChanged.subscribe((newItems: QueryList<ChangeableItemsDirective<any>>) => {
setItems(() => newItems.map(directive => directive));
})
);
// Subscribe for existing item changes
this._subscriptions.push(
directive.onChildItemChanged.subscribe(({ key, changes }) => {
setItems(items => items.map(item => (item.key === key ? mergeItemChanges(item, changes) : item)));
this.markForCheck();
})
);
}