mattlewis92 / angular-calendar

A flexible calendar component for angular 15.0+ that can display events on a month, week or day view.
https://mattlewis-github.com/angular-calendar/
MIT License
2.71k stars 864 forks source link

Issue Drag to create event #1721

Closed c3d28 closed 1 month ago

c3d28 commented 2 months ago

Describe the bug

Hello I copy the code from this page : https://mattlewis-github.com/angular-calendar/#/drag-to-create-events

but when i want to launch the server i have this issue :

Error: src/app/residence/residence-calendar/residence-calendar.component.ts:124:18 - error TS2769: No overload matches this call.
  Overload 1 of 5, '(observer?: PartialObserver<Event> | undefined): Subscription', gave the following error.
    Argument of type '(mouseMoveEvent: MouseEvent) => void' is not assignable to parameter of type 'PartialObserver<Event> | undefined'.
  Overload 2 of 5, '(next?: ((value: Event) => void) | undefined, error?: ((error: any) => void) | undefined, complete?: (() => void) | undefined): Subscription', gave the following error.
This error is from the mouseEvent in the subscribe part:

This error is from the mouseEvent in the subscribe part:

.subscribe((mouseMoveEvent: MouseEvent) => {
        const minutesDiff = ceilToNearest(
          mouseMoveEvent.clientY - segmentPosition.top,
          30
        );

Can you help me please ? I cant use Event instead of MouseEvent because clientY doesnt exist for Event.

Thank for your help. Screenshots

Versions

matts-bot[bot] commented 2 months ago

Thanks so much for opening an issue! If you'd like to support this project, then please consider sponsoring me

mattlewis92 commented 2 months ago

Hey, I think if you do fromEvent<MouseEvent>(document, 'mousemove') it should cast to the correct type

c3d28 commented 2 months ago

Hi , perfect thank you ,

its working

but i have an other issue after : ./node_modules/angular-calendar/css/angular-calendar.css - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/node_modules/postcss-loader/dist/cjs.js): TypeError: Cannot read properties of undefined (reading '500')