How to use atom-select-list - 10 common examples

To help you get started, we’ve selected a few atom-select-list examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atom / command-palette / lib / command-palette-view.js View on Github external
constructor (initiallyVisibleItemCount = 10) {
    this.keyBindingsForActiveElement = []
    this.selectListView = new SelectListView({
      initiallyVisibleItemCount: initiallyVisibleItemCount, // just for being able to disable visible-on-render in spec
      items: [],
      filter: this.filter,
      emptyMessage: 'No matches found',
      elementForItem: (item, {index, selected, visible}) => {
        if (!visible) {
          return document.createElement("li")
        }

        const li = document.createElement('li')
        li.classList.add('event', 'two-lines')
        li.dataset.eventName = item.name

        const rightBlock = document.createElement('div')
        rightBlock.classList.add('pull-right')
github steelbrain / linter / lib / toggle-view.js View on Github external
async show() {
    const selectListView = new SelectListView({
      items: await this.getItems(),
      emptyMessage: 'No matches found',
      filterKeyForItem: item => item,
      elementForItem: (item) => {
        const li = document.createElement('li')
        li.textContent = item
        return li
      },
      didConfirmSelection: (item) => {
        this.process(item).catch(e => console.error('[Linter] Unable to process toggle:', e)).then(() => this.dispose())
      },
      didCancelSelection: () => {
        this.dispose()
      },
    })
    const panel = atom.workspace.addModalPanel({ item: selectListView })
github atom / atom / packages / grammar-selector / spec / grammar-selector-spec.js View on Github external
it('displays Auto Detect as the selected grammar', async () => {
      editor.setGrammar(atom.grammars.nullGrammar);
      atom.commands.dispatch(editor.getElement(), 'grammar-selector:show');
      await SelectListView.getScheduler().getNextUpdatePromise();

      const grammarView = atom.workspace.getModalPanels()[0].getItem().element;
      expect(grammarView.querySelector('li.active').textContent).toBe(
        'Auto Detect'
      );
    }));
github nteract / hydrogen / lib / kernel-picker.js View on Github external
constructor(kernelSpecs: Array) {
    this.kernelSpecs = kernelSpecs;
    this.onConfirmed = null;

    this.selectListView = new SelectListView({
      itemsClassList: ["mark-active"],
      items: [],
      filterKeyForItem: item => item.display_name,
      elementForItem: item => {
        const element = document.createElement("li");
        element.textContent = item.display_name;
        return element;
      },
      didConfirmSelection: item => {
        log("Selected kernel:", item);
        if (this.onConfirmed) this.onConfirmed(item);
        this.cancel();
      },
      didCancelSelection: () => this.cancel(),
      emptyMessage: "No kernels found"
    });
github h3imdall / ftp-remote-edit / lib / views / finder-view.js View on Github external
constructor(treeView) {
    super();
    const self = this;

    self.items = [];
    self.itemsCache = null;
    self.treeView = treeView;
    self.root = null;

    self.selectListView = new SelectListView({
      items: [],
      maxResults: 25,
      emptyMessage: 'No files found\u2026',
      filterKeyForItem: (item) => {
        if (atom.config.get('ftp-remote-edit.finder.filterKeyForItem') == "Filename") {
          return item.file;
        } else {
          return item.relativePath;
        }
      },
      didCancelSelection: () => { self.cancel(); },
      didConfirmSelection: (item) => {
        self.open(item);
        self.cancel();
      },
      elementForItem: ({ file, relativePath }) => {
github joefitzgerald / go-plus / lib / import / importer-view.js View on Github external
constructor(props: Object) {
    const { items, didConfirmSelection } = props
    const font: string = (atom.config.get('editor.fontFamily'): any)
    this.selectListView = new SelectListView({
      items,
      didConfirmSelection: item => {
        this.hide()
        didConfirmSelection(item)
      },
      didCancelSelection: () => this.hide(),
      elementForItem: i => {
        const li = document.createElement('li')
        li.style.fontFamily = font
        li.textContent = i
        return li
      }
    })
  }
github nteract / hydrogen / lib / watch-sidebar.js View on Github external
removeWatch() {
    const watches = this.watchViews
      .map((v, k) => ({
        name: v.getCode(),
        value: k
      }))
      .filter(obj => obj.value !== 0 || obj.name !== "");

    const watchesPicker = new SelectListView({
      items: watches,
      elementForItem: watch => {
        const element = document.createElement("li");
        element.textContent = watch.name || "";
        return element;
      },
      didConfirmSelection: watch => {
        this.watchViews[watch.value].destroy();
        this.watchViews.splice(watch.value, 1);
        modalPanel.destroy();
        watchesPicker.destroy();
        if (this.watchViews.length === 0) this.addWatch();
        else if (previouslyFocusedElement) previouslyFocusedElement.focus();
      },
      filterKeyForItem: watch => watch.name,
      didCancelSelection: () => {
github platformio / platformio-atom-ide / lib / library / containers / install-storage-prompt.js View on Github external
constructor() {
    this.selectListView = new SelectListView({
      items: this.getItems(),
      infoMessage: 'Install library to',
      filterKeyForItem: (item) => [item.name, item.path].join(' '),
      elementForItem: this.buildSelectListElement,
      didConfirmSelection: (item) => {
        if (item.path === 'custom') {
          atom.pickFolder(paths => {
            if (paths) {
              paths.forEach(p => {
                if (fs.isDirectorySync(p)) {
                  this.onDidStorageSelect(p);
                }
              });
              this.destroy();
            }
          });
github atom / line-ending-selector / lib / main.js View on Github external
'line-ending-selector:show': (event) => {
      if (!modalPanel) {
        lineEndingListView = new SelectListView({
          items: [{name: 'LF', value: '\n'}, {name: 'CRLF', value: '\r\n'}],
          filterKeyForItem: (lineEnding) => lineEnding.name,
          didConfirmSelection: (lineEnding) => {
            setLineEnding(atom.workspace.getActiveTextEditor(), lineEnding.value)
            modalPanel.hide()
          },
          didCancelSelection: () => {
            modalPanel.hide()
          },
          elementForItem: (lineEnding) => {
            const element = document.createElement('li')
            element.textContent = lineEnding.name
            return element
          }
        })
        modalPanel = atom.workspace.addModalPanel({item: lineEndingListView})
github akonwi / git-plus / lib / models / manage-stashes.js View on Github external
constructor(stashes: Stash[], handleSelection: Stash => void) {
    this.listView = new SelectList({
      items: stashes,
      emptyMessage: 'Your stash is empty',
      filterKeyForItem: stash => stash.content,
      elementForItem: (stash, _options) => {
        const li = document.createElement('li')
        li.textContent = `${stash.index}: ${stash.label}`
        return li
      },
      didCancelSelection: () => {
        this.destroy()
        this.restoreFocus()
      },
      didConfirmSelection: stash => {
        handleSelection(stash)
        this.destroy()
      }

atom-select-list

A general-purpose select list for use in Atom packages

MIT
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages