import type { Component } from 'vue' import { Delete, Download, Edit, Filter } from '@element-plus/icons-vue' import type { ListToolbarOverflowItem } from '@/components/business/list-toolbar-overflow/types' type ClickOpts = { disabled?: boolean loading?: boolean label?: string icon?: Component onClick: () => void } export function overflowEditItem(opts: ClickOpts): ListToolbarOverflowItem { return { key: 'edit', label: opts.label ?? '编辑', icon: opts.icon ?? Edit, disabled: opts.disabled, loading: opts.loading, onClick: opts.onClick } } export function overflowDeleteItem(opts: ClickOpts): ListToolbarOverflowItem { return { key: 'delete', label: opts.label ?? '删除', icon: opts.icon ?? Delete, type: 'danger', disabled: opts.disabled, loading: opts.loading, onClick: opts.onClick } } export function overflowClearFiltersItem( hasActive: boolean, onClear: () => void ): ListToolbarOverflowItem { return { key: 'clearFilters', label: '清空列过滤', icon: Filter, hidden: !hasActive, onClick: onClear } } export function overflowExportPlaceholder( label = '导出' ): ListToolbarOverflowItem { return { key: 'export', label, icon: Download } }