x-next 1.16.1 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI_USAGE/catalog.md +3 -2
- package/AI_USAGE/components/alert-api.md +1 -1
- package/AI_USAGE/components/alert.md +1 -1
- package/AI_USAGE/components/bar-chart-api.md +1 -1
- package/AI_USAGE/components/bar-chart.md +1 -1
- package/AI_USAGE/components/boxicons.md +1 -1
- package/AI_USAGE/components/button-api.md +1 -1
- package/AI_USAGE/components/button.md +1 -1
- package/AI_USAGE/components/charts.md +1 -1
- package/AI_USAGE/components/checkbox-api.md +1 -1
- package/AI_USAGE/components/checkbox.md +1 -1
- package/AI_USAGE/components/color-picker-api.md +1 -1
- package/AI_USAGE/components/color-picker.md +1 -1
- package/AI_USAGE/components/config-provider-api.md +1 -1
- package/AI_USAGE/components/config-provider.md +1 -1
- package/AI_USAGE/components/date-picker-api.md +1 -1
- package/AI_USAGE/components/date-picker.md +1 -1
- package/AI_USAGE/components/dialog-api.md +1 -1
- package/AI_USAGE/components/dialog.md +1 -1
- package/AI_USAGE/components/draggable-api.md +1 -1
- package/AI_USAGE/components/draggable.md +1 -1
- package/AI_USAGE/components/drawer-api.md +1 -1
- package/AI_USAGE/components/drawer.md +1 -1
- package/AI_USAGE/components/dropdown-api.md +1 -1
- package/AI_USAGE/components/dropdown.md +1 -1
- package/AI_USAGE/components/empty-api.md +1 -1
- package/AI_USAGE/components/empty.md +1 -1
- package/AI_USAGE/components/finicon.md +1 -1
- package/AI_USAGE/components/form-api.md +1 -1
- package/AI_USAGE/components/form.md +1 -1
- package/AI_USAGE/components/grid-api.md +1 -1
- package/AI_USAGE/components/grid.md +1 -1
- package/AI_USAGE/components/heatmap-api.md +1 -1
- package/AI_USAGE/components/heatmap.md +1 -1
- package/AI_USAGE/components/icon-api.md +1 -1
- package/AI_USAGE/components/icon.md +1 -1
- package/AI_USAGE/components/image-api.md +1 -1
- package/AI_USAGE/components/image.md +1 -1
- package/AI_USAGE/components/input-api.md +1 -1
- package/AI_USAGE/components/input-number-api.md +1 -1
- package/AI_USAGE/components/input-number.md +1 -1
- package/AI_USAGE/components/input-tag-api.md +1 -1
- package/AI_USAGE/components/input-tag.md +1 -1
- package/AI_USAGE/components/input.md +1 -1
- package/AI_USAGE/components/layout-api.md +1 -1
- package/AI_USAGE/components/layout.md +1 -1
- package/AI_USAGE/components/line-chart-api.md +1 -1
- package/AI_USAGE/components/line-chart.md +1 -1
- package/AI_USAGE/components/link-api.md +1 -1
- package/AI_USAGE/components/link.md +1 -1
- package/AI_USAGE/components/menu-api.md +1 -1
- package/AI_USAGE/components/menu.md +1 -1
- package/AI_USAGE/components/message-api.md +1 -1
- package/AI_USAGE/components/message-box-api.md +1 -1
- package/AI_USAGE/components/message-box.md +1 -1
- package/AI_USAGE/components/message.md +1 -1
- package/AI_USAGE/components/network-api.md +1 -1
- package/AI_USAGE/components/network.md +1 -1
- package/AI_USAGE/components/notification-api.md +1 -1
- package/AI_USAGE/components/notification.md +1 -1
- package/AI_USAGE/components/pagination-api.md +1 -1
- package/AI_USAGE/components/pagination.md +1 -1
- package/AI_USAGE/components/pie-chart-api.md +1 -1
- package/AI_USAGE/components/pie-chart.md +1 -1
- package/AI_USAGE/components/popconfirm-api.md +1 -1
- package/AI_USAGE/components/popconfirm.md +1 -1
- package/AI_USAGE/components/popover-api.md +1 -1
- package/AI_USAGE/components/popover.md +1 -1
- package/AI_USAGE/components/popup-api.md +1 -1
- package/AI_USAGE/components/popup.md +1 -1
- package/AI_USAGE/components/progress-api.md +1 -1
- package/AI_USAGE/components/progress.md +1 -1
- package/AI_USAGE/components/radio-api.md +1 -1
- package/AI_USAGE/components/radio.md +1 -1
- package/AI_USAGE/components/rate-api.md +1 -1
- package/AI_USAGE/components/rate.md +1 -1
- package/AI_USAGE/components/resize-box-api.md +1 -1
- package/AI_USAGE/components/resize-box.md +1 -1
- package/AI_USAGE/components/scrollbar-api.md +1 -1
- package/AI_USAGE/components/scrollbar.md +1 -1
- package/AI_USAGE/components/select-api.md +1 -1
- package/AI_USAGE/components/select.md +1 -1
- package/AI_USAGE/components/skeleton-api.md +1 -1
- package/AI_USAGE/components/skeleton.md +1 -1
- package/AI_USAGE/components/slider-api.md +1 -1
- package/AI_USAGE/components/slider.md +1 -1
- package/AI_USAGE/components/space-api.md +1 -1
- package/AI_USAGE/components/space.md +1 -1
- package/AI_USAGE/components/spin-api.md +1 -1
- package/AI_USAGE/components/spin.md +1 -1
- package/AI_USAGE/components/steps-api.md +1 -1
- package/AI_USAGE/components/steps.md +1 -1
- package/AI_USAGE/components/switch-api.md +1 -1
- package/AI_USAGE/components/switch.md +1 -1
- package/AI_USAGE/components/table-api.md +1 -1
- package/AI_USAGE/components/table.md +1 -1
- package/AI_USAGE/components/tabs-api.md +1 -1
- package/AI_USAGE/components/tabs.md +1 -1
- package/AI_USAGE/components/tag-api.md +1 -1
- package/AI_USAGE/components/tag.md +1 -1
- package/AI_USAGE/components/textarea-api.md +1 -1
- package/AI_USAGE/components/textarea.md +1 -1
- package/AI_USAGE/components/time-picker-api.md +1 -1
- package/AI_USAGE/components/time-picker.md +1 -1
- package/AI_USAGE/components/time-range-selector-api.md +1 -1
- package/AI_USAGE/components/time-range-selector.md +1 -1
- package/AI_USAGE/components/timeline-api.md +1 -1
- package/AI_USAGE/components/timeline.md +1 -1
- package/AI_USAGE/components/tooltip-api.md +1 -1
- package/AI_USAGE/components/tooltip.md +1 -1
- package/AI_USAGE/components/transfer-api.md +165 -0
- package/AI_USAGE/components/transfer.md +515 -0
- package/AI_USAGE/components/tree-select-api.md +1 -1
- package/AI_USAGE/components/tree-select.md +1 -1
- package/AI_USAGE/components/trend-chart-api.md +1 -1
- package/AI_USAGE/components/trend-chart.md +1 -1
- package/AI_USAGE/components/trigger-api.md +1 -1
- package/AI_USAGE/components/trigger.md +1 -1
- package/AI_USAGE/components/upload-api.md +1 -1
- package/AI_USAGE/components/upload.md +1 -1
- package/AI_USAGE/components/watermark-api.md +1 -1
- package/AI_USAGE/components/watermark.md +1 -1
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +3 -2
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +663 -3
- package/CHANGELOG.md +20 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/transfer/Transfer.d.ts +211 -0
- package/dist/components/transfer/index.d.ts +299 -0
- package/dist/components/transfer/interface.d.ts +80 -0
- package/dist/components/transfer/transfer-panel.d.ts +82 -0
- package/dist/components/transfer/utils.d.ts +5 -0
- package/dist/es/components/index.js +47 -45
- package/dist/es/components/transfer/Transfer.js +267 -0
- package/dist/es/components/transfer/index.js +7 -0
- package/dist/es/components/transfer/transfer-panel.js +251 -0
- package/dist/es/components/transfer/utils.js +9 -0
- package/dist/es/index.js +46 -44
- package/dist/es/locale/en-US.js +16 -0
- package/dist/es/locale/zh-CN.js +16 -0
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/locale/interface.d.ts +16 -0
- package/dist/style/base.css +1 -1
- package/dist/style/dependencies.json +14 -0
- package/dist/style/transfer.css +1 -0
- package/dist/style/transfer.js +12 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +3 -1
- package/volar.d.ts +1 -0
package/AI_USAGE.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
2
|
# x-next AI 使用手册
|
|
3
3
|
|
|
4
|
-
适用版本:**x-next@1.
|
|
4
|
+
适用版本:**x-next@1.17.0**。Vue:`^3.5.0`;Node:`>=20.19.0`。
|
|
5
5
|
|
|
6
|
-
来源指纹(AI 行为说明、docs 导入快照、映射、样式依赖、版本、公开类型和 API 参考):`
|
|
6
|
+
来源指纹(AI 行为说明、docs 导入快照、映射、样式依赖、版本、公开类型和 API 参考):`cb20ad6ab74abb988edda3dcdead384d76be5bf5f8d346414b20974fc2b6ac68`。
|
|
7
7
|
|
|
8
|
-
覆盖
|
|
8
|
+
覆盖 59 个组件族与 106 个公开组件/服务导出。优先通过 [本地按需索引](./AI_USAGE/index.md) 读取组件页和 API,不为查本包用法默认搜索网络。
|
|
9
9
|
|
|
10
10
|
读取入口:`node_modules/x-next/AI_USAGE.md`;可用 `require.resolve('x-next/AI_USAGE.md')` 定位。消费项目应在自己的指令中明确引用。
|
|
11
11
|
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
| Steps | `Steps` | `<x-steps>` | `v-model:current` | `x-next/style/steps` | 无独立依赖 | [组件文档](https://x-next.yjmf.com/components/steps) |
|
|
42
42
|
| Tabs | `Tabs` | `<x-tabs>` | `v-model:active-key` | `x-next/style/tabs` | 无独立依赖 | [组件文档](https://x-next.yjmf.com/components/tabs) |
|
|
43
43
|
| TreeSelect | `TreeSelect`, `TreeSelectDropdown` | `<x-tree-select>` | `v-model`, `v-model:input-value`, `v-model:popup-visible`, `v-model:expanded-keys` | `x-next/style/tree-select` | `empty.css`, `form-checkbox.css`, `form-select.css`, `scrollbar-v2.css`, `spin.css`, `trigger.css` | [组件文档](https://x-next.yjmf.com/components/tree-select) |
|
|
44
|
+
| Transfer | `Transfer` | `<x-transfer>` | `v-model`, `v-model:selected-keys` | `x-next/style/transfer` | `button.css`, `empty.css`, `form-checkbox.css`, `form-input.css`, `form-input-number.css`, `form-select.css`, `pagination.css`, `scrollbar-v2.css`, `spin.css`, `trigger.css` | [组件文档](https://x-next.yjmf.com/components/transfer) |
|
|
44
45
|
| Empty | `Empty` | `<x-empty>` | 无 | `x-next/style/empty` | 无独立依赖 | [组件文档](https://x-next.yjmf.com/components/empty) |
|
|
45
46
|
| Upload | `Upload` | `<x-upload>` | `v-model:file-list` | `x-next/style/upload` | `image.css`, `progress.css`, `trigger.css`, `tooltip.css` | [组件文档](https://x-next.yjmf.com/components/upload) |
|
|
46
47
|
| BarChart | `BarChart` | `<x-bar-chart>` | 无 | `x-next/style/bar-chart` | `spin.css` | [组件文档](https://x-next.yjmf.com/components/bar-chart) |
|
|
@@ -783,6 +784,40 @@ function resized(size: number) { current.value = 1; feedback.value = `每页 ${s
|
|
|
783
784
|
</template>
|
|
784
785
|
```
|
|
785
786
|
|
|
787
|
+
## Transfer
|
|
788
|
+
|
|
789
|
+
[组件文档与 live demo](https://x-next.yjmf.com/components/transfer)。`data` 是 `{ value: string | number, label: string, disabled?: boolean }[]`,可附加业务字段。`v-model` 是目标侧值数组;`v-model:selected-keys` 是两侧临时勾选数组,彼此独立。`defaultValue` / `defaultSelectedKeys` 只初始化非受控状态。数字与字符串值不同;重复数据值保留首项。目标模型中的未加载值不展示,移动其他项时仍保留。
|
|
790
|
+
|
|
791
|
+
`showSearch=false`、`showSelectAll=true`、`simple=false`、`oneWay=false`、`loading=false`、`disabled=false`。搜索默认不区分大小写,`filterOption(input, item, type)` 适配业务字段。全选只处理当前搜索结果,分页时仅当前页,禁用项不参与;已勾选的搜索隐藏项仍可移动。`simple` 点击即移动;`oneWay` 只显示向右按钮,目标侧逐项移除,禁用项不可移除。加载阻止操作。`targetOrder='original'` 按源数据排序,`append` 按模型顺序。
|
|
792
|
+
|
|
793
|
+
`change(values, type, movedValues)` 的 `type` 是目的侧 `'source' | 'target'`;`select(sourceSelected, targetSelected)` 报告两侧有效勾选;`search(input, type)`、`scroll(event, type)` 报告源/目标侧。受控模型必须回写;不回写时不提交界面状态。Form 只在移动时触发 change,搜索/临时勾选不触发字段校验。
|
|
794
|
+
|
|
795
|
+
`pagination=true | { pageSize }` 默认每页 10,优先于 `virtualListProps`。`item` 自定义内容;`source` / `target` 替换列表,提供 `data`、`pageData`、`selectedKeys`、`disabled`、`onSelect(value, checked)`、`onSelectAll(values, checked)`、`onMove(values)`。回调统一校验同侧、存在性、禁用和加载。自定义列表自行实现空态、虚拟滚动及键盘语义;默认列表用 Tab/Space 和方向键/Home/End 操作。没有 readonly、远程分页、拖拽排序或字段映射 API。
|
|
796
|
+
|
|
797
|
+
```vue
|
|
798
|
+
<script setup lang="ts">
|
|
799
|
+
import { ref } from 'vue';
|
|
800
|
+
import { Transfer } from 'x-next';
|
|
801
|
+
import type { TransferItem, TransferValue, TransferType } from 'x-next';
|
|
802
|
+
import 'x-next/style/transfer';
|
|
803
|
+
const values = ref<TransferValue[]>(['audit']);
|
|
804
|
+
const data: TransferItem[] = [
|
|
805
|
+
{ value: 'read', label: '查看数据' },
|
|
806
|
+
{ value: 'edit', label: '编辑数据' },
|
|
807
|
+
{ value: 'audit', label: '审核数据' },
|
|
808
|
+
{ value: 'admin', label: '管理配置', disabled: true },
|
|
809
|
+
];
|
|
810
|
+
const log = ref('');
|
|
811
|
+
function changed(next: TransferValue[], type: TransferType, moved: TransferValue[]) {
|
|
812
|
+
log.value = `${type} ${moved.join(',')};目标值 ${JSON.stringify(next)}`;
|
|
813
|
+
}
|
|
814
|
+
</script>
|
|
815
|
+
<template>
|
|
816
|
+
<Transfer v-model="values" :data="data" show-search @change="changed" />
|
|
817
|
+
<p aria-live="polite">{{ log }}</p>
|
|
818
|
+
</template>
|
|
819
|
+
```
|
|
820
|
+
|
|
786
821
|
## TreeSelect
|
|
787
822
|
|
|
788
823
|
[组件文档与 live demo](https://x-next.yjmf.com/components/tree-select)。用于在层级数据中选择节点,`data` 是 `{ key, title, children }` 树。单选为标量、`multiple` 为数组、`treeCheckable` 勾选模式始终返回数组;`allowSearch` 默认多选 / 勾选开启、单选关闭,`checkedStrategy` 默认 `parent`。
|
|
@@ -9010,6 +9045,474 @@ const nativeAttrs1 = { "aria-label": "键盘选择地区" } satisfies HTMLAttrib
|
|
|
9010
9045
|
- 与 Arco 的差异:`checkedStrategy` 默认 `parent`(Arco 默认 `all`),并在其基础上提供 `child`;值可为 `labelInValue` 对象且附带 `raw` 原始节点,属于 x-next 的扩展。
|
|
9011
9046
|
|
|
9012
9047
|
|
|
9048
|
+
## Transfer 扩展场景
|
|
9049
|
+
|
|
9050
|
+
### 用途与选型
|
|
9051
|
+
|
|
9052
|
+
在两列列表之间移动数据,用于权限分配、成员分组和资源授权。
|
|
9053
|
+
|
|
9054
|
+
|
|
9055
|
+
### 何时使用
|
|
9056
|
+
|
|
9057
|
+
- 同时查看候选与已分配数据,进行批量分配或取消分配。
|
|
9058
|
+
- 选项包含较多业务信息,Select 展开空间不足。
|
|
9059
|
+
- 自定义列表可以接入表格或树;层级关联与列表键盘逻辑由业务组合实现。
|
|
9060
|
+
|
|
9061
|
+
|
|
9062
|
+
### 基础用法与移动事件
|
|
9063
|
+
|
|
9064
|
+
先勾选,再点击方向按钮。`change` 的第二参数是移动目的侧,第三参数仅包含实际移动值。
|
|
9065
|
+
|
|
9066
|
+
```vue
|
|
9067
|
+
<script setup lang="ts">
|
|
9068
|
+
import 'x-next/style.css';
|
|
9069
|
+
import { reactive, ref } from 'vue';
|
|
9070
|
+
import { Transfer } from 'x-next';
|
|
9071
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9072
|
+
const basicValue = ref<TransferValue[]>(['audit']);
|
|
9073
|
+
const basicData: TransferItem[] = [
|
|
9074
|
+
{ value: 'read', label: '查看数据' },
|
|
9075
|
+
{ value: 'edit', label: '编辑数据' },
|
|
9076
|
+
{ value: 'audit', label: '审核数据' },
|
|
9077
|
+
{ value: 'admin', label: '管理配置(不可分配)', disabled: true },
|
|
9078
|
+
];
|
|
9079
|
+
const basicLog = ref('请勾选权限并移动');
|
|
9080
|
+
function basicChange(value: TransferValue[], type: TransferType, moved: TransferValue[]) {
|
|
9081
|
+
basicLog.value = `移至 ${type}:${moved.join(', ')};当前值 ${JSON.stringify(value)}`;
|
|
9082
|
+
}
|
|
9083
|
+
</script>
|
|
9084
|
+
<template>
|
|
9085
|
+
<Transfer
|
|
9086
|
+
v-model="basicValue"
|
|
9087
|
+
:data="basicData"
|
|
9088
|
+
:title="['可分配权限', '已分配权限']"
|
|
9089
|
+
@change="basicChange"
|
|
9090
|
+
/>
|
|
9091
|
+
<p aria-live="polite">{{ basicLog }}</p>
|
|
9092
|
+
<p>目标值:{{ basicValue }}</p>
|
|
9093
|
+
</template>
|
|
9094
|
+
```
|
|
9095
|
+
|
|
9096
|
+
### 受控勾选与目标排序
|
|
9097
|
+
|
|
9098
|
+
`v-model:selected-keys` 控制两侧临时勾选,与目标值独立。`target-order="append"` 以模型顺序展示目标项。
|
|
9099
|
+
|
|
9100
|
+
```vue
|
|
9101
|
+
<script setup lang="ts">
|
|
9102
|
+
import 'x-next/style.css';
|
|
9103
|
+
import { reactive, ref } from 'vue';
|
|
9104
|
+
import { Transfer, Button } from 'x-next';
|
|
9105
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9106
|
+
const checkedValue = ref<TransferValue[]>([2]);
|
|
9107
|
+
const checkedKeys = ref<TransferValue[]>([1]);
|
|
9108
|
+
const checkedData: TransferItem[] = Array.from({ length: 6 }, (_, index) => ({
|
|
9109
|
+
value: index + 1,
|
|
9110
|
+
label: `成员 ${index + 1}`,
|
|
9111
|
+
}));
|
|
9112
|
+
const checkedLog = ref('');
|
|
9113
|
+
function checkedSelect(source: TransferValue[], target: TransferValue[]) {
|
|
9114
|
+
checkedLog.value = `左侧 ${JSON.stringify(source)};右侧 ${JSON.stringify(target)}`;
|
|
9115
|
+
}
|
|
9116
|
+
</script>
|
|
9117
|
+
<template>
|
|
9118
|
+
<p
|
|
9119
|
+
><Button @click="checkedKeys = [1, 2, 3]">勾选成员 1 / 2 / 3</Button>
|
|
9120
|
+
<Button @click="checkedKeys = []">取消所有勾选</Button></p
|
|
9121
|
+
>
|
|
9122
|
+
<Transfer
|
|
9123
|
+
v-model="checkedValue"
|
|
9124
|
+
v-model:selected-keys="checkedKeys"
|
|
9125
|
+
:data="checkedData"
|
|
9126
|
+
target-order="append"
|
|
9127
|
+
@select="checkedSelect"
|
|
9128
|
+
/>
|
|
9129
|
+
<p>目标:{{ checkedValue }};勾选:{{ checkedKeys }}</p>
|
|
9130
|
+
<p aria-live="polite">{{ checkedLog }}</p>
|
|
9131
|
+
</template>
|
|
9132
|
+
```
|
|
9133
|
+
|
|
9134
|
+
### 搜索与过滤后的全选
|
|
9135
|
+
|
|
9136
|
+
全选只作用于当前搜索结果,禁用项不参与;已勾选的隐藏项仍可以移动。自定义过滤可搜索附加业务字段。
|
|
9137
|
+
|
|
9138
|
+
```vue
|
|
9139
|
+
<script setup lang="ts">
|
|
9140
|
+
import 'x-next/style.css';
|
|
9141
|
+
import { reactive, ref } from 'vue';
|
|
9142
|
+
import { Transfer } from 'x-next';
|
|
9143
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9144
|
+
const searchValue = ref<TransferValue[]>([]);
|
|
9145
|
+
const searchData: TransferItem[] = [
|
|
9146
|
+
{ value: 'east-1', label: '杭州', region: '华东' },
|
|
9147
|
+
{ value: 'east-2', label: '上海', region: '华东' },
|
|
9148
|
+
{ value: 'north', label: '北京', region: '华北' },
|
|
9149
|
+
{ value: 'south', label: '深圳', region: '华南', disabled: true },
|
|
9150
|
+
];
|
|
9151
|
+
const searchLog = ref('尝试搜索“华东”,然后全选');
|
|
9152
|
+
function searchFilter(input: string, item: TransferItem) {
|
|
9153
|
+
return `${item.label} ${String(item.region ?? '')}`.includes(input.trim());
|
|
9154
|
+
}
|
|
9155
|
+
function searchChanged(input: string, type: TransferType) {
|
|
9156
|
+
searchLog.value = `${type} 搜索:${input || '已清空'}`;
|
|
9157
|
+
}
|
|
9158
|
+
</script>
|
|
9159
|
+
<template>
|
|
9160
|
+
<Transfer
|
|
9161
|
+
v-model="searchValue"
|
|
9162
|
+
:data="searchData"
|
|
9163
|
+
show-search
|
|
9164
|
+
search-placeholder="搜索城市或大区"
|
|
9165
|
+
:filter-option="searchFilter"
|
|
9166
|
+
@search="searchChanged"
|
|
9167
|
+
/>
|
|
9168
|
+
<p aria-live="polite">{{ searchLog }}</p>
|
|
9169
|
+
<p>目标值:{{ searchValue }}</p>
|
|
9170
|
+
</template>
|
|
9171
|
+
```
|
|
9172
|
+
|
|
9173
|
+
### 禁用、加载与错误状态
|
|
9174
|
+
|
|
9175
|
+
加载时显示真实加载组件并阻止操作。单项禁用只影响该项;`error` 同时支持从 Form 继承。
|
|
9176
|
+
|
|
9177
|
+
```vue
|
|
9178
|
+
<script setup lang="ts">
|
|
9179
|
+
import 'x-next/style.css';
|
|
9180
|
+
import { reactive, ref } from 'vue';
|
|
9181
|
+
import { Transfer, Checkbox } from 'x-next';
|
|
9182
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9183
|
+
const stateValue = ref<TransferValue[]>([1]);
|
|
9184
|
+
const stateDisabled = ref(false);
|
|
9185
|
+
const stateLoading = ref(false);
|
|
9186
|
+
const stateError = ref(false);
|
|
9187
|
+
const stateData: TransferItem[] = [
|
|
9188
|
+
{ value: 1, label: '业务成员' },
|
|
9189
|
+
{ value: 2, label: '运维成员' },
|
|
9190
|
+
{ value: 3, label: '只读成员(禁用)', disabled: true },
|
|
9191
|
+
{ value: 4, label: '这是一个用于检查溢出省略和原生标题的超长成员名称' },
|
|
9192
|
+
];
|
|
9193
|
+
</script>
|
|
9194
|
+
<template>
|
|
9195
|
+
<p
|
|
9196
|
+
><Checkbox v-model="stateDisabled">禁用</Checkbox>
|
|
9197
|
+
<Checkbox v-model="stateLoading">加载中</Checkbox>
|
|
9198
|
+
<Checkbox v-model="stateError">错误</Checkbox></p
|
|
9199
|
+
>
|
|
9200
|
+
<Transfer
|
|
9201
|
+
v-model="stateValue"
|
|
9202
|
+
:data="stateData"
|
|
9203
|
+
:disabled="stateDisabled"
|
|
9204
|
+
:loading="stateLoading"
|
|
9205
|
+
:error="stateError"
|
|
9206
|
+
show-search
|
|
9207
|
+
/>
|
|
9208
|
+
</template>
|
|
9209
|
+
```
|
|
9210
|
+
|
|
9211
|
+
### 单向分配与逐项移除
|
|
9212
|
+
|
|
9213
|
+
只保留向右按钮,目标侧使用可通过键盘到达的移除按钮。已分配的禁用项不能移除。
|
|
9214
|
+
|
|
9215
|
+
```vue
|
|
9216
|
+
<script setup lang="ts">
|
|
9217
|
+
import 'x-next/style.css';
|
|
9218
|
+
import { reactive, ref } from 'vue';
|
|
9219
|
+
import { Transfer } from 'x-next';
|
|
9220
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9221
|
+
const oneWayValue = ref<TransferValue[]>(['owner', 'viewer']);
|
|
9222
|
+
const oneWayData: TransferItem[] = [
|
|
9223
|
+
{ value: 'owner', label: '固定负责人', disabled: true },
|
|
9224
|
+
{ value: 'viewer', label: '查看成员' },
|
|
9225
|
+
{ value: 'editor', label: '编辑成员' },
|
|
9226
|
+
];
|
|
9227
|
+
</script>
|
|
9228
|
+
<template>
|
|
9229
|
+
<Transfer v-model="oneWayValue" :data="oneWayData" one-way :operations="['分配']" />
|
|
9230
|
+
<p>已分配:{{ oneWayValue }}</p>
|
|
9231
|
+
</template>
|
|
9232
|
+
```
|
|
9233
|
+
|
|
9234
|
+
### 简单模式
|
|
9235
|
+
|
|
9236
|
+
点击选项直接移动,也支持 Tab 与 Enter/Space。与 `one-way` 组合时,目标侧仍使用移除按钮。
|
|
9237
|
+
|
|
9238
|
+
```vue
|
|
9239
|
+
<script setup lang="ts">
|
|
9240
|
+
import 'x-next/style.css';
|
|
9241
|
+
import { reactive, ref } from 'vue';
|
|
9242
|
+
import { Transfer } from 'x-next';
|
|
9243
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9244
|
+
const simpleValue = ref<TransferValue[]>(['b']);
|
|
9245
|
+
const simpleData: TransferItem[] = [
|
|
9246
|
+
{ value: 'a', label: '开发组' },
|
|
9247
|
+
{ value: 'b', label: '产品组' },
|
|
9248
|
+
{ value: 'c', label: '测试组' },
|
|
9249
|
+
{ value: 'd', label: '归档组', disabled: true },
|
|
9250
|
+
];
|
|
9251
|
+
</script>
|
|
9252
|
+
<template>
|
|
9253
|
+
<Transfer v-model="simpleValue" :data="simpleData" simple />
|
|
9254
|
+
<p>点击组名即可移动:{{ simpleValue }}</p>
|
|
9255
|
+
</template>
|
|
9256
|
+
```
|
|
9257
|
+
|
|
9258
|
+
### 自定义选项、标题、图标和页脚
|
|
9259
|
+
|
|
9260
|
+
item 仅替换内容,保留原生勾选交互。标题通过 `onSelectAllChange` 调用当前搜索结果/页内的全选。
|
|
9261
|
+
|
|
9262
|
+
```vue
|
|
9263
|
+
<script setup lang="ts">
|
|
9264
|
+
import 'x-next/style.css';
|
|
9265
|
+
import { reactive, ref } from 'vue';
|
|
9266
|
+
import { Transfer, Checkbox } from 'x-next';
|
|
9267
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9268
|
+
const slotValue = ref<TransferValue[]>([]);
|
|
9269
|
+
const slotData: TransferItem[] = [
|
|
9270
|
+
{ value: 1, label: '林老师', role: '产品设计' },
|
|
9271
|
+
{ value: 2, label: '陈同学', role: '前端研发' },
|
|
9272
|
+
{ value: 3, label: '张同学', role: '质量保障' },
|
|
9273
|
+
];
|
|
9274
|
+
</script>
|
|
9275
|
+
<template>
|
|
9276
|
+
<Transfer
|
|
9277
|
+
v-model="slotValue"
|
|
9278
|
+
:data="slotData"
|
|
9279
|
+
show-search
|
|
9280
|
+
:title="['团队成员', '项目成员']"
|
|
9281
|
+
:list-style="{ width: '260px' }"
|
|
9282
|
+
>
|
|
9283
|
+
<template #item="{ item }"
|
|
9284
|
+
><span>{{ item.label }} · {{ item.role }}</span></template
|
|
9285
|
+
>
|
|
9286
|
+
<template #source-title="{ title, checked, indeterminate, disabled, onSelectAllChange }">
|
|
9287
|
+
<Checkbox
|
|
9288
|
+
:model-value="checked"
|
|
9289
|
+
:indeterminate="indeterminate"
|
|
9290
|
+
:disabled="disabled"
|
|
9291
|
+
@change="onSelectAllChange($event === true)"
|
|
9292
|
+
>{{ title }}</Checkbox
|
|
9293
|
+
>
|
|
9294
|
+
</template>
|
|
9295
|
+
<template #to-target-icon><span aria-hidden="true">→</span></template>
|
|
9296
|
+
<template #to-source-icon><span aria-hidden="true">←</span></template>
|
|
9297
|
+
<template #footer="{ type, data, selectedKeys }"
|
|
9298
|
+
><small
|
|
9299
|
+
>{{ type === 'source' ? '可选' : '已选' }} {{ data.length }} 人,勾选
|
|
9300
|
+
{{ selectedKeys.length }} 人</small
|
|
9301
|
+
></template
|
|
9302
|
+
>
|
|
9303
|
+
</Transfer>
|
|
9304
|
+
</template>
|
|
9305
|
+
```
|
|
9306
|
+
|
|
9307
|
+
### 自定义列表
|
|
9308
|
+
|
|
9309
|
+
source/target 替换列表内容。回调接入表格、树或业务卡片,保持共享移动规则。示例按钮支持键盘,并用 aria-pressed 表达勾选状态。
|
|
9310
|
+
|
|
9311
|
+
```vue
|
|
9312
|
+
<script setup lang="ts">
|
|
9313
|
+
import 'x-next/style.css';
|
|
9314
|
+
import { reactive, ref } from 'vue';
|
|
9315
|
+
import { Transfer } from 'x-next';
|
|
9316
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9317
|
+
const customValue = ref<TransferValue[]>(['release']);
|
|
9318
|
+
const customData: TransferItem[] = [
|
|
9319
|
+
{ value: 'design', label: '设计评审' },
|
|
9320
|
+
{ value: 'develop', label: '研发联调' },
|
|
9321
|
+
{ value: 'release', label: '上线验证' },
|
|
9322
|
+
{ value: 'archived', label: '已归档', disabled: true },
|
|
9323
|
+
];
|
|
9324
|
+
</script>
|
|
9325
|
+
<template>
|
|
9326
|
+
<Transfer v-model="customValue" :data="customData" show-search>
|
|
9327
|
+
<template #source="{ pageData, selectedKeys, disabled, onSelect }">
|
|
9328
|
+
<div style="padding: 12px; display: grid; gap: 8px">
|
|
9329
|
+
<button
|
|
9330
|
+
v-for="item in pageData"
|
|
9331
|
+
:key="item.value"
|
|
9332
|
+
type="button"
|
|
9333
|
+
:disabled="disabled || item.disabled"
|
|
9334
|
+
:aria-pressed="selectedKeys.includes(item.value)"
|
|
9335
|
+
@click="onSelect(item.value, !selectedKeys.includes(item.value))"
|
|
9336
|
+
>
|
|
9337
|
+
{{ selectedKeys.includes(item.value) ? '✓ ' : '+ ' }}{{ item.label }}
|
|
9338
|
+
</button>
|
|
9339
|
+
<span v-if="!pageData.length">没有可选任务</span>
|
|
9340
|
+
</div>
|
|
9341
|
+
</template>
|
|
9342
|
+
<template #target="{ pageData, selectedKeys, disabled, onSelect }">
|
|
9343
|
+
<div style="padding: 12px; display: grid; gap: 8px">
|
|
9344
|
+
<button
|
|
9345
|
+
v-for="item in pageData"
|
|
9346
|
+
:key="item.value"
|
|
9347
|
+
type="button"
|
|
9348
|
+
:disabled="disabled || item.disabled"
|
|
9349
|
+
:aria-pressed="selectedKeys.includes(item.value)"
|
|
9350
|
+
@click="onSelect(item.value, !selectedKeys.includes(item.value))"
|
|
9351
|
+
>
|
|
9352
|
+
{{ selectedKeys.includes(item.value) ? '✓ ' : '+ ' }}{{ item.label }}
|
|
9353
|
+
</button>
|
|
9354
|
+
<span v-if="!pageData.length">尚未分配任务</span>
|
|
9355
|
+
</div>
|
|
9356
|
+
</template>
|
|
9357
|
+
</Transfer>
|
|
9358
|
+
<p>当前项目任务:{{ customValue }}</p>
|
|
9359
|
+
</template>
|
|
9360
|
+
```
|
|
9361
|
+
|
|
9362
|
+
### 分页
|
|
9363
|
+
|
|
9364
|
+
两侧页码独立,全选仅当前页。搜索或每页条数变化后回到第一页,移动使页码超出范围时自动收敛。
|
|
9365
|
+
|
|
9366
|
+
```vue
|
|
9367
|
+
<script setup lang="ts">
|
|
9368
|
+
import 'x-next/style.css';
|
|
9369
|
+
import { reactive, ref } from 'vue';
|
|
9370
|
+
import { Transfer } from 'x-next';
|
|
9371
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9372
|
+
const pagedValue = ref<TransferValue[]>([2, 4]);
|
|
9373
|
+
const pagedData: TransferItem[] = Array.from({ length: 30 }, (_, index) => ({
|
|
9374
|
+
value: index + 1,
|
|
9375
|
+
label: `候选成员 ${index + 1}`,
|
|
9376
|
+
disabled: index === 8,
|
|
9377
|
+
}));
|
|
9378
|
+
</script>
|
|
9379
|
+
<template>
|
|
9380
|
+
<Transfer v-model="pagedValue" :data="pagedData" :pagination="{ pageSize: 5 }" show-search />
|
|
9381
|
+
<p>已分配:{{ pagedValue }}</p>
|
|
9382
|
+
</template>
|
|
9383
|
+
```
|
|
9384
|
+
|
|
9385
|
+
### 虚拟滚动
|
|
9386
|
+
|
|
9387
|
+
大数据列表复用库内 VirtualList。分页优先于虚拟滚动;自定义列表自行决定渲染方式。
|
|
9388
|
+
|
|
9389
|
+
```vue
|
|
9390
|
+
<script setup lang="ts">
|
|
9391
|
+
import 'x-next/style.css';
|
|
9392
|
+
import { reactive, ref } from 'vue';
|
|
9393
|
+
import { Transfer } from 'x-next';
|
|
9394
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9395
|
+
const virtualValue = ref<TransferValue[]>([100, 500]);
|
|
9396
|
+
const virtualData: TransferItem[] = Array.from({ length: 1000 }, (_, index) => ({
|
|
9397
|
+
value: index + 1,
|
|
9398
|
+
label: `数据项 ${index + 1}`,
|
|
9399
|
+
}));
|
|
9400
|
+
const virtualLog = ref('尝试滚动列表或搜索数据项 999');
|
|
9401
|
+
function virtualScroll(_event: Event, type: TransferType) {
|
|
9402
|
+
virtualLog.value = `${type} 列表正在滚动`;
|
|
9403
|
+
}
|
|
9404
|
+
</script>
|
|
9405
|
+
<template>
|
|
9406
|
+
<Transfer
|
|
9407
|
+
v-model="virtualValue"
|
|
9408
|
+
:data="virtualData"
|
|
9409
|
+
show-search
|
|
9410
|
+
:virtual-list-props="{
|
|
9411
|
+
height: 240,
|
|
9412
|
+
threshold: 30,
|
|
9413
|
+
fixedSize: true,
|
|
9414
|
+
estimatedSize: 36,
|
|
9415
|
+
buffer: 5,
|
|
9416
|
+
}"
|
|
9417
|
+
@scroll="virtualScroll"
|
|
9418
|
+
/>
|
|
9419
|
+
<p aria-live="polite">{{ virtualLog }}</p>
|
|
9420
|
+
<p>目标值:{{ virtualValue }}</p>
|
|
9421
|
+
</template>
|
|
9422
|
+
```
|
|
9423
|
+
|
|
9424
|
+
### Form 校验联动
|
|
9425
|
+
|
|
9426
|
+
勾选和搜索不改变字段值;实际移动才触发 change 校验。标签/必填/错误说明绑定到整个组,内部控件不会重复注册。
|
|
9427
|
+
|
|
9428
|
+
```vue
|
|
9429
|
+
<script setup lang="ts">
|
|
9430
|
+
import 'x-next/style.css';
|
|
9431
|
+
import { reactive, ref } from 'vue';
|
|
9432
|
+
import { Transfer, Button, FormItem, Form } from 'x-next';
|
|
9433
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9434
|
+
const transferFormRef = ref<FormInstance>();
|
|
9435
|
+
const transferForm = reactive({ members: [] as TransferValue[] });
|
|
9436
|
+
const transferRules: Record<string, FieldRule[]> = {
|
|
9437
|
+
members: [{ type: 'array', required: true, minLength: 2, message: '请至少分配 2 个成员' }],
|
|
9438
|
+
};
|
|
9439
|
+
const transferFormData: TransferItem[] = [
|
|
9440
|
+
{ value: 'lin', label: '林老师' },
|
|
9441
|
+
{ value: 'chen', label: '陈同学' },
|
|
9442
|
+
{ value: 'zhang', label: '张同学' },
|
|
9443
|
+
];
|
|
9444
|
+
const transferFormLog = ref('');
|
|
9445
|
+
async function validateTransfer() {
|
|
9446
|
+
transferFormLog.value = (await transferFormRef.value?.validate()) ? '请补齐成员' : '校验通过';
|
|
9447
|
+
}
|
|
9448
|
+
</script>
|
|
9449
|
+
<template>
|
|
9450
|
+
<Form ref="transferFormRef" :model="transferForm" :rules="transferRules" layout="vertical">
|
|
9451
|
+
<FormItem field="members" label="项目成员" required>
|
|
9452
|
+
<Transfer v-model="transferForm.members" :data="transferFormData" show-search />
|
|
9453
|
+
</FormItem>
|
|
9454
|
+
<Button type="primary" @click="validateTransfer">校验成员</Button>
|
|
9455
|
+
<Button @click="transferFormRef?.resetFields()">重置</Button>
|
|
9456
|
+
<p aria-live="polite">{{ transferFormLog }}</p>
|
|
9457
|
+
</Form>
|
|
9458
|
+
</template>
|
|
9459
|
+
```
|
|
9460
|
+
|
|
9461
|
+
### 空态与异步数据
|
|
9462
|
+
|
|
9463
|
+
模型中暂时没有对应数据的值会保留,数据到达后展示。空态插槽能区分源侧、目标侧和搜索条件。
|
|
9464
|
+
|
|
9465
|
+
```vue
|
|
9466
|
+
<script setup lang="ts">
|
|
9467
|
+
import 'x-next/style.css';
|
|
9468
|
+
const searchValue = ref<TransferValue[]>([]);
|
|
9469
|
+
|
|
9470
|
+
import { reactive, ref } from 'vue';
|
|
9471
|
+
import { Transfer, Button } from 'x-next';
|
|
9472
|
+
import type { TransferItem, TransferValue, TransferType, FormInstance, FieldRule } from 'x-next';
|
|
9473
|
+
const emptyValue = ref<TransferValue[]>(['remote']);
|
|
9474
|
+
const emptyData = ref<TransferItem[]>([]);
|
|
9475
|
+
function loadTransferData() {
|
|
9476
|
+
emptyData.value = [
|
|
9477
|
+
{ value: 'remote', label: '已分配的远程成员' },
|
|
9478
|
+
{ value: 'new', label: '新加载的候选成员' },
|
|
9479
|
+
];
|
|
9480
|
+
}
|
|
9481
|
+
</script>
|
|
9482
|
+
<template>
|
|
9483
|
+
<p
|
|
9484
|
+
><Button @click="loadTransferData">加载模拟数据</Button>
|
|
9485
|
+
<Button @click="emptyData = []">清空数据源</Button></p
|
|
9486
|
+
>
|
|
9487
|
+
<Transfer v-model="emptyValue" :data="emptyData" show-search>
|
|
9488
|
+
<template #empty="{ type, searchValue }"
|
|
9489
|
+
><span>{{
|
|
9490
|
+
searchValue ? '没有匹配的成员' : type === 'source' ? '暂无候选成员' : '暂无已加载成员'
|
|
9491
|
+
}}</span></template
|
|
9492
|
+
>
|
|
9493
|
+
</Transfer>
|
|
9494
|
+
<p>模型值保留:{{ emptyValue }}</p>
|
|
9495
|
+
</template>
|
|
9496
|
+
```
|
|
9497
|
+
|
|
9498
|
+
### 键盘与行为边界
|
|
9499
|
+
|
|
9500
|
+
- Tab 到达搜索、全选、选项和方向按钮;Space 勾选复选框,Enter/Space 激活方向/移除/简单模式按钮。
|
|
9501
|
+
- 默认列表支持 ↑ / ↓、Home / End 定位,跳过禁用项。自定义列表由业务实现键盘语义。
|
|
9502
|
+
- 勾选值与目标值分别受控;传入模型而不回写时保持原值。默认值只在创建时初始化。
|
|
9503
|
+
- `value` 必须全局唯一,数字 `1` 和字符串 `"1"` 不同。重复项保留首项,非法值不展示;不原地修改输入数组。
|
|
9504
|
+
- 默认搜索不区分大小写。全选仅当前搜索结果,分页时仅当前页;已勾选的搜索隐藏项仍参与移动。
|
|
9505
|
+
- 禁用项不能全选、移入或移除。缺失数据的目标值在移动其他项时保留。
|
|
9506
|
+
- `targetOrder="original"` 按数据源排序;`append` 按模型顺序,移入值追加在已有目标值之后。
|
|
9507
|
+
- `pagination` 优先于 `virtualListProps`。source/target 插槽接收过滤数据和当前页数据,自行实现虚拟渲染与键盘。
|
|
9508
|
+
- 数组控件没有 readonly 属性;只读展示可使用 disabled。字段映射、远程分页、拖拽排序需业务适配。
|
|
9509
|
+
|
|
9510
|
+
|
|
9511
|
+
### 数据类型
|
|
9512
|
+
|
|
9513
|
+
组合参见 [Form 表单](./form.md)、[Checkbox 复选框](./checkbox.md)、[Table 表格](./table.md)、[TreeSelect 树选择器](./tree-select.md)。
|
|
9514
|
+
|
|
9515
|
+
|
|
9013
9516
|
## Empty 扩展场景
|
|
9014
9517
|
|
|
9015
9518
|
### 用途与选型
|
|
@@ -34619,6 +35122,163 @@ type Filters = Record<string, string[]>;
|
|
|
34619
35122
|
```
|
|
34620
35123
|
|
|
34621
35124
|
|
|
35125
|
+
## Transfer API
|
|
35126
|
+
|
|
35127
|
+
公开声明:`dist/components/transfer/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
35128
|
+
|
|
35129
|
+
### Props
|
|
35130
|
+
|
|
35131
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
35132
|
+
| --- | --- | --- | --- | --- |
|
|
35133
|
+
| data | 数据源,value 唯一,支持附加字段 | undefined | TransferItem[] | 否 | [] |
|
|
35134
|
+
| modelValue | 见场景用法与类型 | undefined | TransferValue[] | 否 | undefined |
|
|
35135
|
+
| defaultValue | 非受控目标初始值 | undefined | TransferValue[] | 否 | [] |
|
|
35136
|
+
| selectedKeys | 见场景用法与类型 | undefined | TransferValue[] | 否 | undefined |
|
|
35137
|
+
| defaultSelectedKeys | 非受控勾选初始值 | undefined | TransferValue[] | 否 | [] |
|
|
35138
|
+
| disabled | 禁用,继承 Form | undefined | false | true | 否 | false |
|
|
35139
|
+
| loading | 加载并阻止操作 | undefined | false | true | 否 | false |
|
|
35140
|
+
| error | 错误,继承 Form | undefined | false | true | 否 | false |
|
|
35141
|
+
| simple | 点击立即移动 | undefined | false | true | 否 | false |
|
|
35142
|
+
| oneWay | 单向分配,目标逐项移除 | undefined | false | true | 否 | false |
|
|
35143
|
+
| showSearch | 两侧搜索 | undefined | false | true | 否 | false |
|
|
35144
|
+
| showSelectAll | 显示全选;simple/oneWay 目标侧不显示 | undefined | false | true | 否 | true |
|
|
35145
|
+
| title | 两侧标题,缺项按语言包回退 | undefined | string[] | 否 | 未声明 |
|
|
35146
|
+
| operations | 向右、向左操作文案 | undefined | string[] | 否 | [] |
|
|
35147
|
+
| searchPlaceholder | 搜索占位 | undefined | string | 否 | 未声明 |
|
|
35148
|
+
| filterOption | 非空搜索的过滤函数 | undefined | (input: string, item: TransferItem, type: TransferType) => boolean | 否 | 未声明 |
|
|
35149
|
+
| targetOrder | 目标排序 | undefined | "append" | "original" | 否 | "original" |
|
|
35150
|
+
| listStyle | 面板样式,可设置 width 或组件 CSS token | undefined | CSSProperties | 否 | 未声明 |
|
|
35151
|
+
| pagination | 分页,非法 pageSize 回退 10 | undefined | false | true | TransferPagination | 否 | false |
|
|
35152
|
+
| virtualListProps | VirtualList 配置,默认高度 240 | undefined | VirtualListProps | 否 | 未声明 |
|
|
35153
|
+
|
|
35154
|
+
### Events
|
|
35155
|
+
|
|
35156
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
35157
|
+
| --- | --- | --- |
|
|
35158
|
+
| update:modelValue | 请求更新目标模型 | undefined | (_values: TransferValue[]) => any |
|
|
35159
|
+
| update:selectedKeys | 请求更新临时勾选模型 | undefined | (_values: TransferValue[]) => any |
|
|
35160
|
+
| change | 实际移动,type 为目的侧 | undefined | (_values: TransferValue[], _type: TransferType, _movedValues: TransferValue[]) => any |
|
|
35161
|
+
| select | 临时勾选变化或移动清除勾选 | undefined | (_sourceSelected: TransferValue[], _targetSelected: TransferValue[]) => any |
|
|
35162
|
+
| search | 输入/清空/隐藏搜索重置 | undefined | (_value: string, _type: TransferType) => any |
|
|
35163
|
+
| scroll | 列表滚动 | undefined | (_event: Event, _type: TransferType) => any |
|
|
35164
|
+
|
|
35165
|
+
### Slots
|
|
35166
|
+
|
|
35167
|
+
| 名称 | 用途 | 公开类型 |
|
|
35168
|
+
| --- | --- | --- |
|
|
35169
|
+
| item | 选项内容 | undefined | (props: TransferItemSlotProps) => VNodeChild |
|
|
35170
|
+
| source | 见场景用法与类型 | undefined | (props: TransferListSlotProps) => VNodeChild |
|
|
35171
|
+
| target | 见场景用法与类型 | undefined | (props: TransferListSlotProps) => VNodeChild |
|
|
35172
|
+
| source-title | 见场景用法与类型 | undefined | (props: TransferTitleSlotProps) => VNodeChild |
|
|
35173
|
+
| target-title | 见场景用法与类型 | undefined | (props: TransferTitleSlotProps) => VNodeChild |
|
|
35174
|
+
| footer | 两侧页脚 | undefined | (props: TransferListSlotProps) => VNodeChild |
|
|
35175
|
+
| empty | 默认列表空态,自定义列表自行处理 | undefined | (props: { type: TransferType; searchValue: string; }) => VNodeChild |
|
|
35176
|
+
| to-target-icon | 见场景用法与类型 | undefined | () => VNodeChild |
|
|
35177
|
+
| to-source-icon | 见场景用法与类型 | undefined | () => VNodeChild |
|
|
35178
|
+
| source / target | 替换对应侧列表 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
35179
|
+
| source-title / target-title | 替换标题 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
35180
|
+
| to-target-icon / to-source-icon | 方向图标 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
35181
|
+
|
|
35182
|
+
### 实例方法
|
|
35183
|
+
|
|
35184
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
35185
|
+
|
|
35186
|
+
### 关联类型定义
|
|
35187
|
+
|
|
35188
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
35189
|
+
|
|
35190
|
+
```typescript-reference
|
|
35191
|
+
type TransferValue = string | number;
|
|
35192
|
+
|
|
35193
|
+
type TransferType = 'source' | 'target';
|
|
35194
|
+
|
|
35195
|
+
interface TransferItem {
|
|
35196
|
+
value: TransferValue;
|
|
35197
|
+
label: string;
|
|
35198
|
+
disabled?: boolean;
|
|
35199
|
+
[key: string]: unknown;
|
|
35200
|
+
}
|
|
35201
|
+
|
|
35202
|
+
interface TransferPagination {
|
|
35203
|
+
/** 每页条数,默认 10 */
|
|
35204
|
+
pageSize?: number;
|
|
35205
|
+
}
|
|
35206
|
+
|
|
35207
|
+
interface TransferProps {
|
|
35208
|
+
data?: TransferItem[];
|
|
35209
|
+
modelValue?: TransferValue[];
|
|
35210
|
+
defaultValue?: TransferValue[];
|
|
35211
|
+
selectedKeys?: TransferValue[];
|
|
35212
|
+
defaultSelectedKeys?: TransferValue[];
|
|
35213
|
+
disabled?: boolean;
|
|
35214
|
+
loading?: boolean;
|
|
35215
|
+
error?: boolean;
|
|
35216
|
+
simple?: boolean;
|
|
35217
|
+
oneWay?: boolean;
|
|
35218
|
+
showSearch?: boolean;
|
|
35219
|
+
showSelectAll?: boolean;
|
|
35220
|
+
title?: string[];
|
|
35221
|
+
operations?: string[];
|
|
35222
|
+
searchPlaceholder?: string;
|
|
35223
|
+
filterOption?: (inputValue: string, item: TransferItem, type: TransferType) => boolean;
|
|
35224
|
+
targetOrder?: 'original' | 'append';
|
|
35225
|
+
listStyle?: CSSProperties;
|
|
35226
|
+
pagination?: boolean | TransferPagination;
|
|
35227
|
+
virtualListProps?: VirtualListProps;
|
|
35228
|
+
}
|
|
35229
|
+
|
|
35230
|
+
interface TransferListSlotProps {
|
|
35231
|
+
type: TransferType;
|
|
35232
|
+
/** 搜索过滤后的全部数据 */
|
|
35233
|
+
data: TransferItem[];
|
|
35234
|
+
/** 当前页数据,未分页时等于 data */
|
|
35235
|
+
pageData: TransferItem[];
|
|
35236
|
+
/** 本侧有效勾选值,包含搜索隐藏项 */
|
|
35237
|
+
selectedKeys: TransferValue[];
|
|
35238
|
+
disabled: boolean;
|
|
35239
|
+
onSelect: (value: TransferValue, checked: boolean) => void;
|
|
35240
|
+
onSelectAll: (values: TransferValue[], checked: boolean) => void;
|
|
35241
|
+
onMove: (values: TransferValue[]) => void;
|
|
35242
|
+
}
|
|
35243
|
+
|
|
35244
|
+
interface TransferTitleSlotProps {
|
|
35245
|
+
type: TransferType;
|
|
35246
|
+
title: string;
|
|
35247
|
+
countTotal: number;
|
|
35248
|
+
countSelected: number;
|
|
35249
|
+
searchValue: string;
|
|
35250
|
+
checked: boolean;
|
|
35251
|
+
indeterminate: boolean;
|
|
35252
|
+
disabled: boolean;
|
|
35253
|
+
onSelectAllChange: (checked: boolean) => void;
|
|
35254
|
+
}
|
|
35255
|
+
|
|
35256
|
+
interface TransferItemSlotProps {
|
|
35257
|
+
item: TransferItem;
|
|
35258
|
+
type: TransferType;
|
|
35259
|
+
selected: boolean;
|
|
35260
|
+
disabled: boolean;
|
|
35261
|
+
}
|
|
35262
|
+
|
|
35263
|
+
interface TransferSlots {
|
|
35264
|
+
item?: (props: TransferItemSlotProps) => VNodeChild;
|
|
35265
|
+
source?: (props: TransferListSlotProps) => VNodeChild;
|
|
35266
|
+
target?: (props: TransferListSlotProps) => VNodeChild;
|
|
35267
|
+
'source-title'?: (props: TransferTitleSlotProps) => VNodeChild;
|
|
35268
|
+
'target-title'?: (props: TransferTitleSlotProps) => VNodeChild;
|
|
35269
|
+
footer?: (props: TransferListSlotProps) => VNodeChild;
|
|
35270
|
+
empty?: (props: {
|
|
35271
|
+
type: TransferType;
|
|
35272
|
+
searchValue: string;
|
|
35273
|
+
}) => VNodeChild;
|
|
35274
|
+
'to-target-icon'?: () => VNodeChild;
|
|
35275
|
+
'to-source-icon'?: () => VNodeChild;
|
|
35276
|
+
}
|
|
35277
|
+
|
|
35278
|
+
type TransferInstance = InstanceType<typeof Transfer>;
|
|
35279
|
+
```
|
|
35280
|
+
|
|
35281
|
+
|
|
34622
35282
|
## TreeSelect API
|
|
34623
35283
|
|
|
34624
35284
|
公开声明:`dist/components/tree-select/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|