Internal: UI: Add BaseDropdown component

pull/4788/head
Angel Fernando Quiroz Campos 1 year ago
parent 4c48f7869f
commit 506245ea14
  1. 71
      assets/vue/components/basecomponents/BaseDropdown.vue

@ -0,0 +1,71 @@
<template>
<div class="field">
<div class="p-float-label">
<Dropdown
:class="{ 'p-invalid': isInvalid }"
:input-id="inputId"
:model-value="modelValue"
:name="name"
:option-label="optionLabel"
:options="options"
:placeholder="placeholder"
@update:model-value="$emit('update:modelValue', $event)"
/>
<label :for="inputId" v-text="label" />
</div>
<small v-if="isInvalid" :class="{ 'p-error': isInvalid }" v-text="errorText" />
</div>
</template>
<script setup>
import Dropdown from "primevue/dropdown";
defineProps({
name: {
type: String,
required: true,
},
modelValue: {
type: Object,
required: true,
default: () => {},
},
options: {
type: Array,
required: true,
default: () => [],
},
placeholder: {
type: String,
required: false,
default: "",
},
optionLabel: {
type: String,
required: true,
default: "",
},
inputId: {
type: String,
required: true,
default: "",
},
label: {
type: String,
required: true,
default: "",
},
errorText: {
type: String,
required: false,
default: null,
},
isInvalid: {
type: Boolean,
required: false,
default: false,
},
});
defineEmits(["update:modelValue"]);
</script>
Loading…
Cancel
Save