-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsol-catalog-tabset.js
More file actions
32 lines (29 loc) · 960 Bytes
/
sol-catalog-tabset.js
File metadata and controls
32 lines (29 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import {getLinkFromAttr} from './utils/utils.js';
import {getTerm} from './utils/rdf-utils.js';
export class SolCatalogTabset extends HTMLElement {
constructor() {
super();
}
async connectedCallback() {
let cat = this.closest('sol-catalog');
let display = cat.querySelector('.sol-display');
let str = "<sol-tabset>";
let type = this.getAttribute('wanted').replace(/^a /,'');
let source = getLinkFromAttr(this,'source');
let view = getLinkFromAttr(this,'view');
let subs = cat.wantedTypes[getTerm(type)].subtypes;
for(let sub of Object.keys(subs)){
let label = subs[sub].label;
let subtype = subs[sub].type;
if(label){
str+=` <link label="${label}" source="${source}" view="${view}" wanted="a ${subtype}" linktype="catalog-page" />`;
}
}
str += "</sol-tabset>";
this.innerHTML = str;
}
}
customElements.define("sol-catalog-tabset",SolCatalogTabset);
/*
THE END
*/