@aplus-frontend/ui
Version:
43 lines (42 loc) • 1.22 kB
JavaScript
import { computed as s } from "vue";
import { isFunction as m } from "lodash-unified";
import "../../ap-grid/index.mjs";
import { pxToNumber as a } from "../utils.mjs";
import { ROW_SELECTION_FIELD as d } from "../../ap-grid/constants.mjs";
function p(t) {
return t?.bottom?.length || t?.top?.length;
}
const v = (t, c) => s(() => {
if (!t.rowSelection)
return;
const o = t.rowSelection === !0 ? {} : t.rowSelection, i = {
sortable: !1,
resizable: !1,
width: a(o.columnWidth, 60),
tooltipValueGetter: o.tooltip ? ({ node: e }) => {
if (typeof o.tooltip == "string")
return o.tooltip;
const r = !e?.selectable, n = !!e?.isSelected();
return o.tooltip(n, r, e);
} : void 0
};
let l = o.fixed;
if (l === void 0 && (l = c.value.some(
(e) => e.fixed === "left" || e.fixed === !0
) ? "left" : void 0), i.pinned = l, p(t.summary)) {
const { cellClassName: e } = t.summary;
i.cellClass = ({
node: r,
data: n,
colDef: f,
rowIndex: u
}) => {
if (!(!r.rowPinned || !e))
return m(e) ? e(n, f, r.rowPinned, u) : e;
}, i.cellRenderer = ({ data: r }) => r?.[d];
}
return i;
});
export {
v as default
};