New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

multiselect-combo-box

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiselect-combo-box - npm Package Compare versions

Comparing version

to
2.2.0-alpha

4

package.json

@@ -15,3 +15,3 @@ {

"name": "multiselect-combo-box",
"version": "2.1.0",
"version": "2.2.0-alpha",
"main": "multiselect-combo-box.js",

@@ -53,3 +53,3 @@ "directories": {

"@polymer/polymer": "^3.0.0",
"@vaadin/vaadin-combo-box": "^5.0.5",
"@vaadin/vaadin-combo-box": "^5.0.9",
"@vaadin/vaadin-text-field": "^2.4.8",

@@ -56,0 +56,0 @@ "@vaadin/vaadin-themable-mixin": "^1.4.4",

@@ -7,2 +7,3 @@ import {PolymerElement} from '@polymer/polymer/polymer-element.js';

import '@vaadin/vaadin-combo-box/src/vaadin-combo-box-light.js';
import {ComboBoxPlaceholder} from '@vaadin/vaadin-combo-box/src/vaadin-combo-box-placeholder.js';
import {MultiselectComboBoxMixin} from './multiselect-combo-box-mixin.js';

@@ -33,3 +34,2 @@ import './multiselect-combo-box-input.js';

display: inline-flex;
width: 100%;
}

@@ -130,5 +130,13 @@

constructor() {
super();
this._boundCustomOverlaySelectedItemChanged = this._customOverlaySelectedItemChanged.bind(this);
}
ready() {
super.ready();
this.$.comboBox.renderer = this._customRenderer.bind(this);
// replace listener to modify default behavior
this.$.comboBox.$.overlay.removeEventListener('selection-changed', this.$.comboBox._boundOverlaySelectedItemChanged);
this.$.comboBox.$.overlay.addEventListener('selection-changed', this._boundCustomOverlaySelectedItemChanged);
}

@@ -273,2 +281,3 @@

update.splice(index, 1);
this._resetFocusedIndex();
} else {

@@ -280,11 +289,4 @@ update.push(item);

if (this.$.comboBox.dataProvider && typeof this.$.comboBox.dataProvider === 'function') {
// When using a data provider we need to store the value of the `_focusedIndex`
// in order to retain the overlay scroll position after the value is reset
// (reseting the value sets the `_focusedIndex` to -1).
// This ensures that on consecutive value selections, the overlay is opened
// at the correct position in the list of items
const focusedIndex = this.$.comboBox.filteredItems.indexOf(item);
if (this._hasDataProvider()) {
this.$.comboBox.value = null;
this.$.comboBox._focusedIndex = focusedIndex;
} else {

@@ -322,2 +324,3 @@ // reset value

this.selectedItems = update;
this._resetFocusedIndex();
if (this.validate()) {

@@ -330,3 +333,3 @@ this._dispatchChangeEvent();

this.set('selectedItems', []);
this.$.comboBox._focusedIndex = -1; // reset focused index
this._resetFocusedIndex();
if (this.validate()) {

@@ -420,2 +423,23 @@ this._dispatchChangeEvent();

}
_hasDataProvider() {
return this.$.comboBox.dataProvider && typeof this.$.comboBox.dataProvider === 'function';
}
_resetFocusedIndex() {
this.$.comboBox._focusedIndex = -1; // reset focused index
}
_customOverlaySelectedItemChanged(event) {
event.stopPropagation();
if (event.detail.item instanceof ComboBoxPlaceholder) {
return;
}
if (this.$.comboBox.opened) {
this.$.comboBox.selectedItem = event.detail.item;
this.$.comboBox._detectAndDispatchChange();
}
}
}

@@ -422,0 +446,0 @@