"use strict"; import Emel from 'emel'; import { NightInk } from 'nightink'; import AbstractUIItem from './AbstractUIItem.mjs'; class UITable extends AbstractUIItem { constructor(el, def) { super(el, def); this.emel = new Emel().emel; this.el.replaceChildren(this.emel(`table>(thead>tr>${Object.keys(def.content).map(header => `th{${header}}`).join("+")})+tbody`)); } clear() { super.clear(); // TODO: Empty the table, but avoiding removing the header, structure etc } append(peer, table) { super.append(peer, table); let new_row = document.createElement("tr"); for(let [ _, template ] of Object.entries(this.def.content)) { let table_cell = document.createElement("td"); table_cell.appendChild(document.createTextNode()) } // TODO Append the new table item in the right place // Perhaps we could use .dataset & iterate until we find the right one to insert directly before? } } export default UITable;