Skip to content

Commit

Permalink
fix(Table): only show shadow when table need scroll, #201
Browse files Browse the repository at this point in the history
  • Loading branch information
Javey committed Jan 22, 2019
1 parent f52987c commit 2fabae7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion components/table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default class Table extends Intact {

_padding: 0,
_paddingBottom: 0,
_isShowLeftRightMiddle: false,
_disabledAmount: 0,
_isSticky: false,
_leftWidth: 0,
Expand Down Expand Up @@ -409,11 +410,14 @@ export default class Table extends Intact {
}

// calculate the horizontal scroll bar
let paddingBottom = 0
let paddingBottom = 0;
let isShowLeftRightMiddle = false;
if (this.element.offsetWidth < tableWidth + this.get('_padding')) {
paddingBottom = this.get('_scrollBarWidth');
isShowLeftRightMiddle = true;
}
data._paddingBottom = paddingBottom;
data._isShowLeftRightMiddle = isShowLeftRightMiddle;

this.set(data);
}
Expand Down
4 changes: 2 additions & 2 deletions components/table/index.vdt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {
resizable, expandedKeys, type, _isSticky,
style, rowClassName, children, sort, group, _scrollBarWidth,
_scrollLeft, _scrollTop, _hoverIndex, _scrollPosition,
_paddingBottom, _isStickyScrollbar, loading
_paddingBottom, _isStickyScrollbar, loading, _isShowLeftRightMiddle
} = self.get();

let colSpan = checkType === 'checkbox' || checkType === 'radio' ? 1 : 0;
Expand Down Expand Up @@ -344,7 +344,7 @@ const classNameObj = {
[className]: className,
[`k-${type}`]: type !== 'default',
'k-sticky': _isSticky,
[`k-scroll-${_scrollPosition}`]: hasFixedLeft || hasFixedRight,
[`k-scroll-${_scrollPosition}`]: _isShowLeftRightMiddle,
'k-sticky-scrollbar': _isStickyScrollbar,
};

Expand Down

0 comments on commit 2fabae7

Please sign in to comment.