mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-24 06:28:34 +01:00
Some checks are pending
Docker publish rootless / build (linux/amd64) (push) Waiting to run
Docker publish rootless / build (linux/arm/v7) (push) Waiting to run
Docker publish rootless / build (linux/arm64) (push) Waiting to run
Docker publish rootless / merge (push) Blocked by required conditions
Docker publish / build (linux/amd64) (push) Waiting to run
Docker publish / build (linux/arm/v7) (push) Waiting to run
Docker publish / build (linux/arm64) (push) Waiting to run
Docker publish / merge (push) Blocked by required conditions
Update Currencies / update-currencies (push) Waiting to run
* Added quick action menu * Ran ui:fix * Updated quick action ui, added navigation options, translation keys * Changed text color * Added missing translation keys
59 lines
1.5 KiB
Vue
59 lines
1.5 KiB
Vue
<template>
|
|
<BaseModal v-model="modal" :show-close-button="false">
|
|
<div class="relative">
|
|
<span class="text-neutral-400">{{ $t("components.quick_menu.shortcut_hint") }}</span>
|
|
<QuickMenuInput
|
|
ref="inputBox"
|
|
v-model="selectedAction"
|
|
:actions="props.actions || []"
|
|
@quick-select="invokeAction"
|
|
></QuickMenuInput>
|
|
</div>
|
|
</BaseModal>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { ExposedProps as QuickMenuInputData, QuickMenuAction } from "./Input.vue";
|
|
|
|
const props = defineProps({
|
|
modelValue: {
|
|
type: Boolean,
|
|
required: true,
|
|
},
|
|
actions: {
|
|
type: Array as PropType<QuickMenuAction[]>,
|
|
required: false,
|
|
default: () => [],
|
|
},
|
|
});
|
|
|
|
const modal = useVModel(props, "modelValue");
|
|
const selectedAction = ref<QuickMenuAction>();
|
|
|
|
const inputBox = ref<QuickMenuInputData>({ focused: false, revealActions: () => {} });
|
|
|
|
const onModalOpen = useTimeoutFn(() => {
|
|
inputBox.value.focused = true;
|
|
}, 50).start;
|
|
|
|
const onModalClose = () => {
|
|
selectedAction.value = undefined;
|
|
inputBox.value.focused = false;
|
|
};
|
|
|
|
watch(modal, () => (modal.value ? onModalOpen : onModalClose)());
|
|
|
|
onStartTyping(() => {
|
|
inputBox.value.focused = true;
|
|
});
|
|
|
|
function invokeAction(action: QuickMenuAction) {
|
|
modal.value = false;
|
|
useTimeoutFn(action.action, 100).start();
|
|
}
|
|
|
|
watch(selectedAction, action => {
|
|
if (action) invokeAction(action);
|
|
});
|
|
</script>
|