How to use the dom-lib.addStyle function in dom-lib

To help you get started, we’ve selected a few dom-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rsuite / rsuite / src / fixtures / ModalManager.js View on Github external
}
        };

        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;
    }
github rsuite / rsuite-table / src / Scrollbar.js View on Github external
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);
  }
github rsuite / rsuite / src / _picker / MenuWrapper.js View on Github external
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 = () => {
github rsuite / rsuite-table / src / Table.js View on Github external
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);
    }
  }
github rsuite / rsuite / src / Picker / MenuWrapper.tsx View on Github external
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 = () => {
github rsuite / rsuite / src / Slider / Slider.tsx View on Github external
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`);
    }
  }
github rsuite / rsuite-table / src / Table.js View on Github external
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) => {
github rsuite / rsuite-table / src / Table.js View on Github external
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);
    }
  }