Socket
Socket
Sign inDemoInstall

atom-select-list

Package Overview
Dependencies
Maintainers
6
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atom-select-list - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

test/select-list-view.test.js

2

package.json
{
"name": "atom-select-list",
"version": "0.3.2",
"version": "0.4.0",
"description": "A general-purpose select list for use in Atom packages",

@@ -5,0 +5,0 @@ "main": "./src/select-list-view.js",

@@ -52,2 +52,3 @@ # atom-select-list

* (Optional) `itemsClassList: [String]`: an array of strings that will be added as class names to the items element.
* (Optional) `initialSelectionIndex: Number`: the index of the item to initially select and automatically select after query changes; defaults to 0.
* (Optional) `didChangeQuery: (query: String) -> Void`: a function that is called when the query changes.

@@ -54,0 +55,0 @@ * (Optional) `didChangeSelection: (item: Object) -> Void`: a function that is called when the selected item changes.

@@ -17,2 +17,5 @@ const {Disposable, CompositeDisposable, TextEditor} = require('atom')

this.props = props
if (!this.props.hasOwnProperty('initialSelectionIndex')) {
this.props.initialSelectionIndex = 0
}
this.computeItems(false)

@@ -140,2 +143,6 @@ this.disposables = new CompositeDisposable()

if (props.hasOwnProperty('initialSelectionIndex')) {
this.props.initialSelectionIndex = props.initialSelectionIndex
}
if (shouldComputeItems) {

@@ -244,3 +251,3 @@ this.computeItems()

this.selectIndex(0, updateComponent)
this.selectIndex(this.props.initialSelectionIndex, updateComponent)
}

@@ -266,2 +273,3 @@

getSelectedItem () {
if (this.selectionIndex === undefined) return null
return this.items[this.selectionIndex]

@@ -271,2 +279,3 @@ }

selectPrevious () {
if (this.selectionIndex === undefined) return this.selectLast()
return this.selectIndex(this.selectionIndex - 1)

@@ -276,2 +285,3 @@ }

selectNext () {
if (this.selectionIndex === undefined) return this.selectFirst()
return this.selectIndex(this.selectionIndex + 1)

@@ -288,2 +298,6 @@ }

selectNone () {
return this.selectIndex(undefined)
}
selectIndex (index, updateComponent = true) {

@@ -297,3 +311,3 @@ if (index >= this.items.length) {

this.selectionIndex = index
if (this.props.didChangeSelection) {
if (index !== undefined && this.props.didChangeSelection) {
this.props.didChangeSelection(this.getSelectedItem())

@@ -300,0 +314,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc