2.1.4 • Published 3 years ago

ngtr-calendar v2.1.4

Weekly downloads
334
License
MIT
Repository
-
Last release
3 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

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.3

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.9.5

3 years ago

1.9.4

3 years ago

1.9.3

3 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.9.2

4 years ago

1.8.16

4 years ago

1.8.17

4 years ago

1.8.15

4 years ago

1.8.10

4 years ago

1.8.11

4 years ago

1.8.12

4 years ago

1.8.13

4 years ago

1.8.14

4 years ago

1.8.9

4 years ago

1.8.8

4 years ago

1.8.7

4 years ago

1.8.6

4 years ago

1.8.5

4 years ago

1.8.4

4 years ago

1.8.3

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.6.4

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.3.1

4 years ago

1.2.7

4 years ago

1.3.0

4 years ago

1.2.5

4 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.0

5 years ago

1.2.1

5 years ago

1.1.13

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.0.5

5 years ago

1.0.2

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.16.18

5 years ago

0.16.17

5 years ago

0.16.16

5 years ago

0.16.14

5 years ago

0.16.15

5 years ago

0.16.13

5 years ago

0.16.12

5 years ago

0.16.11

5 years ago

0.16.10

5 years ago

0.16.8

5 years ago

0.16.9

5 years ago

0.16.7

5 years ago

0.16.6

5 years ago

0.16.4

5 years ago

0.16.5

5 years ago

0.16.3

5 years ago

0.16.2

5 years ago

0.16.1

5 years ago

0.15.4

5 years ago

0.15.2

5 years ago

0.15.3

5 years ago

0.15.1

5 years ago

0.14.5

5 years ago

0.14.4

5 years ago

0.14.2

5 years ago

0.14.3

5 years ago

0.14.1

5 years ago

0.14.0

5 years ago

0.13.12

5 years ago

0.13.11

5 years ago

0.13.10

5 years ago

0.13.9

5 years ago

0.13.8

5 years ago

0.13.6

5 years ago

0.13.7

5 years ago

0.13.5

5 years ago

0.13.4

5 years ago

0.13.3

5 years ago

0.13.2

5 years ago

0.13.1

5 years ago

0.13.0

5 years ago

0.12.10

5 years ago

0.12.9

5 years ago

0.12.8

5 years ago

0.12.7

5 years ago

0.12.6

5 years ago

0.12.5

5 years ago

0.12.4

5 years ago

0.12.3

5 years ago

0.12.1

5 years ago

0.12.2

5 years ago

0.12.0

5 years ago

0.11.6

5 years ago

0.11.7

5 years ago

0.11.2

5 years ago

0.11.3

5 years ago

0.11.4

5 years ago

0.11.5

5 years ago

0.11.1

5 years ago

0.11.0

5 years ago

0.10.21

5 years ago

0.10.18

5 years ago

0.10.19

5 years ago

0.10.20

5 years ago

0.10.17

5 years ago

0.10.16

5 years ago

0.10.14

5 years ago

0.10.15

5 years ago

0.10.13

5 years ago

0.10.12

5 years ago

0.10.11

5 years ago

0.10.10

5 years ago

0.10.9

5 years ago

0.10.8

5 years ago

0.10.7

5 years ago

0.10.6

5 years ago

0.10.5

5 years ago

0.10.4

5 years ago

0.10.3

5 years ago

0.10.2

5 years ago

0.10.1

5 years ago

0.10.0

5 years ago

0.9.17

5 years ago

0.9.16

5 years ago

0.9.15

5 years ago

0.9.13

5 years ago

0.9.14

5 years ago

0.9.12

5 years ago

0.9.11

5 years ago

0.9.10

5 years ago

0.9.8

5 years ago

0.9.9

5 years ago

0.9.7

5 years ago

0.9.6

5 years ago

0.9.5

5 years ago

0.9.2

5 years ago

0.9.4

5 years ago

0.9.0

5 years ago

0.9.1

5 years ago

0.8.2

5 years ago

0.7.27

6 years ago

0.8.0

6 years ago

0.7.24

6 years ago

0.7.25

6 years ago

0.7.23

6 years ago

0.7.21

6 years ago

0.7.20

6 years ago

0.7.15

6 years ago

0.7.14

6 years ago

0.7.12

6 years ago

0.7.11

6 years ago

0.7.10

6 years ago

0.7.5

6 years ago

0.7.0

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.16

6 years ago

0.5.17

6 years ago

0.5.15

6 years ago

0.5.14

6 years ago

0.5.12

6 years ago

0.5.13

6 years ago

0.5.10

6 years ago

0.5.11

6 years ago

0.5.8

6 years ago

0.5.9

6 years ago

0.5.7

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.6

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.0.1

6 years ago