Skip to content

Commit e332b14

Browse files
authored
feat(SelectTable): support auto fill when collapse search panel (#4881)
* refactor: 重构脚本 * chore: bump version 9.1.6-beta01
1 parent 52d30ad commit e332b14

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.1.5</Version>
4+
<Version>9.1.6-beta01</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Table/Table.razor.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function reset(id) {
5151

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

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

105-
setBodyHeight(table)
106106

107107
setColumnToolboxListener(table);
108108

109+
if (isVisible(table.el) === false) {
110+
table.loopCheckHeightHandler = requestAnimationFrame(() => check(table));
111+
return;
112+
}
113+
114+
observeHeight(table)
115+
}
116+
117+
const observeHeight = table => {
118+
setBodyHeight(table);
119+
109120
const observer = new ResizeObserver(entries => {
110121
entries.forEach(entry => {
111-
if (entry.target === shim) {
122+
if (entry.target === table.shim) {
112123
setTableDefaultWidth(table);
113124
}
114125
else if (entry.target === table.search || entry.target === table.toolbar || entry.target === table.pages) {
@@ -117,7 +128,7 @@ export function reset(id) {
117128
});
118129
});
119130
if (table.thead) {
120-
observer.observe(shim);
131+
observer.observe(table.shim);
121132
}
122133
if (table.search) {
123134
observer.observe(table.search);
@@ -280,18 +291,16 @@ const check = table => {
280291
table.loopCheckHeightHandler = requestAnimationFrame(() => check(table));
281292
}
282293
else {
283-
delete table.loopCheckHeightHandler;
284-
setBodyHeight(table);
294+
if (table.loopCheckHeightHandler > 0) {
295+
cancelAnimationFrame(table.loopCheckHeightHandler);
296+
delete table.loopCheckHeightHandler;
297+
}
298+
observeHeight(table);
285299
}
286300
};
287301

288302
const setBodyHeight = table => {
289303
const el = table.el
290-
if (isVisible(el) === false) {
291-
table.loopCheckHeightHandler = requestAnimationFrame(() => check(table));
292-
return;
293-
}
294-
295304
const children = [...el.children]
296305
const search = children.find(i => i.classList.contains('table-search'))
297306
table.search = search;

0 commit comments

Comments
 (0)