Переписал BaseInputDate
This commit is contained in:
@@ -1,53 +1,57 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.input-wrapper.flex.gap-x-2.px-4.box-border(
|
.flex.flex-col
|
||||||
class="py-2.5",
|
.label(v-if="!!label") {{label}}
|
||||||
:style="{ minWidth: widthInput + 'px' }"
|
.field
|
||||||
)
|
input(
|
||||||
input.input.w-full.outline-0.not-italic.date.cursor-text(
|
v-model="value",
|
||||||
:value="value",
|
|
||||||
type="date",
|
type="date",
|
||||||
@input="$emit('update:value', $event.target.value)",
|
|
||||||
:placeholder="placeholder",
|
|
||||||
:maxlength="maxLength",
|
|
||||||
max="9999-12-31",
|
max="9999-12-31",
|
||||||
min="0000-01-01"
|
min="0000-01-01"
|
||||||
)
|
)
|
||||||
.slot(v-if="withIcon" :class="iconPosition")
|
|
||||||
slot.cursor-pointer
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
//TODO стили перенести для всего кита, избавиться от scoped
|
||||||
|
//TODO покрыть тестами
|
||||||
|
//TODO сделать серый цвет плейсхолдера
|
||||||
|
//TODO обработать ошибку при стирании даты
|
||||||
export default {
|
export default {
|
||||||
name: "BaseInputDate",
|
name: "BaseInputDate",
|
||||||
props: {
|
props: {
|
||||||
maxLength: Number,
|
modelValue: Date,
|
||||||
value: String,
|
label: String,
|
||||||
withIcon: {
|
|
||||||
default: false,
|
|
||||||
},
|
},
|
||||||
iconPosition: {
|
emits: ["update:modelValue"],
|
||||||
default: "right",
|
computed: {
|
||||||
|
value: {
|
||||||
|
get() {
|
||||||
|
return this.modelValue?.toISOString().split("T")[0];
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$emit("update:modelValue", new Date(value));
|
||||||
},
|
},
|
||||||
placeholder: {
|
|
||||||
default: "Поиск",
|
|
||||||
},
|
},
|
||||||
widthInput: Number,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
.left
|
.field
|
||||||
order: -1
|
align-items: center
|
||||||
.right
|
border: 1.5px solid var(--border-light-grey-color)
|
||||||
order: 1
|
|
||||||
.input-wrapper
|
|
||||||
border-radius: 4px
|
border-radius: 4px
|
||||||
background-color: var(--default-white)
|
padding: 8px 16px
|
||||||
color: var(--font-black-color)
|
input
|
||||||
.date
|
cursor: text
|
||||||
|
border: none
|
||||||
|
outline: none
|
||||||
background: url("../../assets/icons/calendar-input.svg") no-repeat 100% 50%
|
background: url("../../assets/icons/calendar-input.svg") no-repeat 100% 50%
|
||||||
&::-webkit-calendar-picker-indicator
|
&::-webkit-calendar-picker-indicator
|
||||||
opacity: 0
|
opacity: 0
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
|
||||||
|
.label
|
||||||
|
font-weight: 600
|
||||||
|
font-size: 14px
|
||||||
|
line-height: 135%
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user