@syncfusion/ej2-data
Advanced tools
Comparing version 18.4.39 to 18.4.46
@@ -9,2 +9,10 @@ # Changelog | ||
- `312017` - `RemoteSaveAdaptor` with batch editing issue has been fixed has been fixed. | ||
## 18.4.33 (2021-01-05) | ||
### DataManager | ||
#### Bug Fixes | ||
- DataManager lazy load grouping script error issue has been fixed. | ||
@@ -11,0 +19,0 @@ |
/*! | ||
* filename: index.d.ts | ||
* version : 18.4.39 | ||
* version : 18.4.46 | ||
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"_from": "@syncfusion/ej2-data@*", | ||
"_id": "@syncfusion/ej2-data@18.4.30", | ||
"_id": "@syncfusion/ej2-data@18.4.39", | ||
"_inBundle": false, | ||
"_integrity": "sha512-ZtWZcyPdCfPrx3plv6FzZtHBRtSUmqSU6NnxqkupUtf01XDk+aMd+C5wr+YNigGMFV/MjrRHKAqt0Cv7gvKBNg==", | ||
"_integrity": "sha512-HC2xI85UN7TXEx0+qHLMRn139Fb3HNwAwRbaCayhhdvgrcSqztOBWGL5H+7DGHVc+HZjqyFGPHOyW6YXHpnRqQ==", | ||
"_location": "/@syncfusion/ej2-data", | ||
@@ -43,4 +43,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-data/-/ej2-data-18.4.30.tgz", | ||
"_shasum": "bdbe8bca6b4879d740ee7430709bda19e950ee1a", | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-data/-/ej2-data-18.4.39.tgz", | ||
"_shasum": "ca753db333c2a4927d749b6753c1aee966717b10", | ||
"_spec": "@syncfusion/ej2-data@*", | ||
@@ -53,3 +53,3 @@ "_where": "/jenkins/workspace/automation_release_18.4.0.1-WOJ6QVY6EU5ONBWOYGQFKS2VU2UW7E67MOXUPKCE5AX7QQX7M5JQ/packages/included", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~18.4.39" | ||
"@syncfusion/ej2-base": "~18.4.44" | ||
}, | ||
@@ -65,4 +65,4 @@ "deprecated": false, | ||
"typings": "index.d.ts", | ||
"version": "18.4.39", | ||
"version": "18.4.46", | ||
"sideEffects": false | ||
} |
@@ -667,2 +667,11 @@ import { Ajax } from '@syncfusion/ej2-base'; | ||
/** | ||
* Ajax Adaptor that is extended from URL Adaptor, is used for handle data operations with user defined functions. | ||
* @hidden | ||
*/ | ||
export declare class AjaxAdaptor extends UrlAdaptor { | ||
protected getModuleName(): string; | ||
protected options: RemoteOptions; | ||
constructor(props?: RemoteOptions); | ||
} | ||
/** | ||
* Cache Adaptor is used to cache the data of the visited pages. It prevents new requests for the previously visited pages. | ||
@@ -842,2 +851,7 @@ * You can configure cache page size and duration of caching by using cachingPageSize and timeTillExpiration properties of the DataManager | ||
apply?: string; | ||
getData?: Function; | ||
updateRecord?: Function; | ||
addRecord?: Function; | ||
deleteRecord?: Function; | ||
batchUpdate?: Function; | ||
} | ||
@@ -844,0 +858,0 @@ /** |
@@ -22,2 +22,4 @@ import { Ajax } from '@syncfusion/ej2-base'; | ||
private requests; | ||
private ajaxDeffered; | ||
private ajaxReqOption; | ||
/** | ||
@@ -88,2 +90,5 @@ * Constructor for DataManager class | ||
update(keyField: string, value: Object, tableName?: string | Query, query?: Query, original?: Object): Object | Promise<Object>; | ||
private isAjaxAdaptor; | ||
private successFunc; | ||
private failureFunc; | ||
private doAjaxRequest; | ||
@@ -155,2 +160,10 @@ } | ||
*/ | ||
export interface AjaxOption { | ||
onSuccess?: Function; | ||
onFailure?: Function; | ||
data?: string; | ||
} | ||
/** | ||
* @hidden | ||
*/ | ||
export interface RequestOptions { | ||
@@ -157,0 +170,0 @@ xhr?: XMLHttpRequest; |
@@ -5,3 +5,3 @@ import { Ajax } from '@syncfusion/ej2-base'; | ||
import { Query } from './query'; | ||
import { ODataAdaptor, JsonAdaptor, CacheAdaptor, RemoteSaveAdaptor } from './adaptors'; | ||
import { ODataAdaptor, JsonAdaptor, CacheAdaptor, RemoteSaveAdaptor, AjaxAdaptor } from './adaptors'; | ||
/** | ||
@@ -63,3 +63,4 @@ * DataManager is used to manage and manipulate relational data. | ||
offline: dataSource.offline !== undefined ? dataSource.offline | ||
: dataSource.adaptor instanceof RemoteSaveAdaptor ? false : dataSource.url ? false : true, | ||
: dataSource.adaptor instanceof RemoteSaveAdaptor || dataSource.adaptor instanceof AjaxAdaptor ? | ||
false : dataSource.url ? false : true, | ||
requiresFormat: dataSource.requiresFormat | ||
@@ -167,3 +168,3 @@ }; | ||
if (!this.dataSource.offline && (this.dataSource.url !== undefined && this.dataSource.url !== '') | ||
|| (!isNullOrUndefined(this.adaptor[makeRequest]))) { | ||
|| (!isNullOrUndefined(this.adaptor[makeRequest])) || this.isAjaxAdaptor(this.adaptor)) { | ||
var result = this.adaptor.processQuery(this, query); | ||
@@ -173,3 +174,3 @@ if (!isNullOrUndefined(this.adaptor[makeRequest])) { | ||
} | ||
else if (!isNullOrUndefined(result.url)) { | ||
else if (!isNullOrUndefined(result.url) || this.isAjaxAdaptor(this.adaptor)) { | ||
this.makeRequest(result, deffered, args, query); | ||
@@ -223,2 +224,3 @@ } | ||
}; | ||
// tslint:disable-next-line:max-func-body-length | ||
DataManager.prototype.makeRequest = function (url, deffered, args, query) { | ||
@@ -258,2 +260,5 @@ var _this = this; | ||
var fnSuccess = function (data, request) { | ||
if (_this.isAjaxAdaptor(_this.adaptor)) { | ||
request = extend({}, _this.ajaxReqOption, request); | ||
} | ||
if (request.httpRequest.getResponseHeader('Content-Type').indexOf('xml') === -1 && _this.dateParse) { | ||
@@ -281,9 +286,19 @@ data = DataUtil.parse.parseJson(data); | ||
var req = this.extendRequest(url, fnSuccess, fnFail); | ||
var ajax = new Ajax(req); | ||
ajax.beforeSend = function () { | ||
_this.beforeSend(ajax.httpRequest, ajax); | ||
}; | ||
req = ajax.send(); | ||
req.catch(function (e) { return true; }); // to handle failure remote requests. | ||
this.requests.push(ajax); | ||
if (!this.isAjaxAdaptor(this.adaptor)) { | ||
var ajax_1 = new Ajax(req); | ||
ajax_1.beforeSend = function () { | ||
_this.beforeSend(ajax_1.httpRequest, ajax_1); | ||
}; | ||
req = ajax_1.send(); | ||
req.catch(function (e) { return true; }); // to handle failure remote requests. | ||
this.requests.push(ajax_1); | ||
} | ||
else { | ||
this.ajaxReqOption = req; | ||
var request = req; | ||
this.adaptor.options.getData({ | ||
data: request.data, | ||
onSuccess: request.onSuccess, onFailure: request.onFailure | ||
}); | ||
} | ||
if (isSelector) { | ||
@@ -364,17 +379,20 @@ var promise = void 0; | ||
} | ||
else { | ||
else if (!this.isAjaxAdaptor(this.adaptor)) { | ||
var deff_1 = new Deferred(); | ||
var ajax_1 = new Ajax(req); | ||
ajax_1.beforeSend = function () { | ||
_this.beforeSend(ajax_1.httpRequest, ajax_1); | ||
var ajax_2 = new Ajax(req); | ||
ajax_2.beforeSend = function () { | ||
_this.beforeSend(ajax_2.httpRequest, ajax_2); | ||
}; | ||
ajax_1.onSuccess = function (data, request) { | ||
ajax_2.onSuccess = function (data, request) { | ||
deff_1.resolve(_this.adaptor.processResponse(data, _this, null, request.httpRequest, request, changes, args)); | ||
}; | ||
ajax_1.onFailure = function (e) { | ||
ajax_2.onFailure = function (e) { | ||
deff_1.reject([{ error: e }]); | ||
}; | ||
ajax_1.send().catch(function (e) { return true; }); // to handle the failure requests. | ||
ajax_2.send().catch(function (e) { return true; }); // to handle the failure requests. | ||
return deff_1.promise; | ||
} | ||
else { | ||
return this.doAjaxRequest(req, this.adaptor.options.batchUpdate); | ||
} | ||
}; | ||
@@ -401,3 +419,3 @@ /** | ||
else { | ||
return this.doAjaxRequest(req); | ||
return this.doAjaxRequest(req, this.adaptor.options.addRecord); | ||
} | ||
@@ -429,3 +447,4 @@ }; | ||
else { | ||
return this.doAjaxRequest(res); | ||
var remove = this.adaptor.options.deleteRecord; | ||
return this.doAjaxRequest(res, remove); | ||
} | ||
@@ -454,8 +473,30 @@ }; | ||
else { | ||
return this.doAjaxRequest(res); | ||
var update = this.adaptor.options.updateRecord; | ||
return this.doAjaxRequest(res, update); | ||
} | ||
}; | ||
DataManager.prototype.doAjaxRequest = function (res) { | ||
DataManager.prototype.isAjaxAdaptor = function (dataSource) { | ||
return this.adaptor.getModuleName && | ||
this.adaptor.getModuleName() === 'AjaxAdaptor'; | ||
}; | ||
DataManager.prototype.successFunc = function (record, request) { | ||
if (this.isAjaxAdaptor(this.adaptor)) { | ||
request = extend({}, this.ajaxReqOption, request); | ||
} | ||
try { | ||
DataUtil.parse.parseJson(record); | ||
} | ||
catch (e) { | ||
record = []; | ||
} | ||
record = this.adaptor.processResponse(DataUtil.parse.parseJson(record), this, null, request.httpRequest, request); | ||
this.ajaxDeffered.resolve(record); | ||
}; | ||
; | ||
DataManager.prototype.failureFunc = function (e) { | ||
this.ajaxDeffered.reject([{ error: e }]); | ||
}; | ||
; | ||
DataManager.prototype.doAjaxRequest = function (res, ajaxFunc) { | ||
var _this = this; | ||
var defer = new Deferred(); | ||
res = extend({}, { | ||
@@ -466,21 +507,20 @@ type: 'POST', | ||
}, res); | ||
var ajax = new Ajax(res); | ||
ajax.beforeSend = function () { | ||
_this.beforeSend(ajax.httpRequest, ajax); | ||
}; | ||
ajax.onSuccess = function (record, request) { | ||
try { | ||
DataUtil.parse.parseJson(record); | ||
} | ||
catch (e) { | ||
record = []; | ||
} | ||
record = _this.adaptor.processResponse(DataUtil.parse.parseJson(record), _this, null, request.httpRequest, request); | ||
defer.resolve(record); | ||
}; | ||
ajax.onFailure = function (e) { | ||
defer.reject([{ error: e }]); | ||
}; | ||
ajax.send().catch(function (e) { return true; }); // to handle the failure requests. | ||
return defer.promise; | ||
this.ajaxDeffered = new Deferred(); | ||
if (!this.isAjaxAdaptor(this.adaptor)) { | ||
var ajax_3 = new Ajax(res); | ||
ajax_3.beforeSend = function () { | ||
_this.beforeSend(ajax_3.httpRequest, ajax_3); | ||
}; | ||
ajax_3.onSuccess = this.successFunc.bind(this); | ||
ajax_3.onFailure = this.failureFunc.bind(this); | ||
ajax_3.send().catch(function (e) { return true; }); // to handle the failure requests. | ||
} | ||
else { | ||
this.ajaxReqOption = res; | ||
ajaxFunc.call(this, { | ||
data: res.data, onSuccess: this.successFunc.bind(this), | ||
onFailure: this.failureFunc.bind(this) | ||
}); | ||
} | ||
return this.ajaxDeffered.promise; | ||
}; | ||
@@ -487,0 +527,0 @@ return DataManager; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2047183
18175
20