Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enter on form modal submit #1730

Merged
merged 4 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/client/hmi-client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
v-if="isAboutModalVisible"
class="modal"
@modal-mask-clicked="isAboutModalVisible = false"
@modal-enter-press="isAboutModalVisible = false"
>
<template #header>
<h4>About Terarium</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@
:model="configItems"
></SplitButton>
<Teleport to="body">
<tera-modal v-if="openValueConfig" @modal-mask-clicked="openValueConfig = false">
<tera-modal
v-if="openValueConfig"
@modal-mask-clicked="openValueConfig = false"
@modal-enter-press="setModelParameters"
>
<template #header>
<h4>
{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
class="edit-modal"
v-if="openEditNode === true"
@modal-mask-clicked="openEditNode = false"
@modal-enter-press="addNode"
>
<template #header>
<h4>Add/Edit {{ editNodeObj.nodeType }}</h4>
Expand Down Expand Up @@ -623,6 +624,9 @@ const prepareTransitionEdit = () => {
const addNode = async () => {
if (!renderer) return;
const node = editNodeObj.value;
if (!node?.id) {
return;
}
if (props.model?.model.states.find((s) => s.id === node.id)) {
YohannParis marked this conversation as resolved.
Show resolved Hide resolved
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@
v-if="isCopyModelModalVisible"
class="modal"
@modal-mask-clicked="isCopyModelModalVisible = false"
@modal-enter-press="duplicateModel"
>
<template #header>
<h4>Make a copy</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
openValueConfig = false;
emit('sync-configs');
"
@model-submit="
openValueConfig = false;
emit('sync-configs');
"
>
<template #header>
<h4>{{ modalVal.id }}</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defineProps<{

<template>
<Transition name="modal">
<main :style="{ '--z-index': zIndex }">
<main :style="{ '--z-index': zIndex }" @keyup.enter="$emit('modal-enter-press')">
<section>
<header>
<slot name="header" />
Expand Down
3 changes: 2 additions & 1 deletion packages/client/hmi-client/src/page/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@
v-if="isNewProjectModalVisible"
class="modal"
@modal-mask-clicked="isNewProjectModalVisible = false"
@modal-enter-press="createNewProject"
>
<template #header>
<h4>Create project</h4>
</template>
<template #default>
<form>
<form @submit.prevent>
YohannParis marked this conversation as resolved.
Show resolved Hide resolved
<label for="new-project-name">Name</label>
<InputText
id="new-project-name"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<template>
<Teleport to="body">
<tera-modal v-if="isVisible" class="modal" @modal-mask-clicked="emit('close-modal')">
<tera-modal
v-if="isVisible"
class="modal"
@modal-mask-clicked="emit('close-modal')"
@modal-enter-press="createNewModel"
>
<template #header>
<h4>New model</h4>
</template>
<template #default>
<form>
<form @submit.prevent>
<label for="new-model">Enter a unique name for your model</label>
<InputText
v-bind:class="invalidInputStyle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
v-if="isDeleteNoteModal"
@modal-mask-clicked="isDeleteNoteModal = false"
class="remove-modal"
@modal-enter-press="deleteNote"
>
<template #header>
<h4>Delete note</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
v-if="isRemovalModal"
@modal-mask-clicked="isRemovalModal = false"
class="remove-modal"
@modal-enter-press="removeAsset"
>
<template #header>
<h4>Confirm remove</h4>
Expand Down