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
66
67
68 | 1×
1×
1×
1×
1468×
1468×
1×
1468×
1468×
1×
2947×
2947×
2473×
3×
3×
3×
41×
41×
41×
41×
3×
3×
2473×
48×
48×
2473×
2473×
2473×
2947×
1×
64450×
64450×
64450×
1×
2644×
1×
975×
975×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-data", "@syncfusion/ej2-base"], function (require, exports, ej2_data_1, ej2_base_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Data = (function () {
function Data(parent, dataSource, query) {
this.parent = parent;
this.initDataManager(dataSource, query);
}
Data.prototype.initDataManager = function (dataSource, query) {
this.dataManager = dataSource instanceof ej2_data_1.DataManager ? dataSource : new ej2_data_1.DataManager(dataSource);
this.query = query instanceof ej2_data_1.Query ? query : new ej2_data_1.Query();
};
Data.prototype.generateQuery = function (startDate, endDate) {
var query = this.query.clone();
if (this.parent && startDate && endDate) {
if (this.parent.activeViewOptions && this.parent.activeViewOptions.enableLazyLoading &&
!ej2_base_1.isNullOrUndefined(this.parent.activeViewOptions.group.resources) &&
this.parent.activeViewOptions.group.resources.length > 0 && this.parent.resourceBase &&
this.parent.resourceBase.resourceCollection.length > 0 && this.parent.resourceBase.renderedResources.length > 0) {
var resIdCollection_1 = [];
this.parent.resourceBase.resourceCollection.forEach(function () { return resIdCollection_1.push([]); });
this.parent.resourceBase.renderedResources.forEach(function (resource) {
resIdCollection_1.forEach(function (resId, index) {
var groupId = resource.groupOrder[parseInt(index.toString(), 10)];
Eif (groupId && resId.indexOf(groupId) < 0) {
resId.push(groupId);
}
});
});
this.parent.resourceBase.resourceCollection.forEach(function (resource, index) {
query.addParams(resource.field, resIdCollection_1[parseInt(index.toString(), 10)].toString());
});
}
if (this.parent.timezone) {
startDate = this.parent.tzModule.remove(new Date(+startDate.getTime()), this.parent.timezone);
endDate = this.parent.tzModule.remove(new Date(+endDate.getTime()), this.parent.timezone);
}
Iif (this.parent.eventSettings.includeFiltersInQuery) {
var dateQuery = this.getStartEndQuery(startDate, endDate);
var recurrenceQuery = new ej2_data_1.Predicate(this.parent.eventFields.recurrenceRule, 'notequal', null).and(new ej2_data_1.Predicate(this.parent.eventFields.recurrenceRule, 'notequal', ''));
return query.where(dateQuery.or(recurrenceQuery));
}
query.addParams('StartDate', startDate.toISOString());
query.addParams('EndDate', endDate.toISOString());
}
return query;
};
Data.prototype.getStartEndQuery = function (startDate, endDate) {
var fieldMapping = this.parent.eventFields;
var dateQuery = new ej2_data_1.Predicate(fieldMapping.startTime, 'greaterthanorequal', startDate)
.and(new ej2_data_1.Predicate(fieldMapping.endTime, 'greaterthanorequal', startDate))
.and(new ej2_data_1.Predicate(fieldMapping.startTime, 'lessthan', endDate))
.or(new ej2_data_1.Predicate(fieldMapping.startTime, 'lessthanorequal', startDate)
.and(new ej2_data_1.Predicate(fieldMapping.endTime, 'greaterthan', startDate)));
return dateQuery;
};
Data.prototype.getData = function (query) {
return this.dataManager.executeQuery(query);
};
Data.prototype.destroy = function () {
this.dataManager = null;
this.query = null;
};
return Data;
}());
exports.Data = Data;
});
|