Removed separate Config class
This commit is contained in:
parent
722ddb41e5
commit
b9cbe21203
@ -1,5 +1,4 @@
|
|||||||
import { GroupTypes } from "../types";
|
import { GroupTypes } from "../types";
|
||||||
import Config from "../Config/Config";
|
|
||||||
import Events from "../Events/";
|
import Events from "../Events/";
|
||||||
import { DayGrouping, WeekGrouping, MonthGrouping } from "../EventGrouping";
|
import { DayGrouping, WeekGrouping, MonthGrouping } from "../EventGrouping";
|
||||||
import {
|
import {
|
||||||
@ -10,19 +9,17 @@ import {
|
|||||||
|
|
||||||
export default class Calendar {
|
export default class Calendar {
|
||||||
private readonly jsonContent: object;
|
private readonly jsonContent: object;
|
||||||
public config: Config;
|
public groupType: GroupTypes;
|
||||||
public events: Events;
|
public events: Events;
|
||||||
|
|
||||||
constructor(json) {
|
constructor(json) {
|
||||||
this.jsonContent = json;
|
this.jsonContent = json;
|
||||||
this.config = new Config({
|
this.groupType = json["group"] ? json["group"].charAt(0) : GroupTypes.Day;
|
||||||
groupType: json["group"] ? json["group"].charAt(0) : GroupTypes.Day,
|
|
||||||
});
|
|
||||||
this.events = new Events(json["events"]);
|
this.events = new Events(json["events"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): HTMLDivElement {
|
render(): HTMLDivElement {
|
||||||
switch (this.config.groupType) {
|
switch (this.groupType) {
|
||||||
case GroupTypes.Day:
|
case GroupTypes.Day:
|
||||||
return new DayRenderer(
|
return new DayRenderer(
|
||||||
new DayGrouping(this.events.sortedEvents)
|
new DayGrouping(this.events.sortedEvents)
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import { GroupTypes } from "../types";
|
|
||||||
|
|
||||||
export default class Config {
|
|
||||||
groupType: GroupTypes;
|
|
||||||
|
|
||||||
constructor({ groupType }) {
|
|
||||||
this.groupType = groupType.toUpperCase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user