@jungherz-de/glasskit-elements 0.9.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,10 +2,17 @@ import { GlkElement } from '../../base.js';
|
|
|
2
2
|
|
|
3
3
|
class GlkList extends GlkElement {
|
|
4
4
|
static get observedAttributes() {
|
|
5
|
-
return ['flush', 'bare'];
|
|
5
|
+
return ['flush', 'bare', 'header'];
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
render() {
|
|
9
|
+
// Optional section header — sits before the <ul>.
|
|
10
|
+
this._header = this.createElement('div', ['glass-list__section-header']);
|
|
11
|
+
const initialHeader = this.getAttribute('header') || '';
|
|
12
|
+
this._header.textContent = initialHeader;
|
|
13
|
+
this._header.hidden = !initialHeader;
|
|
14
|
+
this._wrapper.appendChild(this._header);
|
|
15
|
+
|
|
9
16
|
this._ul = this.createElement('ul', ['glass-list']);
|
|
10
17
|
if (this.getBoolAttr('flush')) this._ul.classList.add('glass-list--flush');
|
|
11
18
|
if (this.getBoolAttr('bare')) this._ul.classList.add('glass-list--bare');
|
|
@@ -41,6 +48,12 @@ class GlkList extends GlkElement {
|
|
|
41
48
|
case 'bare':
|
|
42
49
|
this._ul.classList.toggle('glass-list--bare', this.getBoolAttr('bare'));
|
|
43
50
|
break;
|
|
51
|
+
case 'header': {
|
|
52
|
+
const value = this.getAttribute('header') || '';
|
|
53
|
+
this._header.textContent = value;
|
|
54
|
+
this._header.hidden = !value;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
58
|
}
|
|
46
59
|
|
|
@@ -49,6 +62,12 @@ class GlkList extends GlkElement {
|
|
|
49
62
|
|
|
50
63
|
get bare() { return this.getBoolAttr('bare'); }
|
|
51
64
|
set bare(v) { this.setBoolAttr('bare', v); }
|
|
65
|
+
|
|
66
|
+
get header() { return this.getAttribute('header') || ''; }
|
|
67
|
+
set header(v) {
|
|
68
|
+
if (v) this.setAttribute('header', v);
|
|
69
|
+
else this.removeAttribute('header');
|
|
70
|
+
}
|
|
52
71
|
}
|
|
53
72
|
|
|
54
73
|
customElements.define('glk-list', GlkList);
|