vuetify 2.5.9 → 2.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/json/attributes.json +58 -66
- package/dist/json/tags.json +0 -2
- package/dist/json/web-types.json +89 -146
- package/dist/vuetify.css +37 -24
- package/dist/vuetify.css.map +1 -1
- package/dist/vuetify.js +374 -177
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +2 -2
- package/es5/components/VAppBar/VAppBar.js +3 -0
- package/es5/components/VAppBar/VAppBar.js.map +1 -1
- package/es5/components/VAutocomplete/VAutocomplete.js +20 -2
- package/es5/components/VAutocomplete/VAutocomplete.js.map +1 -1
- package/es5/components/VCalendar/mixins/calendar-with-events.js +4 -2
- package/es5/components/VCalendar/mixins/calendar-with-events.js.map +1 -1
- package/es5/components/VCalendar/mixins/mouse.js +19 -0
- package/es5/components/VCalendar/mixins/mouse.js.map +1 -1
- package/es5/components/VCalendar/util/timestamp.js +2 -2
- package/es5/components/VCalendar/util/timestamp.js.map +1 -1
- package/es5/components/VCombobox/VCombobox.js +0 -5
- package/es5/components/VCombobox/VCombobox.js.map +1 -1
- package/es5/components/VDataTable/VDataTableHeaderMobile.js +2 -2
- package/es5/components/VDataTable/VDataTableHeaderMobile.js.map +1 -1
- package/es5/components/VDialog/VDialog.js +4 -2
- package/es5/components/VDialog/VDialog.js.map +1 -1
- package/es5/components/VList/VListItem.js +8 -1
- package/es5/components/VList/VListItem.js.map +1 -1
- package/es5/components/VOverlay/VOverlay.js +1 -0
- package/es5/components/VOverlay/VOverlay.js.map +1 -1
- package/es5/components/VRadioGroup/VRadioGroup.js +7 -0
- package/es5/components/VRadioGroup/VRadioGroup.js.map +1 -1
- package/es5/components/VRangeSlider/VRangeSlider.js +4 -1
- package/es5/components/VRangeSlider/VRangeSlider.js.map +1 -1
- package/es5/components/VSelect/VSelect.js +1 -1
- package/es5/components/VSelect/VSelect.js.map +1 -1
- package/es5/components/VSlideGroup/VSlideGroup.js +93 -37
- package/es5/components/VSlideGroup/VSlideGroup.js.map +1 -1
- package/es5/components/VTabs/VTab.js +15 -4
- package/es5/components/VTabs/VTab.js.map +1 -1
- package/es5/components/VTabs/VTabsBar.js +1 -1
- package/es5/components/VTabs/VTabsBar.js.map +1 -1
- package/es5/components/VTextarea/VTextarea.js +11 -2
- package/es5/components/VTextarea/VTextarea.js.map +1 -1
- package/es5/components/VTooltip/VTooltip.js +2 -5
- package/es5/components/VTooltip/VTooltip.js.map +1 -1
- package/es5/components/VTreeview/VTreeview.js +1 -1
- package/es5/components/VTreeview/VTreeview.js.map +1 -1
- package/es5/components/transitions/createTransition.js +1 -5
- package/es5/components/transitions/createTransition.js.map +1 -1
- package/es5/directives/click-outside/index.js +19 -10
- package/es5/directives/click-outside/index.js.map +1 -1
- package/es5/directives/intersect/index.js +12 -11
- package/es5/directives/intersect/index.js.map +1 -1
- package/es5/directives/mutate/index.js +7 -6
- package/es5/directives/mutate/index.js.map +1 -1
- package/es5/directives/resize/index.js +8 -7
- package/es5/directives/resize/index.js.map +1 -1
- package/es5/directives/ripple/index.js +2 -3
- package/es5/directives/ripple/index.js.map +1 -1
- package/es5/directives/scroll/index.js +13 -10
- package/es5/directives/scroll/index.js.map +1 -1
- package/es5/framework.js +1 -1
- package/es5/locale/fr.js +1 -1
- package/es5/locale/fr.js.map +1 -1
- package/es5/mixins/detachable/index.js +32 -14
- package/es5/mixins/detachable/index.js.map +1 -1
- package/es5/mixins/intersectable/index.js +5 -2
- package/es5/mixins/intersectable/index.js.map +1 -1
- package/es5/mixins/menuable/index.js +5 -5
- package/es5/mixins/menuable/index.js.map +1 -1
- package/es5/mixins/overlayable/index.js +22 -35
- package/es5/mixins/overlayable/index.js.map +1 -1
- package/es5/mixins/routable/index.js +9 -3
- package/es5/mixins/routable/index.js.map +1 -1
- package/es5/services/goto/index.js +3 -1
- package/es5/services/goto/index.js.map +1 -1
- package/es5/util/helpers.js +23 -0
- package/es5/util/helpers.js.map +1 -1
- package/lib/components/VAppBar/VAppBar.js +4 -0
- package/lib/components/VAppBar/VAppBar.js.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.js +18 -2
- package/lib/components/VAutocomplete/VAutocomplete.js.map +1 -1
- package/lib/components/VCalendar/mixins/calendar-with-events.js +4 -2
- package/lib/components/VCalendar/mixins/calendar-with-events.js.map +1 -1
- package/lib/components/VCalendar/mixins/mouse.js +19 -0
- package/lib/components/VCalendar/mixins/mouse.js.map +1 -1
- package/lib/components/VCalendar/util/timestamp.js +2 -2
- package/lib/components/VCalendar/util/timestamp.js.map +1 -1
- package/lib/components/VCombobox/VCombobox.js +0 -5
- package/lib/components/VCombobox/VCombobox.js.map +1 -1
- package/lib/components/VDataTable/VDataTableHeaderMobile.js +2 -2
- package/lib/components/VDataTable/VDataTableHeaderMobile.js.map +1 -1
- package/lib/components/VDialog/VDialog.js +5 -2
- package/lib/components/VDialog/VDialog.js.map +1 -1
- package/lib/components/VList/VListItem.js +9 -1
- package/lib/components/VList/VListItem.js.map +1 -1
- package/lib/components/VOverlay/VOverlay.js +1 -0
- package/lib/components/VOverlay/VOverlay.js.map +1 -1
- package/lib/components/VRadioGroup/VRadioGroup.js +9 -0
- package/lib/components/VRadioGroup/VRadioGroup.js.map +1 -1
- package/lib/components/VRangeSlider/VRangeSlider.js +4 -1
- package/lib/components/VRangeSlider/VRangeSlider.js.map +1 -1
- package/lib/components/VSelect/VSelect.js +1 -1
- package/lib/components/VSelect/VSelect.js.map +1 -1
- package/lib/components/VSlideGroup/VSlideGroup.js +63 -40
- package/lib/components/VSlideGroup/VSlideGroup.js.map +1 -1
- package/lib/components/VTabs/VTab.js +16 -6
- package/lib/components/VTabs/VTab.js.map +1 -1
- package/lib/components/VTabs/VTabsBar.js +1 -1
- package/lib/components/VTabs/VTabsBar.js.map +1 -1
- package/lib/components/VTextarea/VTextarea.js +8 -0
- package/lib/components/VTextarea/VTextarea.js.map +1 -1
- package/lib/components/VTooltip/VTooltip.js +2 -5
- package/lib/components/VTooltip/VTooltip.js.map +1 -1
- package/lib/components/VTreeview/VTreeview.js +1 -1
- package/lib/components/VTreeview/VTreeview.js.map +1 -1
- package/lib/components/transitions/createTransition.js +1 -5
- package/lib/components/transitions/createTransition.js.map +1 -1
- package/lib/directives/click-outside/index.js +20 -10
- package/lib/directives/click-outside/index.js.map +1 -1
- package/lib/directives/intersect/index.js +12 -10
- package/lib/directives/intersect/index.js.map +1 -1
- package/lib/directives/mutate/index.js +7 -6
- package/lib/directives/mutate/index.js.map +1 -1
- package/lib/directives/resize/index.js +6 -5
- package/lib/directives/resize/index.js.map +1 -1
- package/lib/directives/ripple/index.js +2 -3
- package/lib/directives/ripple/index.js.map +1 -1
- package/lib/directives/scroll/index.js +9 -6
- package/lib/directives/scroll/index.js.map +1 -1
- package/lib/framework.js +1 -1
- package/lib/locale/fr.js +1 -1
- package/lib/locale/fr.js.map +1 -1
- package/lib/mixins/detachable/index.js +28 -13
- package/lib/mixins/detachable/index.js.map +1 -1
- package/lib/mixins/intersectable/index.js +5 -2
- package/lib/mixins/intersectable/index.js.map +1 -1
- package/lib/mixins/menuable/index.js +4 -4
- package/lib/mixins/menuable/index.js.map +1 -1
- package/lib/mixins/overlayable/index.js +23 -36
- package/lib/mixins/overlayable/index.js.map +1 -1
- package/lib/mixins/routable/index.js +12 -3
- package/lib/mixins/routable/index.js.map +1 -1
- package/lib/services/goto/index.js +3 -1
- package/lib/services/goto/index.js.map +1 -1
- package/lib/util/helpers.js +21 -0
- package/lib/util/helpers.js.map +1 -1
- package/package.json +2 -3
- package/src/components/VAppBar/VAppBar.ts +3 -0
- package/src/components/VAutocomplete/VAutocomplete.ts +15 -2
- package/src/components/VCalendar/mixins/calendar-with-events.sass +7 -1
- package/src/components/VCalendar/mixins/calendar-with-events.ts +3 -3
- package/src/components/VCalendar/mixins/mouse.ts +21 -0
- package/src/components/VCalendar/util/__tests__/events.spec.ts +1 -1
- package/src/components/VCalendar/util/timestamp.ts +2 -2
- package/src/components/VCombobox/VCombobox.ts +0 -5
- package/src/components/VCombobox/__tests__/VCombobox-multiple.spec.ts +113 -0
- package/src/components/VCombobox/__tests__/VCombobox.spec.ts +30 -0
- package/src/components/VDataTable/VDataTableHeaderMobile.ts +3 -1
- package/src/components/VDataTable/__tests__/__snapshots__/VDataTable.spec.ts.snap +0 -20
- package/src/components/VDialog/VDialog.ts +4 -2
- package/src/components/VImg/__tests__/VImg.spec.ts +1 -1
- package/src/components/VList/VListItem.sass +2 -1
- package/src/components/VList/VListItem.ts +7 -1
- package/src/components/VList/__tests__/VListItem.spec.ts +16 -0
- package/src/components/VOverlay/VOverlay.ts +1 -0
- package/src/components/VRadioGroup/VRadioGroup.ts +8 -0
- package/src/components/VRangeSlider/VRangeSlider.ts +3 -1
- package/src/components/VSelect/VSelect.ts +1 -1
- package/src/components/VSlideGroup/VSlideGroup.ts +75 -35
- package/src/components/VSlideGroup/__tests__/VSlideGroup.spec.ts +1 -3
- package/src/components/VSnackbar/VSnackbar.sass +2 -0
- package/src/components/VStepper/VStepper.sass +5 -1
- package/src/components/VStepper/_variables.scss +2 -1
- package/src/components/VTabs/VTab.ts +14 -4
- package/src/components/VTabs/VTabs.sass +5 -2
- package/src/components/VTabs/VTabsBar.ts +2 -2
- package/src/components/VTextarea/VTextarea.ts +7 -0
- package/src/components/VTooltip/VTooltip.ts +2 -5
- package/src/components/VTreeview/VTreeview.ts +1 -1
- package/src/components/transitions/createTransition.ts +1 -5
- package/src/directives/click-outside/__tests__/click-outside-shadow-dom.spec.ts +9 -6
- package/src/directives/click-outside/__tests__/click-outside.spec.ts +7 -4
- package/src/directives/click-outside/index.ts +19 -10
- package/src/directives/intersect/__tests__/intersect.spec.ts +13 -10
- package/src/directives/intersect/index.ts +13 -12
- package/src/directives/mutate/__tests__/mutate.spec.ts +36 -17
- package/src/directives/mutate/index.ts +8 -7
- package/src/directives/resize/__tests__/resize.spec.ts +4 -4
- package/src/directives/resize/index.ts +10 -5
- package/src/directives/ripple/index.ts +3 -5
- package/src/directives/scroll/__tests__/scroll.spec.ts +9 -9
- package/src/directives/scroll/index.ts +8 -7
- package/src/globals.d.ts +10 -11
- package/src/locale/fr.ts +1 -1
- package/src/mixins/detachable/index.ts +32 -15
- package/src/mixins/intersectable/index.ts +5 -2
- package/src/mixins/menuable/index.ts +4 -4
- package/src/mixins/overlayable/index.ts +24 -35
- package/src/mixins/routable/__tests__/routable.spec.ts +82 -5
- package/src/mixins/routable/index.ts +10 -3
- package/src/services/goto/index.ts +6 -1
- package/src/styles/components/_selection-controls.sass +4 -7
- package/src/styles/generic/_transitions.scss +219 -215
- package/src/styles/settings/_variables.scss +7 -7
- package/src/util/helpers.ts +22 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VNodeDirective } from 'vue/types/vnode'
|
|
2
|
-
import { DirectiveOptions } from 'vue'
|
|
2
|
+
import { DirectiveOptions, VNode } from 'vue'
|
|
3
3
|
|
|
4
4
|
interface ScrollVNodeDirective extends Omit<VNodeDirective, 'modifiers'> {
|
|
5
5
|
value: EventListener | {
|
|
@@ -11,7 +11,7 @@ interface ScrollVNodeDirective extends Omit<VNodeDirective, 'modifiers'> {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function inserted (el: HTMLElement, binding: ScrollVNodeDirective) {
|
|
14
|
+
function inserted (el: HTMLElement, binding: ScrollVNodeDirective, vnode: VNode) {
|
|
15
15
|
const { self = false } = binding.modifiers || {}
|
|
16
16
|
const value = binding.value
|
|
17
17
|
const options = (typeof value === 'object' && value.options) || { passive: true }
|
|
@@ -27,7 +27,8 @@ function inserted (el: HTMLElement, binding: ScrollVNodeDirective) {
|
|
|
27
27
|
|
|
28
28
|
target.addEventListener('scroll', handler, options)
|
|
29
29
|
|
|
30
|
-
el._onScroll =
|
|
30
|
+
el._onScroll = Object(el._onScroll)
|
|
31
|
+
el._onScroll![vnode.context!._uid] = {
|
|
31
32
|
handler,
|
|
32
33
|
options,
|
|
33
34
|
// Don't reference self
|
|
@@ -35,13 +36,13 @@ function inserted (el: HTMLElement, binding: ScrollVNodeDirective) {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
function unbind (el: HTMLElement) {
|
|
39
|
-
if (!el._onScroll) return
|
|
39
|
+
function unbind (el: HTMLElement, binding: ScrollVNodeDirective, vnode: VNode) {
|
|
40
|
+
if (!el._onScroll?.[vnode.context!._uid]) return
|
|
40
41
|
|
|
41
|
-
const { handler, options, target = el } = el._onScroll
|
|
42
|
+
const { handler, options, target = el } = el._onScroll[vnode.context!._uid]
|
|
42
43
|
|
|
43
44
|
target.removeEventListener('scroll', handler, options)
|
|
44
|
-
delete el._onScroll
|
|
45
|
+
delete el._onScroll[vnode.context!._uid]
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export const Scroll = {
|
package/src/globals.d.ts
CHANGED
|
@@ -29,15 +29,14 @@ declare global {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
interface HTMLElement {
|
|
32
|
-
_clickOutside?: {
|
|
33
|
-
lastMousedownWasOutside: boolean
|
|
32
|
+
_clickOutside?: Record<number, {
|
|
34
33
|
onClick: EventListener
|
|
35
34
|
onMousedown: EventListener
|
|
36
|
-
}
|
|
37
|
-
_onResize?: {
|
|
35
|
+
}> & { lastMousedownWasOutside: boolean }
|
|
36
|
+
_onResize?: Record<number, {
|
|
38
37
|
callback: () => void
|
|
39
38
|
options?: boolean | AddEventListenerOptions
|
|
40
|
-
}
|
|
39
|
+
}>
|
|
41
40
|
_ripple?: {
|
|
42
41
|
enabled?: boolean
|
|
43
42
|
centered?: boolean
|
|
@@ -48,18 +47,18 @@ declare global {
|
|
|
48
47
|
showTimer?: number
|
|
49
48
|
showTimerCommit?: (() => void) | null
|
|
50
49
|
}
|
|
51
|
-
_observe?: {
|
|
50
|
+
_observe?: Record<number, {
|
|
52
51
|
init: boolean
|
|
53
52
|
observer: IntersectionObserver
|
|
54
|
-
}
|
|
55
|
-
_mutate?: {
|
|
53
|
+
}>
|
|
54
|
+
_mutate?: Record<number, {
|
|
56
55
|
observer: MutationObserver
|
|
57
|
-
}
|
|
58
|
-
_onScroll?: {
|
|
56
|
+
}>
|
|
57
|
+
_onScroll?: Record<number, {
|
|
59
58
|
handler: EventListenerOrEventListenerObject
|
|
60
59
|
options: boolean | AddEventListenerOptions
|
|
61
60
|
target?: EventTarget
|
|
62
|
-
}
|
|
61
|
+
}>
|
|
63
62
|
_touchHandlers?: {
|
|
64
63
|
[_uid: number]: TouchStoredHandlers
|
|
65
64
|
}
|
package/src/locale/fr.ts
CHANGED
|
@@ -25,6 +25,14 @@ function validateAttachTarget (val: any) {
|
|
|
25
25
|
return val.nodeType === Node.ELEMENT_NODE
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
function removeActivator (activator: VNode[]) {
|
|
29
|
+
activator.forEach(node => {
|
|
30
|
+
node.elm &&
|
|
31
|
+
node.elm.parentNode &&
|
|
32
|
+
node.elm.parentNode.removeChild(node.elm)
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
/* @vue/component */
|
|
29
37
|
export default mixins<options &
|
|
30
38
|
/* eslint-disable indent */
|
|
@@ -87,24 +95,33 @@ export default mixins<options &
|
|
|
87
95
|
},
|
|
88
96
|
|
|
89
97
|
beforeDestroy () {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
+
if (
|
|
99
|
+
this.$refs.content &&
|
|
100
|
+
this.$refs.content.parentNode
|
|
101
|
+
) {
|
|
102
|
+
this.$refs.content.parentNode.removeChild(this.$refs.content)
|
|
103
|
+
}
|
|
104
|
+
},
|
|
98
105
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
destroyed () {
|
|
107
|
+
if (this.activatorNode) {
|
|
108
|
+
const activator = Array.isArray(this.activatorNode) ? this.activatorNode : [this.activatorNode]
|
|
109
|
+
if (this.$el.isConnected) {
|
|
110
|
+
// Component has been destroyed but the element still exists, we must be in a transition
|
|
111
|
+
// Wait for the transition to finish before cleaning up the detached activator
|
|
112
|
+
const observer = new MutationObserver(list => {
|
|
113
|
+
if (
|
|
114
|
+
list.some(record => Array.from(record.removedNodes).includes(this.$el))
|
|
115
|
+
) {
|
|
116
|
+
observer.disconnect()
|
|
117
|
+
removeActivator(activator)
|
|
118
|
+
}
|
|
105
119
|
})
|
|
120
|
+
observer.observe(this.$el.parentNode!, { subtree: false, childList: true })
|
|
121
|
+
} else {
|
|
122
|
+
removeActivator(activator)
|
|
106
123
|
}
|
|
107
|
-
}
|
|
124
|
+
}
|
|
108
125
|
},
|
|
109
126
|
|
|
110
127
|
methods: {
|
|
@@ -15,11 +15,14 @@ export default function intersectable (options: { onVisible: string[] }) {
|
|
|
15
15
|
Intersect.inserted(this.$el as HTMLElement, {
|
|
16
16
|
name: 'intersect',
|
|
17
17
|
value: this.onObserve,
|
|
18
|
-
})
|
|
18
|
+
}, this.$vnode)
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
destroyed () {
|
|
22
|
-
Intersect.unbind(this.$el as HTMLElement
|
|
22
|
+
Intersect.unbind(this.$el as HTMLElement, {
|
|
23
|
+
name: 'intersect',
|
|
24
|
+
value: this.onObserve,
|
|
25
|
+
}, this.$vnode)
|
|
23
26
|
},
|
|
24
27
|
|
|
25
28
|
methods: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Mixins
|
|
2
|
-
import Positionable from '../positionable'
|
|
3
2
|
import Stackable from '../stackable'
|
|
3
|
+
import { factory as positionableFactory } from '../positionable'
|
|
4
4
|
import Activatable from '../activatable'
|
|
5
5
|
import Detachable from '../detachable'
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ import { VNode } from 'vue'
|
|
|
13
13
|
|
|
14
14
|
const baseMixins = mixins(
|
|
15
15
|
Stackable,
|
|
16
|
-
|
|
16
|
+
positionableFactory(['top', 'right', 'bottom', 'left', 'absolute']),
|
|
17
17
|
Activatable,
|
|
18
18
|
Detachable,
|
|
19
19
|
)
|
|
@@ -205,8 +205,8 @@ export default baseMixins.extend<options>().extend({
|
|
|
205
205
|
methods: {
|
|
206
206
|
absolutePosition () {
|
|
207
207
|
return {
|
|
208
|
-
offsetTop:
|
|
209
|
-
offsetLeft:
|
|
208
|
+
offsetTop: this.positionY || this.absoluteY,
|
|
209
|
+
offsetLeft: this.positionX || this.absoluteX,
|
|
210
210
|
scrollHeight: 0,
|
|
211
211
|
top: this.positionY || this.absoluteY,
|
|
212
212
|
bottom: this.positionY || this.absoluteY,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
addOnceEventListener,
|
|
8
8
|
addPassiveEventListener,
|
|
9
9
|
getZIndex,
|
|
10
|
+
composedPath,
|
|
10
11
|
} from '../../util/helpers'
|
|
11
12
|
|
|
12
13
|
// Types
|
|
@@ -155,20 +156,32 @@ export default Vue.extend<Vue & Toggleable & Stackable & options>().extend({
|
|
|
155
156
|
if (!el || el.nodeType !== Node.ELEMENT_NODE) return false
|
|
156
157
|
|
|
157
158
|
const style = window.getComputedStyle(el)
|
|
158
|
-
return ['auto', 'scroll'].includes(style.overflowY!) && el.scrollHeight > el.clientHeight
|
|
159
|
+
return ((['auto', 'scroll'].includes(style.overflowY!) || el.tagName === 'SELECT') && el.scrollHeight > el.clientHeight) ||
|
|
160
|
+
((['auto', 'scroll'].includes(style.overflowX!)) && el.scrollWidth > el.clientWidth)
|
|
159
161
|
},
|
|
160
|
-
shouldScroll (el: Element,
|
|
162
|
+
shouldScroll (el: Element, e: WheelEvent): boolean {
|
|
161
163
|
if (el.hasAttribute('data-app')) return false
|
|
162
164
|
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
+
const dir = e.shiftKey || e.deltaX ? 'x' : 'y'
|
|
166
|
+
const delta = dir === 'y' ? e.deltaY : e.deltaX || e.deltaY
|
|
167
|
+
|
|
168
|
+
let alreadyAtStart: boolean
|
|
169
|
+
let alreadyAtEnd: boolean
|
|
170
|
+
if (dir === 'y') {
|
|
171
|
+
alreadyAtStart = el.scrollTop === 0
|
|
172
|
+
alreadyAtEnd = el.scrollTop + el.clientHeight === el.scrollHeight
|
|
173
|
+
} else {
|
|
174
|
+
alreadyAtStart = el.scrollLeft === 0
|
|
175
|
+
alreadyAtEnd = el.scrollLeft + el.clientWidth === el.scrollWidth
|
|
176
|
+
}
|
|
177
|
+
|
|
165
178
|
const scrollingUp = delta < 0
|
|
166
179
|
const scrollingDown = delta > 0
|
|
167
180
|
|
|
168
|
-
if (!
|
|
169
|
-
if (!
|
|
170
|
-
if ((
|
|
171
|
-
return this.shouldScroll(el.parentNode as Element,
|
|
181
|
+
if (!alreadyAtStart && scrollingUp) return true
|
|
182
|
+
if (!alreadyAtEnd && scrollingDown) return true
|
|
183
|
+
if ((alreadyAtStart || alreadyAtEnd)) {
|
|
184
|
+
return this.shouldScroll(el.parentNode as Element, e)
|
|
172
185
|
}
|
|
173
186
|
|
|
174
187
|
return false
|
|
@@ -183,15 +196,14 @@ export default Vue.extend<Vue & Toggleable & Stackable & options>().extend({
|
|
|
183
196
|
}
|
|
184
197
|
},
|
|
185
198
|
checkPath (e: WheelEvent) {
|
|
186
|
-
const path =
|
|
187
|
-
const delta = e.deltaY
|
|
199
|
+
const path = composedPath(e)
|
|
188
200
|
|
|
189
201
|
if (e.type === 'keydown' && path[0] === document.body) {
|
|
190
202
|
const dialog = this.$refs.dialog
|
|
191
203
|
// getSelection returns null in firefox in some edge cases, can be ignored
|
|
192
204
|
const selected = window.getSelection()!.anchorNode as Element
|
|
193
205
|
if (dialog && this.hasScrollbar(dialog) && this.isInside(selected, dialog)) {
|
|
194
|
-
return !this.shouldScroll(dialog,
|
|
206
|
+
return !this.shouldScroll(dialog, e)
|
|
195
207
|
}
|
|
196
208
|
return true
|
|
197
209
|
}
|
|
@@ -203,34 +215,11 @@ export default Vue.extend<Vue & Toggleable & Stackable & options>().extend({
|
|
|
203
215
|
if (el === document.documentElement) return true
|
|
204
216
|
if (el === this.$refs.content) return true
|
|
205
217
|
|
|
206
|
-
if (this.hasScrollbar(el as Element)) return !this.shouldScroll(el as Element,
|
|
218
|
+
if (this.hasScrollbar(el as Element)) return !this.shouldScroll(el as Element, e)
|
|
207
219
|
}
|
|
208
220
|
|
|
209
221
|
return true
|
|
210
222
|
},
|
|
211
|
-
/**
|
|
212
|
-
* Polyfill for Event.prototype.composedPath
|
|
213
|
-
*/
|
|
214
|
-
composedPath (e: WheelEvent): EventTarget[] {
|
|
215
|
-
if (e.composedPath) return e.composedPath()
|
|
216
|
-
|
|
217
|
-
const path = []
|
|
218
|
-
let el = e.target as Element
|
|
219
|
-
|
|
220
|
-
while (el) {
|
|
221
|
-
path.push(el)
|
|
222
|
-
|
|
223
|
-
if (el.tagName === 'HTML') {
|
|
224
|
-
path.push(document)
|
|
225
|
-
path.push(window)
|
|
226
|
-
|
|
227
|
-
return path
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
el = el.parentElement!
|
|
231
|
-
}
|
|
232
|
-
return path
|
|
233
|
-
},
|
|
234
223
|
hideScroll () {
|
|
235
224
|
if (this.$vuetify.breakpoint.smAndDown) {
|
|
236
225
|
document.documentElement!.classList.add('overflow-y-hidden')
|
|
@@ -1,12 +1,50 @@
|
|
|
1
1
|
import Routable from '../'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { createLocalVue, mount, Wrapper } from '@vue/test-utils'
|
|
3
|
+
import Router from 'vue-router'
|
|
4
|
+
import Vue, { VNode } from 'vue'
|
|
3
5
|
|
|
4
6
|
describe('routable.ts', () => {
|
|
7
|
+
let mountFunction: (options?: object) => Wrapper<Vue>
|
|
8
|
+
let router: Router
|
|
9
|
+
let localVue: typeof Vue
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
router = new Router()
|
|
13
|
+
localVue = createLocalVue()
|
|
14
|
+
localVue.use(Router)
|
|
15
|
+
|
|
16
|
+
mountFunction = (options = {}) => {
|
|
17
|
+
return mount({
|
|
18
|
+
mixins: [Routable],
|
|
19
|
+
props: {
|
|
20
|
+
activeClass: {
|
|
21
|
+
default: 'active',
|
|
22
|
+
},
|
|
23
|
+
exactActiveClass: {
|
|
24
|
+
default: 'exact-active',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
render (h): VNode {
|
|
28
|
+
const { tag, data } = this.generateRouteLink()
|
|
29
|
+
|
|
30
|
+
data.attrs = {
|
|
31
|
+
...data.attrs,
|
|
32
|
+
}
|
|
33
|
+
data.on = {
|
|
34
|
+
...data.on,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return h(tag, data, this.$slots.default)
|
|
38
|
+
},
|
|
39
|
+
}, {
|
|
40
|
+
localVue,
|
|
41
|
+
router,
|
|
42
|
+
...options,
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
})
|
|
5
46
|
it('should generate exact route link with to="/" and undefined exact', async () => {
|
|
6
|
-
const wrapper =
|
|
7
|
-
mixins: [Routable],
|
|
8
|
-
render: h => h('div'),
|
|
9
|
-
}, {
|
|
47
|
+
const wrapper = mountFunction({
|
|
10
48
|
propsData: {
|
|
11
49
|
to: '/',
|
|
12
50
|
},
|
|
@@ -14,4 +52,43 @@ describe('routable.ts', () => {
|
|
|
14
52
|
|
|
15
53
|
expect(wrapper.vm.generateRouteLink().data.props.exact).toBe(true)
|
|
16
54
|
})
|
|
55
|
+
|
|
56
|
+
it('should reflect the link state to isActive', async () => {
|
|
57
|
+
const wrapper = mountFunction({
|
|
58
|
+
propsData: {
|
|
59
|
+
to: '/',
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
await wrapper.vm.$nextTick()
|
|
63
|
+
expect(wrapper.vm.isActive).toBe(true)
|
|
64
|
+
|
|
65
|
+
// Simulate route changing
|
|
66
|
+
wrapper.vm.$router.push('/foo')
|
|
67
|
+
|
|
68
|
+
await wrapper.vm.$nextTick()
|
|
69
|
+
await wrapper.vm.$nextTick()
|
|
70
|
+
expect(wrapper.vm.isActive).toBe(false)
|
|
71
|
+
|
|
72
|
+
wrapper.vm.$router.push('/')
|
|
73
|
+
await wrapper.vm.$nextTick()
|
|
74
|
+
await wrapper.vm.$nextTick()
|
|
75
|
+
expect(wrapper.vm.isActive).toBe(true)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('should reflect the link state to isActive if not exact', async () => {
|
|
79
|
+
const wrapper = mountFunction({
|
|
80
|
+
propsData: {
|
|
81
|
+
to: '/foo',
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
await wrapper.vm.$nextTick()
|
|
85
|
+
expect(wrapper.vm.isActive).toBe(false)
|
|
86
|
+
|
|
87
|
+
// Simulate route changing
|
|
88
|
+
wrapper.vm.$router.push('/foo')
|
|
89
|
+
|
|
90
|
+
await wrapper.vm.$nextTick()
|
|
91
|
+
await wrapper.vm.$nextTick()
|
|
92
|
+
expect(wrapper.vm.isActive).toBe(true)
|
|
93
|
+
})
|
|
17
94
|
})
|
|
@@ -75,6 +75,10 @@ export default Vue.extend({
|
|
|
75
75
|
$route: 'onRouteChange',
|
|
76
76
|
},
|
|
77
77
|
|
|
78
|
+
mounted () {
|
|
79
|
+
this.onRouteChange()
|
|
80
|
+
},
|
|
81
|
+
|
|
78
82
|
methods: {
|
|
79
83
|
click (e: MouseEvent): void {
|
|
80
84
|
this.$emit('click', e)
|
|
@@ -140,16 +144,19 @@ export default Vue.extend({
|
|
|
140
144
|
onRouteChange () {
|
|
141
145
|
if (!this.to || !this.$refs.link || !this.$route) return
|
|
142
146
|
const activeClass = `${this.activeClass} ${this.proxyClass || ''}`.trim()
|
|
147
|
+
const exactActiveClass = `${this.exactActiveClass} ${this.proxyClass || ''}`.trim() || activeClass
|
|
143
148
|
|
|
144
|
-
const path =
|
|
149
|
+
const path = '_vnode.data.class.' + (this.exact ? exactActiveClass : activeClass)
|
|
145
150
|
|
|
146
151
|
this.$nextTick(() => {
|
|
147
152
|
/* istanbul ignore else */
|
|
148
|
-
if (getObjectValueByPath(this.$refs.link, path)) {
|
|
153
|
+
if (!getObjectValueByPath(this.$refs.link, path) === this.isActive) {
|
|
149
154
|
this.toggle()
|
|
150
155
|
}
|
|
151
156
|
})
|
|
152
157
|
},
|
|
153
|
-
toggle
|
|
158
|
+
toggle () {
|
|
159
|
+
this.isActive = !this.isActive
|
|
160
|
+
},
|
|
154
161
|
},
|
|
155
162
|
})
|
|
@@ -65,7 +65,12 @@ export default function goTo (
|
|
|
65
65
|
container.scrollTop = Math.floor(startLocation + (targetLocation - startLocation) * ease(progress))
|
|
66
66
|
|
|
67
67
|
const clientHeight = container === document.body ? document.documentElement.clientHeight : container.clientHeight
|
|
68
|
-
|
|
68
|
+
const reachBottom = clientHeight + container.scrollTop >= container.scrollHeight
|
|
69
|
+
if (
|
|
70
|
+
progress === 1 ||
|
|
71
|
+
// Need to go lower but reach bottom
|
|
72
|
+
(targetLocation > container.scrollTop && reachBottom)
|
|
73
|
+
) {
|
|
69
74
|
return resolve(targetLocation)
|
|
70
75
|
}
|
|
71
76
|
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
@import '../styles.sass'
|
|
2
2
|
|
|
3
|
-
// Theme
|
|
4
|
-
+theme(v-input--selection-controls) using ($material)
|
|
5
|
-
&.v-input--is-disabled:not(.v-input--indeterminate)
|
|
6
|
-
.v-icon
|
|
7
|
-
// needed for helper override
|
|
8
|
-
color: map-deep-get($material, 'selection-controls', 'disabled') !important
|
|
9
|
-
|
|
10
3
|
.v-input--selection-controls
|
|
11
4
|
margin-top: $input-top-spacing
|
|
12
5
|
padding-top: 4px
|
|
@@ -112,6 +105,10 @@
|
|
|
112
105
|
background: currentColor
|
|
113
106
|
transform: scale(1.2)
|
|
114
107
|
|
|
108
|
+
&.v-input--is-disabled:not(.v-input--indeterminate)
|
|
109
|
+
.v-icon
|
|
110
|
+
color: inherit
|
|
111
|
+
|
|
115
112
|
.v-input--selection-controls__input:hover
|
|
116
113
|
.v-input--selection-controls__ripple:before
|
|
117
114
|
background: currentColor
|