vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
20 lines (19 loc) • 692 B
JavaScript
import { inject as o, computed as i } from "vue";
import { Utils as c } from "@vuux/utils";
const h = (t) => {
const s = o("tableContext"), l = i(() => t.columns[0].prop === "select");
return {
getStyle: (e) => l.value && e === 1 || !l.value && e === 0 ? `padding-inline-start: ${t.item.level * 12 - 12}px` : null,
classNames: (e) => e.fixed === "left" ? "is-fixed-left" : e.fixed === "right" ? "is-fixed-right" : "",
isMore: (e, n) => !c.isEmpty(e.children) && (l.value && n === 1 || !l.value && n === 0),
handleToggle: (e) => {
e.open = !e.open;
},
selectChange: (e) => {
t.item && s?.select(t.item, e);
}
};
};
export {
h as useTableNode
};