Socket
Socket
Sign inDemoInstall

@syncfusion/ej2-data

Package Overview
Dependencies
2
Maintainers
3
Versions
159
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 21.1.35 to 21.1.36

1

.eslintrc.json

@@ -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,2 +7,10 @@ # Changelog

#### Features
- `#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.1.35 (2023-03-23)
### DataManager
#### New Features

@@ -9,0 +17,0 @@

2

dist/global/index.d.ts
/*!
* filename: index.d.ts
* version : 21.1.35
* version : 21.1.36
* 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@0.15.7",
"_id": "@syncfusion/ej2-data@0.16.0",
"_inBundle": false,
"_integrity": "sha512-JfJrrzBQ6rjgcxTx55DsWb8BTGXGk97hjCKMHDu2fMmLuIDixQAxGwToS5BU83W269GEM3QAiG4Tz9LkLoF8jw==",
"_integrity": "sha512-SHAuO/Z29f90xUdcuZQTWgDxGztMqtyxm5sENO6ZMAdr1a6my+zSrmCCKCbR+OZBqqKdGRRhLlz0TkCn1dMwWw==",
"_location": "/@syncfusion/ej2-data",

@@ -43,4 +43,4 @@ "_phantomChildren": {},

],
"_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-data/-/ej2-data-0.15.7.tgz",
"_shasum": "4f5bd34d97cb177b33d22e2a209bc0ebcaa19e63",
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-data/-/ej2-data-0.16.0.tgz",
"_shasum": "31b80d6789109cc182d865496185feba54fba09c",
"_spec": "@syncfusion/ej2-data@*",

@@ -53,3 +53,3 @@ "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",

"dependencies": {
"@syncfusion/ej2-base": "~21.1.35"
"@syncfusion/ej2-base": "~22.1.34"
},

@@ -65,5 +65,5 @@ "deprecated": false,

"typings": "index.d.ts",
"version": "21.1.35",
"version": "21.1.36",
"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

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc