-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs(notification): 插件调用与函数式调用 * fix(table): merged cells border style * fix(table): pagination * fix(table): add default width for table-layout: auto * fix(table): support ellipsis for safari browser * fix(table): add rowKey validate * fix(table): improve ellipsis * feat(table): toggleExpandData * fix(table): rowValue could be 0 * docs(table): update documents * fix(table): dragSort rowKey * fix(table): 去掉非必要的 col width * fix(table): selectedRowKeys * feat: update common & update docs * fix(table): rowClass * docs: deprecated map-props * refactor(table): code improve * feat(table): add event params * refactor(table): drag-sort * feat(table): remove dragSort=drag-col * feat(table): 全局配置 * docs(config-provider): 添加全局配置示例 * feat(config-provider): update docs * feat(table): 无内置按钮场景下的列配置 * fix(table): rowClassName * refactor(table): 整理懒加载代码 * feat: update common * feat: update common * feat(table): some little things * feat(table): some features * chore: some little thing * feat(table): column drag sort * fix(table): affixed header * test(table): fix test error * feat: update common Co-authored-by: sheepluo <[email protected]>
- Loading branch information
Showing
34 changed files
with
752 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<template> | ||
<div class="demo-container t-table-demo-sort"> | ||
<div class="item"> | ||
<!-- 拖拽排序涉及到 data 的变更,相对比较慎重,因此仅支持受控用法 --> | ||
|
||
<t-table rowKey="id" :columns="columns" :data="data" dragSort="row-handler" @drag-sort="onDragSort"> | ||
<template #status="{ row }"> | ||
<p class="status" :class="['', 'warning', 'unhealth'][row.status]"> | ||
{{ ['健康', '警告', '异常'][row.status] }} | ||
</p> | ||
</template> | ||
</t-table> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="jsx"> | ||
import { MoveIcon } from 'tdesign-icons-vue'; | ||
const columns = [ | ||
{ | ||
colKey: 'drag', // 列拖拽排序必要参数 | ||
title: '排序', | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
cell: (h) => <MoveIcon />, | ||
width: 80, | ||
}, | ||
{ colKey: 'instance', title: '集群名称' }, | ||
{ | ||
colKey: 'status', | ||
title: '状态', | ||
}, | ||
{ | ||
colKey: 'survivalTime', | ||
title: '存活时间(s)', | ||
}, | ||
{ colKey: 'owner', title: '管理员' }, | ||
]; | ||
const initialData = new Array(4).fill(5).map((_, i) => ({ | ||
id: i + 1, | ||
instance: `JQTest${i + 1}`, | ||
status: [0, 1, 2, 1][i % 4], | ||
owner: ['jenny;peter', 'jenny', 'jenny', 'peter'][i % 4], | ||
survivalTime: [1000, 1000, 500, 1500][i % 4], | ||
})); | ||
export default { | ||
data() { | ||
return { | ||
data: [...initialData], | ||
columns, | ||
}; | ||
}, | ||
methods: { | ||
onDragSort({ | ||
currentIndex, current, targetIndex, target, currentData, e, | ||
}) { | ||
console.log('交换行', currentIndex, current, targetIndex, target, currentData, e); | ||
this.data = currentData; | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.