Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[table]列拖动功能优化 #870

Merged
merged 3 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/table/hooks/useColumnResize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function useColumnResize(tableElmRef: Ref<HTMLTableElement>, refr
const onColumnMouseover = (e: MouseEvent) => {
if (!resizeLineRef.value) return;

const target = e.target as HTMLElement;
const target = (e.target as HTMLElement).closest('th');
const targetBoundRect = target.getBoundingClientRect();
if (!resizeLineParams.isDragging) {
// 最小宽度暂定为30,如果单元格小于30,则不能拖拽
Expand All @@ -41,7 +41,7 @@ export default function useColumnResize(tableElmRef: Ref<HTMLTableElement>, refr
// 非resize的点击,不做处理
if (!resizeLineParams.draggingCol) return;

const target = e.target as HTMLElement;
const target = (e.target as HTMLElement).closest('th');
const targetBoundRect = target.getBoundingClientRect();
const tableBoundRect = tableElmRef.value?.getBoundingClientRect();
const resizeLinePos = targetBoundRect.right - tableBoundRect.left;
Expand Down
5 changes: 3 additions & 2 deletions src/table/hooks/useRowSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ export default function useRowSelect(props: TdPrimaryTableProps) {

// eslint-disable-next-line
function getSelectedHeader(h: CreateElement) {
const isIndeterminate = intersectionKeys.value.length > 0 && intersectionKeys.value.length < canSelectedRows.value.length;
return () => (
<Checkbox
checked={intersectionKeys.value.length === canSelectedRows.value.length}
indeterminate={isIndeterminate}
indeterminate={
intersectionKeys.value.length > 0 && intersectionKeys.value.length < canSelectedRows.value.length
}
chaishi marked this conversation as resolved.
Show resolved Hide resolved
disabled={!canSelectedRows.value.length}
{...{ on: { change: handleSelectAll } }}
/>
Expand Down