Completed
Push — master ( a67509...9a7ad7 )
by Dimas
372:44 queued 358:19
created

src/MVC/themes/adminlte/plugins/fullcalendar-timegrid/main.d.ts   F

Complexity

Total Complexity 63
Complexity/F 1

Size

Lines of Code 224
Function Count 63

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 194
dl 0
loc 224
rs 3.36
c 0
b 0
f 0
wmc 63
mnd 0
bc 0
fnc 63
bpm 0
cpm 1
noi 0

63 Functions

Rating   Name   Duplication   Size   Complexity  
A AllDaySplitter.getKeysForDateSpan 0 1 1
A TimeGrid.unrenderNowIndicator 0 1 1
A TimeGrid.destroy 0 1 1
A TimeGrid.computeLabelInterval 0 1 1
A TimeGrid.assignSegVerticals 0 1 1
A TimeGrid.groupSegsByCol 0 1 1
A TimeGrid._renderEventResize 0 1 1
A TimeGrid._unrenderColumns 0 1 1
A TimeGrid.render 0 1 1
A TimeGrid.buildColPositions 0 1 1
A TimeGrid.unrenderContentSkeleton 0 1 1
A TimeGrid.buildSlatPositions 0 1 1
A TimeGrid.computeTimeTop 0 1 1
A AbstractTimeGridView.destroy 0 1 1
A AbstractTimeGridView._renderSkeleton 0 1 1
A TimeGrid._processOptions 0 1 1
A TimeGridView._unrenderSkeleton 0 1 1
A TimeGrid.attachSegsByCol 0 1 1
A TimeGrid._renderColumns 0 1 1
A AllDaySplitter.getKeysForEventDef 0 1 1
A AbstractTimeGridView.render 0 1 1
A TimeGrid._renderDateSelection 0 1 1
A TimeGrid._renderSlats 0 1 1
A SimpleTimeGrid.renderNowIndicator 0 1 1
A AbstractTimeGridView.computeScrollerHeight 0 1 1
A AbstractTimeGridView.computeDateScroll 0 2 1
A TimeGrid.getTotalSlatHeight 0 1 1
A main.d.ts ➔ buildDayRanges 0 1 1
A TimeGrid.computeSegVerticals 0 1 1
A TimeGrid.computeDateTop 0 1 1
A AbstractTimeGridView.renderSkeletonHtml 0 1 1
A main.d.ts ➔ buildDayTable 0 1 1
A TimeGridView.render 0 1 1
A TimeGrid._unrenderDateSelection 0 1 1
A TimeGridView.renderNowIndicator 0 1 1
A TimeGrid.renderContentSkeleton 0 1 1
A TimeGrid.updateSize 0 1 1
A AbstractTimeGridView.unrenderNowIndicator 0 1 1
A SimpleTimeGrid.firstContext 0 1 1
A TimeGrid.renderSlatRowHtml 0 1 1
A TimeGrid.buildPositionCaches 0 1 1
A TimeGrid.positionToHit 0 15 1
A AllDaySplitter.getKeyInfo 0 3 1
A SimpleTimeGrid.queryHit 0 1 1
A TimeGridView._renderSkeleton 0 1 1
A TimeGrid.generateSegVerticalCss 0 3 1
A TimeGrid._unrenderEventDrag 0 1 1
A AbstractTimeGridView._unrenderSkeleton 0 1 1
A AbstractTimeGridView.updateBaseSize 0 1 1
A TimeGrid._renderEventDrag 0 1 1
A TimeGrid._renderSkeleton 0 1 1
A AbstractTimeGridView.updateSize 0 1 1
A TimeGrid._unrenderEventResize 0 1 1
A TimeGrid.renderNowIndicator 0 1 1
A SimpleTimeGrid.buildPositionCaches 0 1 1
A AbstractTimeGridView.getNowIndicatorUnit 0 1 1
A SimpleTimeGrid.render 0 1 1
A SimpleTimeGrid.destroy 0 1 1
A AbstractTimeGridView.queryDateScroll 0 2 1
A AbstractTimeGridView.axisStyleAttr 0 1 1
A TimeGrid.getNowIndicatorUnit 0 1 1
A TimeGridSlicer.sliceRange 0 1 1
A AbstractTimeGridView.applyDateScroll 0 1 1

How to fix   Complexity   

Complexity

Complex classes like src/MVC/themes/adminlte/plugins/fullcalendar-timegrid/main.d.ts often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
// Generated by dts-bundle v0.7.3-fork.1
2
// Dependencies for this module:
3
//   ../../../../../@fullcalendar/core
4
//   ../../../../../@fullcalendar/daygrid
5
6
declare module '@fullcalendar/timegrid' {
7
    import AbstractTimeGridView from '@fullcalendar/timegrid/AbstractTimeGridView';
8
    import TimeGridView, { buildDayTable } from '@fullcalendar/timegrid/TimeGridView';
9
    import { TimeGridSeg } from '@fullcalendar/timegrid/TimeGrid';
10
    import { TimeGridSlicer, buildDayRanges } from '@fullcalendar/timegrid/SimpleTimeGrid';
11
    export { TimeGridView, AbstractTimeGridView, buildDayTable, buildDayRanges, TimeGridSlicer, TimeGridSeg };
12
    export { default as TimeGrid } from '@fullcalendar/timegrid/TimeGrid';
13
    const _default: import("@fullcalendar/core").PluginDef;
14
    export default _default;
15
}
16
17
declare module '@fullcalendar/timegrid/AbstractTimeGridView' {
18
    import { ScrollComponent, View, ComponentContext, Duration, ViewProps } from '@fullcalendar/core';
19
    import { DayGrid } from '@fullcalendar/daygrid';
20
    import TimeGrid from '@fullcalendar/timegrid/TimeGrid';
21
    import AllDaySplitter from '@fullcalendar/timegrid/AllDaySplitter';
22
    export { AbstractTimeGridView as default, AbstractTimeGridView };
23
    abstract class AbstractTimeGridView extends View {
24
        timeGrid: TimeGrid;
25
        dayGrid: DayGrid;
26
        scroller: ScrollComponent;
27
        axisWidth: any;
28
        protected splitter: AllDaySplitter;
29
        render(props: ViewProps, context: ComponentContext): void;
30
        destroy(): void;
31
        _renderSkeleton(context: ComponentContext): void;
32
        _unrenderSkeleton(): void;
33
        renderSkeletonHtml(): string;
34
        getNowIndicatorUnit(): string;
35
        unrenderNowIndicator(): void;
36
        updateSize(isResize: boolean, viewHeight: number, isAuto: boolean): void;
37
        updateBaseSize(isResize: any, viewHeight: any, isAuto: any): void;
38
        computeScrollerHeight(viewHeight: any): number;
39
        computeDateScroll(duration: Duration): {
40
            top: any;
41
        };
42
        queryDateScroll(): {
43
            top: number;
44
        };
45
        applyDateScroll(scroll: any): void;
46
        renderHeadIntroHtml: () => string;
47
        axisStyleAttr(): string;
48
        renderTimeGridBgIntroHtml: () => string;
49
        renderTimeGridIntroHtml: () => string;
50
        renderDayGridBgIntroHtml: () => string;
51
        renderDayGridIntroHtml: () => string;
52
    }
53
}
54
55
declare module '@fullcalendar/timegrid/TimeGridView' {
56
    import { DateProfileGenerator, DateProfile, ComponentContext, DayHeader, DayTable, ViewProps } from '@fullcalendar/core';
57
    import { SimpleDayGrid } from '@fullcalendar/daygrid';
58
    import SimpleTimeGrid from '@fullcalendar/timegrid/SimpleTimeGrid';
59
    import AbstractTimeGridView from '@fullcalendar/timegrid/AbstractTimeGridView';
60
    export { TimeGridView as default, TimeGridView };
61
    class TimeGridView extends AbstractTimeGridView {
62
        header: DayHeader;
63
        simpleDayGrid: SimpleDayGrid;
64
        simpleTimeGrid: SimpleTimeGrid;
65
        render(props: ViewProps, context: ComponentContext): void;
66
        _renderSkeleton(context: ComponentContext): void;
67
        _unrenderSkeleton(): void;
68
        renderNowIndicator(date: any): void;
69
    }
70
    export function buildDayTable(dateProfile: DateProfile, dateProfileGenerator: DateProfileGenerator): DayTable;
71
}
72
73
declare module '@fullcalendar/timegrid/TimeGrid' {
74
    import { PositionCache, Duration, DateMarker, DateFormatter, ComponentContext, DateComponent, Seg, EventSegUiInteractionState, DateProfile, Theme } from '@fullcalendar/core';
75
    export interface RenderProps {
76
        renderBgIntroHtml: () => string;
77
        renderIntroHtml: () => string;
78
    }
79
    export interface TimeGridSeg extends Seg {
80
        col: number;
81
        start: DateMarker;
82
        end: DateMarker;
83
    }
84
    export interface TimeGridCell {
85
        date: DateMarker;
86
        htmlAttrs?: string;
87
    }
88
    export interface TimeGridProps {
89
        dateProfile: DateProfile;
90
        cells: TimeGridCell[];
91
        businessHourSegs: TimeGridSeg[];
92
        bgEventSegs: TimeGridSeg[];
93
        fgEventSegs: TimeGridSeg[];
94
        dateSelectionSegs: TimeGridSeg[];
95
        eventSelection: string;
96
        eventDrag: EventSegUiInteractionState | null;
97
        eventResize: EventSegUiInteractionState | null;
98
    }
99
    export { TimeGrid as default, TimeGrid };
100
    class TimeGrid extends DateComponent<TimeGridProps> {
101
        renderProps: RenderProps;
102
        slotDuration: Duration;
103
        snapDuration: Duration;
104
        snapsPerSlot: any;
105
        labelFormat: DateFormatter;
106
        labelInterval: Duration;
107
        colCnt: number;
108
        colEls: HTMLElement[];
109
        slatContainerEl: HTMLElement;
110
        slatEls: HTMLElement[];
111
        nowIndicatorEls: HTMLElement[];
112
        colPositions: PositionCache;
113
        slatPositions: PositionCache;
114
        isSlatSizesDirty: boolean;
115
        isColSizesDirty: boolean;
116
        rootBgContainerEl: HTMLElement;
117
        bottomRuleEl: HTMLElement;
118
        contentSkeletonEl: HTMLElement;
119
        colContainerEls: HTMLElement[];
120
        fgContainerEls: HTMLElement[];
121
        bgContainerEls: HTMLElement[];
122
        mirrorContainerEls: HTMLElement[];
123
        highlightContainerEls: HTMLElement[];
124
        businessContainerEls: HTMLElement[];
125
        constructor(el: HTMLElement, renderProps: RenderProps);
126
        _processOptions(options: any): void;
127
        computeLabelInterval(slotDuration: any): any;
128
        render(props: TimeGridProps, context: ComponentContext): void;
129
        destroy(): void;
130
        updateSize(isResize: boolean): void;
131
        _renderSkeleton(theme: Theme): void;
132
        _renderSlats(dateProfile: DateProfile): void;
133
        renderSlatRowHtml(dateProfile: DateProfile): string;
134
        _renderColumns(cells: TimeGridCell[], dateProfile: DateProfile): void;
135
        _unrenderColumns(): void;
136
        renderContentSkeleton(): void;
137
        unrenderContentSkeleton(): void;
138
        groupSegsByCol(segs: any): any[];
139
        attachSegsByCol(segsByCol: any, containerEls: HTMLElement[]): void;
140
        getNowIndicatorUnit(): string;
141
        renderNowIndicator(segs: TimeGridSeg[], date: any): void;
142
        unrenderNowIndicator(): void;
143
        getTotalSlatHeight(): number;
144
        computeDateTop(when: DateMarker, startOfDayDate?: DateMarker): any;
145
        computeTimeTop(duration: Duration): any;
146
        computeSegVerticals(segs: any): void;
147
        assignSegVerticals(segs: any): void;
148
        generateSegVerticalCss(seg: any): {
149
            top: any;
150
            bottom: number;
151
        };
152
        buildPositionCaches(): void;
153
        buildColPositions(): void;
154
        buildSlatPositions(): void;
155
        positionToHit(positionLeft: any, positionTop: any): {
156
            col: any;
157
            dateSpan: {
158
                range: {
159
                    start: Date;
160
                    end: Date;
161
                };
162
                allDay: boolean;
163
            };
164
            dayEl: HTMLElement;
165
            relativeRect: {
166
                left: any;
167
                right: any;
168
                top: any;
169
                bottom: any;
170
            };
171
        };
172
        _renderEventDrag(state: EventSegUiInteractionState): void;
173
        _unrenderEventDrag(state: EventSegUiInteractionState): void;
174
        _renderEventResize(state: EventSegUiInteractionState): void;
175
        _unrenderEventResize(state: EventSegUiInteractionState): void;
176
        _renderDateSelection(segs: Seg[]): void;
177
        _unrenderDateSelection(segs: Seg[]): void;
178
    }
179
}
180
181
declare module '@fullcalendar/timegrid/SimpleTimeGrid' {
182
    import { DateComponent, DateProfile, EventStore, EventUiHash, EventInteractionState, DateSpan, DateRange, DayTable, DateEnv, DateMarker, Slicer, Hit, ComponentContext } from '@fullcalendar/core';
183
    import TimeGrid, { TimeGridSeg } from '@fullcalendar/timegrid/TimeGrid';
184
    export interface SimpleTimeGridProps {
185
        dateProfile: DateProfile | null;
186
        dayTable: DayTable;
187
        businessHours: EventStore;
188
        eventStore: EventStore;
189
        eventUiBases: EventUiHash;
190
        dateSelection: DateSpan | null;
191
        eventSelection: string;
192
        eventDrag: EventInteractionState | null;
193
        eventResize: EventInteractionState | null;
194
    }
195
    export { SimpleTimeGrid as default, SimpleTimeGrid };
196
    class SimpleTimeGrid extends DateComponent<SimpleTimeGridProps> {
197
        timeGrid: TimeGrid;
198
        constructor(timeGrid: TimeGrid);
199
        firstContext(context: ComponentContext): void;
200
        destroy(): void;
201
        render(props: SimpleTimeGridProps, context: ComponentContext): void;
202
        renderNowIndicator(date: DateMarker): void;
203
        buildPositionCaches(): void;
204
        queryHit(positionLeft: number, positionTop: number): Hit;
205
    }
206
    export function buildDayRanges(dayTable: DayTable, dateProfile: DateProfile, dateEnv: DateEnv): DateRange[];
207
    export class TimeGridSlicer extends Slicer<TimeGridSeg, [DateRange[]]> {
208
        sliceRange(range: DateRange, dayRanges: DateRange[]): TimeGridSeg[];
209
    }
210
}
211
212
declare module '@fullcalendar/timegrid/AllDaySplitter' {
213
    import { Splitter, EventDef, DateSpan } from '@fullcalendar/core';
214
    export { AllDaySplitter as default, AllDaySplitter };
215
    class AllDaySplitter extends Splitter {
216
        getKeyInfo(): {
217
            allDay: {};
218
            timed: {};
219
        };
220
        getKeysForDateSpan(dateSpan: DateSpan): string[];
221
        getKeysForEventDef(eventDef: EventDef): string[];
222
    }
223
}
224
225