ui: Remove string casting when passing index/checked for dropmenus (#9077)

* ui: Remove string casting when passing index/checked

* Check for e.target
pull/9102/head
John Cowen 4 years ago committed by GitHub
parent 907c4ad789
commit bf32a17994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -71,7 +71,7 @@ export default Component.extend(Slotted, {
return this.dom.clickFirstAnchor(e, '.list-collection > ul > li');
},
change: function(index, e = {}) {
if (e.target.checked && index != get(this, 'checked')) {
if (e.target.checked && index !== get(this, 'checked')) {
set(this, 'checked', parseInt(index));
this.$row = this.dom.closest('li', e.target);
this.$row.style.zIndex = 1;

@ -18,7 +18,7 @@
<YieldSlot @name="row">{{yield cell.item index}}</YieldSlot>
{{#if hasActions }}
<td class="actions">
<YieldSlot @name="actions" @params={{block-params (concat cell.index) (action "change") checked}}>
<YieldSlot @name="actions" @params={{block-params cell.index (action "change") checked}}>
{{yield cell.item index}}
</YieldSlot>
</td>

@ -95,13 +95,10 @@ export default CollectionComponent.extend(Slotted, {
return this.dom.clickFirstAnchor(e);
},
change: function(index, e = {}) {
if (typeof index !== 'string') {
return;
}
if (this.$tr) {
this.$tr.style.zIndex = null;
}
if (e.target.checked && index != get(this, 'checked')) {
if (e.target && e.target.checked && index !== get(this, 'checked')) {
set(this, 'checked', parseInt(index));
const target = e.target;
const $tr = this.dom.closest('tr', target);

Loading…
Cancel
Save