Skip to content

Commit c08e581

Browse files
authored
Merge pull request #1 from vparaskevas/master
Merging code from vparaskevas
2 parents 7879a70 + 99ea36b commit c08e581

File tree

10 files changed

+12214
-33
lines changed

10 files changed

+12214
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ node_modules
66
.DS_Store
77
*.log
88
.idea
9+
lib/react-selectable-fast.js

dist/index.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-selectable-fast.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-selectable-fast.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-selectable-fast.js

Lines changed: 363 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 11811 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "react-selectable-fast",
3-
"version": "3.4.0",
2+
"name": "react-selectable-fast2",
3+
"version": "3.4.1",
44
"description": "Enable other React components to be selectable by drawing a box with your mouse/touch",
55
"repository": {
66
"type": "git",
7-
"url": "git://github.com/valerybugakov/react-selectable-fast.git"
7+
"url": "git://github.com/vparaskevas/react-selectable-fast.git"
88
},
9-
"main": "lib/index.js",
9+
"main": "dist/index.js",
1010
"scripts": {
1111
"clean": "rimraf ./lib ./dist",
1212
"watch": "webpack --watch",

src/SelectableGroup.tsx

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
noop,
1010
Maybe,
1111
TComputedBounds,
12-
getDocumentScroll,
12+
getDocumentScroll
1313
} from './utils'
1414
import { TSelectableItem } from './Selectable.types'
1515
import { SelectableGroupContext } from './SelectableGroup.context'
@@ -110,7 +110,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
110110
allowCtrlClick: false,
111111
allowMetaClick: false,
112112
allowShiftClick: false,
113-
selectOnClick: true,
113+
selectOnClick: true
114114
}
115115

116116
state = { selectionMode: false }
@@ -132,7 +132,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
132132
mouseDownData: TMouseDownData = {
133133
selectboxY: 0,
134134
selectboxX: 0,
135-
target: null,
135+
target: null
136136
}
137137

138138
registry = new Set<TSelectableItem>()
@@ -161,12 +161,12 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
161161

162162
containerScroll = {
163163
scrollTop: 0,
164-
scrollLeft: 0,
164+
scrollLeft: 0
165165
}
166166

167167
documentScroll = {
168168
scrollTop: 0,
169-
scrollLeft: 0,
169+
scrollLeft: 0
170170
}
171171

172172
componentDidMount() {
@@ -214,7 +214,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
214214

215215
this.containerScroll = {
216216
scrollTop,
217-
scrollLeft,
217+
scrollLeft
218218
}
219219
}
220220

@@ -223,20 +223,20 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
223223

224224
this.documentScroll = {
225225
scrollTop: documentScrollTop,
226-
scrollLeft: documentScrollLeft,
226+
scrollLeft: documentScrollLeft
227227
}
228228
}
229229

230230
get containerDocumentScroll() {
231231
return {
232232
scrollTop: this.containerScroll.scrollTop + this.documentScroll.scrollTop,
233-
scrollLeft: this.containerScroll.scrollLeft + this.documentScroll.scrollLeft,
233+
scrollLeft: this.containerScroll.scrollLeft + this.documentScroll.scrollLeft
234234
}
235235
}
236236

237237
removeTempEventListeners() {
238238
document.removeEventListener('mousemove', this.updateSelectBox)
239-
document.removeEventListener('touchmove', this.updateSelectBox)
239+
// document.removeEventListener('touchmove', this.updateSelectBox)
240240
document.removeEventListener('mouseup', this.mouseUp)
241241
document.removeEventListener('touchend', this.mouseUp)
242242
}
@@ -279,7 +279,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
279279
toggleSelectionMode() {
280280
const {
281281
selectedItems,
282-
state: { selectionMode },
282+
state: { selectionMode }
283283
} = this
284284

285285
if (selectedItems.size && !selectionMode) {
@@ -363,7 +363,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
363363
x: selectboxX,
364364
y: selectboxY,
365365
width: Math.abs(pointX - mouseDownData.selectboxX),
366-
height: Math.abs(pointY - mouseDownData.selectboxY),
366+
height: Math.abs(pointY - mouseDownData.selectboxY)
367367
}
368368

369369
this.setSelectboxState!(selectboxState)
@@ -374,7 +374,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
374374
width: selectboxState.width,
375375
height: selectboxState.height,
376376
offsetWidth: selectboxState.width || 1,
377-
offsetHeight: selectboxState.height || 1,
377+
offsetHeight: selectboxState.height || 1
378378
}
379379

380380
this.selectItems(selectboxBounds)
@@ -392,7 +392,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
392392
tolerance: tolerance!,
393393
mixedDeselect: mixedDeselect!,
394394
enableDeselect: enableDeselect!,
395-
isFromClick: options && options.isFromClick,
395+
isFromClick: options && options.isFromClick
396396
})
397397
}
398398
}
@@ -459,7 +459,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
459459
}
460460

461461
this.setState({ selectionMode: false })
462-
this.props.onSelectionFinish!([...this.selectedItems])
462+
this.props.onSelectionFinish!([...this.selectedItems], this.selectableGroup)
463463
this.props.onSelectionClear!()
464464
}
465465

@@ -474,7 +474,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
474474
}
475475

476476
this.setState({ selectionMode: true })
477-
this.props.onSelectionFinish!([...this.selectedItems])
477+
this.props.onSelectionFinish!([...this.selectedItems], this.selectableGroup)
478478
}
479479

480480
isInIgnoreList(target: HTMLElement | null) {
@@ -511,7 +511,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
511511
allowAltClick: this.props.allowAltClick,
512512
allowCtrlClick: this.props.allowCtrlClick,
513513
allowMetaClick: this.props.allowMetaClick,
514-
allowShiftClick: this.props.allowShiftClick,
514+
allowShiftClick: this.props.allowShiftClick
515515
})
516516
if (this.mouseDownStarted || this.props.disabled || isNotLeftButtonClick) {
517517
return
@@ -541,15 +541,15 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
541541
width: 0,
542542
height: 0,
543543
offsetHeight: bounds.offsetHeight,
544-
offsetWidth: bounds.offsetWidth,
544+
offsetWidth: bounds.offsetWidth
545545
},
546546
{
547547
top: evt.pageY,
548548
left: evt.pageX,
549549
width: 0,
550550
height: 0,
551551
offsetWidth: 0,
552-
offsetHeight: 0,
552+
offsetHeight: 0
553553
}
554554
)
555555

@@ -564,7 +564,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
564564
this.mouseDownData = {
565565
target: evt.target as HTMLElement,
566566
selectboxY: evt.clientY - this.scrollBounds!.top + this.containerScroll.scrollTop,
567-
selectboxX: evt.clientX - this.scrollBounds!.left + this.containerScroll.scrollLeft,
567+
selectboxX: evt.clientX - this.scrollBounds!.left + this.containerScroll.scrollLeft
568568
}
569569

570570
if( this.props.selectingWithoutMouseMove ) {
@@ -574,7 +574,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
574574
evt.preventDefault()
575575

576576
document.addEventListener('mousemove', this.updateSelectBox)
577-
document.addEventListener('touchmove', this.updateSelectBox)
577+
// document.addEventListener('touchmove', this.updateSelectBox)
578578
document.addEventListener('mouseup', this.mouseUp)
579579
document.addEventListener('touchend', this.mouseUp)
580580
}
@@ -621,9 +621,9 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
621621
x: 0,
622622
y: 0,
623623
width: 0,
624-
height: 0,
624+
height: 0
625625
})
626-
this.props.onSelectionFinish!([...this.selectedItems])
626+
this.props.onSelectionFinish!([...this.selectedItems], this.selectableGroup)
627627
}
628628

629629
this.toggleSelectionMode()
@@ -659,7 +659,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
659659

660660
// eslint-disable-next-line react/sort-comp
661661
defaultContainerStyle: CSSProperties = {
662-
position: 'relative',
662+
position: 'relative'
663663
}
664664

665665
contextValue = {
@@ -668,8 +668,8 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
668668
unregister: this.unregisterSelectable,
669669
selectAll: this.selectAll,
670670
clearSelection: this.clearSelection,
671-
getScrolledContainer: () => this.scrollContainer,
672-
},
671+
getScrolledContainer: () => this.scrollContainer
672+
}
673673
}
674674

675675
handleClick(evt: any, top: number, left: number) {
@@ -694,12 +694,12 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
694694
width: 0,
695695
height: 0,
696696
offsetWidth: 0,
697-
offsetHeight: 0,
697+
offsetHeight: 0
698698
},
699699
{ isFromClick: true }
700700
)
701701

702-
onSelectionFinish!([...this.selectedItems], this.clickedItem)
702+
onSelectionFinish!([...this.selectedItems], this.selectableGroup, this.clickedItem)
703703

704704
if (evt.which === 1) {
705705
this.preventEvent(evt.target, 'click')
@@ -719,7 +719,7 @@ export class SelectableGroup extends Component<TSelectableGroupProps> {
719719
selectionModeClass,
720720
fixedPosition,
721721
selectboxClassName,
722-
children,
722+
children
723723
} = this.props
724724

725725
return (

webpack.config.prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
output: {
2020
path: path.resolve(__dirname, 'dist'),
2121
publicPath: '',
22-
filename: 'react-selectable-fast.js',
22+
filename: 'index.js',
2323
library: 'React-Selectable-Fast',
2424
libraryTarget: 'umd',
2525
},

0 commit comments

Comments
 (0)