@syncfusion/ej2-data
Advanced tools
Comparing version 21.2.9 to 22.1.34
@@ -40,2 +40,3 @@ { | ||
"security/detect-new-buffer":"error", | ||
"security/detect-bidi-characters":"error", | ||
"@typescript-eslint/no-inferrable-types": "off", | ||
@@ -42,0 +43,0 @@ "@typescript-eslint/ban-types": ["warn", { |
@@ -7,38 +7,6 @@ # Changelog | ||
#### Bug Fixes | ||
#### Features | ||
- `#I469713` - Resolved the issue where data was duplicated in the complex field when using an empty nested object. | ||
- `#I361245` - Provided support for persistence in DataManager. By setting, the `enablePersistence` and `id` properties in DataManager, you can store and retain actions such as sorting, filtering, grouping, and searching. Additionally, you can selectively exclude specific queries from persistence by setting a value for the `ignoreOnPersist` property. | ||
## 21.2.8 (2023-05-30) | ||
### DataManager | ||
#### Bug Fixes | ||
- `#I464294` - Resolved the issue where the value zero is not displayed in the grid while using complex data binding. | ||
## 21.2.6 (2023-05-23) | ||
### DataManager | ||
#### Bug Fixes | ||
- `#I456631` - Resolved the issue where the search functionality was not working properly within brackets. | ||
## 21.2.4 (2023-05-09) | ||
### DataManager | ||
#### Bug Fixes | ||
- `#F180240` - Provided support to render and perform Grid data actions without using `ContractResolver` in `ASP.NET Core`. | ||
## 21.1.38 (2023-04-04) | ||
### DataManager | ||
#### Bug Fixes | ||
- `#I440048` - Data not bound when using `ODataV4 Adaptor` with version 4.01 protocol has been fixed. | ||
## 21.1.35 (2023-03-23) | ||
@@ -45,0 +13,0 @@ |
/*! | ||
* filename: index.d.ts | ||
* version : 21.2.9 | ||
* version : 22.1.34 | ||
* 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@21.2.8", | ||
"_id": "@syncfusion/ej2-data@0.16.0", | ||
"_inBundle": false, | ||
"_integrity": "sha512-oRnS1a2Zq2YAsasiVjCtsmPMhlTkQYvXpUjBP3ZLO8YWadRYU6uIjEQMrW70pEDakXS/r5kJ4efGmaDgLkfONA==", | ||
"_integrity": "sha512-Pky7JmSHCk9nB/MfP5fETdyHo6hvpfVrUydnZPU8eWd9hcbN6JOQBfM2omGRyGl8mhHjgbQz0WvDRDXg97xaOw==", | ||
"_location": "/@syncfusion/ej2-data", | ||
@@ -43,4 +43,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-data/-/ej2-data-21.2.8.tgz", | ||
"_shasum": "3edf6bd233b58f7b33ef966fe55c93c8697d3529", | ||
"_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-data/-/ej2-data-0.16.0.tgz", | ||
"_shasum": "f12dc2871bdc3e7f2fd88c92a0a78325f41218dd", | ||
"_spec": "@syncfusion/ej2-data@*", | ||
@@ -53,3 +53,3 @@ "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~21.2.9" | ||
"@syncfusion/ej2-base": "~22.1.34" | ||
}, | ||
@@ -65,5 +65,5 @@ "deprecated": false, | ||
"typings": "index.d.ts", | ||
"version": "21.2.9", | ||
"version": "22.1.34", | ||
"sideEffects": false, | ||
"homepage": "https://www.syncfusion.com/javascript-ui-controls" | ||
} |
@@ -21,2 +21,4 @@ import { Ajax } from '@syncfusion/ej2-base'; | ||
private isDataAvailable; | ||
private persistQuery; | ||
private isInitialLoad; | ||
private requests; | ||
@@ -38,2 +40,17 @@ private ajaxDeffered; | ||
/** | ||
* Get the queries maintained in the persisted state. | ||
* @param {string} id - The identifier of the persisted query to retrieve. | ||
* @returns {object} The persisted data object. | ||
*/ | ||
getPersistedData(id?: string): object; | ||
/** | ||
* Set the queries to be maintained in the persisted state. | ||
* @param {Event} e - The event parameter that triggers the setPersistData method. | ||
* @param {string} id - The identifier of the persisted query to set. | ||
* @param {object} persistData - The data to be persisted. | ||
* @returns {void} . | ||
*/ | ||
setPersistData(e: Event, id?: string, persistData?: object): void; | ||
private setPersistQuery; | ||
/** | ||
* Overrides DataManager's default query with given query. | ||
@@ -110,2 +127,3 @@ * | ||
private doAjaxRequest; | ||
clearPersistence(): void; | ||
} | ||
@@ -163,2 +181,5 @@ /** | ||
timeZoneHandling?: boolean; | ||
id?: string; | ||
enablePersistence?: boolean; | ||
ignoreOnPersist?: string[]; | ||
} | ||
@@ -165,0 +186,0 @@ /** |
@@ -6,3 +6,3 @@ /* eslint-disable valid-jsdoc */ | ||
import { DataUtil } from './util'; | ||
import { Query } from './query'; | ||
import { Predicate, Query } from './query'; | ||
import { ODataAdaptor, JsonAdaptor, CacheAdaptor, RemoteSaveAdaptor, CustomDataAdaptor } from './adaptors'; | ||
@@ -30,3 +30,6 @@ /** | ||
this.timeZoneHandling = true; | ||
this.persistQuery = {}; | ||
this.isInitialLoad = false; | ||
this.requests = []; | ||
this.isInitialLoad = true; | ||
if (!dataSource && !this.dataSource) { | ||
@@ -50,2 +53,11 @@ dataSource = []; | ||
} | ||
if (!dataSource.enablePersistence) { | ||
dataSource.enablePersistence = false; | ||
} | ||
if (!dataSource.id) { | ||
dataSource.id = ''; | ||
} | ||
if (!dataSource.ignoreOnPersist) { | ||
dataSource.ignoreOnPersist = []; | ||
} | ||
data = { | ||
@@ -73,3 +85,6 @@ url: dataSource.url, | ||
false : dataSource.url ? false : true, | ||
requiresFormat: dataSource.requiresFormat | ||
requiresFormat: dataSource.requiresFormat, | ||
enablePersistence: dataSource.enablePersistence, | ||
id: dataSource.id, | ||
ignoreOnPersist: dataSource.ignoreOnPersist | ||
}; | ||
@@ -88,2 +103,5 @@ } | ||
this.defaultQuery = query; | ||
if (this.dataSource.enablePersistence && this.dataSource.id) { | ||
window.addEventListener('unload', this.setPersistData.bind(this)); | ||
} | ||
if (data.url && data.offline && !data.json.length) { | ||
@@ -114,2 +132,54 @@ this.isDataAvailable = false; | ||
/** | ||
* Get the queries maintained in the persisted state. | ||
* @param {string} id - The identifier of the persisted query to retrieve. | ||
* @returns {object} The persisted data object. | ||
*/ | ||
DataManager.prototype.getPersistedData = function (id) { | ||
var persistedData = localStorage.getItem(id || this.dataSource.id); | ||
return JSON.parse(persistedData); | ||
}; | ||
/** | ||
* Set the queries to be maintained in the persisted state. | ||
* @param {Event} e - The event parameter that triggers the setPersistData method. | ||
* @param {string} id - The identifier of the persisted query to set. | ||
* @param {object} persistData - The data to be persisted. | ||
* @returns {void} . | ||
*/ | ||
DataManager.prototype.setPersistData = function (e, id, persistData) { | ||
localStorage.setItem(id || this.dataSource.id, JSON.stringify(persistData || this.persistQuery)); | ||
}; | ||
DataManager.prototype.setPersistQuery = function (query) { | ||
var _this = this; | ||
var persistedQuery = this.getPersistedData(); | ||
if (this.isInitialLoad && persistedQuery && Object.keys(persistedQuery).length) { | ||
this.persistQuery = persistedQuery; | ||
this.persistQuery.queries = this.persistQuery.queries.filter(function (query) { | ||
if (_this.dataSource.ignoreOnPersist && _this.dataSource.ignoreOnPersist.length) { | ||
if (query.fn && _this.dataSource.ignoreOnPersist.some(function (keyword) { return query.fn === keyword; })) { | ||
return false; // Exclude the matching query | ||
} | ||
} | ||
if (query.fn === 'onWhere') { | ||
var e = query.e; | ||
if (e && e.isComplex && e.predicates instanceof Array) { | ||
var predicates = e.predicates.map(function (predicateObj) { | ||
var field = predicateObj.field, operator = predicateObj.operator, value = predicateObj.value, ignoreCase = predicateObj.ignoreCase, ignoreAccent = predicateObj.ignoreAccent, matchCase = predicateObj.matchCase; | ||
return new Predicate(field, operator, value, ignoreCase, ignoreAccent, matchCase); | ||
}); | ||
query.e = new Predicate(predicates[0], e.condition, predicates.slice(1)); | ||
} | ||
} | ||
return true; // Keep all other queries | ||
}); | ||
var newQuery = extend(new Query(), this.persistQuery); | ||
this.isInitialLoad = false; | ||
return (newQuery); | ||
} | ||
else { | ||
this.persistQuery = query; | ||
this.isInitialLoad = false; | ||
return query; | ||
} | ||
}; | ||
/** | ||
* Overrides DataManager's default query with given query. | ||
@@ -135,2 +205,5 @@ * | ||
} | ||
if (this.dataSource.enablePersistence && this.dataSource.id) { | ||
query = this.setPersistQuery(query); | ||
} | ||
query = query || this.defaultQuery; | ||
@@ -167,2 +240,5 @@ var result = this.adaptor.processQuery(this, query); | ||
var makeRequest = 'makeRequest'; | ||
if (this.dataSource.enablePersistence && this.dataSource.id) { | ||
query = this.setPersistQuery(query); | ||
} | ||
if (typeof query === 'function') { | ||
@@ -567,2 +643,8 @@ always = fail; | ||
}; | ||
DataManager.prototype.clearPersistence = function () { | ||
window.removeEventListener('unload', this.setPersistData.bind(this)); | ||
this.dataSource.enablePersistence = false; | ||
this.persistQuery = {}; | ||
window.localStorage.setItem(this.dataSource.id, '[]'); | ||
}; | ||
return DataManager; | ||
@@ -569,0 +651,0 @@ }()); |
Sorry, the diff of this file is too big to display
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
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
2585131
22762
+ Added@syncfusion/ej2-base@22.1.38(transitive)
+ Added@syncfusion/ej2-icons@22.1.34(transitive)
- Removed@syncfusion/ej2-base@21.2.9(transitive)
- Removed@syncfusion/ej2-icons@21.2.3(transitive)