Skip to content

Commit caa212c

Browse files
committed
refactor: use existing $refs declaration
1 parent 2ae697d commit caa212c

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

Diff for: packages/vuetify/src/components/VDialog/VDialog.ts

+5-11
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Toggleable from '../../mixins/toggleable'
1717
import ClickOutside from '../../directives/click-outside'
1818

1919
// Helpers
20-
import mixins, { ExtractVue } from '../../util/mixins'
20+
import mixins from '../../util/mixins'
2121
import { removed } from '../../util/console'
2222
import {
2323
convertToUnit,
@@ -37,15 +37,8 @@ const baseMixins = mixins(
3737
Toggleable
3838
)
3939

40-
interface options extends ExtractVue<typeof baseMixins> {
41-
$refs: {
42-
dialog: HTMLElement
43-
content: HTMLElement
44-
}
45-
}
46-
4740
/* @vue/component */
48-
export default baseMixins.extend<options>().extend({
41+
export default baseMixins.extend().extend({
4942
name: 'v-dialog',
5043

5144
directives: { ClickOutside },
@@ -188,9 +181,9 @@ export default baseMixins.extend<options>().extend({
188181
// Double nextTick to wait for lazy content to be generated
189182
this.$nextTick(() => {
190183
this.$nextTick(() => {
191-
if (!this.$refs.dialog.contains(document.activeElement)) {
184+
if (!this.$refs.dialog?.contains(document.activeElement)) {
192185
this.previousActiveElement = document.activeElement as HTMLElement
193-
this.$refs.dialog.focus()
186+
this.$refs.dialog?.focus()
194187
}
195188
this.bind()
196189
})
@@ -232,6 +225,7 @@ export default baseMixins.extend<options>().extend({
232225

233226
if (
234227
!!target &&
228+
this.$refs.dialog &&
235229
// It isn't the document or the dialog body
236230
![document, this.$refs.dialog].includes(target) &&
237231
// It isn't inside the dialog body

Diff for: packages/vuetify/src/mixins/dependent/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import Vue from 'vue'
33
import mixins from '../../util/mixins'
44
import { VOverlay } from '../../components/VOverlay'
55

6-
interface options extends Vue {
6+
interface options {
77
$el: HTMLElement
88
$refs: {
9-
content: HTMLElement
9+
content?: HTMLElement
1010
}
1111
overlay?: InstanceType<typeof VOverlay>
1212
}
@@ -31,7 +31,7 @@ function searchChildren (children: Vue[]): DependentInstance[] {
3131
}
3232

3333
/* @vue/component */
34-
export default mixins<options>().extend({
34+
export default mixins<Vue & options>().extend({
3535
name: 'dependent',
3636

3737
data () {

Diff for: packages/vuetify/src/mixins/detachable/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import mixins, { ExtractVue } from '../../util/mixins'
77
import { consoleWarn } from '../../util/console'
88

99
// Types
10-
import Vue, { PropOptions } from 'vue'
10+
import { PropOptions } from 'vue'
1111
import { VNode } from 'vue/types'
1212

13-
interface options extends Vue {
13+
interface options {
1414
$el: HTMLElement
1515
$refs: {
16-
content: HTMLElement
16+
content?: HTMLElement
1717
}
1818
}
1919

0 commit comments

Comments
 (0)