Add tabledefs & ui item indexes

This commit is contained in:
Starbeamrainbowlabs 2022-03-10 23:09:22 +00:00
parent 30b20f8e18
commit a24ba21ba8
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 24 additions and 10 deletions

View file

@ -0,0 +1,9 @@
"use strict";
import cpu from './cpu.mjs';
import cpu_live from './cpu_live.mjs';
export default {
cpu,
cpu_live
}

View file

@ -2,9 +2,9 @@
import Emel from 'emel'; import Emel from 'emel';
import tabledefs from '../tabledefs/index.mjs';
import forkawesome_emel from './forkawesome_emel.mjs'; import forkawesome_emel from './forkawesome_emel.mjs';
import tabledefs from './tabledefs/index.mjs';
class GlobalUI { class GlobalUI {
constructor() { constructor() {

View file

@ -3,7 +3,7 @@
import Emel from 'emel'; import Emel from 'emel';
import fa_emel from './forkawesome_emel.mjs'; import fa_emel from './forkawesome_emel.mjs';
import UITable from './UITable.mjs'; import ui_item_index from './ui_item_index.mjs';
class TableView { class TableView {
constructor(el) { constructor(el) {
@ -32,15 +32,13 @@ class TableView {
el.classList.add("data-item"); el.classList.add("data-item");
el_dataitems.appendChild(el); el_dataitems.appendChild(el);
let item_manager = null; if(typeof ui_item_index[def.type] !== "undefined") {
switch(def.type) { let item_manager = new ui_item_index[def.type](el, def);
case "table": this.el_parts.set(def.name, item_manager);
item_manager = new UITable(el, def); }
break; else {
default:
console.warn(`Unknown item definition type '${def.type}', ignoring. This is probably a bug.`); console.warn(`Unknown item definition type '${def.type}', ignoring. This is probably a bug.`);
} }
this.el_parts.set(def.name, item_manager);
} }
this.el.replaceChildren(parts); this.el.replaceChildren(parts);

View file

@ -0,0 +1,7 @@
"use strict";
import UITable from './UITable.mjs';
export default {
table: UITable
};