Skip to content

Commit

Permalink
fix(SelectTable): dropdown pop not full width (#3465)
Browse files Browse the repository at this point in the history
* fix: 修复 table 在弹窗中宽度无法计算问题

* fix: 修复 SelectTable 宽度多两个像素问题

* chore: bump version 8.5.6-beta01
  • Loading branch information
ArgoZhang authored May 10, 2024
1 parent 0869d3e commit aade44d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
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>8.5.5</Version>
<Version>8.5.6-beta01</Version>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Select/SelectTable.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function init(id) {
}
const dropdown = el.querySelector('.dropdown-table') || document.querySelector('.popover-dropdown .dropdown-table');
if (dropdown) {
dropdown.style.setProperty('--bb-dropdown-table-width', `${width}px`);
dropdown.style.setProperty('--bb-dropdown-table-width', `${width - 2}px`);
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/BootstrapBlazor/Components/Table/Table.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const setBodyHeight = table => {
const el = table.el
const children = [...el.children]
const search = children.find(i => i.classList.contains('table-search'))
table.search = search
table.search = search;

if (isVisible(el) === false) {
return;
Expand Down Expand Up @@ -573,9 +573,11 @@ const setTableDefaultWidth = table => {
const { scrollWidth, columnMinWidth } = table.options;
const length = table.tables[0].querySelectorAll('th').length;
const tableWidth = length * columnMinWidth;
if (tableWidth > table.tables[0].offsetWidth) {
table.tables[0].style.setProperty('width', `${tableWidth}px`);
table.tables[1].style.setProperty('width', `${tableWidth - scrollWidth}px`);
if (table.tables[0].checkVisibility()) {
if (tableWidth > table.tables[0].offsetWidth) {
table.tables[0].style.setProperty('width', `${tableWidth}px`);
table.tables[1].style.setProperty('width', `${tableWidth - scrollWidth}px`);
}
}
}
}
Expand Down

0 comments on commit aade44d

Please sign in to comment.