WIP Исправлены inputs в SectionAddress

This commit is contained in:
Daria Golova
2022-12-30 17:07:40 +03:00
parent 9fe57eda5e
commit bda481cfe5
5 changed files with 125 additions and 80 deletions

View File

@@ -1,6 +1,9 @@
<template lang="pug"> <template lang="pug">
.flex.flex-col.gap-y-2 .flex.flex-col.gap-y-2
.label.font-semibold.text-sm.opacity-40(v-if="label") {{ label }} .font-semibold.text-sm.opacity-40(
v-if="label",
:class="labelClass"
) {{ label }}
.base-select.flex.justify-between.items-center.py-9px.px-4.gap-4.cursor-pointer.relative( .base-select.flex.justify-between.items-center.py-9px.px-4.gap-4.cursor-pointer.relative(
ref="select", ref="select",
@click="open = !open", @click="open = !open",
@@ -46,6 +49,7 @@ export default {
center: Boolean, center: Boolean,
label: String, label: String,
textStyle: String, textStyle: String,
labelStyle: String,
}, },
emits: ["update:modelValue"], emits: ["update:modelValue"],
data() { data() {
@@ -71,6 +75,15 @@ export default {
"text-base": true, "text-base": true,
}; };
}, },
labelClass() {
return this.labelStyle
? {
[this.labelStyle]: true,
}
: {
"text-sm": true,
};
},
}, },
methods: { methods: {
clickItem(id, label) { clickItem(id, label) {

View File

@@ -1,13 +1,17 @@
<template lang="pug"> <template lang="pug">
.flex.flex-col.gap-y-2 .flex.flex-col.gap-y-2
.label.font-semibold.text-sm.opacity-40(v-if="label") {{ label }} .label.font-semibold.text-sm.opacity-40(
v-if="label",
:class="labelClass"
) {{ label }}
.input-wrapper.flex.gap-x-2.px-4.box-border.py-10px( .input-wrapper.flex.gap-x-2.px-4.box-border.py-10px(
:class="{'border-none': borderNone, 'border-error': borderError }" :class="{'border-none': borderNone, 'border-error': borderError }"
:style="{'background-color': disabled && 'var(--bg-disable-grey-color)'}" :style="{'background-color': disabled && 'var(--bg-disable-grey-color)'}"
) )
input.input.w-full.outline-0.not-italic( input.input.w-full.outline-0.not-italic(
v-model="value", v-model="value",
:style="{'color': disabled && 'var(--font-grey-color-0)'}" :style="{'color': disabled && 'var(--font-grey-color-0)'}",
:class="textClass",
:placeholder="placeholder", :placeholder="placeholder",
:disabled="disabled", :disabled="disabled",
:type="type" :type="type"
@@ -35,6 +39,8 @@ export default {
borderError: Boolean, borderError: Boolean,
disabled: Boolean, disabled: Boolean,
label: String, label: String,
textStyle: String,
labelStyle: String,
}, },
emits: ["update:modelValue"], emits: ["update:modelValue"],
computed: { computed: {
@@ -46,6 +52,24 @@ export default {
this.$emit("update:modelValue", value); this.$emit("update:modelValue", value);
}, },
}, },
textClass() {
return this.textStyle
? {
[this.textStyle]: true,
}
: {
"text-base": true,
};
},
labelClass() {
return this.labelStyle
? {
[this.labelStyle]: true,
}
: {
"text-sm": true,
};
},
}, },
}; };
</script> </script>

View File

@@ -1,23 +1,29 @@
<template lang="pug"> <template lang="pug">
.base-select( .flex.flex-col.gap-y-2
@click="invertOpen", .font-semibold.opacity-40(
:class="{'open': open && !disable, 'border-none': borderNone}", v-if="label",
ref="select" :class="labelClass"
) ) {{ label }}
.placeholder( .base-select(
:class="{'value-color': value || placeholderOpacity, ...textClass}", @click="invertOpen",
:style="{'color': !disable || '#9ca3af', 'opacity': 1}" :class="{'open': open && !disable, 'border-none': borderNone}",
) {{ value || placeholder }} :style="{'background-color': disable && 'var(--bg-disable-grey-color)'}"
.flex.items-center ref="select"
.select-form-separator.cursor-pointer.mr-4(v-if="separator") )
span.icon-down-arrow.open-icon(:class="{'open': open && !disable }") .placeholder(
base-menu(v-if="open") :class="{'value-color': value || placeholderOpacity, ...textClass}",
.items-container( :style="{'color': !disable || '#9ca3af', 'opacity': 1}"
@click="open = false", ) {{ value || placeholder }}
v-click-outside="leaveSelect", .flex.items-center
:class="textClass" .select-form-separator.cursor-pointer.mr-4(v-if="separator")
) span.icon-down-arrow.open-icon(:class="{'open': open && !disable }")
.item(v-for="item in items", :key="item.id" @click="clickItem(item.label)") {{ item.label }} base-menu(v-if="open")
.items-container(
@click="open = false",
v-click-outside="leaveSelect",
:class="textClass"
)
.item(v-for="item in items", :key="item.id" @click="clickItem(item.label)") {{ item.label }}
</template> </template>
<script> <script>
@@ -37,6 +43,8 @@ export default {
placeholderOpacity: Boolean, placeholderOpacity: Boolean,
disable: Boolean, disable: Boolean,
textStyle: String, textStyle: String,
labelStyle: String,
label: String,
}, },
emits: ["update:modelValue"], emits: ["update:modelValue"],
data() { data() {
@@ -62,6 +70,15 @@ export default {
"text-base": true, "text-base": true,
}; };
}, },
labelClass() {
return this.labelStyle
? {
[this.labelStyle]: true,
}
: {
"text-sm": true,
};
},
}, },
methods: { methods: {
clickItem(id) { clickItem(id) {
@@ -80,6 +97,7 @@ export default {
<style scoped lang="sass"> <style scoped lang="sass">
.base-select .base-select
width: 100% width: 100%
height: 40px
border: 1.5px solid #D3D4DC border: 1.5px solid #D3D4DC
border-radius: 4px border-radius: 4px
padding: 9px 16px padding: 9px 16px

View File

@@ -1,56 +1,55 @@
<template lang="pug"> <template lang="pug">
.flex.flex-col.gap-y-4 .flex.flex-col.gap-y-4
.flex.flex-col(class="gap-y-1.5") base-select(
.text-info.text-xxs.font-semibold Город disable,
base-select.select.text-sm( textStyle="text-sm",
disable, labelStyle="text-xxs",
textStyle="text-sm", placeholder="Введите город",
placeholder="Введите город", v-model="dopeAddress.city",
v-model="dopeAddress.city", label="Город"
:style="{backgroundColor: 'var(--bg-disable-grey-color)'}" )
) base-input(
.flex.flex-col(class="gap-y-1.5") disabled,
.text-info.text-xxs.font-semibold Область placeholder="Введите область",
base-input.text-sm.input-info( labelStyle="text-xxs",
disabled, textStyle="text-sm",
placeholder="Введите область", v-model="dopeAddress.region",
v-model="dopeAddress.region", label="Область"
:style="{backgroundColor: 'var(--bg-disable-grey-color)'}" )
) base-input(
.flex.flex-col(class="gap-y-1.5") disabled,
.text-info.text-xxs.font-semibold Улица placeholder="Введите улицу",
base-input.text-sm.input-info( labelStyle="text-xxs",
disabled, textStyle="text-sm",
placeholder="Введите улицу", v-model="dopeAddress.street",
v-model="dopeAddress.street", label="Улица"
:style="{backgroundColor: 'var(--bg-disable-grey-color)'}" )
)
.flex.gap-x-4 .flex.gap-x-4
.flex.flex-col(class="gap-y-1.5") base-input(
.text-info.text-xxs.font-semibold Дом
base-input.text-sm.input-info(
disabled,
placeholder="Дом",
v-model="dopeAddress.house",
:style="{backgroundColor: 'var(--bg-disable-grey-color)'}"
)
.flex.flex-col(class="gap-y-1.5")
.text-info.text-xxs.font-semibold Квартира
base-input.text-sm.input-info(
disabled,
placeholder="Квартира",
v-model="dopeAddress.flat",
:style="{backgroundColor: 'var(--bg-disable-grey-color)'}"
)
.flex.flex-col(class="gap-y-1.5")
.text-info.text-xxs.font-semibold Индекс
base-input.text-sm.input-info(
disabled, disabled,
v-mask="'######'", placeholder="Дом",
placeholder="000000", label="Дом"
v-model="dopeAddress.index", v-model="dopeAddress.house",
:style="{backgroundColor: 'var(--bg-disable-grey-color)'}" labelStyle="text-xxs",
textStyle="text-sm",
) )
base-input(
disabled,
placeholder="Квартира",
label="Квартира",
v-model="dopeAddress.flat",
labelStyle="text-xxs",
textStyle="text-sm",
)
base-input(
disabled,
v-mask="'######'",
placeholder="000000",
label="Индекс",
v-model="dopeAddress.index",
labelStyle="text-xxs",
textStyle="text-sm",
)
</template> </template>
<script> <script>
@@ -69,12 +68,3 @@ export default {
directives: { mask }, directives: { mask },
}; };
</script> </script>
<style lang="sass" scoped>
.input-info
color: var(--font-dark-blue-color)
.text-info
color: var(--font-grey-color)
.select
height: 40px
</style>

View File

@@ -28,7 +28,7 @@
) )
.text.flex.items-center .text.flex.items-center
.text.font-medium.text-base {{ dateString }} .text.font-medium.text-base {{ dateString }}
.opacity-50.font-bold.text-xxs.ml-2(v-if="isCurrentMonth") Текущий .opacity-50.font-bold.text-xxs.ml-2(v-if="isCurrentMonth") Текущий
base-button.font-semibold(:size="40", @click="openForm") Замена смен base-button.font-semibold(:size="40", @click="openForm") Замена смен
</template> </template>