Files
dspace-angular/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.ts
2020-03-13 13:18:20 +01:00

53 lines
1.8 KiB
TypeScript

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);
}
}