all files / actions/ day-markers.js

100% Statements 47/47
100% Branches 9/9
100% Functions 9/9
100% Lines 47/47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65   529× 529× 529× 529×   529× 529× 529×   10× 10× 23× 23×             625× 625× 625× 398×   625×   647× 647×   27959×   528× 524×          
define(["require", "exports", "../renderer/nonworking-day", "../renderer/event-marker", "@syncfusion/ej2-base"], function (require, exports, nonworking_day_1, event_marker_1, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var DayMarkers = (function () {
        function DayMarkers(parent) {
            this.parent = parent;
            this.nonworkingDayRender = new nonworking_day_1.NonWorkingDay(this.parent);
            this.eventMarkerRender = new event_marker_1.EventMarker(this.parent);
            this.wireEvents();
        }
        DayMarkers.prototype.wireEvents = function () {
            this.parent.on('refreshDayMarkers', this.refreshMarkers, this);
            this.parent.on('updateHeight', this.updateHeight, this);
            this.parent.on('ui-update', this.propertyChanged, this);
        };
        DayMarkers.prototype.propertyChanged = function (property) {
            var keys = Object.keys(ej2_base_1.getValue('properties', property));
            for (var i = 0; i < keys.length; i++) {
                var key = keys[i];
                switch (key) {
                    case 'eventMarkers':
                        this.eventMarkerRender.renderEventMarkers();
                        this.updateHeight();
                        break;
                    case 'highlightWeekends':
                        this.nonworkingDayRender.renderWeekends();
                        this.updateHeight();
                        break;
                    case 'holidays':
                        this.nonworkingDayRender.renderHolidays();
                        this.updateHeight();
                        break;
                }
            }
        };
        DayMarkers.prototype.refreshMarkers = function () {
            this.nonworkingDayRender.renderWeekends();
            this.nonworkingDayRender.renderHolidays();
            if (this.parent.gridLines === 'Vertical' || this.parent.gridLines === 'Both') {
                this.parent['renderChartVerticalLines']();
            }
            this.eventMarkerRender.renderEventMarkers();
        };
        DayMarkers.prototype.updateHeight = function () {
            this.nonworkingDayRender.updateContainerHeight();
            this.eventMarkerRender.updateContainerHeight();
        };
        DayMarkers.prototype.getModuleName = function () {
            return 'dayMarkers';
        };
        DayMarkers.prototype.destroy = function () {
            if (this.parent.isDestroyed) {
                return;
            }
            this.nonworkingDayRender.removeContainers();
            this.eventMarkerRender.removeContainer();
            this.parent.off('refreshDayMarkers', this.refreshMarkers);
            this.parent.off('updateHeight', this.updateHeight);
            this.parent.off('ui-update', this.propertyChanged);
        };
        return DayMarkers;
    }());
    exports.DayMarkers = DayMarkers;
});