haya-select 1.0.22 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haya-select",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -240,6 +240,14 @@ export default class HayaSelect extends React.PureComponent {
240
240
  }
241
241
  }
242
242
 
243
+ isActive() {
244
+ if (this.t.endOfSelectRef.current) {
245
+ return true
246
+ }
247
+
248
+ return false
249
+ }
250
+
243
251
  async loadDefaultValuesFromOptionsCallback() {
244
252
  const defaultValues = this.defaultValues()
245
253
 
@@ -329,6 +337,8 @@ export default class HayaSelect extends React.PureComponent {
329
337
  focusTextInput = () => digg(this.t.searchTextInputRef, "current").focus()
330
338
 
331
339
  setOptionsPosition() {
340
+ if (!this.isActive()) return // Debounce after un-mount handeling.
341
+
332
342
  this.setOptionsPositionBelow()
333
343
  this.setOptionsPositionAboveIfOutsideScreen()
334
344
  }
@@ -348,7 +358,7 @@ export default class HayaSelect extends React.PureComponent {
348
358
  }
349
359
 
350
360
  setOptionsPositionAbove() {
351
- const {optionsContainerRef, currentSelectedRef} = this.t
361
+ const {optionsContainerRef, currentSelectedRef, searchTextInputRef} = this.t
352
362
  const optionsHeight = digg(optionsContainerRef, "current", "offsetHeight")
353
363
  const position = currentSelectedRef.current.getBoundingClientRect()
354
364
  const {left, top, width} = digs(position, "left", "top", "width")
@@ -365,7 +375,7 @@ export default class HayaSelect extends React.PureComponent {
365
375
  scrollLeft: document.documentElement.scrollLeft,
366
376
  scrollTop: document.documentElement.scrollTop
367
377
  },
368
- () => digg(this.t.searchTextInputRef, "current").focus()
378
+ () => searchTextInputRef.current.focus()
369
379
  )
370
380
  }
371
381
 
@@ -385,7 +395,7 @@ export default class HayaSelect extends React.PureComponent {
385
395
  scrollLeft: document.documentElement.scrollLeft,
386
396
  scrollTop: document.documentElement.scrollTop
387
397
  },
388
- () => digg(searchTextInputRef, "current").focus()
398
+ () => searchTextInputRef.current.focus()
389
399
  )
390
400
  }
391
401
 
@@ -447,9 +457,9 @@ export default class HayaSelect extends React.PureComponent {
447
457
  )
448
458
  }
449
459
 
450
- onOptionClicked = (e, loadedOption) => {
451
- e.preventDefault()
452
- e.stopPropagation()
460
+ onOptionClicked = (event, loadedOption) => {
461
+ event.preventDefault()
462
+ event.stopPropagation()
453
463
 
454
464
  const {onChange, toggleOptions} = this.props
455
465
  const {multiple} = this.p
@@ -500,6 +510,7 @@ export default class HayaSelect extends React.PureComponent {
500
510
  }
501
511
 
502
512
  onChange({
513
+ event,
503
514
  options: this.shape.currentOptions,
504
515
  toggles
505
516
  })