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 DragSort Column 列拖拽排序 #755

Merged
merged 44 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
49072ba
docs(notification): 插件调用与函数式调用
Feb 11, 2022
8e5badf
Merge remote-tracking branch 'upstream/develop' into develop
Feb 14, 2022
5d3dd2a
Merge remote-tracking branch 'upstream/develop' into develop
Feb 15, 2022
df1f39a
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Mar 23, 2022
e9a6f2e
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Mar 28, 2022
993a2a4
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Mar 29, 2022
bbe4c10
fix(table): merged cells border style
chaishi Mar 29, 2022
51a9b4b
feat: merge from upstream/develop
chaishi Mar 31, 2022
ca8b1f5
fix(table): pagination
chaishi Mar 31, 2022
4e72529
fix(table): add default width for table-layout: auto
chaishi Mar 31, 2022
88c3efb
fix(table): support ellipsis for safari browser
chaishi Mar 31, 2022
737e0ec
fix(table): add rowKey validate
chaishi Mar 31, 2022
b591bbd
fix(table): improve ellipsis
chaishi Mar 31, 2022
19e8645
feat(table): toggleExpandData
chaishi Apr 1, 2022
b3e19a3
fix(table): rowValue could be 0
chaishi Apr 1, 2022
755e6e1
docs(table): update documents
chaishi Apr 1, 2022
bcfd35c
Merge remote-tracking branch 'upstream/develop' into fix_table_pagina…
chaishi Apr 1, 2022
9f4efcc
fix(table): dragSort rowKey
chaishi Apr 1, 2022
b601793
fix(table): 去掉非必要的 col width
chaishi Apr 1, 2022
6b20a1e
fix(table): selectedRowKeys
chaishi Apr 2, 2022
df4b6de
feat: update common & update docs
chaishi Apr 2, 2022
d3a7b5a
fix(table): rowClass
chaishi Apr 2, 2022
6e595fa
docs: deprecated map-props
chaishi Apr 2, 2022
70cb448
refactor(table): code improve
chaishi Apr 3, 2022
db164f9
feat(table): add event params
chaishi Apr 3, 2022
ba2d2ff
feat: merge from upstream/develop
chaishi Apr 3, 2022
8f6baa1
refactor(table): drag-sort
chaishi Apr 3, 2022
02da661
feat(table): remove dragSort=drag-col
chaishi Apr 3, 2022
5fcbab4
feat(table): 全局配置
chaishi Apr 4, 2022
5eb1251
docs(config-provider): 添加全局配置示例
chaishi Apr 5, 2022
4ce535a
feat(config-provider): update docs
chaishi Apr 5, 2022
aed5d96
feat(table): 无内置按钮场景下的列配置
chaishi Apr 5, 2022
44b38f6
fix(table): rowClassName
chaishi Apr 5, 2022
52dd188
refactor(table): 整理懒加载代码
chaishi Apr 6, 2022
2cab141
feat: update common
chaishi Apr 6, 2022
50cdd86
feat: update common
chaishi Apr 6, 2022
837acf5
feat(table): some little things
chaishi Apr 13, 2022
2a45e9c
feat(table): some features
chaishi Apr 16, 2022
15ce240
chore: some little thing
chaishi Apr 16, 2022
02c9bc0
feat(table): column drag sort
chaishi Apr 17, 2022
d969def
fix(table): affixed header
chaishi Apr 17, 2022
b84406f
feat: merge from upstream/develop
chaishi Apr 18, 2022
eaac4e3
test(table): fix test error
chaishi Apr 18, 2022
5d571dd
feat: update common
chaishi Apr 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(table): fix test error
  • Loading branch information
chaishi committed Apr 18, 2022
commit eaac4e3a043f4c29a6968dd9a647db01e5e6f63c
12 changes: 0 additions & 12 deletions src/table/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,3 @@ export function getCurrentRowByKey<T extends { colKey?: string; children?: any[]
}
}
}

// 多级表头,列配置场景,获取 currentRow
export function getCurrentRowByKey<T extends { colKey?: string; children?: any[] }>(columns: T[], key: string): T {
if (!columns || !key) return;
const col = columns?.find((t) => t.colKey === key);
if (col) return col;
for (let i = 0, len = columns.length; i < len; i++) {
if (columns[i]?.children?.length) {
return getCurrentRowByKey(columns[i]?.children, key);
}
}
}
130 changes: 104 additions & 26 deletions test/ssr/__snapshots__/ssr.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12489,17 +12489,13 @@ exports[`ssr snapshot test renders ./examples/table/demos/drag-col-sort.vue corr
<div class="t-table__content">
<table class="t-table--layout-fixed" style="width:;">
<colgroup>
<col style="width:80px;">
<col>
<col>
<col>
<col>
<col style="width:150px;">
<col style="width:100px;">
<col style="width:200px;">
<col style="width:100px;">
</colgroup>
<thead class="t-table__header">
<tr>
<th data-colkey="drag" class="t-table__th-drag">
<div class="t-table__th-cell-inner">排序</div>
</th>
<th data-colkey="instance" class="t-table__th-instance">
<div class="t-table__th-cell-inner">集群名称</div>
</th>
Expand All @@ -12515,10 +12511,7 @@ exports[`ssr snapshot test renders ./examples/table/demos/drag-col-sort.vue corr
</tr>
</thead>
<tbody class="t-table__body">
<tr data-id="1">
<td class="t-table__handle-draggable"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-move">
<path fill="currentColor" d="M5 1a1 1 0 100 2 1 1 0 000-2zM11 1a1 1 0 100 2 1 1 0 000-2zM4 6a1 1 0 112 0 1 1 0 01-2 0zM11 5a1 1 0 100 2 1 1 0 000-2zM4 10a1 1 0 112 0 1 1 0 01-2 0zM5 13a1 1 0 100 2 1 1 0 000-2zM10 10a1 1 0 112 0 1 1 0 01-2 0zM11 13a1 1 0 100 2 1 1 0 000-2z" fill-opacity="0.9"></path>
</svg></td>
<tr>
<td>JQTest1</td>
<td>
<p class="status">
Expand All @@ -12528,10 +12521,7 @@ exports[`ssr snapshot test renders ./examples/table/demos/drag-col-sort.vue corr
<td>1000</td>
<td>jenny;peter</td>
</tr>
<tr data-id="2">
<td class="t-table__handle-draggable"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-move">
<path fill="currentColor" d="M5 1a1 1 0 100 2 1 1 0 000-2zM11 1a1 1 0 100 2 1 1 0 000-2zM4 6a1 1 0 112 0 1 1 0 01-2 0zM11 5a1 1 0 100 2 1 1 0 000-2zM4 10a1 1 0 112 0 1 1 0 01-2 0zM5 13a1 1 0 100 2 1 1 0 000-2zM10 10a1 1 0 112 0 1 1 0 01-2 0zM11 13a1 1 0 100 2 1 1 0 000-2z" fill-opacity="0.9"></path>
</svg></td>
<tr>
<td>JQTest2</td>
<td>
<p class="status warning">
Expand All @@ -12541,10 +12531,7 @@ exports[`ssr snapshot test renders ./examples/table/demos/drag-col-sort.vue corr
<td>1000</td>
<td>jenny</td>
</tr>
<tr data-id="3">
<td class="t-table__handle-draggable"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-move">
<path fill="currentColor" d="M5 1a1 1 0 100 2 1 1 0 000-2zM11 1a1 1 0 100 2 1 1 0 000-2zM4 6a1 1 0 112 0 1 1 0 01-2 0zM11 5a1 1 0 100 2 1 1 0 000-2zM4 10a1 1 0 112 0 1 1 0 01-2 0zM5 13a1 1 0 100 2 1 1 0 000-2zM10 10a1 1 0 112 0 1 1 0 01-2 0zM11 13a1 1 0 100 2 1 1 0 000-2z" fill-opacity="0.9"></path>
</svg></td>
<tr>
<td>JQTest3</td>
<td>
<p class="status unhealth">
Expand All @@ -12554,10 +12541,7 @@ exports[`ssr snapshot test renders ./examples/table/demos/drag-col-sort.vue corr
<td>500</td>
<td>jenny</td>
</tr>
<tr data-id="4">
<td class="t-table__handle-draggable"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-move">
<path fill="currentColor" d="M5 1a1 1 0 100 2 1 1 0 000-2zM11 1a1 1 0 100 2 1 1 0 000-2zM4 6a1 1 0 112 0 1 1 0 01-2 0zM11 5a1 1 0 100 2 1 1 0 000-2zM4 10a1 1 0 112 0 1 1 0 01-2 0zM5 13a1 1 0 100 2 1 1 0 000-2zM10 10a1 1 0 112 0 1 1 0 01-2 0zM11 13a1 1 0 100 2 1 1 0 000-2z" fill-opacity="0.9"></path>
</svg></td>
<tr>
<td>JQTest4</td>
<td>
<p class="status warning">
Expand Down Expand Up @@ -12654,6 +12638,100 @@ exports[`ssr snapshot test renders ./examples/table/demos/drag-sort.vue correctl
</div>
`;

exports[`ssr snapshot test renders ./examples/table/demos/drag-sort-handler.vue correctly 1`] = `
<div class="demo-container t-table-demo-sort">
<div class="item">
<div class="t-table t-table--row-handler-draggable" style="position:relative;">
<div class="t-table__content">
<table class="t-table--layout-fixed" style="width:;">
<colgroup>
<col style="width:80px;">
<col>
<col>
<col>
<col>
</colgroup>
<thead class="t-table__header">
<tr>
<th data-colkey="drag" class="t-table__th-drag">
<div class="t-table__th-cell-inner">排序</div>
</th>
<th data-colkey="instance" class="t-table__th-instance">
<div class="t-table__th-cell-inner">集群名称</div>
</th>
<th data-colkey="status" class="t-table__th-status">
<div class="t-table__th-cell-inner">状态</div>
</th>
<th data-colkey="survivalTime" class="t-table__th-survivalTime">
<div class="t-table__th-cell-inner">存活时间(s)</div>
</th>
<th data-colkey="owner" class="t-table__th-owner">
<div class="t-table__th-cell-inner">管理员</div>
</th>
</tr>
</thead>
<tbody class="t-table__body">
<tr data-id="1">
<td class="t-table__handle-draggable"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-move">
<path fill="currentColor" d="M5 1a1 1 0 100 2 1 1 0 000-2zM11 1a1 1 0 100 2 1 1 0 000-2zM4 6a1 1 0 112 0 1 1 0 01-2 0zM11 5a1 1 0 100 2 1 1 0 000-2zM4 10a1 1 0 112 0 1 1 0 01-2 0zM5 13a1 1 0 100 2 1 1 0 000-2zM10 10a1 1 0 112 0 1 1 0 01-2 0zM11 13a1 1 0 100 2 1 1 0 000-2z" fill-opacity="0.9"></path>
</svg></td>
<td>JQTest1</td>
<td>
<p class="status">
健康
</p>
</td>
<td>1000</td>
<td>jenny;peter</td>
</tr>
<tr data-id="2">
<td class="t-table__handle-draggable"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-move">
<path fill="currentColor" d="M5 1a1 1 0 100 2 1 1 0 000-2zM11 1a1 1 0 100 2 1 1 0 000-2zM4 6a1 1 0 112 0 1 1 0 01-2 0zM11 5a1 1 0 100 2 1 1 0 000-2zM4 10a1 1 0 112 0 1 1 0 01-2 0zM5 13a1 1 0 100 2 1 1 0 000-2zM10 10a1 1 0 112 0 1 1 0 01-2 0zM11 13a1 1 0 100 2 1 1 0 000-2z" fill-opacity="0.9"></path>
</svg></td>
<td>JQTest2</td>
<td>
<p class="status warning">
警告
</p>
</td>
<td>1000</td>
<td>jenny</td>
</tr>
<tr data-id="3">
<td class="t-table__handle-draggable"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-move">
<path fill="currentColor" d="M5 1a1 1 0 100 2 1 1 0 000-2zM11 1a1 1 0 100 2 1 1 0 000-2zM4 6a1 1 0 112 0 1 1 0 01-2 0zM11 5a1 1 0 100 2 1 1 0 000-2zM4 10a1 1 0 112 0 1 1 0 01-2 0zM5 13a1 1 0 100 2 1 1 0 000-2zM10 10a1 1 0 112 0 1 1 0 01-2 0zM11 13a1 1 0 100 2 1 1 0 000-2z" fill-opacity="0.9"></path>
</svg></td>
<td>JQTest3</td>
<td>
<p class="status unhealth">
异常
</p>
</td>
<td>500</td>
<td>jenny</td>
</tr>
<tr data-id="4">
<td class="t-table__handle-draggable"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-move">
<path fill="currentColor" d="M5 1a1 1 0 100 2 1 1 0 000-2zM11 1a1 1 0 100 2 1 1 0 000-2zM4 6a1 1 0 112 0 1 1 0 01-2 0zM11 5a1 1 0 100 2 1 1 0 000-2zM4 10a1 1 0 112 0 1 1 0 01-2 0zM5 13a1 1 0 100 2 1 1 0 000-2zM10 10a1 1 0 112 0 1 1 0 01-2 0zM11 13a1 1 0 100 2 1 1 0 000-2z" fill-opacity="0.9"></path>
</svg></td>
<td>JQTest4</td>
<td>
<p class="status warning">
警告
</p>
</td>
<td>1500</td>
<td>peter</td>
</tr>
</tbody>
<!---->
</table>
</div>
</div>
</div>
</div>
`;

exports[`ssr snapshot test renders ./examples/table/demos/empty.vue correctly 1`] = `
<div class="tdesign-demo-block-column-large">
<div class="t-table" style="position:relative;">
Expand Down Expand Up @@ -13996,7 +14074,7 @@ exports[`ssr snapshot test renders ./examples/table/demos/merge-cells.vue correc

exports[`ssr snapshot test renders ./examples/table/demos/multi-header.vue correctly 1`] = `
<div class="tdesign-demo-block-column-large tdesign-demo-table-multi-header" style="width:100%;">
<div><label class="t-checkbox t-is-checked"><input type="checkbox" checked="checked" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">显示表格边框</span></label> <label class="t-checkbox t-is-checked"><input type="checkbox" checked="checked" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">显示固定表头</span></label> <label class="t-checkbox t-is-checked"><input type="checkbox" checked="checked" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">虚拟滚动</span></label> <label class="t-checkbox"><input type="checkbox" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">固定左侧列</span></label> <label class="t-checkbox"><input type="checkbox" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">固定右侧列</span></label> <label class="t-checkbox"><input type="checkbox" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">表头吸顶</span></label></div>
<div><label class="t-checkbox t-is-checked"><input type="checkbox" checked="checked" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">显示表格边框</span></label> <label class="t-checkbox t-is-checked"><input type="checkbox" checked="checked" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">显示固定表头</span></label> <label class="t-checkbox"><input type="checkbox" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">固定左侧列</span></label> <label class="t-checkbox"><input type="checkbox" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">固定右侧列</span></label> <label class="t-checkbox"><input type="checkbox" class="t-checkbox__former"><span class="t-checkbox__input"></span><span class="t-checkbox__label">表头吸顶</span></label></div>
<div class="t-table t-table--bordered t-table--multiple-header" style="position:relative;">
<div class="t-table__top-content">
<div class="t-table__column-controller-trigger t-align-top-right"><button type="button" class="t-button t-size-m t-button--variant-outline t-button--theme-default"><svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-setting">
Expand All @@ -14005,7 +14083,7 @@ exports[`ssr snapshot test renders ./examples/table/demos/multi-header.vue corre
</svg><span class="t-button__text">列配置</span></button></div>
</div>
<div class="t-table__content" style="max-height:380px;">
<div class="t-table__virtual-scroll-cursor" style="transform:translate(0, 28800px);-ms-transform:translate(0, 28800px);-moz-transform:translate(0, 28800px);-webkit-transform:translate(0, 28800px);"></div>
<div class="t-table__virtual-scroll-cursor" style="transform:translate(0, 30000px);-ms-transform:translate(0, 30000px);-moz-transform:translate(0, 30000px);-webkit-transform:translate(0, 30000px);"></div>
<table class="t-table--layout-fixed" style="width:;">
<colgroup>
<col style="width:100px;">
Expand Down
Loading