diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-05 01:25:00 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-05 01:25:00 +0200 |
commit | 7949fcdc683d07689bad5da5d20bfa3eeb5a6a46 (patch) | |
tree | c1bc39dc0e508ee498cf7119f888f513db4bab8f /static/components/vevent-dl.ts | |
parent | Add build step for jsdoc. (diff) | |
download | calp-7949fcdc683d07689bad5da5d20bfa3eeb5a6a46.tar.gz calp-7949fcdc683d07689bad5da5d20bfa3eeb5a6a46.tar.xz |
Move frontend code to subdirectories, to simplify command line flags.
Diffstat (limited to 'static/components/vevent-dl.ts')
-rw-r--r-- | static/components/vevent-dl.ts | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/static/components/vevent-dl.ts b/static/components/vevent-dl.ts deleted file mode 100644 index a792c07f..00000000 --- a/static/components/vevent-dl.ts +++ /dev/null @@ -1,35 +0,0 @@ -export { VEventDL } - -import { ComponentVEvent } from './vevent' -import { VEvent } from '../vevent' -import { makeElement } from '../lib' - -import { RecurrenceRule } from '../vevent' - -/* <vevent-dl /> */ -class VEventDL extends ComponentVEvent { - redraw(obj: VEvent) { - let dl = buildDescriptionList( - Array.from(obj.boundProperties) - .map(key => [key, obj.getProperty(key)])) - this.replaceChildren(dl); - } -} - -function buildDescriptionList(data: [string, any][]): HTMLElement { - let dl = document.createElement('dl'); - for (let [key, val] of data) { - dl.appendChild(makeElement('dt', { textContent: key })) - let fmtVal: string = val; - if (val instanceof Date) { - fmtVal = val.format( - val.dateonly - ? '~Y-~m-~d' - : '~Y-~m-~dT~H:~M:~S'); - } else if (val instanceof RecurrenceRule) { - fmtVal = JSON.stringify(val.to_jcal()) - } - dl.appendChild(makeElement('dd', { textContent: fmtVal })) - } - return dl; -} |