import { Component, Input, OnInit, ViewChild, ViewContainerRef } from '@angular/core'; import { Bundle } from '../../../../core/shared/bundle.model'; import { Item } from '../../../../core/shared/item.model'; import { ResponsiveColumnSizes } from '../../../../shared/responsive-table-sizes/responsive-column-sizes'; import { ResponsiveTableSizes } from '../../../../shared/responsive-table-sizes/responsive-table-sizes'; @Component({ selector: 'ds-item-edit-bitstream-bundle', styleUrls: ['../item-bitstreams.component.scss'], templateUrl: './item-edit-bitstream-bundle.component.html', }) /** * Component that displays a single bundle of an item on the item bitstreams edit page * Creates an embedded view of the contents. This is to ensure the table structure won't break. * (which means it'll be added to the parents html without a wrapping ds-item-edit-bitstream-bundle element) */ export class ItemEditBitstreamBundleComponent implements OnInit { /** * The view on the bundle information and bitstreams */ @ViewChild('bundleView', {static: true}) bundleView; /** * The bundle to display bitstreams for */ @Input() bundle: Bundle; /** * The item the bundle belongs to */ @Input() item: Item; /** * The bootstrap sizes used for the columns within this table */ @Input() columnSizes: ResponsiveTableSizes; /** * The bootstrap sizes used for the Bundle Name column * This column stretches over the first 3 columns and thus is a combination of their sizes processed in ngOnInit */ bundleNameColumn: ResponsiveColumnSizes; constructor(private viewContainerRef: ViewContainerRef) { } ngOnInit(): void { this.bundleNameColumn = this.columnSizes.combineColumns(0, 2); this.viewContainerRef.createEmbeddedView(this.bundleView); } }