Skip to content

Commit

Permalink
👌 Updating child component ref type casting
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Nov 11, 2022
1 parent 54955c0 commit 3b1006f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div :class="['action-dropdown-container', $style.actionDropdownContainer]">
<el-dropdown :placement="placement" :trigger="trigger" @command="onSelect" ref="elementDropdown">
<el-dropdown :placement="placement" :trigger="trigger" @command="onSelect" ref="elementDropdown">
<div :class="$style.activator" @click.prevent @blur="onButtonBlur">
<n8n-icon :icon="activatorIcon"/>
</div>
Expand Down Expand Up @@ -93,12 +93,10 @@ export default Vue.extend({
this.$emit('select', action);
},
onButtonBlur(event: FocusEvent): void {
const elementDropdown = this.$refs.elementDropdown;
const elementDropdown = this.$refs.elementDropdown as Vue & { hide: () => void };
// Hide dropdown when clicking outside of current document
if (elementDropdown && event.relatedTarget === null) {
// TODO: Disabling error here since this ref is always ElDropdown instance
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
(elementDropdown as unknown as InstanceType<typeof ElDropdown>).hide();
elementDropdown.hide();
}
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export default mixins(restApi, showMessage, executionHelpers).extend({
},
onRetryButtonBlur(event: FocusEvent): void {
// Hide dropdown when clicking outside of current document
const retryDropdown = this.$refs.retryDropdown;
const retryDropdown = this.$refs.retryDropdown as Vue & { hide: () => void };
if (retryDropdown && event.relatedTarget === null) {
(retryDropdown as unknown as InstanceType<typeof ElDropdown>).hide();
retryDropdown.hide();
}
},
},
Expand Down

0 comments on commit 3b1006f

Please sign in to comment.