-
-
Notifications
You must be signed in to change notification settings - Fork 871
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add individual month / week / day modules
now you can just import what you need to help reduce bundle size Closes #361
- Loading branch information
Matt Lewis
committed
Oct 22, 2017
1 parent
d3137e6
commit e87ae23
Showing
41 changed files
with
258 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { NgModule, ModuleWithProviders } from '@angular/core'; | ||
import { DraggableHelper } from 'angular-draggable-droppable'; | ||
import { | ||
CalendarCommonModule, | ||
CalendarModuleConfig, | ||
CalendarEventTitleFormatter, | ||
CalendarDateFormatter, | ||
CalendarUtils | ||
} from './common/calendar-common.module'; | ||
import { CalendarMonthModule } from './month/calendar-month.module'; | ||
import { CalendarWeekModule } from './week/calendar-week.module'; | ||
import { CalendarDayModule } from './day/calendar-day.module'; | ||
|
||
export * from './common/calendar-common.module'; | ||
export * from './month/calendar-month.module'; | ||
export * from './week/calendar-week.module'; | ||
export * from './day/calendar-day.module'; | ||
|
||
/** | ||
* The main module of this library. Example usage: | ||
* | ||
* ```typescript | ||
* import { CalenderModule } from 'angular-calendar'; | ||
* | ||
* @NgModule({ | ||
* imports: [ | ||
* CalenderModule.forRoot() | ||
* ] | ||
* }) | ||
* class MyModule {} | ||
* ``` | ||
* | ||
*/ | ||
@NgModule({ | ||
imports: [ | ||
CalendarCommonModule, | ||
CalendarMonthModule, | ||
CalendarWeekModule, | ||
CalendarDayModule | ||
], | ||
exports: [ | ||
CalendarCommonModule, | ||
CalendarMonthModule, | ||
CalendarWeekModule, | ||
CalendarDayModule | ||
] | ||
}) | ||
export class CalendarModule { | ||
static forRoot(config: CalendarModuleConfig = {}): ModuleWithProviders { | ||
return { | ||
ngModule: CalendarModule, | ||
providers: [ | ||
DraggableHelper, | ||
config.eventTitleFormatter || CalendarEventTitleFormatter, | ||
config.dateFormatter || CalendarDateFormatter, | ||
config.utils || CalendarUtils | ||
] | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { ModuleWithProviders, NgModule, Provider } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { DraggableHelper } from 'angular-draggable-droppable'; | ||
import { CalendarEventActionsComponent } from './calendar-event-actions.component'; | ||
import { CalendarEventTitleComponent } from './calendar-event-title.component'; | ||
import { | ||
CalendarTooltipDirective, | ||
CalendarTooltipWindowComponent | ||
} from './calendar-tooltip.directive'; | ||
import { CalendarPreviousViewDirective } from './calendar-previous-view.directive'; | ||
import { CalendarNextViewDirective } from './calendar-next-view.directive'; | ||
import { CalendarTodayDirective } from './calendar-today.directive'; | ||
import { CalendarDatePipe } from './calendar-date.pipe'; | ||
import { CalendarEventTitlePipe } from './calendar-event-title.pipe'; | ||
import { ClickDirective } from './click.directive'; | ||
import { CalendarEventTitleFormatter } from './calendar-event-title-formatter.provider'; | ||
import { CalendarDateFormatter } from './calendar-date-formatter.provider'; | ||
import { CalendarUtils } from './calendar-utils.provider'; | ||
|
||
export interface CalendarModuleConfig { | ||
eventTitleFormatter?: Provider; | ||
dateFormatter?: Provider; | ||
utils?: Provider; | ||
} | ||
|
||
export * from './calendar-event-title-formatter.provider'; | ||
export * from './calendar-moment-date-formatter.provider'; | ||
export * from './calendar-native-date-formatter.provider'; | ||
export * from './calendar-date-formatter.provider'; | ||
export * from './calendar-utils.provider'; | ||
export * from './calendar-date-formatter.interface'; | ||
export * from './calendar-event-times-changed-event.interface'; | ||
|
||
export { | ||
CalendarEvent, | ||
EventAction as CalendarEventAction, | ||
DAYS_OF_WEEK | ||
} from 'calendar-utils'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
CalendarEventActionsComponent, | ||
CalendarEventTitleComponent, | ||
CalendarTooltipWindowComponent, | ||
CalendarTooltipDirective, | ||
CalendarPreviousViewDirective, | ||
CalendarNextViewDirective, | ||
CalendarTodayDirective, | ||
CalendarDatePipe, | ||
CalendarEventTitlePipe, | ||
ClickDirective | ||
], | ||
imports: [CommonModule], | ||
exports: [ | ||
CalendarEventActionsComponent, | ||
CalendarEventTitleComponent, | ||
CalendarTooltipWindowComponent, | ||
CalendarTooltipDirective, | ||
CalendarPreviousViewDirective, | ||
CalendarNextViewDirective, | ||
CalendarTodayDirective, | ||
CalendarDatePipe, | ||
CalendarEventTitlePipe, | ||
ClickDirective | ||
], | ||
entryComponents: [CalendarTooltipWindowComponent] | ||
}) | ||
export class CalendarCommonModule { | ||
static forRoot(config: CalendarModuleConfig = {}): ModuleWithProviders { | ||
return { | ||
ngModule: CalendarCommonModule, | ||
providers: [ | ||
DraggableHelper, | ||
config.eventTitleFormatter || CalendarEventTitleFormatter, | ||
config.dateFormatter || CalendarDateFormatter, | ||
config.utils || CalendarUtils | ||
] | ||
}; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/pipes/calendar-date.pipe.ts → src/common/calendar-date.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/pipes/calendar-event-title.pipe.ts → src/common/calendar-event-title.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...alendar-native-date-formatter.provider.ts → ...alendar-native-date-formatter.provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './calendar-common.module'; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { ResizableModule } from 'angular-resizable-element'; | ||
import { DragAndDropModule } from 'angular-draggable-droppable'; | ||
import { CalendarDayViewComponent } from './calendar-day-view.component'; | ||
import { CalendarAllDayEventComponent } from './calendar-all-day-event.component'; | ||
import { CalendarDayViewHourSegmentComponent } from './calendar-day-view-hour-segment.component'; | ||
import { CalendarDayViewEventComponent } from './calendar-day-view-event.component'; | ||
import { CalendarCommonModule } from '../common/calendar-common.module'; | ||
|
||
export { CalendarDayViewComponent } from './calendar-day-view.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
ResizableModule, | ||
DragAndDropModule, | ||
CalendarCommonModule | ||
], | ||
declarations: [ | ||
CalendarDayViewComponent, | ||
CalendarAllDayEventComponent, | ||
CalendarDayViewHourSegmentComponent, | ||
CalendarDayViewEventComponent | ||
], | ||
exports: [ | ||
CalendarDayViewComponent, | ||
CalendarAllDayEventComponent, | ||
CalendarDayViewHourSegmentComponent, | ||
CalendarDayViewEventComponent | ||
] | ||
}) | ||
export class CalendarDayModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './calendar-day.module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1 @@ | ||
export * from './providers/calendar-event-title-formatter.provider'; | ||
export * from './providers/calendar-moment-date-formatter.provider'; | ||
export * from './providers/calendar-native-date-formatter.provider'; | ||
export * from './providers/calendar-date-formatter.provider'; | ||
export * from './providers/calendar-utils.provider'; | ||
export * from './interfaces/calendar-date-formatter.interface'; | ||
export * from './interfaces/calendar-event-times-changed-event.interface'; | ||
export * from './modules/calendar'; | ||
export * from './components/day/calendar-day-view.component'; | ||
export * from './components/month/calendar-month-view.component'; | ||
export * from './components/week/calendar-week-view.component'; | ||
export { | ||
CalendarEvent, | ||
EventAction as CalendarEventAction, | ||
MonthViewDay as CalendarMonthViewDay, | ||
WeekViewEvent as CalendarWeekViewEvent, | ||
WeekViewEventRow as CalendarWeekViewEventRow, | ||
GetWeekViewArgs as CalendarGetWeekViewArgs, | ||
DAYS_OF_WEEK | ||
} from 'calendar-utils'; | ||
export * from './calendar.module'; |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.