WIP Позиционирование карточек
This commit is contained in:
@@ -69,8 +69,8 @@ export default {
|
|||||||
selectedEvent: {},
|
selectedEvent: {},
|
||||||
showModal: false,
|
showModal: false,
|
||||||
timeInformation: {
|
timeInformation: {
|
||||||
dayStartTime: "08:00",
|
dayStartTime: "00:00",
|
||||||
dayEndTime: "20:00",
|
dayEndTime: "24:00",
|
||||||
},
|
},
|
||||||
eventsData: [],
|
eventsData: [],
|
||||||
employeesData: [],
|
employeesData: [],
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
@selected-event="transmitEventData"
|
@selected-event="transmitEventData"
|
||||||
@reset-change-form="transmitResetChangeForm"
|
@reset-change-form="transmitResetChangeForm"
|
||||||
@delete-event="transmitDeleteEvent"
|
@delete-event="transmitDeleteEvent"
|
||||||
|
:schedule-body-ref="scheduleBodyRef"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ export default {
|
|||||||
dayStartTime: Number,
|
dayStartTime: Number,
|
||||||
eventTypes: Array,
|
eventTypes: Array,
|
||||||
changeFormWasClosed: Boolean,
|
changeFormWasClosed: Boolean,
|
||||||
|
scheduleBodyRef: Node,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.wrapper.cursor-pointer.my-1.relative(
|
.wrapper.cursor-pointer.my-1.relative(
|
||||||
:style="themeColors",
|
:style="themeColors",
|
||||||
:class="cardTheme"
|
:class="cardTheme",
|
||||||
|
ref="eventCard"
|
||||||
)
|
)
|
||||||
.card.flex.px-2(
|
.card.flex.px-2(
|
||||||
:class="{'py-6px flex-col': longCard}",
|
:class="{'py-6px flex-col': longCard}",
|
||||||
@@ -20,14 +21,15 @@
|
|||||||
.col
|
.col
|
||||||
ul
|
ul
|
||||||
li.mt-2(v-for="elem in descriptionColumns.rightColumn" :key="elem") {{ elem }}
|
li.mt-2(v-for="elem in descriptionColumns.rightColumn" :key="elem") {{ elem }}
|
||||||
calendar-event-description-card.right-0(
|
calendar-event-description-card(
|
||||||
v-if="isOpenDescriptionCard"
|
v-if="isOpenDescriptionCard"
|
||||||
:style="descriptionCardPosition"
|
|
||||||
:owner-event="ownerEvent"
|
:owner-event="ownerEvent"
|
||||||
:event-types="eventTypes"
|
:event-types="eventTypes"
|
||||||
@selected-event="transmitEventData"
|
@selected-event="transmitEventData"
|
||||||
@close-description-card="closeDescriptionCard"
|
@close-description-card="closeDescriptionCard"
|
||||||
@delete-event="transmitDeleteEvent"
|
@delete-event="transmitDeleteEvent"
|
||||||
|
:schedule-body-ref="scheduleBodyRef"
|
||||||
|
:event-card-size="cardSize"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -45,6 +47,7 @@ export default {
|
|||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
scheduleBodyRef: Node,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -52,6 +55,7 @@ export default {
|
|||||||
isActive: false,
|
isActive: false,
|
||||||
someDetailsShown: true,
|
someDetailsShown: true,
|
||||||
isOpenDescriptionCard: false,
|
isOpenDescriptionCard: false,
|
||||||
|
cardSize: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -182,11 +186,6 @@ export default {
|
|||||||
if (!remainingDetails) this.changeDetailsShown();
|
if (!remainingDetails) this.changeDetailsShown();
|
||||||
return remainingDetails;
|
return remainingDetails;
|
||||||
},
|
},
|
||||||
descriptionCardPosition() {
|
|
||||||
return {
|
|
||||||
top: `calc(${this.cardHeight.height} + 8px)`,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
trimTime(time) {
|
trimTime(time) {
|
||||||
@@ -224,6 +223,12 @@ export default {
|
|||||||
this.hideDescriptionCard();
|
this.hideDescriptionCard();
|
||||||
this.setDefaultTheme();
|
this.setDefaultTheme();
|
||||||
},
|
},
|
||||||
|
writeCardSize() {
|
||||||
|
this.cardSize = {
|
||||||
|
width: this.$refs["eventCard"].getBoundingClientRect().width,
|
||||||
|
height: this.calculateCardHeight - 8,
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
changeFormWasClosed: {
|
changeFormWasClosed: {
|
||||||
@@ -236,6 +241,9 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.writeCardSize();
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.wrapper.px-4.pt-14px.pb-4.font-medium.cursor-auto(
|
.wrapper.px-4.pt-14px.pb-4.font-medium.cursor-auto(
|
||||||
:style="typeColor",
|
:style="{...typeColor, ...position}",
|
||||||
v-click-outside="close",
|
v-click-outside="close",
|
||||||
:class="{'shadow': !disabled}"
|
:class="{'shadow': !disabled}"
|
||||||
|
ref="descriptionCard"
|
||||||
)
|
)
|
||||||
.flex.justify-between.items-center.mb-2
|
.flex.justify-between.items-center.mb-2
|
||||||
.flex
|
.flex
|
||||||
@@ -36,10 +37,13 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
scheduleBodyRef: Node,
|
||||||
|
eventCardSize: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isCertainType: true,
|
isCertainType: true,
|
||||||
|
position: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -111,11 +115,30 @@ export default {
|
|||||||
return `${object.last_name} ${object.first_name} ${object.patronymic}`;
|
return `${object.last_name} ${object.first_name} ${object.patronymic}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
if (!this.$refs.descriptionCard || !this.scheduleBodyRef) return;
|
||||||
|
const cardRect = this.$refs.descriptionCard.getBoundingClientRect();
|
||||||
|
const bodyRect = this.scheduleBodyRef.getBoundingClientRect();
|
||||||
|
//const bodyHeight = this.scheduleBodyRef.clientHeight + bodyRect.y - 20;
|
||||||
|
const bodyWidth = this.scheduleBodyRef.clientWidth + bodyRect.x - 20;
|
||||||
|
if (cardRect.x + cardRect.width > bodyWidth) {
|
||||||
|
this.position = {
|
||||||
|
top: `-${this.eventCardSize.height + 8}px`,
|
||||||
|
left: `-${cardRect.width + 8}px`,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this.position = {
|
||||||
|
top: `-${this.eventCardSize.height + 8}px`,
|
||||||
|
right: `-${this.eventCardSize.width + 8}px`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
.wrapper
|
.wrapper
|
||||||
|
width: 100% !important
|
||||||
height: auto !important
|
height: auto !important
|
||||||
background-color: var(--default-white)
|
background-color: var(--default-white)
|
||||||
color: var(--font-dark-blue-color)
|
color: var(--font-dark-blue-color)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
@selected-event="transmitEventData"
|
@selected-event="transmitEventData"
|
||||||
@reset-change-form="transmitResetChangeForm"
|
@reset-change-form="transmitResetChangeForm"
|
||||||
@delete-event="transmitDeleteEvent"
|
@delete-event="transmitDeleteEvent"
|
||||||
|
:schedule-body-ref="$refs.scheduleBody"
|
||||||
)
|
)
|
||||||
.flex.w-full.relative
|
.flex.w-full.relative
|
||||||
.time-coil-wrapper.left-0.-mt-12.pt-9
|
.time-coil-wrapper.left-0.-mt-12.pt-9
|
||||||
|
|||||||
Reference in New Issue
Block a user