start vtable mode
This commit is contained in:
parent
0be2078c45
commit
54d4c4c4c0
@ -7,9 +7,13 @@ import { setTooltip } from "../tooltip";
|
|||||||
import Dropdown from "../dropdown";
|
import Dropdown from "../dropdown";
|
||||||
|
|
||||||
class GridColumn {
|
class GridColumn {
|
||||||
static create() { return createElement('span') }
|
static create() {
|
||||||
|
return createElement('span');
|
||||||
|
}
|
||||||
|
|
||||||
static setValue(element, val) { element.innerText = val }
|
static setValue(element, val) {
|
||||||
|
element.innerText = val;
|
||||||
|
}
|
||||||
|
|
||||||
static setStyle(element, style) {
|
static setStyle(element, style) {
|
||||||
for (let css of Object.entries(style)) {
|
for (let css of Object.entries(style)) {
|
||||||
@ -49,7 +53,9 @@ class GridInputColumn extends GridColumn {
|
|||||||
|
|
||||||
static getValue(e) { return e.target.value }
|
static getValue(e) { return e.target.value }
|
||||||
|
|
||||||
static setEnabled(element, enabled) { element.disabled = enabled === false }
|
static setEnabled(element, enabled) {
|
||||||
|
element.disabled = enabled === false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GridTextColumn extends GridInputColumn {
|
class GridTextColumn extends GridInputColumn {
|
||||||
@ -79,6 +85,7 @@ class GridTextColumn extends GridInputColumn {
|
|||||||
const lines = String(val).split('\n').length;
|
const lines = String(val).split('\n').length;
|
||||||
element.style.height = `${lines * grid.lineHeight + 12}px`;
|
element.style.height = `${lines * grid.lineHeight + 12}px`;
|
||||||
}
|
}
|
||||||
|
// TODO: bad performance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,11 +178,15 @@ class GridCheckboxColumn extends GridColumn {
|
|||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
static setValue(element, val) { element.querySelector('input').checked = val }
|
static setValue(element, val) {
|
||||||
|
element.querySelector('input').checked = val;
|
||||||
|
}
|
||||||
|
|
||||||
static getValue(e) { return e.target.checked }
|
static getValue(e) { return e.target.checked }
|
||||||
|
|
||||||
static setEnabled(element, enabled) { element.querySelector('input').disabled = enabled === false }
|
static setEnabled(element, enabled) {
|
||||||
|
element.querySelector('input').disabled = enabled === false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GridIconColumn extends GridColumn {
|
class GridIconColumn extends GridColumn {
|
||||||
|
@ -67,6 +67,7 @@ class Grid {
|
|||||||
#scrollLeft;
|
#scrollLeft;
|
||||||
#colTypes = {};
|
#colTypes = {};
|
||||||
#colAttrs = {};
|
#colAttrs = {};
|
||||||
|
#vtable = [];
|
||||||
|
|
||||||
columns = [];
|
columns = [];
|
||||||
langs = {
|
langs = {
|
||||||
@ -629,7 +630,6 @@ class Grid {
|
|||||||
}
|
}
|
||||||
cell.appendChild(type.create(col));
|
cell.appendChild(type.create(col));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
row.appendChild(cell);
|
row.appendChild(cell);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user