Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SelectTable): support auto fill when collapse search panel #4881

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.1.5</Version>
<Version>9.1.6-beta01</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
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
Loading