2024-08-02 18:19:39 +08:00

21 lines
564 B
JavaScript

import { ref } from 'vue';
import { isColumnResizable } from "./utils.mjs";
export function useResizable() {
const resizableWidthsRef = ref({});
function getResizableWidth(key) {
return resizableWidthsRef.value[key];
}
function doUpdateResizableWidth(column, width) {
if (isColumnResizable(column) && 'key' in column) {
resizableWidthsRef.value[column.key] = width;
}
}
function clearResizableWidth() {
resizableWidthsRef.value = {};
}
return {
getResizableWidth,
doUpdateResizableWidth,
clearResizableWidth
};
}