Skip to content

Commit

Permalink
fix(Table): setBodyHeight incorrect when invisible (#2798)
Browse files Browse the repository at this point in the history
* refactor: 精简代码

* refactor: update check visible method

* refactor: 使用 isVisible 函数
  • Loading branch information
ArgoZhang authored Jan 13, 2024
1 parent bbbad3c commit c910914
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/BootstrapBlazor/Components/Table/Table.razor.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
export { getResponsive } from '../../modules/responsive.js?v=$version'
import { copy, drag, getDescribedElement, getOuterHeight, getWidth } from '../../modules/utility.js?v=$version'
import { copy, drag, getDescribedElement, getOuterHeight, getWidth, isVisible } from '../../modules/utility.js?v=$version'
import '../../modules/browser.js?v=$version'
import Data from '../../modules/data.js?v=$version'
import EventHandler from '../../modules/event-handler.js?v=$version'
import Popover from "../../modules/base-popover.js?v=$version"

const setBodyHeight = table => {
const el = table.el
const children = [...el.children]
if (isVisible(el) === false) {
return;
}

const children = [...el.children]
const search = children.find(i => i.classList.contains('table-search'))
table.search = search
let searchHeight = 0
Expand Down Expand Up @@ -241,7 +244,7 @@ const setResizeListener = table => {
disposeColumnDrag(table.columns)
table.columns = []
const columns = [...table.tables[0].querySelectorAll('.col-resizer')]
columns.forEach((col, index) => {
columns.forEach(col => {
table.columns.push(col)
EventHandler.on(col, 'click', e => e.stopPropagation())
drag(col,
Expand Down Expand Up @@ -383,7 +386,7 @@ const setDraggable = table => {
dragItem = col
e.dataTransfer.effectAllowed = 'move'
})
EventHandler.on(col, 'dragend', e => {
EventHandler.on(col, 'dragend', () => {
col.parentNode.classList.remove('table-dragging')
dragItem.classList.remove('table-drag')
table.dragColumns.forEach(i => {
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/wwwroot/modules/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ const debounce = function (fn, duration = 200, callback = null) {
clearTimeout(handler)
}
if (callback && typeof (callback) === 'function') {
var v = callback.apply(this, arguments)
const v = callback.apply(this, arguments)
if (v === true) {
handler = null
}
Expand Down

0 comments on commit c910914

Please sign in to comment.