Skip to content

Commit

Permalink
Merge branch 'main' into feat-footer
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/BootstrapBlazor/BootstrapBlazor.csproj

Co-authored-by: yuchen7701 <844356115@qq.com>
Co-authored-by: 卢骥 <1429614920@qq.com>
Co-authored-by: Argo Zhang <argo@live.ca>
  • Loading branch information
3 people committed Dec 18, 2024
2 parents 50712c3 + e332b14 commit 77c0954
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/BootstrapBlazor/Components/Table/Table.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function reset(id) {

const shim = [...table.el.children].find(i => i.classList.contains('table-shim'))
if (shim !== void 0) {
table.shim = shim;
table.thead = [...shim.children].find(i => i.classList.contains('table-fixed-header'))
table.isResizeColumn = shim.classList.contains('table-resize')
if (table.thead) {
Expand Down Expand Up @@ -102,13 +103,23 @@ export function reset(id) {

table.pages = [...table.el.children].find(i => i.classList.contains('nav-pages'));

setBodyHeight(table)

setColumnToolboxListener(table);

if (isVisible(table.el) === false) {
table.loopCheckHeightHandler = requestAnimationFrame(() => check(table));
return;
}

observeHeight(table)
}

const observeHeight = table => {
setBodyHeight(table);

const observer = new ResizeObserver(entries => {
entries.forEach(entry => {
if (entry.target === shim) {
if (entry.target === table.shim) {
setTableDefaultWidth(table);
}
else if (entry.target === table.search || entry.target === table.toolbar || entry.target === table.pages) {
Expand All @@ -117,7 +128,7 @@ export function reset(id) {
});
});
if (table.thead) {
observer.observe(shim);
observer.observe(table.shim);
}
if (table.search) {
observer.observe(table.search);
Expand Down Expand Up @@ -280,18 +291,16 @@ const check = table => {
table.loopCheckHeightHandler = requestAnimationFrame(() => check(table));
}
else {
delete table.loopCheckHeightHandler;
setBodyHeight(table);
if (table.loopCheckHeightHandler > 0) {
cancelAnimationFrame(table.loopCheckHeightHandler);
delete table.loopCheckHeightHandler;
}
observeHeight(table);
}
};

const setBodyHeight = table => {
const el = table.el
if (isVisible(el) === false) {
table.loopCheckHeightHandler = requestAnimationFrame(() => check(table));
return;
}

const children = [...el.children]
const search = children.find(i => i.classList.contains('table-search'))
table.search = search;
Expand Down

0 comments on commit 77c0954

Please sign in to comment.