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 tabledefs from '../tabledefs/index.mjs';
import forkawesome_emel from './forkawesome_emel.mjs';
import tabledefs from './tabledefs/index.mjs';
class GlobalUI {
constructor() {

View file

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

View file

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