diff --git a/src/collection/collection-header.css b/src/collection/collection-header.css new file mode 100644 index 00000000..cc109f14 --- /dev/null +++ b/src/collection/collection-header.css @@ -0,0 +1,3 @@ +md-collection-header { + display: block; +} diff --git a/src/collection/collection-header.html b/src/collection/collection-header.html new file mode 100644 index 00000000..e5b4a63e --- /dev/null +++ b/src/collection/collection-header.html @@ -0,0 +1,4 @@ + diff --git a/src/collection/collection-header.js b/src/collection/collection-header.js new file mode 100644 index 00000000..9ebc5e34 --- /dev/null +++ b/src/collection/collection-header.js @@ -0,0 +1,10 @@ +import { customElement } from 'aurelia-templating'; +import { inject } from 'aurelia-dependency-injection'; + +@customElement('md-collection-header') +@inject(Element) +export class MdCollectionHeader { + constructor(element) { + this.element = element; + } +} diff --git a/src/collection/collection.html b/src/collection/collection.html index 4c7ff830..2b4e3138 100644 --- a/src/collection/collection.html +++ b/src/collection/collection.html @@ -1,5 +1,6 @@ diff --git a/src/collection/collection.js b/src/collection/collection.js index e314af45..eda2715c 100644 --- a/src/collection/collection.js +++ b/src/collection/collection.js @@ -8,6 +8,13 @@ export class MdCollection { this.element = element; } + attached() { + let header = this.element.querySelector('md-collection-header'); + if (header) { + this.anchor.classList.add('with-header'); + } + } + getSelected() { let items = [].slice.call(this.element.querySelectorAll('md-collection-selector')); return items.filter(i => i.au['md-collection-selector'].viewModel.isSelected) diff --git a/src/config-builder.js b/src/config-builder.js index a3641231..9fa3112b 100644 --- a/src/config-builder.js +++ b/src/config-builder.js @@ -109,6 +109,7 @@ export class ConfigBuilder { useCollection() : ConfigBuilder { this.globalResources.push('./collection/collection'); this.globalResources.push('./collection/collection-item'); + this.globalResources.push('./collection/collection-header'); this.globalResources.push('./collection/md-collection-selector'); return this; }