Skip to content

Commit acc0d8a

Browse files
Fix selection is incorrect when items changed but items count remained (#112)
* Fix selection is incorrect when items changed but items count remained * 4.10.1
1 parent d2a6cd0 commit acc0d8a

File tree

8 files changed

+3119
-1342
lines changed

8 files changed

+3119
-1342
lines changed

.travis.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
sudo: required
2-
dist: trusty
2+
dist: xenial
33
language: node_js
44
node_js:
5-
- 9
5+
- 10.0.0
66
branches:
77
except:
88
- gh-pages
99
addons:
10-
firefox: latest
1110
apt:
12-
sources:
13-
- google-chrome
1411
packages:
15-
- google-chrome-stable
12+
# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves
13+
- libgconf-2-4
14+
chrome: beta
15+
firefox: latest
16+
before_install:
17+
- google-chrome-beta --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
1618
before_script:
1719
- yarn add polymer-cli
1820
- polymer install --variants

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v4.10.1
2+
3+
- Fix selection is incorrect when items changed but items count remained issue.
4+
15
# v4.9.3
26

37
- Use margin right and left to avoid browser specific prefix fix for rtl space issue.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "px-dropdown",
3-
"version": "4.9.3",
3+
"version": "4.10.1",
44
"main": [
55
"px-dropdown.html"
66
],

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "px-dropdown",
33
"author": "General Electric",
44
"description": "A Predix UI Dropdown component",
5-
"version": "4.9.3",
5+
"version": "4.10.1",
66
"extName": null,
77
"scripts": {
88
"clean": "gulp clean",

px-dropdown-content.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,11 @@
535535
}
536536
}.bind(this));
537537
}
538+
var shouldRenderSynchronously = newComputedItems.length === this._computedItems.length;
538539
this._computedItems = newComputedItems;
540+
if (shouldRenderSynchronously) {
541+
this.$.dropdownItems.render();
542+
}
539543
if(this.clearSelectionsOnChange) {
540544
this.set('selected', null);
541545
this.set('selectedValues', []);
@@ -568,7 +572,7 @@
568572
*
569573
* @event px-dropdown-click
570574
*/
571-
_handleActivate: function(evt) {
575+
_handleActivate: function(evt) {
572576
if(evt.detail.item.hasAttribute('disabled') || this.readOnly || this.disabledViewable) {
573577
evt.preventDefault();
574578
}
@@ -624,7 +628,7 @@
624628
if(this.multi && this.$.selector.selectedItems.length > 0 && this.$.selector.selectedItems.length <= this.displayValueCount && !this.hideSelected) {
625629
this.displayValueSelected = this.$.selector.selectedItems.map(function(item) {
626630
return item.val.trim();
627-
}).join(', ');
631+
}).join(', ');
628632
}
629633
else if(this.multi && this.selectedValues.length > this.displayValueCount && !this.hideSelected) {
630634
this.displayValueSelected = this.selectedValues.length + ' ' + this.localize('selected');
@@ -731,7 +735,7 @@
731735
/**
732736
* Adds the class that sets pointer-events = none to disable user interactions.
733737
*/
734-
_setReadOnly: function() {
738+
_setReadOnly: function() {
735739
if (this.multi && this.readOnly){
736740
this.toggleClass('dropdown--read-only-multi',true,Polymer.dom(this.$.dropdown).querySelector('.dropdown-content'));
737741
} else if (this.readOnly) {

px-dropdown.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@
173173
hide-selected="[[hideSelected]]"
174174
allow-outside-scroll="[[allowOutsideScroll]]"
175175
display-value-selected="{{_displayValueSelected}}"
176-
disable-truncate="[[disableTruncate]]">
176+
disable-truncate="[[disableTruncate]]"
177+
clear-selections-on-change="[[clearSelectionsOnChange]]">
177178
</px-dropdown-content>
178179
</px-overlay-content>
179180
</template>
@@ -231,7 +232,7 @@
231232
observer: '_resetMinWidth'
232233
},
233234
/**
234-
* The number of values to display as a comma separated string on multi select lists.
235+
* The number of values to display as a comma separated string on multi select lists.
235236
* Selections greater then this number will display as "N Selected"
236237
*/
237238
displayValueCount: {

0 commit comments

Comments
 (0)