SHARE
TWEET

Untitled

a guest Jun 20th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dragOverHandler = (e: any) => {
  2.     e.preventDefault();
  3.     e.dataTransfer.dropEffect = 'move';
  4.  
  5.     const isDraggable = e.target.classList.contains(
  6.       'ruiTable__row__col--draggable'
  7.     );
  8.  
  9.     const lastPinnedCol = e.target.parentNode.querySelector(
  10.       '.last-pinned-col'
  11.     );
  12.  
  13.     const isHiddenByPinnedCol = lastPinnedCol
  14.       ? lastPinnedCol.getBoundingClientRect().right >
  15.         e.target.getBoundingClientRect().left
  16.       : false;
  17.  
  18.     if (isHiddenByPinnedCol) {
  19.       return null;
  20.     }
  21.   };
  22.   …
  23.   render() {
  24.     return (
  25.       <tr
  26.         onDragOver={this.dragOverHandler}
  27.         onDrop={this.dropHandler}>
  28.        …
  29.      )
  30.    }
  31.      
  32. class TableRowCell extends React.Component<Props> {
  33.       dragStartHandler = (e: any) => {
  34.         ...
  35.       };
  36.  
  37.       dragLeaveHandler = (e: SyntheticDragEvent<HTMLTableCellElement>) => {
  38.         const { dragHandlers } = this.props;
  39.         e.preventDefault();
  40.         cleanDraggedClasses(e);
  41.  
  42.         if (dragHandlers && dragHandlers.dragLeaveHandler)
  43.           dragHandlers.dragLeaveHandler();
  44.       };
  45.  
  46.       dragEndHandler = (e: any) => {
  47.         ...
  48.       };
  49.  
  50.       render() {
  51.         return (
  52.           <th
  53.             className={this.cssClassName()}
  54.             draggable={true}
  55.             onDragLeave={this.dragLeaveHandler}
  56.             onDragStart={this.dragStartHandler}
  57.             onDragEnd={this.dragEndHandler}
  58.           >
  59.             ...
  60.           </th>
  61.         );
  62.       }
  63.     }
  64.  
  65.     export default TableRowCell;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top