New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gd-sprest-react

Package Overview
Dependencies
Maintainers
1
Versions
309
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gd-sprest-react - npm Package Compare versions

Comparing version 2.4.4 to 2.4.5

7

build/definitions/wpList.d.ts

@@ -54,3 +54,9 @@ /// <reference types="react" />

export interface IWebPartListProps {
/** Flag to store the items in local cache. (False by default) */
cacheItemsFl?: boolean;
/** The number of seconds to refresh the cached items. (Default: 300) */
cacheTimeout?: number;
/** The webpart configuration. */
cfg: IWebPartListCfg;
/** The class name to apply to the webpart. */
className?: string;

@@ -63,2 +69,3 @@ }

items?: Array<IWebPartListItem>;
lastRefresh?: Date;
}

@@ -17,2 +17,14 @@ /// <reference types="react" />

/**
* Flag to cache the items
*/
protected _cacheFl: boolean;
/**
* The number of seconds to refresh the data
*/
protected _cacheTimeout: number;
/**
* The key used for storing the data in cache.
*/
protected _key: string;
/**
* The OData query (Default)

@@ -29,2 +41,3 @@ */

*/
componentDidMount(): void;
/**

@@ -31,0 +44,0 @@ * The render container event

81

build/webparts/wpList.js

@@ -35,2 +35,10 @@ "use strict";

/**
* Flag to cache the items
*/
_this._cacheFl = false;
/**
* The key used for storing the data in cache.
*/
_this._key = null;
/**
* The OData query (Default)

@@ -40,5 +48,2 @@ */

/**
* Events
*/
/**
* The render container event

@@ -73,2 +78,22 @@ * @param items - An array of webpart list items.

_this.load = function () {
// See if we are loading the items from cache
if (_this._cacheFl) {
// See data from cache
var cache = localStorage.getItem(_this._key);
if (cache) {
// Convert the items back to an object
var items = cache ? gd_sprest_1.Helper.parse(cache) : null;
if (items) {
// Check the last refresh
var diff = Math.abs(((new Date(Date.now())).getTime() - _this.state.lastRefresh.getTime()) / 1000);
if (diff < _this._cacheTimeout) {
// Update the state and return
_this.setState({ items: items });
return;
}
}
// Clear the storage
localStorage.removeItem(_this._key);
}
}
// See if we are using the CAML query

@@ -95,3 +120,11 @@ if (_this._caml) {

.getItemsByQuery(_this._caml)
.execute(_this.onLoadData);
.execute(function (items) {
// See if we are storing the items in cache
if (_this._cacheFl) {
// Save the items to cache
localStorage.setItem(_this._key, items.stringify());
}
// Load the data
_this.onLoadData(items);
});
});

@@ -104,3 +137,11 @@ }

.getItemsByQuery(_this._caml)
.execute(_this.onLoadData);
.execute(function (items) {
// See if we are storing the items in cache
if (_this._cacheFl) {
// Save the items to cache
localStorage.setItem(_this._key, items.stringify());
}
// Load the data
_this.onLoadData(items);
});
}

@@ -117,3 +158,11 @@ };

.query(_this._query)
.execute(_this.onLoadData);
.execute(function (items) {
// See if we are storing the items in cache
if (_this._cacheFl) {
// Save the items to cache
localStorage.setItem(_this._key, items.stringify());
}
// Load the data
_this.onLoadData(items);
});
};

@@ -128,3 +177,4 @@ /**

_this.setState({
items: items.results
items: items.results,
lastRefresh: new Date(Date.now())
});

@@ -170,4 +220,9 @@ }

_this.state = {
items: null
items: null,
lastRefresh: new Date(Date.now())
};
// Update the cache properties
_this._cacheFl = _this.props.cacheItemsFl ? true : false;
_this._cacheTimeout = _this.props.cacheTimeout > 0 ? _this.props.cacheTimeout : 300;
_this._key = _this.props.cfg.WebPartId || "gd-sprest-items";
// Set the default query to use ODATA

@@ -184,2 +239,10 @@ _this._query = {

/**
* Events
*/
// Component initialized event
WebPartList.prototype.componentDidMount = function () {
// Load the items
this.load();
};
/**
* Render the component

@@ -192,4 +255,2 @@ */

if (this.props.cfg && this.props.cfg.ListName) {
// Load the items
this.load();
// Return a spinner

@@ -196,0 +257,0 @@ return (React.createElement(office_ui_fabric_react_1.Spinner, { label: "Loading the items..." }));

@@ -119,2 +119,3 @@ "use strict";

items: items.results || [],
lastRefresh: new Date(Date.now()),
searchTerms: searchTerms,

@@ -214,2 +215,22 @@ selectedTags: [],

_this._query.Select.push("ID");
// See if we are loading the items from cache
if (_this._cacheFl) {
// See data from cache
var cache = localStorage.getItem(_this._key);
if (cache) {
// Convert the items back to an object
var items = cache ? gd_sprest_1.Helper.parse(cache) : null;
if (items) {
// Check the last refresh
var diff = Math.abs(((new Date(Date.now())).getTime() - _this.state.lastRefresh.getTime()) / 1000);
if (diff < _this._cacheTimeout) {
// Generate the mapper
_this.generateMapper(items);
return;
}
}
// Clear the storage
localStorage.removeItem(_this._key);
}
}
// Ensure fields exist

@@ -241,3 +262,11 @@ if (_this.props.cfg.Fields) {

.query(_this._query)
.execute(_this.generateMapper);
.execute(function (items) {
// See if we are caching the results
if (_this._cacheFl) {
// Save the items to cache
localStorage.setItem(_this._key, items.stringify());
}
// Generate the mapper
_this.generateMapper(items);
});
}

@@ -309,2 +338,3 @@ };

items: null,
lastRefresh: new Date(Date.now()),
searchFilter: "",

@@ -331,4 +361,2 @@ searchTerms: [],

if (this.state.items == null) {
// Load the items
this.load();
// Return a spinner

@@ -335,0 +363,0 @@ return (React.createElement(office_ui_fabric_react_1.Spinner, { label: "Loading the items..." }));

12

package.json
{
"name": "gd-sprest-react",
"version": "2.4.4",
"version": "2.4.5",
"description": "SharePoint react components.",

@@ -34,4 +34,4 @@ "main": "build/index.js",

"devDependencies": {
"@types/core-js": "^0.9.43",
"@types/react": "^16.0.31",
"@types/core-js": "^0.9.44",
"@types/react": "^16.0.34",
"@types/react-dom": "^16.0.3",

@@ -42,6 +42,6 @@ "babel-core": "^6.26.0",

"core-js": "^2.5.3",
"css-loader": "^0.28.7",
"gd-sprest": "^2.4.5",
"css-loader": "^0.28.8",
"gd-sprest": "^2.5.8",
"node-sass": "^4.7.2",
"office-ui-fabric-react": "^5.36.0",
"office-ui-fabric-react": "^5.38.0",
"react": "^16.2.0",

@@ -48,0 +48,0 @@ "react-dom": "^16.2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc