document.addEventListener('WebComponentsReady', function(event) { class HDAppUserInfo extends SIBDisplayLookupList { get parentElement() { return 'div'; } getTemplate(value, index) { var firstname, lastname, email; if (typeof value == 'object') if (Object.keys(value).length > 1) { firstname = value.first_name; lastname = value.last_name; email = value.email; } else { store.get(value).then(resource => { this.value.push(resource); this.render(); }); if (Array.isArray(this.value)) this.value.splice(this.value.indexOf(value), 1); else this.value = []; return ''; } return `
${firstname} ${lastname}
`; // + `
${email}
`; } } customElements.define('hdapp-userinfo', HDAppUserInfo); class HDAppMail extends SIBWidget { get template() { return `
SEND A MESSAGE
`; } } customElements.define('hdapp-mail', HDAppMail); class HDAppMember extends SIBWidget { get template() { return `
`; } render() { store.get(this.value).then(value => { this._value = value; this.innerHTML = this.template; }); } } customElements.define('hdapp-member', HDAppMember); class HDAppAuthor extends SIBDisplayLookupList { get parentElement() { return 'div'; } getTemplate(value, index) { var firstname, lastname; if (typeof value == 'object') if (Object.keys(value).length > 1) { firstname = value.user.first_name; lastname = value.user.last_name; } else { store.get(value).then(resource => { this.value.push(resource); this.render(); }); if (Array.isArray(this.value)) this.value.splice(this.value.indexOf(value), 1); else this.value = []; return ''; } return `${firstname} ${lastname}`; } } customElements.define('hdapp-author', HDAppAuthor); class HDAppClosingDate extends SIBWidget { get template() { return this.value ? `closed (${this.value})` : 'open'; } render() { this.innerHTML = this.template; } } customElements.define('hdapp-closing-date', HDAppClosingDate); class HDAppAvailable extends SIBWidget { get template() { return this.value ? 'Available' : 'Not available'; } render() { this.innerHTML = this.template; } } customElements.define('hdapp-available', HDAppAvailable); class HDAppHyperlink extends SIBWidget { get template() { const escaped = this.value .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); return `${escaped}`; } render() { this.innerHTML = this.template; } } customElements.define('hdapp-hyperlink', HDAppHyperlink); class HDAppLinkMore extends SIBWidget { get template() { const id = uniqID(); console.warn('HDAppLinkMore', this); return ` ${this.label} ${this.name} ${this.escapedValue} `; } } customElements.define('hdapp-link-more', HDAppLinkMore); });