Удалила лишние пропсы и стили

This commit is contained in:
Daria Golova
2022-10-28 12:32:59 +03:00
parent 8b0babec77
commit 4c2cce443b
4 changed files with 8 additions and 67 deletions

View File

@@ -26,7 +26,7 @@ export default {
currentDate: moment(), currentDate: moment(),
timeInformation: { timeInformation: {
dayStartTime: "8:00", dayStartTime: "8:00",
dayEndTime: "24:00", dayEndTime: "13:00",
}, },
eventsData: [], eventsData: [],
teamData: [], teamData: [],

View File

@@ -1,9 +1,8 @@
<template lang="pug"> <template lang="pug">
.calendar-background-wrapper.flex.flex-col( .flex.flex-col(
ref="backgroundWrapper"
:style="backgroundExtendedWidth" :style="backgroundExtendedWidth"
) )
.body.flex.flex-col .flex.flex-col
.line-wrapper .line-wrapper
.line.flex.items-center( .line.flex.items-center(
v-for="hour in timeCoil" v-for="hour in timeCoil"
@@ -17,26 +16,16 @@ export default {
name: "CalendarBackground", name: "CalendarBackground",
props: { props: {
timeCoil: Array, timeCoil: Array,
filteredOwners: Array,
eventsData: Array,
currentDate: Object,
sidebarWidth: String,
dayStartTime: Number,
dayEndTime: Number,
ownersCount: Number, ownersCount: Number,
}, },
data() { data() {
return { return {
backgroundWidth: 0,
columnWidth: 0, columnWidth: 0,
defaultColumnWidth: 470, defaultColumnWidth: 470,
pixelsPerHour: 62, pixelsPerHour: 62,
}; };
}, },
computed: { computed: {
ownersArrayLength() {
return this.filteredOwners.length;
},
backgroundExtendedWidth() { backgroundExtendedWidth() {
if (this.ownersCount > 3) { if (this.ownersCount > 3) {
return { return {
@@ -47,56 +36,14 @@ export default {
width: "100%", width: "100%",
}; };
}, },
backgroundHeight() {
return (this.timeCoil.length - 1) * this.pixelsPerHour + 48;
},
horizontalScrollPresence() {
return {
"scroll-x": this.ownersArrayLength > 3,
};
},
},
methods: {
calculateColumnPosition(elemIndex) {
let deductible = parseInt(this.sidebarWidth.slice(0, -2), 10) - 72;
if (this.ownersArrayLength < 4) {
this.columnWidth =
(this.backgroundWidth - deductible) / this.ownersArrayLength;
return {
width: `${this.columnWidth}px`,
height: `${this.backgroundHeight}px`,
left: `${elemIndex * this.columnWidth}px`,
};
}
return {
width: `${this.defaultColumnWidth}px`,
height: `${this.backgroundHeight}px`,
left: `${elemIndex * this.defaultColumnWidth}px`,
};
},
calculateBackgroundWidth() {
this.backgroundWidth = this.$refs.backgroundWrapper.scrollWidth;
},
},
mounted() {
this.calculateBackgroundWidth();
}, },
}; };
</script> </script>
<style lang="sass" scoped> <style lang="sass" scoped>
.calendar-background-wrapper
position: relative
.header-wrapper
position: relative
.header .header
height: 48px height: 48px
.body
position: relative
.line .line
border-bottom: 1px solid var(--border-light-grey-color) border-bottom: 1px solid var(--border-light-grey-color)
height: 62px height: 62px

View File

@@ -76,8 +76,6 @@ export default {
<style lang="sass" scoped> <style lang="sass" scoped>
.calendar-column-wrapper .calendar-column-wrapper
border-right: 1px solid var(--border-light-grey-color) border-right: 1px solid var(--border-light-grey-color)
&:nth-last-child(2) .header
border-right: none
&:last-child &:last-child
border-right: none border-right: none

View File

@@ -10,7 +10,7 @@
@selected-layout="selectedLayout" @selected-layout="selectedLayout"
) )
.schedule-body .schedule-body
.column-wrapper.flex.ml-20.relative(:style="columnWrapperWidth") .column-wrapper.flex.ml-20(:style="columnWrapperWidth")
calendar-column( calendar-column(
v-for="(owner, index) in filteredOwners" v-for="(owner, index) in filteredOwners"
:key="owner.id" :key="owner.id"
@@ -18,7 +18,7 @@
:day-events="filterEventsByOwner(owner)" :day-events="filterEventsByOwner(owner)"
:day-start-time="validateStartTime" :day-start-time="validateStartTime"
:day-end-time="validateEndTime" :day-end-time="validateEndTime"
:style="columnWidth" :style="columnSize"
) )
.flex.w-full.relative .flex.w-full.relative
.time-coil-wrapper.left-0.-mt-3 .time-coil-wrapper.left-0.-mt-3
@@ -38,12 +38,7 @@
) )
.flex(:class="calendarBackgroundWidth") .flex(:class="calendarBackgroundWidth")
calendar-background( calendar-background(
:current-date="currentDate"
:time-coil="timeCoil" :time-coil="timeCoil"
:events-data="eventsData"
:sidebar-width="sidebarWidth"
:day-start-time="validateStartTime"
:day-end-time="validateEndTime"
:owners-count="ownersCount" :owners-count="ownersCount"
) )
</template> </template>
@@ -187,7 +182,7 @@ export default {
this.columnHeaderHeight this.columnHeaderHeight
); );
}, },
columnWidth() { columnSize() {
if (this.ownersCount > 3) { if (this.ownersCount > 3) {
return { return {
height: `${this.columnHeight}px`, height: `${this.columnHeight}px`,
@@ -260,7 +255,7 @@ export default {
if (this.convertTime(elem, 0, -3) === this.hours) { if (this.convertTime(elem, 0, -3) === this.hours) {
return this.hoursMinutes; return this.hoursMinutes;
} }
return elem; return elem.slice(0, -3) + ":00";
}); });
}, },
verifyTime(dayTime) { verifyTime(dayTime) {
@@ -360,6 +355,7 @@ export default {
z-index: 5 z-index: 5
.column-wrapper .column-wrapper
position: relative
height: 48px height: 48px
background-color: var(--default-white) background-color: var(--default-white)