Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
};
let style = {
overflow: 'hidden'
};
data.overflowing = isOverflowing(container);
if (data.overflowing) {
// use computed style, here to get the real padding
// to add our scrollbar width
style.paddingRight = parseInt(addStyle(container, 'paddingRight') || 0, 10) + getScrollbarSize() + 'px';
}
addStyle(container, style);
data.classes.forEach(addClass.bind(null, container));
this.containers.push(container);
this.data.push(data);
return modalIdx;
}
if (_.isUndefined(forceDelta)) {
this.scrollOffset += delta;
this.scrollOffset = Math.max(this.scrollOffset, 0);
this.scrollOffset = Math.min(this.scrollOffset, max);
} else {
this.scrollOffset = forceDelta || 0;
}
if (vertical) {
updatePosition(styles, 0, this.scrollOffset);
} else {
updatePosition(styles, this.scrollOffset, 0);
}
addStyle(this.handle, styles);
}
updateMenuStyle() {
const { getToggleInstance } = this.props;
if (this.menuElement && getToggleInstance) {
const instance = getToggleInstance();
if (instance && instance.toggle) {
const width = getWidth(findDOMNode(instance.toggle));
addStyle(this.menuElement, 'min-width', `${width}px`);
}
}
}
handleResize = () => {
updatePosition() {
/**
* 当存在锁定列情况处理
*/
if (this.state.shouldFixedColumn) {
this.updatePositionByFixedCell();
} else {
const wheelStyle = {};
const headerStyle = {};
this.translateDOMPositionXY(wheelStyle, this.scrollX, this.scrollY);
this.translateDOMPositionXY(headerStyle, this.scrollX, 0);
this.wheelWrapper && addStyle(this.wheelWrapper, wheelStyle);
this.headerWrapper && addStyle(this.headerWrapper, headerStyle);
}
if (this.tableHeader) {
toggleClass(this.tableHeader, this.addPrefix('cell-group-shadow'), this.scrollY < 0);
}
}
updateMenuStyle() {
const { getToggleInstance } = this.props;
if (this.menuElementRef.current && getToggleInstance) {
const instance = getToggleInstance();
if (instance?.toggleRef?.current) {
const width = getWidth(findDOMNode(instance.toggleRef.current));
addStyle(this.menuElementRef.current, 'min-width', `${width}px`);
}
}
}
handleResize = () => {
setTooltipPosition() {
const { tooltip } = this.props;
if (tooltip) {
const handle = this.handleRef.current;
const tip = handle.querySelector(`.${this.addPrefix('tooltip')}`);
const width = getWidth(tip);
addStyle(tip, 'left', `-${width / 2}px`);
}
}
const fixedLeftGroups = this.getFixedLeftCellGroups();
const fixedRightGroups = this.getFixedRightCellGroups();
const { contentWidth, width } = this.state;
this.translateDOMPositionXY(wheelGroupStyle, this.scrollX, 0);
this.translateDOMPositionXY(wheelStyle, 0, this.scrollY);
const scrollArrayGroups = Array.from(scrollGroups);
for (let i = 0; i < scrollArrayGroups.length; i++) {
let group = scrollArrayGroups[i];
addStyle(group, wheelGroupStyle);
}
if (this.wheelWrapper) {
addStyle(this.wheelWrapper, wheelStyle);
}
const leftShadowClassName = this.addPrefix('cell-group-left-shadow');
const rightShadowClassName = this.addPrefix('cell-group-right-shadow');
const showLeftShadow = this.scrollX < 0;
const showRightShadow = width - contentWidth - SCROLLBAR_WIDTH !== this.scrollX;
toggleClass(fixedLeftGroups, leftShadowClassName, showLeftShadow);
toggleClass(fixedRightGroups, rightShadowClassName, showRightShadow);
}
shouldHandleWheelX = (delta: number) => {
updatePosition() {
/**
* 当存在锁定列情况处理
*/
if (this.state.shouldFixedColumn) {
this.updatePositionByFixedCell();
} else {
const wheelStyle = {};
const headerStyle = {};
this.translateDOMPositionXY(wheelStyle, this.scrollX, this.scrollY);
this.translateDOMPositionXY(headerStyle, this.scrollX, 0);
this.wheelWrapper && addStyle(this.wheelWrapper, wheelStyle);
this.headerWrapper && addStyle(this.headerWrapper, headerStyle);
}
if (this.tableHeader) {
toggleClass(this.tableHeader, this.addPrefix('cell-group-shadow'), this.scrollY < 0);
}
}