Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ts): fix types for ember-tr onClick and onDoubleClick #1117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukasnys
Copy link
Contributor

While using the @onClick argument on a EmberTr component, I noticed the value I was getting back didn't match its type.

I based the type off of the implementation of the click and doubleClick function here:

click(event) {
let rowSelectionMode = this.get('rowSelectionMode');
let inputParent = closest(event.target, 'input, button, label, a, select');
if (!inputParent) {
let rowMeta = this.get('rowMeta');
if (rowMeta && rowSelectionMode === SELECT_MODE.MULTIPLE) {
let toggle = event.ctrlKey || event.metaKey || this.get('rowToggleMode');
let range = event.shiftKey;
rowMeta.select({ toggle, range });
} else if (rowMeta && rowSelectionMode === SELECT_MODE.SINGLE) {
rowMeta.select({ single: true });
}
}
this.sendEventAction('onClick', event);
},
doubleClick(event) {
this.sendEventAction('onDoubleClick', event);
},
sendEventAction(action, event) {
let rowValue = this.get('rowValue');
let rowMeta = this.get('rowMeta');
let closureAction = this[action];
closureAction?.({
event,
rowValue,
rowMeta,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants