This commit is contained in:
2026-09-15 18:17:21 +08:00
parent 9a8a72b1bd
commit 056f9ef073
6 changed files with 147 additions and 24 deletions
+21
View File
@@ -0,0 +1,21 @@
import type { Component } from 'vue'
export interface TableAction {
key: string
label: string
icon?: Component
disabled?: boolean
loading?: boolean
run: () => unknown
}
// Callers supply only permitted actions; disabled actions retain their place.
export function splitTableActions(actions: readonly TableAction[]) {
return actions.length > 3
? { visible: actions.slice(0, 2), overflow: actions.slice(2) }
: { visible: actions, overflow: [] }
}
export function runTableAction(action: TableAction) {
if (!action.disabled && !action.loading) return action.run()
}