This commit is contained in:
2023-04-28 15:06:47 +08:00
parent 58de68a878
commit 9bf9e7da27
6 changed files with 64 additions and 48 deletions

View File

@ -515,7 +515,7 @@
}
}
@media (prefers-color-scheme: dark) {
/*@media (prefers-color-scheme: dark) {
.ui-grid {
--cell-hover-bg-color: yellow;
--header-border-color: #525456;
@ -532,4 +532,4 @@
--row-selected-bg-color: #190d04;
--text-disabled-color: gray;
}
}
}*/

View File

@ -10,7 +10,7 @@
}
:root {
color-scheme: light dark;
/*color-scheme: light dark;*/
--color: #201f1e;
--bg-color: #fff;
@ -40,7 +40,7 @@
--font-family: "Franklin Gothic Book", "San Francisco", "Segoe UI", "Open Sans", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
/*@media (prefers-color-scheme: dark) {
:root {
--color: rgb(255 255 255/87%);
--bg-color: #141414;
@ -60,4 +60,4 @@
--loading-bg-color: rgb(20 20 20/40%);
--loading-fore-color: rgb(255 255 255/20%);
}
}
}*/

View File

@ -296,7 +296,7 @@ class Grid {
let height = this.height;
if (height === 0) {
height = this.#containerHeight;
height = this.#containerHeight ??= this.containerHeight;
} else if (isNaN(height) || height < 0) {
height = this.#el.offsetHeight - top;
}
@ -308,12 +308,16 @@ class Grid {
this.#bodyClientWidth = body.clientWidth;
}
reload() {
get containerHeight() {
let length = this.#currentSource.length;
if (this.extraRows > 0) {
length += this.extraRows;
}
this.#containerHeight = length * (this.rowHeight + 1);
return length * (this.rowHeight + 1);
}
reload() {
this.#containerHeight = this.containerHeight;
this.#refs.body.scrollTop = 0;
this.#refs.body.scrollLeft = 0;
this.#refs.bodyContent.style.top = '0px';
@ -634,7 +638,7 @@ class Grid {
}
}
if (Grid.ColumnTypes.isCheckbox(col.type)) {
cell.appendChild(GridCheckboxColumn.createEdit(e => this.#onRowChanged(e, exists + i, col, e.target.checked)));
cell.appendChild(GridCheckboxColumn.createEdit(e => this.#onRowChanged(e, index, col, e.target.checked)));
// this.#colTypes[col.key] = GridCheckboxColumn;
} else {
let type = this.#colTypes[col.key];
@ -1532,7 +1536,7 @@ class Grid {
if (this.#currentSource == null) {
return;
}
const row = this.#currentSource[this.#startIndex + index];
const row = this.#currentSource[index];
const item = row.values;
if (item == null) {
return;