Skip to content

Commit c8f8eb9

Browse files
committed
Display: Remove BaseDropdown component in favor of BaseSelect
1 parent cb3d4ac commit c8f8eb9

File tree

15 files changed

+71
-160
lines changed

15 files changed

+71
-160
lines changed

assets/vue/components/admin/ColorThemePreview.vue

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import BaseCalendar from "../basecomponents/BaseCalendar.vue"
55
import BaseButton from "../basecomponents/BaseButton.vue"
66
import BaseMenu from "../basecomponents/BaseMenu.vue"
77
import BaseDialogConfirmCancel from "../basecomponents/BaseDialogConfirmCancel.vue"
8-
import BaseDropdown from "../basecomponents/BaseDropdown.vue"
8+
import BaseSelect from "../basecomponents/BaseSelect.vue"
99
import BaseRadioButtons from "../basecomponents/BaseRadioButtons.vue"
1010
import BaseCheckbox from "../basecomponents/BaseCheckbox.vue"
1111
import BaseInputText from "../basecomponents/BaseInputText.vue"
@@ -136,24 +136,7 @@ provide("isCustomizing", isCustomizing)
136136
ref="menu"
137137
:model="menuItems"
138138
/>
139-
<BaseDropdown
140-
v-model="dropdown"
141-
:label="t('Dropdown')"
142-
:options="[
143-
{
144-
label: t('Option 1'),
145-
value: 'option_1',
146-
},
147-
{
148-
label: t('Option 2'),
149-
value: 'option_2',
150-
},
151-
{
152-
label: t('Option 3'),
153-
value: 'option_3',
154-
},
155-
]"
156-
class="w-36"
139+
<BaseSelect
157140
input-id="dropdown"
158141
name="dropdown"
159142
option-label="label"

assets/vue/components/assignments/AssignmentsForm.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/>
3131

3232
<div v-if="chkAddToGradebook">
33-
<BaseDropdrown
33+
<BaseSelect
3434
v-model="v$.gradebookId.$model"
3535
:error-text="v$.gradebookId.$errors.map((error) => error.$message).join('<br>')"
3636
:is-invalid="v$.gradebookId.$error"
@@ -92,7 +92,7 @@
9292
name="add_to_calendar"
9393
/>
9494

95-
<BaseDropdrown
95+
<BaseSelect
9696
v-model="v$.allowTextAssignment.$model"
9797
:error-text="v$.allowTextAssignment.$errors.map((error) => error.$message).join('<br>')"
9898
:is-invalid="v$.allowTextAssignment.$error"
@@ -122,7 +122,7 @@ import BaseInputText from "../basecomponents/BaseInputText.vue"
122122
import BaseAdvancedSettingsButton from "../basecomponents/BaseAdvancedSettingsButton.vue"
123123
import BaseButton from "../basecomponents/BaseButton.vue"
124124
import BaseCheckbox from "../basecomponents/BaseCheckbox.vue"
125-
import BaseDropdrown from "../basecomponents/BaseDropdown.vue"
125+
import BaseSelect from "../basecomponents/BaseSelect.vue"
126126
import BaseInputNumber from "../basecomponents/BaseInputNumber.vue"
127127
import useVuelidate from "@vuelidate/core"
128128
import { computed, reactive, ref, watchEffect } from "vue"

assets/vue/components/attendance/AttendanceCalendarForm.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
v-model="formData.repeatType"
2323
:label="t('Repeat Type')"
2424
:options="repeatTypeOptions"
25-
option-label="label"
26-
option-value="value"
2725
required
2826
/>
2927

@@ -61,8 +59,6 @@
6159
v-model="formData.group"
6260
:label="t('Group')"
6361
:options="groupOptions"
64-
option-label="label"
65-
option-value="value"
6662
required
6763
/>
6864

assets/vue/components/attendance/AttendanceForm.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
v-model="formData.gradebookOption"
4343
:label="t('Select Gradebook Option')"
4444
:options="gradebookOptions"
45-
option-label="label"
46-
option-value="value"
4745
/>
4846

4947
<BaseInputText

assets/vue/components/basecomponents/BaseDropdown.vue

Lines changed: 0 additions & 90 deletions
This file was deleted.

assets/vue/components/basecomponents/BaseSelect.vue

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,83 @@
11
<template>
22
<div class="field">
3-
<FloatLabel>
3+
<FloatLabel variant="on">
44
<Dropdown
5-
:id="id"
5+
v-model="modelValue"
66
:disabled="disabled"
7+
:input-id="id"
8+
:invalid="isInvalid"
79
:loading="isLoading"
8-
:model-value="modelValue"
10+
:name="name"
911
:option-label="optionLabel"
1012
:option-value="optionValue"
1113
:options="realOptions"
14+
:placeholder="placeholder"
1215
:show-clear="allowClear"
1316
@change="emit('change', $event)"
14-
@update:model-value="emit('update:modelValue', $event)"
1517
>
1618
<template #emptyfilter>--</template>
1719
<template #empty>
18-
<p class="pt-2 px-2">{{ t("No available options") }}</p>
20+
{{ t("No available options") }}
1921
</template>
2022
</Dropdown>
2123
<label
22-
v-t="label"
2324
:for="id"
25+
v-text="label"
2426
/>
2527
</FloatLabel>
28+
<Message
29+
v-if="isInvalid || messageText"
30+
size="small"
31+
:severity="isInvalid ? 'error' : 'contrast'"
32+
variant="simple"
33+
>
34+
{{ messageText }}
35+
</Message>
2636
</div>
2737
</template>
2838

2939
<script setup>
3040
import { useI18n } from "vue-i18n"
3141
import { computed } from "vue"
3242
import FloatLabel from "primevue/floatlabel"
43+
import Dropdown from "primevue/select"
44+
import Message from "primevue/message"
3345
3446
const { t } = useI18n()
3547
48+
const modelValue = defineModel({
49+
type: [String, Number, Object],
50+
})
51+
3652
const props = defineProps({
3753
id: {
3854
type: String,
3955
require: true,
4056
default: "",
4157
},
58+
name: {
59+
type: String,
60+
required: false,
61+
default: undefined,
62+
},
4263
label: {
4364
type: String,
4465
required: true,
4566
default: "",
4667
},
47-
modelValue: {
48-
type: [String, Number, null],
49-
required: true,
50-
},
5168
options: {
5269
type: Array,
5370
required: true,
5471
},
5572
optionLabel: {
5673
type: String,
57-
required: true,
74+
required: false,
75+
default: "label",
5876
},
5977
optionValue: {
6078
type: String,
61-
required: true,
79+
required: false,
80+
default: "value",
6281
},
6382
isInvalid: {
6483
type: Boolean,
@@ -82,9 +101,19 @@ const props = defineProps({
82101
required: false,
83102
type: Boolean,
84103
},
104+
placeholder: {
105+
type: String,
106+
required: false,
107+
default: "",
108+
},
109+
messageText: {
110+
type: [String, null],
111+
required: false,
112+
default: null,
113+
},
85114
})
86115
87-
const emit = defineEmits(["update:modelValue", "change"])
116+
const emit = defineEmits(["change"])
88117
89118
const realOptions = computed(() => {
90119
if (props.hastEmptyValue) {

assets/vue/components/ccalendarevent/CalendarInvitations.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ const maxSubscriptionsDisabled = computed(() => 0 === subscriptionVisibilitySele
117117
v-model="subscriptionVisibilitySelected"
118118
:label="t('Allow subscriptions')"
119119
:options="subscriptionVisibilityList"
120-
option-label="label"
121-
option-value="value"
122120
/>
123121
<BaseAutocomplete
124122
id="subscription_item"

assets/vue/components/course/Form.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
:maxlength="40"
3434
validation-message="Only letters (a-z) and numbers (0-9) are allowed."
3535
/>
36-
<BaseDropdown
36+
<BaseSelect
3737
v-model="courseLanguage"
3838
:label="t('Language')"
3939
:options="languageOptions"
40-
:placeholder="t('Select Language')"
41-
input-id="language-dropdown"
40+
input-id="language-dropdowns"
4241
name="language"
4342
option-label="name"
43+
option-value="id"
4444
/>
4545
<BaseCheckbox
4646
id="demo-content"
@@ -78,7 +78,7 @@
7878
import { onMounted, ref } from "vue"
7979
import BaseInputText from "../basecomponents/BaseInputText.vue"
8080
import BaseAdvancedSettingsButton from "../basecomponents/BaseAdvancedSettingsButton.vue"
81-
import BaseDropdown from "../basecomponents/BaseDropdown.vue"
81+
import BaseSelect from "../basecomponents/BaseSelect.vue"
8282
import BaseCheckbox from "../basecomponents/BaseCheckbox.vue"
8383
import BaseButton from "../basecomponents/BaseButton.vue"
8484
import { useRouter } from "vue-router"

assets/vue/components/glossary/GlossaryExportForm.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
v-model="selectedFormat"
66
:label="t('Export format')"
77
:options="formats"
8-
option-label="label"
9-
option-value="value"
108
/>
119

1210
<LayoutFormButtons>

assets/vue/components/installer/Step1.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
/>
88
<SectionHeader :title="t('Step 1 - Installation Language')" />
99

10-
<BaseDropdown
10+
<BaseSelect
1111
v-model="installerData.langIso"
12-
:help-text="
12+
:message-text="
1313
t('Cannot find your language in the list? Contact us at {0} to contribute as a translator.', [
1414
1515
])
@@ -78,7 +78,7 @@ import { inject } from "vue"
7878
import { useI18n } from "vue-i18n"
7979
8080
import Message from "primevue/message"
81-
import BaseDropdown from "../basecomponents/BaseDropdown.vue"
81+
import BaseSelect from "../basecomponents/BaseSelect.vue"
8282
import BaseButton from "../basecomponents/BaseButton.vue"
8383
import SectionHeader from "../layout/SectionHeader.vue"
8484

0 commit comments

Comments
 (0)