File

src/structured-list/list-header.component.ts

Description

ListHeader provides a container for the ListColumns that make up the header of a structured list.

Example:

Example :
    <cds-list-header>
        <cds-list-column nowrap="true">Column 1</cds-list-column>
        <cds-list-column nowrap="true">Column 2</cds-list-column>
        <cds-list-column>Column 3</cds-list-column>
    </cds-list-header>

Implements

AfterContentInit

Metadata

Index

Properties
Methods
Inputs
HostBindings
Accessors

Inputs

skeleton
Type : any

HostBindings

attr.role
Type : string
Default value : "rowgroup"
class.cds--structured-list-thead
Type : boolean
Default value : true

Methods

ngAfterContentInit
ngAfterContentInit()
Returns : void
Protected updateChildren
updateChildren()
Returns : void

Properties

Protected _skeleton
Default value : false
columns
Type : QueryList<ListColumn>
Decorators :
@ContentChildren(ListColumn)
role
Type : string
Default value : "rowgroup"
Decorators :
@HostBinding('attr.role')
selection
Default value : false

Set by the containing StructuredList. Adds a dummy header for the selection column when set to true.

wrapper
Default value : true
Decorators :
@HostBinding('class.cds--structured-list-thead')

Accessors

skeleton
getskeleton()
setskeleton(value: any)
Parameters :
Name Type Optional
value any No
Returns : void
import {
	Component,
	HostBinding,
	ContentChildren,
	QueryList,
	AfterContentInit,
	Input
} from "@angular/core";
import { ListColumn } from "./list-column.component";

/**
 * `ListHeader` provides a container for the `ListColumn`s that make up the header of a structured list.
 *
 * Example:
 * ```html
 * 	<cds-list-header>
 *		<cds-list-column nowrap="true">Column 1</cds-list-column>
 *		<cds-list-column nowrap="true">Column 2</cds-list-column>
 *		<cds-list-column>Column 3</cds-list-column>
 *	</cds-list-header>
 * ```
 */
@Component({
	selector: "cds-list-header, ibm-list-header",
	template: `
		<div class="cds--structured-list-row cds--structured-list-row--header-row" role="row">
			<ng-content></ng-content>
			<div *ngIf="selection" class="cds--structured-list-th"></div>
		</div>
	`
})
export class ListHeader implements AfterContentInit {
	@HostBinding("class.cds--structured-list-thead") wrapper = true;
	@HostBinding("attr.role") role = "rowgroup";

	@Input()
	set skeleton(value: any) {
		this._skeleton = value;
		this.updateChildren();
	}

	get skeleton(): any {
		return this._skeleton;
	}

	@ContentChildren(ListColumn) columns: QueryList<ListColumn>;

	/**
	 * Set by the containing `StructuredList`. Adds a dummy header for the selection column when set to true.
	 */
	selection = false;

	protected _skeleton = false;

	ngAfterContentInit() {
		this.columns.forEach(column => {
			column.isBodyColumn = false;
			column.isHeaderColumn = true;
		});
		this.updateChildren();
	}

	protected updateChildren() {
		if (this.columns) {
			this.columns.toArray().forEach(child => child.skeleton = this.skeleton);
		}
	}
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""