@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
29 lines (28 loc) • 733 B
JavaScript
//#region src/base-ui/Table/fixedOffsets.ts
const widthOf = (column) => typeof column.width === "number" ? column.width : 0;
const getFixedOffsets = (columns) => {
const offsets = columns.map(() => void 0);
let left = 0;
columns.forEach((column, index) => {
if (column.fixed !== "left") return;
offsets[index] = {
left,
position: "sticky"
};
left += widthOf(column);
});
let right = 0;
for (let index = columns.length - 1; index >= 0; index--) {
const column = columns[index];
if (column.fixed !== "right") continue;
offsets[index] = {
position: "sticky",
right
};
right += widthOf(column);
}
return offsets;
};
//#endregion
export { getFixedOffsets };
//# sourceMappingURL=fixedOffsets.mjs.map