Skip to content

Commit 5135590

Browse files
brutusmcforceMagnus von Wachenfeldt
and
Magnus von Wachenfeldt
authored
feat(week-view): add ability to customise document cursor when resizing events (#1613)
Co-authored-by: Magnus von Wachenfeldt <[email protected]>
1 parent 03f5d74 commit 5135590

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

projects/angular-calendar/src/modules/day/calendar-day-view.component.ts

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Subject } from 'rxjs';
1010
import { CalendarEventTimesChangedEvent } from '../common/calendar-event-times-changed-event.interface';
1111
import { PlacementArray } from 'positioning';
1212
import { CalendarWeekViewBeforeRenderEvent } from '../week/calendar-week.module';
13+
import { ResizeCursors } from 'angular-resizable-element';
1314

1415
export type CalendarDayViewBeforeRenderEvent =
1516
CalendarWeekViewBeforeRenderEvent;
@@ -47,6 +48,7 @@ export type CalendarDayViewBeforeRenderEvent =
4748
[tooltipTemplate]="tooltipTemplate"
4849
[tooltipAppendToBody]="tooltipAppendToBody"
4950
[tooltipDelay]="tooltipDelay"
51+
[resizeCursors]="resizeCursors"
5052
[hourSegmentTemplate]="hourSegmentTemplate"
5153
[eventTemplate]="eventTemplate"
5254
[eventTitleTemplate]="eventTitleTemplate"
@@ -193,6 +195,13 @@ export class CalendarDayViewComponent {
193195
event: CalendarEventTimesChangedEvent
194196
) => boolean;
195197

198+
/**
199+
* Customise the document cursor when dragging to resize an event
200+
*/
201+
@Input() resizeCursors: Partial<
202+
Pick<ResizeCursors, 'leftOrRight' | 'topOrBottom'>
203+
>;
204+
196205
/**
197206
* Called when an event title is clicked
198207
*/

projects/angular-calendar/src/modules/week/calendar-week-view.component.ts

+10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
WeekViewAllDayEventRow,
2828
} from 'calendar-utils';
2929
import { ResizeEvent } from 'angular-resizable-element';
30+
import { ResizeCursors } from 'angular-resizable-element';
3031
import { CalendarDragHelper } from '../common/calendar-drag-helper.provider';
3132
import { CalendarResizeHelper } from '../common/calendar-resize-helper.provider';
3233
import {
@@ -141,6 +142,7 @@ export interface CalendarWeekViewBeforeRenderEvent extends WeekView {
141142
rtl ? (100 / days.length) * allDayEvent.offset : null
142143
"
143144
mwlResizable
145+
[resizeCursors]="resizeCursors"
144146
[resizeSnapGrid]="{ left: dayColumnWidth, right: dayColumnWidth }"
145147
[validateResize]="validateResize"
146148
(resizeStart)="
@@ -281,6 +283,7 @@ export interface CalendarWeekViewBeforeRenderEvent extends WeekView {
281283
[style.left.%]="timeEvent.left"
282284
[style.width.%]="timeEvent.width"
283285
mwlResizable
286+
[resizeCursors]="resizeCursors"
284287
[resizeSnapGrid]="{
285288
left: dayColumnWidth,
286289
right: dayColumnWidth,
@@ -592,6 +595,13 @@ export class CalendarWeekViewComponent
592595
event: CalendarEventTimesChangedEvent
593596
) => boolean;
594597

598+
/**
599+
* Customise the document cursor when dragging to resize an event
600+
*/
601+
@Input() resizeCursors: Partial<
602+
Pick<ResizeCursors, 'leftOrRight' | 'topOrBottom'>
603+
>;
604+
595605
/**
596606
* Called when a header week day is clicked. Adding a `cssClass` property on `$event.day` will add that class to the header element
597607
*/

0 commit comments

Comments
 (0)