2.1.4 • Published 2 years ago

ngtr-calendar v2.1.4

Weekly downloads
334
License
MIT
Repository
-
Last release
2 years ago

NgtrCalendar ngtr-calendar

The ngtr-calendar module is made for using a calendar in an Angular project. It contains some different components, models and a service for setting details some titles and button-texts.

There is a working example on calendar.troos.nl

Ngtr-calendar uses 3 dependencies:

  • momentJS (only versions < 0.13.0)
  • Luxon (versions 0.13.0 and later)
  • @fortawesome/angular-fontawesome (and @fortawesome/free-solid-svg-icons)

Steps to create

Step 1: Install from npm

npm install ngtr-calendar

Step 2: In tsconfig

No solution for this yet.

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true
  }
}

Step 3: Add wanted view to a module

import { NgtrCalendarModule } from 'ngtr-calendar';
//..
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    // here
    NgtrWeeKViewModule
    // ...
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Step 4: In the component

.ts-part
import {
  EventModel,
  NewEventConstructorObject,
  WorkHoursModel,
  ViewChangedObject,
  CalendarTypesEnum,
  EventContextResultModel,
  EventContextActionModel,
  ContextActionTypesEnum,
  NgtrCalendarService
} from 'ngtr-calendar';

import type { CalendarType, }

actions: EventContextActionModel[] = [];
calendarTypes: CalendarType[] = ['week', 'month', 'fourweeks', 'year', 'list'];
events: BaseEventModel[] = [];
workHours: WorkHoursModel[] = [];
currentCalendarType: string = 'week';
viewDate: DateTime: = DateTime.local();
visibleDays: number[] = [1, 2, 3, 4, 5, 6, 7]; //  (mon = 1, tue = 2, ... , sun = 7)
options: INgtrCalendarOptions = {};
// ....
constructor(public calendarService: NgtrCalendarService) { }
.html-part
<ngtr-week-view
  [events]="events"
  [workHours]="workHours"
  [viewDate]="viewDate"
  [currentCalendarType]="currentCalendarType"
  [options]="options"
  (viewChange)="console.log($event)"
  (createEvent)="console.log($event)"
  (selectEvent)="console.log($event)"
  (contextAction)="console.log($event)"
>
  ></ngtr-week-view
>

Step 5: import the stylesheet

// if you want, edit the primary, secundary, warning and danger color and the font family
$primary: #0080ff;
$secundary: #80ff00;
$warning: #ff8000;
$danger: #bb0000;
$font-family: "Comic Sans MS";
//.....
// For the full list of overwriteable values see variables.scss file.

// and then this:
@import "~ngtr-calendar/styles/styles.scss";
  • There are a lot more values to overwrite. These are an example.

Step 6: Add stuff

  • Add events
    • use EventModel or extend it
    • events can contain context-actions
    • events do NOT have group-functions (yet?)
const evt = new EventModel(
  DateTime.local().minus({ days: 2 }).set({ hour: 9, minute: 30 })
);
evt.isEditable = false;
evt.isAllday = false;
evt.title = "Testevent 1";
evt.description = "uneditable event test";
evt.endDateTime = evt.startDateTime.plus({ hours: 5 });

this.events.push(evt);
  • Add workhours/businesshours with a WorkhourModel
let whm = new WorkHoursModel(1, "08:00", "17:00");
workHours.push(whm);
  • Add context-actions to events using EventContextActionModel
    • each event has context-action.
    • no actions disables them
    • add a do-context-action function
let ecam = new EventContextActionModel(
  "Delete",
  1000,
  ContextActionTypesEnum.Dangerous,
  false
);
evt.contextActions.push(ecam);
//... and a place to use it.
switch (contextaction.contextActionID) {
  case 1000: // delete
    let del = this.events.findIndex((e) => e.calendarID == evt.calendarID);
    this.events.splice(del, 1);
    this.events = [...this.events];
    break;
  default:
    return;
}
2.1.4

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.3

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.9.5

2 years ago

1.9.4

2 years ago

1.9.3

2 years ago

1.9.1

3 years ago

1.9.0

3 years ago

1.9.2

3 years ago

1.8.16

3 years ago

1.8.17

3 years ago

1.8.15

3 years ago

1.8.10

3 years ago

1.8.11

3 years ago

1.8.12

3 years ago

1.8.13

3 years ago

1.8.14

3 years ago

1.8.9

3 years ago

1.8.8

3 years ago

1.8.7

3 years ago

1.8.6

3 years ago

1.8.5

3 years ago

1.8.4

3 years ago

1.8.3

3 years ago

1.8.2

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.6.4

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.3.1

3 years ago

1.2.7

3 years ago

1.3.0

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.13

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.5

3 years ago

1.0.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.16.18

3 years ago

0.16.17

3 years ago

0.16.16

3 years ago

0.16.14

3 years ago

0.16.15

3 years ago

0.16.13

3 years ago

0.16.12

3 years ago

0.16.11

3 years ago

0.16.10

3 years ago

0.16.8

3 years ago

0.16.9

3 years ago

0.16.7

3 years ago

0.16.6

3 years ago

0.16.4

3 years ago

0.16.5

3 years ago

0.16.3

3 years ago

0.16.2

3 years ago

0.16.1

3 years ago

0.15.4

4 years ago

0.15.2

4 years ago

0.15.3

4 years ago

0.15.1

4 years ago

0.14.5

4 years ago

0.14.4

4 years ago

0.14.2

4 years ago

0.14.3

4 years ago

0.14.1

4 years ago

0.14.0

4 years ago

0.13.12

4 years ago

0.13.11

4 years ago

0.13.10

4 years ago

0.13.9

4 years ago

0.13.8

4 years ago

0.13.6

4 years ago

0.13.7

4 years ago

0.13.5

4 years ago

0.13.4

4 years ago

0.13.3

4 years ago

0.13.2

4 years ago

0.13.1

4 years ago

0.13.0

4 years ago

0.12.10

4 years ago

0.12.9

4 years ago

0.12.8

4 years ago

0.12.7

4 years ago

0.12.6

4 years ago

0.12.5

4 years ago

0.12.4

4 years ago

0.12.3

4 years ago

0.12.1

4 years ago

0.12.2

4 years ago

0.12.0

4 years ago

0.11.6

4 years ago

0.11.7

4 years ago

0.11.2

4 years ago

0.11.3

4 years ago

0.11.4

4 years ago

0.11.5

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.21

4 years ago

0.10.18

4 years ago

0.10.19

4 years ago

0.10.20

4 years ago

0.10.17

4 years ago

0.10.16

4 years ago

0.10.14

4 years ago

0.10.15

4 years ago

0.10.13

4 years ago

0.10.12

4 years ago

0.10.11

4 years ago

0.10.10

4 years ago

0.10.9

4 years ago

0.10.8

4 years ago

0.10.7

4 years ago

0.10.6

4 years ago

0.10.5

4 years ago

0.10.4

4 years ago

0.10.3

4 years ago

0.10.2

4 years ago

0.10.1

4 years ago

0.10.0

4 years ago

0.9.17

4 years ago

0.9.16

4 years ago

0.9.15

4 years ago

0.9.13

4 years ago

0.9.14

4 years ago

0.9.12

4 years ago

0.9.11

4 years ago

0.9.10

4 years ago

0.9.8

4 years ago

0.9.9

4 years ago

0.9.7

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.2

4 years ago

0.9.4

4 years ago

0.9.0

4 years ago

0.9.1

4 years ago

0.8.2

4 years ago

0.7.27

4 years ago

0.8.0

4 years ago

0.7.24

4 years ago

0.7.25

4 years ago

0.7.23

4 years ago

0.7.21

4 years ago

0.7.20

4 years ago

0.7.15

4 years ago

0.7.14

4 years ago

0.7.12

4 years ago

0.7.11

4 years ago

0.7.10

4 years ago

0.7.5

4 years ago

0.7.0

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.16

4 years ago

0.5.17

4 years ago

0.5.15

4 years ago

0.5.14

4 years ago

0.5.12

4 years ago

0.5.13

4 years ago

0.5.10

4 years ago

0.5.11

4 years ago

0.5.8

5 years ago

0.5.9

5 years ago

0.5.7

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.6

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.6

5 years ago

0.4.5

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.0.1

5 years ago