Giter Site home page Giter Site logo

vaadin / vaadin-list-box Goto Github PK

View Code? Open in Web Editor NEW
7.0 15.0 2.0 4.81 MB

The Web Component providing reusable list boxes. Part of the Vaadin components.

Home Page: https://vaadin.com/components

License: Apache License 2.0

JavaScript 17.63% HTML 82.37%
vaadin polymer2 webcomponents listbox web-components

vaadin-list-box's Issues

Uncaught TypeError: Cannot read property 'focus' of undefined

when using the following versions and menu from the markup (which appears to work fine) the menu does not appear as a result of this error.

is it more appropriate to file this under vaadin-list-mixin or vaadin-dropdown-menu?

Uncaught TypeError: Cannot read property 'focus' of undefined
    at HTMLElement.focus (vaadin-list-mixin.js:185)
    at HTMLElement._openedChanged (vaadin-dropdown-menu.js:362)
    at Object.runObserverEffect [as fn] (property-effects.js:214)
    at runEffectsForProperty (property-effects.js:159)
    at runEffects (property-effects.js:125)
    at HTMLElement._propertiesChanged (property-effects.js:1707)
    at HTMLElement._flushProperties (properties-changed.js:335)
    at HTMLElement._flushProperties (property-effects.js:1555)
    at HTMLElement._invalidateProperties (property-effects.js:1527)
    at HTMLElement._setProperty (property-effects.js:1512)

return html`...excerpt...
		<vaadin-dropdown-menu placeholder="modules" on-value-changed="appSelect">
		<template>
		<vaadin-list-box>
			${ repeat(this.itemList, (i, index) => index, (i, index) => html`<vaadin-item value="${i.name}">${i.title}</vaadin-item>`) }
		</vaadin-list-box>
		</template>
		</vaadin-dropdown-menu>




npm ls --depth=0
├── @polymer/[email protected]
├── @polymer/[email protected]
├── @vaadin/[email protected]
├── @vaadin/[email protected]
├── @vaadin/[email protected]
├── @vaadin/[email protected]
├── @vaadin/[email protected]
├── @vaadin/[email protected]
├── @vaadin/[email protected]
├── @webcomponents/[email protected]

Update docs for multi select listbox

Selected property should emphasize that it’s for single selection only and vice versa. Also the event documentation should say it's not fired on single-select mode

vaadin-list-box is not working with paper-menu-button

Hi,

It is not possible to use vaadin-list-box with paper-menu-button, the menu is not closed once an item is selected.

It seems paper-menu-button listens to specific event iron-select to auto close the menu.
vaadin-list-box should fire the same event to be compatible with polymer components.

Multiple selection feature

Several UX/DX tests participants would like to see multiple selection functionality in vaadin-list-box, so it will be possible to select multiple options by just adding multiple attribute to vaadin-list-box. (Selection process similar to native select-option multiple selection)

Disabled and Readonly seem not to work

When tried to use disable or readonly attributes like disabled="" has-label="" aria-disabled="true" or disabled for the vaadin-list-box , they did not work.

Screen reader support is lacking

The component (including the items in the dropdown) is announced as a generic “group”.
The changes to the selection are not announced.

Should we introduce value property?

One of the UX/DX tests participant propose to introduce value property to vaadin-list-box to align with vaadin-dropdown-menu where it is currently used.

Show a warning of missing vaadin-item

Show a warning of missing vaadin-item import if the component includes vaadin-items
Use the same approach as in vaadin-grid with warning about missing import

Offer an api for getting the selected item

e.g. vaadin-drop-down needs to access private API in order to get the selected item.

Additionally it would be nice to select an item by providing the item without having to know it's index in the dom.

Proposed API

   menu.selectedElement;
   menu.setSelected(itemElement);

MultiSelectListBox doesn't respect DataProvider::getId

Calling setValue with a set of items, all of which equal some item in the current item set, but are not the same object reference, throws an exception.

This is the current implementation of converting from the model object (Java Set) to the web component property (array of indices of selected items):

private static <T> JsonArray modelToPresentation(
        MultiSelectListBox<T> listBox, Set<T> model) {
    JsonArray array = Json.createArray();
    model.stream().map(listBox.getItems()::indexOf)
            .forEach(index -> array.set(array.length(), index));
    return array;
}

Instead of finding the index of the exact reference in the current set of items, it should find a match with:

dataProvider.getId(item1).equals(dataProvider.getId(item2));

MultiselectListBox looses its value after remove() and add()

Version:
Seen on vaadin 14.4.6 - high likelyhood this also is present in more recent versions (code not changed AFAIK)

Description:
The MultiselectListBox does not preserve its set value when the component is added to a container that already exists, removed and then added again. This most certainly is due to a rebuild() in an attach listener added to the ListBoxBase class that does also clear().

Steps To Reproduce:

final List<String> listBoxItems = Arrays.asList("1", "2", "3", "4");
final MultiSelectListBox<String> listBox = new MultiSelectListBox<>();
listBox.setItems(listBoxItems);
listBox.setValue(Collections.singleton("2"));
final Button addButton = new Button("add");
add(addButton);
addButton.addClickListener(event -> {
    add(listBox);
    remove(listBox);
    add(listBox);
});

Expected Result:
The MultiselectListBox keeps its value no matter how many times and where it is added/removed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.