Skip to content

Commit

Permalink
🐛 fix(DataTable): incorrect fixed column style in RTL
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem committed Dec 26, 2024
1 parent 259f741 commit a29173c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
11 changes: 9 additions & 2 deletions src/Masa.Blazor.JS/src/interop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1589,15 +1589,22 @@ export function registerTableScrollEvent(wrapper: HTMLElement) {
const listener = () => {
const scrollWidth = wrapper.scrollWidth;
const clientWidth = wrapper.clientWidth;
const scrollLeft = wrapper.scrollLeft;
const scrollLeft = wrapper.scrollLeft;

if (scrollWidth == clientWidth) {
wrapper.classList.remove('scrolling');
wrapper.classList.remove('scrolled-to-right');
wrapper.classList.remove('scrolled-to-left');
return;
}

const rtl = wrapper.parentElement.classList.contains('m-data-table--rtl');

if (Math.abs(scrollWidth -((rtl ? -scrollLeft : scrollLeft) + clientWidth)) < 1) {
wrapper.classList.remove('scrolling')
wrapper.classList.remove('scrolled-to-left')
wrapper.classList.add('scrolled-to-right');
} else if (Math.abs(scrollLeft - (rtl ? scrollWidth - clientWidth : 0)) < 1) {
} else if (scrollLeft == 0) {
wrapper.classList.remove('scrolling')
wrapper.classList.remove('scrolled-to-right')
wrapper.classList.add('scrolled-to-left');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Masa.Blazor;

// public class MDataIterator<TItem> : BDataIterator<TItem>, IDataIterator<TItem>, ILoadable
public partial class MDataIterator<TItem> : MData<TItem>
{
[Inject]
Expand Down
12 changes: 8 additions & 4 deletions src/Masa.Blazor/wwwroot/css/masa-blazor.extend.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@
pointer-events: none;
}

.m-data-table > .m-data-table__wrapper:not(.scrolled-to-right) .m-data-table__column--fixed-right.first-fixed-column:after,
.m-application--is-rtl .m-data-table > .m-data-table__wrapper:not(.scrolled-to-left) .m-data-table__column--fixed-left.first-fixed-column:after {
.m-data-table > .m-data-table__wrapper.scrolled-to-left .m-data-table__column--fixed-right.first-fixed-column:after,
.m-data-table > .m-data-table__wrapper.scrolling .m-data-table__column--fixed-right.first-fixed-column:after,
.m-application--is-rtl .m-data-table > .m-data-table__wrapper.scrolling .m-data-table__column--fixed-left.first-fixed-column:after,
.m-application--is-rtl .m-data-table > .m-data-table__wrapper.scrolled-to-right .m-data-table__column--fixed-left.first-fixed-column:after {
box-shadow: inset -10px 0 8px -8px rgb(0 0 0 / 15%);
}

.m-data-table > .m-data-table__wrapper:not(.scrolled-to-left) .m-data-table__column--fixed-left.first-fixed-column:after,
.m-application--is-rtl .m-data-table > .m-data-table__wrapper:not(.scrolled-to-right) .m-data-table__column--fixed-right.first-fixed-column:after {
.m-data-table > .m-data-table__wrapper.scrolled-to-right .m-data-table__column--fixed-left.first-fixed-column:after,
.m-data-table > .m-data-table__wrapper.scrolling .m-data-table__column--fixed-left.first-fixed-column:after,
.m-application--is-rtl .m-data-table > .m-data-table__wrapper.scrolling .m-data-table__column--fixed-right.first-fixed-column:after,
.m-application--is-rtl .m-data-table > .m-data-table__wrapper.scrolled-to-left .m-data-table__column--fixed-right.first-fixed-column:after {
box-shadow: inset 10px 0 8px -8px rgb(0 0 0 / 15%);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/wwwroot/css/masa-blazor.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Masa.Blazor/wwwroot/js/masa-blazor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Masa.Blazor/wwwroot/js/masa-blazor.js.map

Large diffs are not rendered by default.

0 comments on commit a29173c

Please sign in to comment.