-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comp:transfer): label slot renders source and target seperately (#…
…1006) BREAKING CHANGE: label slot params change to { item, isSource }
- Loading branch information
Showing
13 changed files
with
227 additions
and
12 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
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,14 @@ | ||
--- | ||
title: | ||
zh: 表格穿梭框自定义表格列渲染 | ||
en: Customize Table Transfer Column Render | ||
order: 11 | ||
--- | ||
|
||
## zh | ||
|
||
使用表格 `TableColumn` 中的 `customCell` 以及 `customTitle` 自定义表格列。 | ||
|
||
## en | ||
|
||
Customize table column render using `customCell` and `customTitle` of `TableColumn` options. |
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,72 @@ | ||
<template> | ||
<IxProTransfer | ||
v-model:value="targetKeys" | ||
type="table" | ||
:data-source="dataSource" | ||
:table-props="tableProps" | ||
:scroll="{ height: 300, width: { source: 600 }, fullHeight: true }" | ||
> | ||
<template #nameTitle> Name </template> | ||
<template #sourceNameCell="{ record }"> | ||
<IxIcon name="user" /> | ||
{{ record.name }} | ||
</template> | ||
<template #targetNameCell="{ record }"> | ||
<IxIcon name="user" /> | ||
{{ record.name }} ({{ record.age }}) | ||
</template> | ||
</IxProTransfer> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { TableColumn } from '@idux/components/table' | ||
interface Data { | ||
key: number | ||
disabled: boolean | ||
name: string | ||
age: number | ||
address: string | ||
} | ||
const sourceColumns: TableColumn<Data>[] = [ | ||
{ | ||
dataKey: 'name', | ||
customTitle: 'nameTitle', | ||
customCell: 'sourceNameCell', | ||
}, | ||
{ | ||
title: 'Age', | ||
dataKey: 'age', | ||
}, | ||
{ | ||
title: 'Address', | ||
dataKey: 'address', | ||
}, | ||
] | ||
const targetColumns: TableColumn<Data>[] = [ | ||
{ | ||
dataKey: 'name', | ||
customTitle: 'nameTitle', | ||
customCell: 'targetNameCell', | ||
}, | ||
] | ||
const tableProps = { | ||
sourceColumns, | ||
targetColumns, | ||
} | ||
const targetKeys = ref<number[]>(Array.from(new Array(10)).map((_, idx) => idx)) | ||
const dataSource: Data[] = Array.from(new Array(20)).map((_, idx) => ({ | ||
key: idx, | ||
disabled: [1, 6, 12, 16].includes(idx), | ||
name: 'Candidate' + idx, | ||
age: idx, | ||
address: 'London No.1 Lake Park', | ||
})) | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 12 | ||
title: | ||
zh: 树穿梭框自定义标签渲染 | ||
en: Customize Tree Transfer Label Render | ||
--- | ||
|
||
## zh | ||
|
||
使用表格 `label` 插槽自定义标签渲染。 | ||
|
||
## en | ||
|
||
Customize label render using `label` slot. |
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,97 @@ | ||
<template> | ||
<IxProTransfer | ||
v-model:value="targetKeys" | ||
type="tree" | ||
:data-source="dataSource" | ||
:scroll="{ height: 300, fullHeight: true }" | ||
> | ||
<template #label="{ item, isSource }"> | ||
<span v-if="isSource">{{ item.label }}</span> | ||
<span v-else>{{ item.key }}</span> | ||
</template> | ||
</IxProTransfer> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
interface Data { | ||
key: string | ||
disabled: boolean | ||
label: string | ||
children?: Data[] | ||
} | ||
const targetKeys = ref<string[]>(['1-2', '1-2-1', '1-2-2', '1-3-2-1', '2']) | ||
const dataSource: Data[] = [ | ||
{ | ||
key: '1', | ||
disabled: false, | ||
label: 'Selection-1', | ||
children: [ | ||
{ | ||
key: '1-1', | ||
disabled: false, | ||
label: 'Selection-1-1', | ||
}, | ||
{ | ||
key: '1-2', | ||
disabled: false, | ||
label: 'Selection-1-2', | ||
children: [ | ||
{ | ||
key: '1-2-1', | ||
disabled: false, | ||
label: 'Selection-1-2-1', | ||
}, | ||
{ | ||
key: '1-2-2', | ||
disabled: false, | ||
label: 'Selection-1-2-2', | ||
}, | ||
], | ||
}, | ||
{ | ||
key: '1-3', | ||
disabled: false, | ||
label: 'Selection-1-3', | ||
children: [ | ||
{ | ||
key: '1-3-1', | ||
disabled: false, | ||
label: 'Selection-1-3-1', | ||
}, | ||
{ | ||
key: '1-3-2', | ||
disabled: false, | ||
label: 'Selection-1-3-2', | ||
children: [ | ||
{ | ||
key: '1-3-2-1', | ||
disabled: true, | ||
label: 'Selection-1-3-2-1', | ||
}, | ||
{ | ||
key: '1-3-2-2', | ||
disabled: false, | ||
label: 'Selection-1-3-2-2', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
key: '1-4', | ||
disabled: false, | ||
label: 'Selection-1-4', | ||
}, | ||
], | ||
}, | ||
{ | ||
key: '2', | ||
disabled: false, | ||
label: 'Selection-2', | ||
}, | ||
] | ||
</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
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