import { DeesElement, property, html, customElement, type TemplateResult, } from '@design.estate/dees-element'; import * as domtools from '@design.estate/dees-domtools'; import * as deesCatalog from '@design.estate/dees-catalog'; deesCatalog; @customElement('sio-combox') export class SioCombox extends DeesElement { public static demo = () => html` `; @property({ type: Object }) public referenceObject: HTMLElement; /** * computes the button offset */ public cssComputeHeight() { let height = window.innerHeight < 760 ? window.innerHeight : 760; if (!this.referenceObject) { console.log('SioCombox: no reference object set'); } if (this.referenceObject) { console.log(`referenceObject height is ${this.referenceObject.clientHeight}`); height = height - (this.referenceObject.clientHeight + 60); } return height; } public cssComputeInnerScroll() { console.log( `SioCombox clientHeight: ${this.shadowRoot.querySelector('.mainbox').clientHeight}` ); console.log( `SioCombox content scrollheight is: ${ this.shadowRoot.querySelector('.contentbox').clientHeight }` ); if ( this.shadowRoot.querySelector('.mainbox').clientHeight < this.shadowRoot.querySelector('.contentbox').clientHeight ) { (this.shadowRoot.querySelector('.mainbox') as HTMLElement).style.overflowY = 'scroll'; } else { (this.shadowRoot.querySelector('.mainbox') as HTMLElement).style.overflowY = 'hidden'; } } constructor() { super(); domtools.DomTools.setupDomTools(); } public render(): TemplateResult { return html` ${domtools.elementBasic.styles}
Hello :)
Ask us anything or share your feedback!
Conversations
Onboarding
powered by social.io
`; } async updated() { this.cssComputeHeight(); window.requestAnimationFrame(() => { setTimeout(() => { this.cssComputeInnerScroll(); }, 200); }); } }