Setup packetization and available fks pairs

This commit is contained in:
Lewis Moten
2024-05-12 00:21:58 -04:00
parent 716aa046c4
commit 51a51d7e96
7 changed files with 246 additions and 97 deletions

View File

@@ -65,6 +65,20 @@ class BasePanel {
this.append(select);
}
addCheckedInputs = (type, name, items, value) => {
const div = document.createElement('div');
div.id = this.childId(name);
this.createCheckedInputs(type, name, items, value)
.forEach(element => div.appendChild(element));
this.append(div);
}
replaceCheckedInputs = (type, name, items, value) => {
const div = this.getElement(name);
div.innerHTML = '';
this.createCheckedInputs(type, name, items, value)
.forEach(element => div.appendChild(element));
}
createCheckedInputs = (type, name, items, value) => {
const elements = [];
items.forEach(({id, text, checked = false, eventName = 'change'})=> {
const label = document.createElement('label');
label.for = this.childId(id);
@@ -72,9 +86,10 @@ class BasePanel {
label.appendChild(input);
const textNode = document.createTextNode(text);
label.append(textNode);
this.append(label);
this.addNewLine();
elements.push(label);
elements.push(document.createElement('br'));
});
return elements;
}
addInputText = (id, value, options = {}) => {
this.append(this.createInput(id, value, {...options, type: 'text'}));