|
|
|
@@ -79,7 +79,13 @@
|
|
|
|
|
<div class="day-date">{{ day.date }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ml-body">
|
|
|
|
|
<div
|
|
|
|
|
ref="landscapeBodyRef"
|
|
|
|
|
class="ml-body"
|
|
|
|
|
@touchstart="onLandscapeBodyTouchStart"
|
|
|
|
|
@touchmove.prevent="onLandscapeBodyTouchMove"
|
|
|
|
|
@wheel="onLandscapeBodyWheel"
|
|
|
|
|
>
|
|
|
|
|
<div v-for="slot in timeSlots" :key="slot.key" class="ml-row">
|
|
|
|
|
<div class="ml-label">
|
|
|
|
|
<div class="header-label">{{ slot.label }}</div>
|
|
|
|
@@ -114,7 +120,7 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { computed, defineComponent, PropType } from 'vue';
|
|
|
|
|
import { computed, defineComponent, PropType, ref } from 'vue';
|
|
|
|
|
import { NormalizedClazzEvent } from '../useClazzViewModel';
|
|
|
|
|
import { DateFormatter, formatDate, hexToRgb } from '~/utils';
|
|
|
|
|
|
|
|
|
@@ -172,6 +178,8 @@ export default defineComponent({
|
|
|
|
|
emits: ['cell-click', 'event-click'],
|
|
|
|
|
setup(props, { emit }) {
|
|
|
|
|
const today = computed(() => new Date());
|
|
|
|
|
const landscapeBodyRef = ref<HTMLElement | null>(null);
|
|
|
|
|
const landscapeTouchLastY = ref<number | null>(null);
|
|
|
|
|
|
|
|
|
|
const weekDays = computed<WeekDay[]>(() => {
|
|
|
|
|
const days: WeekDay[] = [];
|
|
|
|
@@ -253,7 +261,30 @@ export default defineComponent({
|
|
|
|
|
emit('event-click', ev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onLandscapeBodyTouchStart(e: TouchEvent) {
|
|
|
|
|
if (!props.landscape) return;
|
|
|
|
|
landscapeTouchLastY.value = e.touches[0]?.clientY ?? null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onLandscapeBodyTouchMove(e: TouchEvent) {
|
|
|
|
|
if (!props.landscape) return;
|
|
|
|
|
const currentY = e.touches[0]?.clientY;
|
|
|
|
|
const previousY = landscapeTouchLastY.value;
|
|
|
|
|
const body = landscapeBodyRef.value;
|
|
|
|
|
if (currentY == null || previousY == null || !body) return;
|
|
|
|
|
body.scrollTop += currentY - previousY;
|
|
|
|
|
landscapeTouchLastY.value = currentY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onLandscapeBodyWheel(e: WheelEvent) {
|
|
|
|
|
if (!props.landscape) return;
|
|
|
|
|
const body = landscapeBodyRef.value;
|
|
|
|
|
if (!body) return;
|
|
|
|
|
body.scrollTop += e.deltaY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
landscapeBodyRef,
|
|
|
|
|
timeSlots,
|
|
|
|
|
weekDays,
|
|
|
|
|
eventMap,
|
|
|
|
@@ -262,6 +293,9 @@ export default defineComponent({
|
|
|
|
|
eventStyle,
|
|
|
|
|
onCellClick,
|
|
|
|
|
onEventClick,
|
|
|
|
|
onLandscapeBodyTouchStart,
|
|
|
|
|
onLandscapeBodyTouchMove,
|
|
|
|
|
onLandscapeBodyWheel,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
@@ -270,6 +304,7 @@ export default defineComponent({
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
@sidebar-width: 1.2rem;
|
|
|
|
|
@cell-width: 1.8rem;
|
|
|
|
|
@portrait-header-height: 0.72rem;
|
|
|
|
|
|
|
|
|
|
.matrix-wrapper {
|
|
|
|
|
width: 100%;
|
|
|
|
@@ -300,9 +335,12 @@ export default defineComponent({
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
pointer-events: none; /* allow click-through to cells underneath */
|
|
|
|
|
|
|
|
|
|
.sidebar-corner {
|
|
|
|
|
height: @portrait-header-height;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
background: #f7f8fa;
|
|
|
|
|
border-bottom: 1px solid #e8e8e8;
|
|
|
|
@@ -358,6 +396,7 @@ export default defineComponent({
|
|
|
|
|
/* ─── 行:共用 ─── */
|
|
|
|
|
.sr-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
height: @portrait-header-height;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -484,6 +523,8 @@ export default defineComponent({
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
height: 100%;
|
|
|
|
|
min-height: 0;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ml-header {
|
|
|
|
@@ -491,6 +532,9 @@ export default defineComponent({
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
background: #f7f8fa;
|
|
|
|
|
border-bottom: 1px solid #e8e8e8;
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
z-index: 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ml-corner {
|
|
|
|
@@ -521,8 +565,12 @@ export default defineComponent({
|
|
|
|
|
|
|
|
|
|
.ml-body {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-height: 0;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
|
overscroll-behavior: contain;
|
|
|
|
|
touch-action: none;
|
|
|
|
|
padding-bottom: 0.08rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|