UNPKG

@arco-vue-pro-components/pro-components

Version:
25 lines (24 loc) 852 B
import { computed, ref } from "vue"; const useRowSelection = ({ selectedKeys, defaultSelectedKeys, selected, defaultSelected, rowSelection }) => { var _a, _b, _c, _d, _e, _f, _g, _h; const isRadio = computed(() => { var _a2; return ((_a2 = rowSelection.value) == null ? void 0 : _a2.type) === "radio"; }); const selectedRowKeys = ref( (_f = (_e = (_c = (_b = selectedKeys.value) != null ? _b : (_a = rowSelection.value) == null ? void 0 : _a.selectedRowKeys) != null ? _c : defaultSelectedKeys.value) != null ? _e : (_d = rowSelection.value) == null ? void 0 : _d.defaultSelectedRowKeys) != null ? _f : [] ); const selectedRows = ref((_h = (_g = selected.value) != null ? _g : defaultSelected.value) != null ? _h : []); return { isRadio, selectedRowKeys, selectedRows }; }; export { useRowSelection };