feat(editor): handle calendar view overflow in edgeless mode (#14992)
#### PR Dependency Tree * **PR #14992** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Calendar view now supports horizontal scrolling for better navigation. * **Bug Fixes** * Improved mouse wheel interaction handling to prevent unintended scrolling. * **Style** * Calendar layout is now more responsive and adapts better to different screen sizes. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/toeverything/AFFiNE/pull/14992?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -3,7 +3,9 @@ import { css } from 'lit';
|
|||||||
export const calendarViewStyles = css`
|
export const calendarViewStyles = css`
|
||||||
affine-data-view-calendar {
|
affine-data-view-calendar {
|
||||||
display: block;
|
display: block;
|
||||||
min-width: 720px;
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
--calendar-entry-height: 22px;
|
--calendar-entry-height: 22px;
|
||||||
--calendar-entry-gap: 3px;
|
--calendar-entry-gap: 3px;
|
||||||
--calendar-entry-slot-height: calc(
|
--calendar-entry-slot-height: calc(
|
||||||
@@ -32,8 +34,15 @@ export const calendarViewStyles = css`
|
|||||||
--calendar-external-fallback-color: #b45309;
|
--calendar-external-fallback-color: #b45309;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.calendar-scroll {
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.calendar-shell {
|
.calendar-shell {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
min-width: 720px;
|
||||||
padding: 0 0 12px;
|
padding: 0 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,19 @@ export class CalendarViewUILogic extends DataViewUILogicBase<CalendarSingleView>
|
|||||||
|
|
||||||
focusFirstCell = () => {};
|
focusFirstCell = () => {};
|
||||||
|
|
||||||
|
onWheel = (event: WheelEvent) => {
|
||||||
|
if (event.metaKey || event.ctrlKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const ele = event.currentTarget;
|
||||||
|
if (ele instanceof HTMLElement) {
|
||||||
|
if (ele.scrollWidth === ele.clientWidth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
showIndicator = () => false;
|
showIndicator = () => false;
|
||||||
|
|
||||||
hideIndicator = () => {};
|
hideIndicator = () => {};
|
||||||
@@ -1076,7 +1089,9 @@ export class CalendarViewUI extends DataViewUIBase<CalendarViewUILogic> {
|
|||||||
})
|
})
|
||||||
: nothing}
|
: nothing}
|
||||||
<div class=${setup ? 'calendar-setup-wrap' : ''}>
|
<div class=${setup ? 'calendar-setup-wrap' : ''}>
|
||||||
${this.renderCalendar(setup)}
|
<div class="calendar-scroll" @wheel="${this.logic.onWheel}">
|
||||||
|
${this.renderCalendar(setup)}
|
||||||
|
</div>
|
||||||
${setup
|
${setup
|
||||||
? html`<div class="calendar-setup">
|
? html`<div class="calendar-setup">
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user