Skip to content

Commit 7ed96fd

Browse files
authored
Merge pull request #1033 from Georglider/main
feat: alwaysClearable prop
2 parents 3fcd0ae + 94ff47d commit 7ed96fd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/VueDatePicker/components/DatepickerInput.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@
5858
@click="emit('toggle')"
5959
/>
6060
</div>
61-
<span v-if="$slots['clear-icon'] && inputValue && clearable && !disabled && !readonly" class="dp--clear-btn"
61+
<span v-if="$slots['clear-icon'] && (alwaysClearable || inputValue && clearable && !disabled && !readonly)" class="dp--clear-btn"
6262
><slot name="clear-icon" :clear="onClear"
6363
/></span>
6464
<button
65-
v-if="clearable && !$slots['clear-icon'] && inputValue && !disabled && !readonly"
65+
v-if="!$slots['clear-icon'] && (alwaysClearable || clearable && inputValue && !disabled && !readonly)"
6666
:aria-label="defaultedAriaLabels?.clearInput"
6767
class="dp--clear-btn"
6868
type="button"

src/VueDatePicker/props.ts

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export const AllProps = {
120120
placeholder: { type: String as PropType<string>, default: '' },
121121
hideInputIcon: { type: Boolean as PropType<boolean>, default: false },
122122
clearable: { type: Boolean as PropType<boolean>, default: true },
123+
alwaysClearable: { type: Boolean as PropType<boolean>, default: false },
123124
state: { type: Boolean as PropType<boolean | null>, default: null },
124125
required: { type: Boolean as PropType<boolean>, default: false },
125126
autocomplete: { type: String as PropType<string>, default: 'off' },

0 commit comments

Comments
 (0)