-
- Header
- Content
- Footer
-
-
-
- Header
-
- Sider
- Content
-
- Footer
-
-
-
- Header
-
- Content
- Sider
-
- Footer
-
-
-
- Sider
-
- Header
- Content
- Footer
-
-
-
-
可折叠侧边栏示例(带触发器)
-
-
- Sider
-
-
- Header
- Content
- Footer
-
-
-
-
可折叠侧边栏示例(自定义触发器)
-
-
-
- Sider Content
-
-
- S
-
-
-
-
- Header
-
-
- Content
- Footer
-
-
+
+
Transfer 组件示例
+
+
基础用法
+
+
+
自定义列表标题
+
+
+
自定义高度
+
+
+
液态玻璃效果
+
+
+
+
+
不同尺寸
+
+
+
自定义渲染
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
可搜索
+
+
+
自定义搜索方法
+
diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts
index fb3c8be0..223f1fee 100644
--- a/src/locales/en-US.ts
+++ b/src/locales/en-US.ts
@@ -333,5 +333,12 @@ export default {
clearAll: 'Clear All',
noData: 'No data'
}
+ },
+ transfer: {
+ text: {
+ leftTitle: 'Source',
+ rightTitle: 'Target',
+ filterPlaceholder: 'Search'
+ }
}
}
\ No newline at end of file
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 3dba708d..a84e6e03 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -333,5 +333,12 @@ export default {
clearAll: '全部清除',
noData: '暂无数据'
}
+ },
+ transfer: {
+ text: {
+ leftTitle: '源列表',
+ rightTitle: '目标列表',
+ filterPlaceholder: '请输入搜索内容'
+ }
}
}
\ No newline at end of file
diff --git a/src/ui/transfer/ShadcnTransfer.vue b/src/ui/transfer/ShadcnTransfer.vue
new file mode 100644
index 00000000..2d5f79ce
--- /dev/null
+++ b/src/ui/transfer/ShadcnTransfer.vue
@@ -0,0 +1,413 @@
+
+
+
+
+
+
+ {{ computedLeftTitle }}
+
+
+ {{ leftCheckedCount }}/{{ leftData.length }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item[props.labelProp] }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ computedRightTitle }}
+
+
+ {{ rightCheckedCount }}/{{ rightData.length }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item[props.labelProp] }}
+
+
+
+
+
+
+
+
+
diff --git a/src/ui/transfer/index.ts b/src/ui/transfer/index.ts
new file mode 100644
index 00000000..fd187233
--- /dev/null
+++ b/src/ui/transfer/index.ts
@@ -0,0 +1,2 @@
+export { default as ShadcnTransfer } from './ShadcnTransfer.vue'
+export type { TransferProps, TransferEmits, TransferItem } from './types'
diff --git a/src/ui/transfer/types.ts b/src/ui/transfer/types.ts
new file mode 100644
index 00000000..352b3cfe
--- /dev/null
+++ b/src/ui/transfer/types.ts
@@ -0,0 +1,29 @@
+import { Size } from '@/ui/enum/Size'
+import { Type } from '@/ui/enum/Type'
+
+export interface TransferItem {
+ [key: string]: any
+ disabled?: boolean
+}
+
+export interface TransferProps {
+ data: TransferItem[]
+ modelValue: (string | number)[]
+ keyProp?: string
+ labelProp?: string
+ leftTitle?: string
+ rightTitle?: string
+ dark?: boolean
+ glass?: boolean
+ type?: keyof typeof Type
+ size?: keyof typeof Size
+ height?: any
+ filterable?: boolean
+ filterPlaceholder?: string
+ filterMethod?: (query: string, item: TransferItem) => boolean
+}
+
+export type TransferEmits = {
+ 'update:modelValue': [value: (string | number)[]]
+ 'on-change': [value: (string | number)[], direction: 'left' | 'right', movedKeys: (string | number)[]]
+}
diff --git a/types/view-shadcn.d.ts b/types/view-shadcn.d.ts
index be7f3099..57e6b65e 100644
--- a/types/view-shadcn.d.ts
+++ b/types/view-shadcn.d.ts
@@ -9,7 +9,7 @@ declare module 'view-shadcn-ui'
export const ShadcnCopy: typeof import('@/ui/copy').default
export const ShadcnCode: typeof import('@/ui/code').default
export const ShadcnInput: typeof import('@/ui/input').default
- export const Icon: typeof import('@/ui/icon').default
+ export const ShadcnIcon: typeof import('@/ui/icon').default
export const ShadcnModal: typeof import('@/ui/modal').default
export const ShadcnTooltip: typeof import('@/ui/tooltip').default
export const ShadcnRow: typeof import('@/ui/row').default
@@ -49,4 +49,7 @@ declare module 'view-shadcn-ui'
export const ShadcnBreadcrumb: typeof import('@/ui/breadcrumb').default
export const ShadcnBreadcrumbItem: typeof import('@/ui/breadcrumb/item').default
export const ShadcnSlider: typeof import('@/ui/slider').default
+ export const ShadcnTransfer: typeof import('@/ui/transfer').ShadcnTransfer
+
+ export type { TransferProps, TransferEmits, TransferItem } from '@/ui/transfer'
}