multiselect-combo-box
Advanced tools
+2
-2
@@ -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 @@ |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
54554
1.01%1098
1.67%0
-100%1
Infinity%2
100%