john 9 сар өмнө
parent
commit
71d1f2a7c5
1 өөрчлөгдсөн 22 нэмэгдсэн , 22 устгасан
  1. 22 22
      src/lib/dragact.tsx

+ 22 - 22
src/lib/dragact.tsx

@@ -1,5 +1,5 @@
 import * as React from 'react'
-import GridItem, { GridItemEvent } from './GridItem'
+import GridItem, { GridItemEvent } from './gridItem'
 import { compactLayout } from './util/compact'
 import { getMaxContainerHeight } from './util/sort'
 import { layoutCheck } from './util/collison'
@@ -29,7 +29,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
             layout: layout,
             containerHeight: 500,
             dragType: 'drag',
-            mapLayout: undefined
+            mapLayout: undefined,
         }
     }
 
@@ -45,7 +45,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 placeholderShow: true,
                 placeholderMoving: true,
                 mapLayout: newlayout,
-                dragType: 'resize'
+                dragType: 'resize',
             })
         }
         this.props.onDragStart &&
@@ -78,7 +78,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 this.props.margin[1],
                 this.state.containerHeight,
                 false
-            )
+            ),
         })
     }
 
@@ -97,7 +97,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 this.props.rowHeight,
                 this.props.margin[1],
                 this.state.containerHeight
-            )
+            ),
         })
         this.props.onDragEnd && this.props.onDragEnd(layoutItem, compacted)
     }
@@ -113,7 +113,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 placeholderShow: true,
                 placeholderMoving: true,
                 mapLayout: syncLayout(this.state.mapLayout, bundles),
-                dragType: 'drag'
+                dragType: 'drag',
             })
         }
         this.props.onDragStart &&
@@ -146,7 +146,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 this.props.rowHeight,
                 this.props.margin[1],
                 this.state.containerHeight
-            )
+            ),
         })
         this.props.onDrag && this.props.onDrag(layoutItem, compacted)
     }
@@ -167,7 +167,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 this.props.rowHeight,
                 this.props.margin[1],
                 this.state.containerHeight
-            )
+            ),
         })
         this.props.onDragEnd && this.props.onDragEnd(layoutItem, compacted)
     }
@@ -181,7 +181,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
             wMoving,
             hMoving,
             placeholderMoving,
-            dragType
+            dragType,
         } = this.state
 
         if (!placeholder) return null
@@ -200,7 +200,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 style={{
                     background: 'rgba(15,15,15,0.3)',
                     zIndex: dragType === 'drag' ? 1 : 10,
-                    transition: ' all .15s ease-out'
+                    transition: ' all .15s ease-out',
                 }}
                 isUserMove={!placeholderMoving}
                 dragType={dragType}
@@ -227,7 +227,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
 
                 return {
                     ...copyed[item.key],
-                    others
+                    others,
                 }
             })
             const { compacted, mapLayout } = compactLayout(
@@ -243,7 +243,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                     this.state.containerHeight
                 ),
                 layout: compacted,
-                mapLayout
+                mapLayout,
             })
         } else if (this.props.layout.length < nextProps.layout.length) {
             //add
@@ -252,18 +252,18 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 if (copyed[v.key]) {
                     return {
                         ...v,
-                        GridX:copyed[v.key].GridX,
-                        GridY:copyed[v.key].GridY,
-                        w:copyed[v.key].w,
-                        h:copyed[v.key].h,
-                        key:copyed[v.key].key
+                        GridX: copyed[v.key].GridX,
+                        GridY: copyed[v.key].GridY,
+                        w: copyed[v.key].w,
+                        h: copyed[v.key].h,
+                        key: copyed[v.key].key,
                     }
                 }
 
                 return {
                     ...v,
                     isUserMove: false,
-                    key: v.key + ''
+                    key: v.key + '',
                 }
             })
             const { compacted, mapLayout } = compactLayout(
@@ -280,7 +280,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                     false
                 ),
                 layout: compacted,
-                mapLayout
+                mapLayout,
             })
         } else {
             this.recalculateLayout(nextProps.layout, nextProps.col)
@@ -303,7 +303,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                 this.props.margin[1],
                 this.state.containerHeight,
                 false
-            )
+            ),
         })
     }
 
@@ -350,7 +350,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                                     : false,
                             props: GridItemProvided,
                             dragHandle,
-                            resizeHandle
+                            resizeHandle,
                         })
                     }
                 </GridItem>
@@ -370,7 +370,7 @@ export class Dragact extends React.Component<DragactProps, DragactState> {
                     left: 100,
                     width: width,
                     height: containerHeight,
-                    zIndex: 1
+                    zIndex: 1,
                 }}
             >
                 {layout.map((item, index) => {