mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 21:55:59 +00:00
moved some widgets to elements
This commit is contained in:
32
packages/web/src/elements/SearchInput.svelte
Normal file
32
packages/web/src/elements/SearchInput.svelte
Normal file
@@ -0,0 +1,32 @@
|
||||
<script lang="ts">
|
||||
import keycodes from '../utility/keycodes';
|
||||
|
||||
export let placeholder;
|
||||
export let value;
|
||||
|
||||
let domInput;
|
||||
|
||||
function handleKeyDown(e) {
|
||||
if (e.keyCode == keycodes.escape) {
|
||||
value = '';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
{placeholder}
|
||||
bind:value
|
||||
on:keydown={handleKeyDown}
|
||||
bind:this={domInput}
|
||||
on:focus={e => domInput.select()}
|
||||
/>
|
||||
|
||||
<style>
|
||||
input {
|
||||
flex: 1;
|
||||
min-width: 10px;
|
||||
width: 10px;
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user