@sunbird-cb/utils-v2 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/sunbird-cb-utils-v2.umd.js +48 -7
- package/bundles/sunbird-cb-utils-v2.umd.js.map +1 -1
- package/bundles/sunbird-cb-utils-v2.umd.min.js +1 -1
- package/bundles/sunbird-cb-utils-v2.umd.min.js.map +1 -1
- package/esm2015/lib/helpers/horizontal-scroller-v2/horizontal-scroller-v2.component.js +5 -3
- package/esm2015/lib/services/event.service.js +44 -5
- package/esm5/lib/helpers/horizontal-scroller-v2/horizontal-scroller-v2.component.js +5 -3
- package/esm5/lib/services/event.service.js +44 -5
- package/fesm2015/sunbird-cb-utils-v2.js +48 -7
- package/fesm2015/sunbird-cb-utils-v2.js.map +1 -1
- package/fesm5/sunbird-cb-utils-v2.js +49 -8
- package/fesm5/sunbird-cb-utils-v2.js.map +1 -1
- package/lib/services/event.service.d.ts +3 -0
- package/package.json +1 -1
- package/sunbird-cb-utils-v2.metadata.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __values, __read } from 'tslib';
|
|
1
|
+
import { __assign, __spread, __awaiter, __generator, __values, __read } from 'tslib';
|
|
2
2
|
import { Injectable, ɵɵdefineInjectable, ɵɵinject, EventEmitter, Component, Inject, Output, NgModule, Directive, Input, HostBinding, HostListener, ElementRef, ViewChild, Pipe, LOCALE_ID } from '@angular/core';
|
|
3
3
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
4
4
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
@@ -1957,6 +1957,7 @@ var EventService = (function () {
|
|
|
1957
1957
|
function EventService(environment, utilitySvc) {
|
|
1958
1958
|
this.utilitySvc = utilitySvc;
|
|
1959
1959
|
this.todaysEvents = [];
|
|
1960
|
+
this.todaysLiveEvents = [];
|
|
1960
1961
|
this.eventsSubject = new Subject();
|
|
1961
1962
|
this.events$ = this.eventsSubject.asObservable();
|
|
1962
1963
|
this.eventsChatbotSubject = new Subject();
|
|
@@ -2087,16 +2088,26 @@ var EventService = (function () {
|
|
|
2087
2088
|
var min = stime.substr(2, 3);
|
|
2088
2089
|
return date + " " + hour + min;
|
|
2089
2090
|
};
|
|
2091
|
+
EventService.prototype.sortItemByTime = function (eventsdata) {
|
|
2092
|
+
return eventsdata.sort((function (a, b) {
|
|
2093
|
+
return (a.eventDate === b.eventDate) ? 0 : b.eventDate ? -1 : 1;
|
|
2094
|
+
}));
|
|
2095
|
+
};
|
|
2090
2096
|
EventService.prototype.setEventListData = function (eventObj) {
|
|
2091
2097
|
var _this = this;
|
|
2092
2098
|
if (eventObj !== undefined) {
|
|
2093
2099
|
this.todaysEvents = [];
|
|
2100
|
+
this.todaysLiveEvents = [];
|
|
2094
2101
|
var data_1 = eventObj;
|
|
2095
2102
|
var isEventLive_1 = false;
|
|
2096
2103
|
var isEventRecording_1 = false;
|
|
2104
|
+
var isEventPast_1 = false;
|
|
2105
|
+
var isEventFuture_1 = false;
|
|
2097
2106
|
Object.keys(data_1).forEach((function (index) {
|
|
2098
2107
|
isEventRecording_1 = false;
|
|
2099
2108
|
isEventLive_1 = false;
|
|
2109
|
+
isEventPast_1 = false;
|
|
2110
|
+
isEventFuture_1 = false;
|
|
2100
2111
|
var obj = data_1[index];
|
|
2101
2112
|
var floor = Math.floor;
|
|
2102
2113
|
var hours = floor(obj.duration / 60);
|
|
@@ -2132,9 +2143,21 @@ var EventService = (function () {
|
|
|
2132
2143
|
else if (today >= eventendDate) {
|
|
2133
2144
|
isEventRecording_1 = true;
|
|
2134
2145
|
isEventLive_1 = false;
|
|
2146
|
+
if (moment(today).isAfter(eventendDate) && moment(today).isAfter(eventDate)) {
|
|
2147
|
+
isEventPast_1 = true;
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
else {
|
|
2151
|
+
if (moment(today).isBefore(eventDate) && moment(today).isBefore(eventendDate)) {
|
|
2152
|
+
isEventFuture_1 = true;
|
|
2153
|
+
}
|
|
2135
2154
|
}
|
|
2136
2155
|
var eventDataObj = {
|
|
2156
|
+
eventDate: eventDate,
|
|
2157
|
+
eventendDate: eventendDate,
|
|
2137
2158
|
isEventLive: isEventLive_1,
|
|
2159
|
+
isEventFuture: isEventFuture_1,
|
|
2160
|
+
isEventPast: isEventPast_1,
|
|
2138
2161
|
isEventRecording: isEventRecording_1,
|
|
2139
2162
|
event: obj,
|
|
2140
2163
|
eventName: obj.name,
|
|
@@ -2150,14 +2173,29 @@ var EventService = (function () {
|
|
|
2150
2173
|
pastevent: false,
|
|
2151
2174
|
};
|
|
2152
2175
|
var isToday = _this.compareDate(obj.startDate);
|
|
2153
|
-
if (isToday
|
|
2176
|
+
if (isToday) {
|
|
2154
2177
|
_this.todaysEvents.push(eventDataObj);
|
|
2155
2178
|
}
|
|
2179
|
+
if (isToday && isEventLive_1) {
|
|
2180
|
+
_this.todaysLiveEvents.push(eventDataObj);
|
|
2181
|
+
}
|
|
2156
2182
|
}));
|
|
2157
|
-
this.
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2183
|
+
this.todaysLiveEvents = this.sortItemByTime(this.todaysLiveEvents);
|
|
2184
|
+
this.todaysEvents = this.getTodaysEvents(this.todaysEvents);
|
|
2185
|
+
}
|
|
2186
|
+
};
|
|
2187
|
+
EventService.prototype.getTodaysEvents = function (eventData) {
|
|
2188
|
+
var liveEvents = [];
|
|
2189
|
+
var pastEvents = [];
|
|
2190
|
+
var futureEvents = [];
|
|
2191
|
+
liveEvents = this.todaysLiveEvents;
|
|
2192
|
+
pastEvents = eventData.filter((function (pastEvent) { return pastEvent.isEventPast; }));
|
|
2193
|
+
futureEvents = eventData.filter((function (futureEvent) { return futureEvent.isEventFuture; }));
|
|
2194
|
+
liveEvents = this.sortItemByTime(liveEvents);
|
|
2195
|
+
futureEvents = this.sortItemByTime(futureEvents);
|
|
2196
|
+
pastEvents = this.sortItemByTime(pastEvents);
|
|
2197
|
+
this.todaysEvents = __spread(liveEvents, futureEvents, pastEvents);
|
|
2198
|
+
return this.todaysEvents;
|
|
2161
2199
|
};
|
|
2162
2200
|
EventService.decorators = [
|
|
2163
2201
|
{ type: Injectable, args: [{
|
|
@@ -2173,6 +2211,7 @@ var EventService = (function () {
|
|
|
2173
2211
|
}());
|
|
2174
2212
|
if (false) {
|
|
2175
2213
|
EventService.prototype.todaysEvents;
|
|
2214
|
+
EventService.prototype.todaysLiveEvents;
|
|
2176
2215
|
EventService.prototype.eventsSubject;
|
|
2177
2216
|
EventService.prototype.events$;
|
|
2178
2217
|
EventService.prototype.eventsChatbotSubject;
|
|
@@ -2318,8 +2357,10 @@ var HorizontalScrollerV2Component = (function () {
|
|
|
2318
2357
|
this.defaultMaxWidgets = this.defaultMaxWidgets ? this.widgetsLength < this.defaultMaxWidgets ?
|
|
2319
2358
|
this.widgetsLength : this.defaultMaxWidgets : this.defaultMaxWidgets;
|
|
2320
2359
|
arrLength_1 = this.defaultMaxWidgets / arrLength_1;
|
|
2321
|
-
|
|
2322
|
-
|
|
2360
|
+
if (arrLength_1 !== Infinity) {
|
|
2361
|
+
for (var i = 0; i < arrLength_1; i += 1) {
|
|
2362
|
+
this.bottomDotsArray.push(i);
|
|
2363
|
+
}
|
|
2323
2364
|
}
|
|
2324
2365
|
}
|
|
2325
2366
|
}
|