-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure clicking a
ComboboxOption
after filtering the options, corre…
…ctly triggers a change (#3180) * add mouse buttons * add `useDisposables` hook * add `useFrameDebounce` hook Schedule a task in the next frame * ensure we reset the `isTyping` flag correctly * use same `mousedown` API as we did in React This allows us to never leave the `input`, even when clicking on an option. * update changelog * format comments * inline `cb`
- Loading branch information
1 parent
2d5d35a
commit 886fdf7
Showing
6 changed files
with
74 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { onUnmounted } from 'vue' | ||
import { disposables } from '../utils/disposables' | ||
|
||
/** | ||
* The `useDisposables` hook returns a `disposables` object that is disposed | ||
* when the component is unmounted. | ||
*/ | ||
export function useDisposables() { | ||
let d = disposables() | ||
onUnmounted(() => d.dispose()) | ||
return d | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useDisposables } from './use-disposables' | ||
|
||
/** | ||
* Schedule some task in the next frame. | ||
* | ||
* - If you call the returned function multiple times, only the last task will | ||
* be executed. | ||
* - If the component is unmounted, the task will be cancelled. | ||
*/ | ||
export function useFrameDebounce() { | ||
let d = useDisposables() | ||
|
||
return (cb: () => void) => { | ||
d.dispose() | ||
d.nextFrame(cb) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum MouseButton { | ||
Left = 0, | ||
Right = 2, | ||
} |