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

Merged
merged 2 commits into from
Jan 8, 2025

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,
});

@lukasnys
Copy link
Contributor Author

@kpfefferle I rebased on master and it seems like tests are passing now 😄

@kpfefferle kpfefferle merged commit 678d037 into Addepar:master Jan 8, 2025
8 checks passed
@mixonic
Copy link
Member

mixonic commented Jan 16, 2025

This patch is released in 6.0.0-7.

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.

3 participants