UNPKG

@aplus-frontend/ui

Version:

34 lines (33 loc) 694 B
import { ref as u, computed as a, watch as i } from "vue"; import { getStringKey as l } from "../utils.mjs"; const g = (o) => { const n = u([]), t = u([]); function m() { return o.columns?.filter((e) => !e.hideInTable) || []; } function r(e) { return n.value.find((c) => l(c.key) === e); } const s = a( () => n.value.map((e) => l(e.key)).filter(Boolean) ); return i( () => o.columns, () => { const e = m(); n.value = e, t.value = e, o.onShownColumnsChange?.(e); }, { deep: !0, immediate: !0 } ), { columns: n, shownColumns: t, columnKeys: s, getTargetColumnByKey: r }; }; export { g as useColumns };