Skip to content

Commit

Permalink
start input list with add and delete actions
Browse files Browse the repository at this point in the history
  • Loading branch information
syrk4web committed Jul 2, 2024
1 parent 9f1dbef commit 9400784
Show file tree
Hide file tree
Showing 8 changed files with 583 additions and 23 deletions.
25 changes: 19 additions & 6 deletions src/client/vite/input.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/client/vite/public/css/style.css

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions src/client/vite/src/components/Forms/Error/Dropdown.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<script setup>
/**
@name Forms/Error/Dropdown.vue
@description This component is used to display a feedback message on a dropdown field.
It is used with /Forms/Field components.
@example
{
isValid: false,
isValue: false,
}
@param {boolean} [isValid=false] - Check if the field is valid
@param {boolean} [isValue=false] - Check if the field has a value, display a different message if the field is empty or not
@param {boolean} [isValueTaken=false] - Check if input is already taken. Use with list input.
@param {string} [errorClass=""] - Additional class
*/
const props = defineProps({
isValid: {
type: Boolean,
required: false,
},
isValue: {
type: Boolean,
required: false,
},
isValueTaken: {
type: Boolean,
required: false,
default: false,
},
errorClass: {
type: String,
required: false,
default: "",
},
});
</script>

<template>
<div
:aria-hidden="props.isValid ? 'true' : 'false'"
:class="[
props.isValid ? 'hidden' : '',
'select-dropdown-btn last first',
props.errorClass,
]"
role="alert"
>
<p class="input-error-dropdown-msg">
{{
props.isValid
? $t("inp_input_valid")
: props.isNoMatch
? $t("inp_input_no_match")
: props.isValueTaken
? $t("inp_input_error_taken")
: !props.isValue
? $t("inp_input_error_required")
: $t("inp_input_error")
}}
</p>
</div>
</template>
10 changes: 10 additions & 0 deletions src/client/vite/src/components/Forms/Error/Field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
@param {boolean} [isValid=false] - Check if the field is valid
@param {boolean} [isValue=false] - Check if the field has a value, display a different message if the field is empty or not
@param {boolean} [isValueTaken=false] - Check if input is already taken. Use with list input.
@param {string} [errorClass=""] - Additional class
*/
Expand All @@ -22,6 +23,11 @@ const props = defineProps({
type: Boolean,
required: false,
},
isValueTaken: {
type: Boolean,
required: false,
default: false,
},
errorClass: {
type: String,
required: false,
Expand All @@ -39,6 +45,10 @@ const props = defineProps({
{{
props.isValid
? $t("inp_input_valid")
: props.isNoMatch
? $t("inp_input_no_match")
: props.isValueTaken
? $t("inp_input_error_taken")
: !props.isValue
? $t("inp_input_error_required")
: $t("inp_input_error")
Expand Down
15 changes: 6 additions & 9 deletions src/client/vite/src/components/Forms/Field/Combobox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { contentIndex } from "@utils/tabindex.js";
import Container from "@components/Widget/Container.vue";
import Header from "@components/Forms/Header/Field.vue";
import ErrorField from "@components/Forms/Error/Field.vue";
import ErrorDropdown from "@components/Forms/Error/Dropdown.vue";
import { useUUID } from "@utils/global.js";
/**
Expand Down Expand Up @@ -431,18 +432,14 @@ const emits = defineEmits(["inp"]);
:value="inp.value"
:type="'text'"
/>
<div
class="select-dropdown-btn"
<ErrorDropdown
v-if="!inp.isMatching"
:aria-hidden="!inp.isMatching ? 'true' : 'false'"
role="alert"
>
<p class="combobox-no-match">
{{ $t("inp_combobox_no_match") }}
</p>
</div>
:isNoMatch="true"
:isValid="false"
/>
</div>
<div
v-if="inp.isMatching"
data-select-dropdown-items
:id="`${inp.id}-list`"
:aria-hidden="select.isOpen ? 'false' : 'true'"
Expand Down
Loading

0 comments on commit 9400784

Please sign in to comment.