From 3d3f46d12abb7d18b33f3b22e51b1a4c154bf85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 9 Nov 2021 15:13:33 +0100 Subject: Better handle debug tab. --- module/calp/html/view/calendar/week.scm | 10 +++++++- static/globals.ts | 41 ++++++++++++++++----------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index 93d11c25..cc89d77b 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -111,7 +111,15 @@ (span (@ (slot "label")) "๐Ÿ–Š") (vevent-edit (@ (slot "content") (class "populate-with-uid"))) - )) + ) + ,@(when (debug) + `((tab-element + (@ (title "Debug")) + (span (@ (slot "label")) "๐Ÿธ") + (vevent-dl (@ (slot "content") + (class "populate-with-uid"))) + + )))) ;; ,(tabset ;; `(("๐Ÿ“…" title: "ร–versikt" diff --git a/static/globals.ts b/static/globals.ts index f19312e0..c812958b 100644 --- a/static/globals.ts +++ b/static/globals.ts @@ -112,7 +112,19 @@ function popuplateTab(tab: HTMLElement, tabgroup: string, index: number) { } } -/* */ +/* */ +class VEventDL extends ComponentVEvent { + redraw(obj: VEvent) { + let dl = buildDescriptionList( + Array.from(obj.boundProperties) + .map(key => [key, obj.getProperty(key)])) + this.replaceChildren(dl); + } +} + +/* + Edit form for a given VEvent. Used as the edit tab of popups. +*/ class ComponentEdit extends ComponentVEvent { firstTime: boolean @@ -206,7 +218,7 @@ function find_popup(uid: uid): HTMLElement | null { // } // } // throw 'Popup not fonud'; - return document.querySelector(`popup-element[data-uid="${uid}"]`) as HTMLElement + return document.querySelector(`popup-element[data-uid="${uid}"]`) } function find_block(uid: uid): HTMLElement | null { @@ -306,6 +318,7 @@ window.addEventListener('load', function() { customElements.define('vevent-description', ComponentDescription); customElements.define('vevent-edit', ComponentEdit); + customElements.define('vevent-dl', VEventDL); customElements.define('vevent-block', ComponentBlock); }) @@ -314,8 +327,11 @@ window.addEventListener('load', function() { /* '' */ class DateTimeInput extends /* HTMLInputElement */ HTMLElement { - constructor() { - super(); + connectedCallback() { + /* This can be in the constructor for chromium, but NOT firefox... + Vivaldi 4.3.2439.63 stable + Mozilla Firefox 94.0.1 + */ this.innerHTML = '' // console.log('constructing datetime input') } @@ -503,23 +519,6 @@ class PopupElement extends ComponentVEvent { // this.value; // event.properties.calendar = this.value; }); - - - - let tab = makeElement('tab-element', { title: 'Debug' }) as TabElement - /// let tab = new TabElement(); - tab.setAttribute('title', 'Debug') - tab.appendChild(makeElement('span', { slot: 'label', innerText: "๐Ÿธ" })) - // let dl = makeElement('dl', { slot: 'content' }) - let obj = vcal_objects.get(uid)! - let dl = buildDescriptionList( - Array.from(obj.boundProperties) - .map(key => [key, obj.getProperty(key)])) - dl.slot = 'content' - tab.appendChild(dl) - - this.addTab(tab); - // window.setTimeout(() => { this.addTab(tab) }) } addTab(tab: TabElement) { -- cgit v1.2.3