WIP Сделала BaseSearchSelect
This commit is contained in:
@@ -4,27 +4,26 @@
|
|||||||
v-if="label",
|
v-if="label",
|
||||||
:class="labelClass"
|
:class="labelClass"
|
||||||
) {{ label }}
|
) {{ 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.relative(
|
||||||
ref="select",
|
ref="select",
|
||||||
@click="open = !open",
|
@click="open = !open",
|
||||||
:class="{'open': open, 'border-none': borderNone}",
|
:class="{'open': open, 'border-none': borderNone}",
|
||||||
)
|
)
|
||||||
base-input(
|
input.w-full.outline-0.not-italic(
|
||||||
:class="{'value-color': value.label || placeholderOpacity}",
|
|
||||||
:placeholder="placeholder",
|
:placeholder="placeholder",
|
||||||
v-model="value.label"
|
v-model="value.label",
|
||||||
)
|
)
|
||||||
.flex.items-center
|
.flex.items-center
|
||||||
span.icon-down-arrow.open-icon.flex.text-xsm(:class="{'open': open }")
|
span.icon-down-arrow.open-icon.flex.text-xsm(:class="{'open': open }")
|
||||||
base-options(
|
base-options(v-if="open")
|
||||||
v-if="open",
|
|
||||||
)
|
|
||||||
.items-container.mt-1(
|
.items-container.mt-1(
|
||||||
@click="closeOptions",
|
@click="closeOptions",
|
||||||
v-click-outside="leaveSelect",
|
v-click-outside="leaveSelect",
|
||||||
:class="textClass"
|
:class="textClass"
|
||||||
)
|
)
|
||||||
|
.empty-window.py-2.px-4(v-if="items.length === 0") Ничего не найдено
|
||||||
.item.py-2.px-4.cursor-pointer(
|
.item.py-2.px-4.cursor-pointer(
|
||||||
|
v-else
|
||||||
v-for="item in items",
|
v-for="item in items",
|
||||||
:key="item?.id",
|
:key="item?.id",
|
||||||
:class="{'center': center}",
|
:class="{'center': center}",
|
||||||
@@ -47,11 +46,6 @@ export default {
|
|||||||
},
|
},
|
||||||
label: String,
|
label: String,
|
||||||
modelValue: Object,
|
modelValue: Object,
|
||||||
maxItems: {
|
|
||||||
type: Number,
|
|
||||||
default: 5,
|
|
||||||
},
|
|
||||||
placeholderOpacity: Boolean,
|
|
||||||
center: Boolean,
|
center: Boolean,
|
||||||
borderNone: Boolean,
|
borderNone: Boolean,
|
||||||
textStyle: String,
|
textStyle: String,
|
||||||
@@ -60,9 +54,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
open: false,
|
open: false,
|
||||||
searchField: "",
|
filteredItems: [],
|
||||||
saveSearchField: "",
|
|
||||||
selected: undefined,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
emits: ["update:modelValue"],
|
emits: ["update:modelValue"],
|
||||||
@@ -115,13 +107,13 @@ export default {
|
|||||||
<style scoped lang="sass">
|
<style scoped lang="sass">
|
||||||
.base-select
|
.base-select
|
||||||
width: 100%
|
width: 100%
|
||||||
border: 1.5px solid #D3D4DC
|
border: 1.5px solid var(--border-light-grey-color)
|
||||||
border-radius: 4px
|
border-radius: 4px
|
||||||
background-color: white
|
background-color: white
|
||||||
user-select: none
|
user-select: none
|
||||||
height: 40px
|
height: 40px
|
||||||
&.open
|
&.open
|
||||||
border: 1.5px solid #4772F2
|
border: 1.5px solid var(--btn-blue-color)
|
||||||
.items-container
|
.items-container
|
||||||
box-shadow: 1px 1px 8px rgba(37, 40, 80, 0.15)
|
box-shadow: 1px 1px 8px rgba(37, 40, 80, 0.15)
|
||||||
border-radius: 4px
|
border-radius: 4px
|
||||||
@@ -129,13 +121,13 @@ export default {
|
|||||||
max-height: 142px
|
max-height: 142px
|
||||||
overflow-y: auto
|
overflow-y: auto
|
||||||
.placeholder
|
.placeholder
|
||||||
color: #090A15
|
color: var(--font-black-color)
|
||||||
opacity: 0.4
|
opacity: 0.4
|
||||||
text-overflow: ellipsis
|
text-overflow: ellipsis
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
.item
|
.item
|
||||||
border-bottom: 0.5px solid #D3D4DC
|
border-bottom: 0.5px solid var(--border-light-grey-color)
|
||||||
color: #090A15
|
color: var(--font-black-color)
|
||||||
&:hover
|
&:hover
|
||||||
background-color: rgba(215, 217, 255, 0.25)
|
background-color: rgba(215, 217, 255, 0.25)
|
||||||
&:last-child
|
&:last-child
|
||||||
@@ -143,21 +135,12 @@ export default {
|
|||||||
.open-icon
|
.open-icon
|
||||||
&.open
|
&.open
|
||||||
transform: rotate(180deg)
|
transform: rotate(180deg)
|
||||||
.separator
|
|
||||||
background-color: var(--btn-blue-color-3)
|
|
||||||
height: 24px
|
|
||||||
width: 1px
|
|
||||||
border-radius: 1px
|
|
||||||
.border-none
|
.border-none
|
||||||
border: none
|
border: none
|
||||||
.value-color
|
|
||||||
opacity: 1
|
|
||||||
.select-form-separator
|
|
||||||
background-color: var(--btn-blue-color-3)
|
|
||||||
height: 24px
|
|
||||||
width: 1px
|
|
||||||
border-radius: 1px
|
|
||||||
.center
|
.center
|
||||||
display: flex
|
display: flex
|
||||||
justify-content: center
|
justify-content: center
|
||||||
|
.empty-window
|
||||||
|
color: var(--font-black-color)
|
||||||
|
pointer-events: none
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -36,10 +36,6 @@
|
|||||||
:delete-schedule="deleteSchedule",
|
:delete-schedule="deleteSchedule",
|
||||||
:template="template"
|
:template="template"
|
||||||
)
|
)
|
||||||
base-search-select(
|
|
||||||
:items="options",
|
|
||||||
v-model="input"
|
|
||||||
)
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -49,7 +45,6 @@ import ScheduleBar from "@/pages/schedule/components/ScheduleBar.vue";
|
|||||||
import ScheduleTable from "@/pages/schedule/components/ScheduleTable.vue";
|
import ScheduleTable from "@/pages/schedule/components/ScheduleTable.vue";
|
||||||
import { fetchWrapper } from "@/shared/fetchWrapper.js";
|
import { fetchWrapper } from "@/shared/fetchWrapper.js";
|
||||||
import BaseLoader from "@/components/Loader/BaseLoader.vue";
|
import BaseLoader from "@/components/Loader/BaseLoader.vue";
|
||||||
import BaseSearchSelect from "@/components/base/BaseSearchSelect.vue";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TheSchedule",
|
name: "TheSchedule",
|
||||||
@@ -58,7 +53,6 @@ export default {
|
|||||||
ScheduleBar,
|
ScheduleBar,
|
||||||
ScheduleTable,
|
ScheduleTable,
|
||||||
BaseLoader,
|
BaseLoader,
|
||||||
BaseSearchSelect,
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -106,20 +100,6 @@ export default {
|
|||||||
startMonth: moment().startOf("month"),
|
startMonth: moment().startOf("month"),
|
||||||
showTime: false,
|
showTime: false,
|
||||||
schedulesDate: {},
|
schedulesDate: {},
|
||||||
input: {
|
|
||||||
id: null,
|
|
||||||
label: null,
|
|
||||||
},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
label: "1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
label: "2",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
Reference in New Issue
Block a user