minishouyin/node_modules/antd/lib/table/hooks/useContainerWidth.js

20 lines
628 B
JavaScript
Raw Normal View History

2025-11-12 11:35:57 +08:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useContainerWidth;
function useContainerWidth(prefixCls) {
const getContainerWidth = (ele, width) => {
const container = ele.querySelector(`.${prefixCls}-container`);
let returnWidth = width;
if (container) {
const style = getComputedStyle(container);
const borderLeft = Number.parseInt(style.borderLeftWidth, 10);
const borderRight = Number.parseInt(style.borderRightWidth, 10);
returnWidth = width - borderLeft - borderRight;
}
return returnWidth;
};
return getContainerWidth;
}