mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-20 06:43:11 -05:00
feat: Auto-adjust shopping list item autofocus (#7096)
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
:items="foods"
|
:items="foods"
|
||||||
:label="$t('shopping-list.food')"
|
:label="$t('shopping-list.food')"
|
||||||
:icon="$globals.icons.foods"
|
:icon="$globals.icons.foods"
|
||||||
|
:autofocus="autoFocus === 'food'"
|
||||||
create
|
create
|
||||||
@create="createAssignFood"
|
@create="createAssignFood"
|
||||||
/>
|
/>
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
:label="$t('shopping-list.note')"
|
:label="$t('shopping-list.note')"
|
||||||
rows="1"
|
rows="1"
|
||||||
auto-grow
|
auto-grow
|
||||||
autofocus
|
:autofocus="autoFocus === 'note'"
|
||||||
@keypress="handleNoteKeyPress"
|
@keypress="handleNoteKeyPress"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -165,6 +166,8 @@ export default defineNuxtComponent({
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const autoFocus = !listItem.value.food && listItem.value.note ? "note" : "food";
|
||||||
|
|
||||||
async function createAssignFood(val: string) {
|
async function createAssignFood(val: string) {
|
||||||
// keep UI reactive
|
// keep UI reactive
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||||
@@ -204,6 +207,7 @@ export default defineNuxtComponent({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
listItem,
|
listItem,
|
||||||
|
autoFocus,
|
||||||
createAssignFood,
|
createAssignFood,
|
||||||
createAssignUnit,
|
createAssignUnit,
|
||||||
assignLabelToFood,
|
assignLabelToFood,
|
||||||
|
|||||||
Reference in New Issue
Block a user