How to use the rc-util/lib/Dom/class.addClass function in rc-util

To help you get started, we’ve selected a few rc-util 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 uxcore / uxcore-table / src / Table.jsx View on Github external
checkBodyVScroll() {
    if (this.bodyScroll) {
      const { prefixCls } = this.props;
      const node = this.bodyScroll.getDom();
      // body does not exist if no data
      if (node.children[0]) {
        const wrapperHeight = node.clientHeight;
        const bodyHeight = node.children[0].clientHeight;
        const headerDom = this.headerScroll ? this.headerScroll.getDom() : null;
        const footerDom = this.footerScroll ? this.footerScroll.getDom() : null;
        const noVScroll = bodyHeight <= wrapperHeight;
        if (this.noVScroll === undefined || this.noVScroll !== noVScroll) {
          if (noVScroll) {
            addClass(node, `${prefixCls}-no-v-scroll`);
            if (headerDom) {
              addClass(headerDom, `${prefixCls}-no-v-scroll`);
            }
            if (footerDom) {
              addClass(footerDom, `${prefixCls}-no-v-scroll`);
            }
          } else {
            removeClass(node, `${prefixCls}-no-v-scroll`);
            if (headerDom) {
              removeClass(headerDom, `${prefixCls}-no-v-scroll`);
            }
            if (footerDom) {
              removeClass(footerDom, `${prefixCls}-no-v-scroll`);
            }
          }
          this.noVScroll = noVScroll;
        }
      }
github uxcore / uxcore-table / src / Table.jsx View on Github external
checkBodyVScroll() {
    if (this.bodyScroll) {
      const { prefixCls } = this.props;
      const node = this.bodyScroll.getDom();
      // body does not exist if no data
      if (node.children[0]) {
        const wrapperHeight = node.clientHeight;
        const bodyHeight = node.children[0].clientHeight;
        const headerDom = this.headerScroll ? this.headerScroll.getDom() : null;
        const footerDom = this.footerScroll ? this.footerScroll.getDom() : null;
        const noVScroll = bodyHeight <= wrapperHeight;
        if (this.noVScroll === undefined || this.noVScroll !== noVScroll) {
          if (noVScroll) {
            addClass(node, `${prefixCls}-no-v-scroll`);
            if (headerDom) {
              addClass(headerDom, `${prefixCls}-no-v-scroll`);
            }
            if (footerDom) {
              addClass(footerDom, `${prefixCls}-no-v-scroll`);
            }
          } else {
            removeClass(node, `${prefixCls}-no-v-scroll`);
            if (headerDom) {
              removeClass(headerDom, `${prefixCls}-no-v-scroll`);
            }
            if (footerDom) {
              removeClass(footerDom, `${prefixCls}-no-v-scroll`);
            }
          }
          this.noVScroll = noVScroll;
github uxcore / uxcore-table / src / Table.jsx View on Github external
const node = this.bodyScroll.getDom();
      // body does not exist if no data
      if (node.children[0]) {
        const wrapperHeight = node.clientHeight;
        const bodyHeight = node.children[0].clientHeight;
        const headerDom = this.headerScroll ? this.headerScroll.getDom() : null;
        const footerDom = this.footerScroll ? this.footerScroll.getDom() : null;
        const noVScroll = bodyHeight <= wrapperHeight;
        if (this.noVScroll === undefined || this.noVScroll !== noVScroll) {
          if (noVScroll) {
            addClass(node, `${prefixCls}-no-v-scroll`);
            if (headerDom) {
              addClass(headerDom, `${prefixCls}-no-v-scroll`);
            }
            if (footerDom) {
              addClass(footerDom, `${prefixCls}-no-v-scroll`);
            }
          } else {
            removeClass(node, `${prefixCls}-no-v-scroll`);
            if (headerDom) {
              removeClass(headerDom, `${prefixCls}-no-v-scroll`);
            }
            if (footerDom) {
              removeClass(footerDom, `${prefixCls}-no-v-scroll`);
            }
          }
          this.noVScroll = noVScroll;
        }
      }
    }
  }
github uxcore / uxcore-table / src / Table.jsx View on Github external
checkBodyHScroll(scrollLeft) {
    if (!this.state.hasFixed) {
      return false;
    }
    if (!this.bodyScroll) {
      return false;
    }
    const node = this.bodyScroll.getDom();
    const wrapperScrollLeft = scrollLeft || node.scrollLeft;
    if (this.state.hasFixed.hasLeft && this.fixedTable) {
      if (wrapperScrollLeft > 0) {
        addClass(this.fixedTable, 'has-scroll');
      } else {
        removeClass(this.fixedTable, 'has-scroll');
      }
    }
    if (this.state.hasFixed.hasRight) {
      const wrapperWidth = node.clientWidth;
      if (node.children[0]) {
        const bodyWidth = node.children[0].clientWidth;
        if (this.rightFixedTable) {
          if (wrapperScrollLeft + wrapperWidth + 3 < bodyWidth) {
            addClass(this.rightFixedTable, 'end-of-scroll');
          } else {
            removeClass(this.rightFixedTable, 'end-of-scroll');
          }
        }
      }
github uxcore / uxcore-table / src / Table.jsx View on Github external
const node = this.bodyScroll.getDom();
    const wrapperScrollLeft = scrollLeft || node.scrollLeft;
    if (this.state.hasFixed.hasLeft && this.fixedTable) {
      if (wrapperScrollLeft > 0) {
        addClass(this.fixedTable, 'has-scroll');
      } else {
        removeClass(this.fixedTable, 'has-scroll');
      }
    }
    if (this.state.hasFixed.hasRight) {
      const wrapperWidth = node.clientWidth;
      if (node.children[0]) {
        const bodyWidth = node.children[0].clientWidth;
        if (this.rightFixedTable) {
          if (wrapperScrollLeft + wrapperWidth + 3 < bodyWidth) {
            addClass(this.rightFixedTable, 'end-of-scroll');
          } else {
            removeClass(this.rightFixedTable, 'end-of-scroll');
          }
        }
      }
    }
    return false;
  }