mattlewis92 / angular-calendar

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

Import and use CalendarResizeHelper and CalendarDragHelper #730

Open michelebombardi opened 6 years ago

michelebombardi commented 6 years ago

I'm trying to implement my own drag and resize featured component but when I try to import CalendarResizeHelper and CalendarDragHelper in this way:

import { CalendarResizeHelper } from 'angular-calendar/modules/common/calendar-resize-helper.provider';
import { CalendarDragHelper } from 'angular-calendar/modules/common/calendar-drag-helper.provider';

the angular compiler returns the following errors:

ERROR in ./lib/modules/scheduler/calendar-scheduler-view.component.ts 
Module not found: Error: Can't resolve 'angular-calendar/modules/common/calendar-drag-helper.provider' in 'C:\Code\AngularCliProjects\angular-calendar-scheduler\lib\modules\scheduler'\scheduler'

ERROR in ./lib/modules/scheduler/calendar-scheduler-view.component.ts                                                                                                       es\scheduler'
Module not found: Error: Can't resolve 'angular-calendar/modules/common/calendar-resize-helper.provider' in 'C:\Code\AngularCliProjects\angular-calendar-scheduler\lib\modules\scheduler'

In the previsous version of your library I didn't experienced this problem. How can I import those components now?

To reproduce the issue: try to import CalendarResizeHelper and CalendarDragHelper as snown above.

Versions

halilibrahim commented 6 years ago

@bm-software You can import as shown below (as a temporary workaround)

import { CalendarDragHelper } from 'angular-calendar/esm2015/modules/common/calendar-drag-helper.provider';
import { CalendarResizeHelper } from 'angular-calendar/esm2015/modules/common/calendar-resize-helper.provider';
michelebombardi commented 6 years ago

@halilibrahim Thank you very much!

michelebombardi commented 2 years ago

Hi, with version 0.30.1 I run into this issue again. I was able to import CalendarResizeHelper and CalendarDragHelper in this way:

import { CalendarDragHelper } from 'angular-calendar/modules/common/calendar-drag-helper.provider';
import { CalendarResizeHelper } from 'angular-calendar/modules/common/calendar-resize-helper.provider';

but when I try to build my library it says:

./lib/modules/scheduler/calendar-scheduler-view.component.ts:3:0-99 - Error: Module not found: Error: Package path ./modules/common/calendar-drag-helper.provider is not exported from package E:\Programmazione\Projects\NodeJsProjects\angular-calendar-scheduler\node_modules\angular-calendar (see exports field in E:\Programmazione\Projects\NodeJsProjects\angular-calendar-scheduler\node_modules\angular-calendar\package.json)

./lib/modules/scheduler/calendar-scheduler-view.component.ts:4:0-103 - Error: Module not found: Error: Package path ./modules/common/calendar-resize-helper.provider is not exported from package E:\Programmazione\Projects\NodeJsProjects\angular-calendar-scheduler\node_modules\angular-calendar (see exports field in E:\Programmazione\Projects\NodeJsProjects\angular-calendar-scheduler\node_modules\angular-calendar\package.json)

Is there any solution?

tbelmega commented 1 year ago

@michelebombardi I ran into the same issue. Seems like CalendarDragHelper and CalendarResizeHelper are meant to be only internal to angular-calendar, not to be used by us. That's why they are not exported from CalendarCommonModule.

You have three options now: 1) Contribute with a pull request to angular-calendar and see if @mattlewis92 accepts it. Then pull the new version into your project. (Content of the pull request would be to add CalendarDragHelper and CalendarResizeHelper to the exports of CalendarCommonModule) 2) Fork the project, make the change described in (1), and in your project use your own fork instead of the official release of angular-calendar. 3) Quick and dirty: Copy the source code files CalendarDragHelper and CalendarResizeHelper into your project. Change the imports to point to your local copies instead of the library. (May take multiple iterations, in case you need to copy other files that these two depend on.)

Legal disclaimer: As far as I understand the MIT license this project is published under, copying the code is allowed. But don't take my word for it, check for yourself.