🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

dt2react

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dt2react - npm Package Compare versions

Comparing version
2.2.1
to
2.2.2
+7
-7
lib/style/positionFactory.js

@@ -72,12 +72,12 @@ "use strict";

(0, _classCallCheck2.default)(this, t);
var i = e.trigger, r = e.target, o = e.direction, n = e.align, c = e.fixed, s = getDocumentScroll(), l = (0,
_slicedToArray2.default)(s, 2), g = l[0], h = l[1];
var i = e.trigger, r = e.target, o = e.direction, n = e.align, c = e.fixed, s = e.getScroll, l = e.offsetX, g = void 0 === l ? 0 : l, h = e.offsetY, u = void 0 === h ? 0 : h, a = s ? s() : getDocumentScroll(), d = (0,
_slicedToArray2.default)(a, 2), p = d[0], f = d[1];
i.getBoundingClientRect ? this.triggerRect = i.getBoundingClientRect() : this.triggerRect = i,
r.getBoundingClientRect ? this.popoverRect = r.getBoundingClientRect() : this.popoverRect = r,
this.direction = this.getComputedDirection(o), this.align = this.getComputedAlign(n);
var u = this.triggerRect, a = u.width, d = u.height, p = u.top, f = u.left;
if (this.center = [ f + a / 2 + h, p + d / 2 + g ], !c) {
var R = this.coordinateMap[this.direction].call(this), v = (0, _slicedToArray2.default)(R, 2), m = v[0], y = v[1];
r.style ? (r.style.left = "".concat(m, "px"), r.style.top = "".concat(y, "px")) : (r.left = "".concat(m, "px"),
r.top = "".concat(y, "px"));
var R = this.triggerRect, v = R.width, m = R.height, y = R.top, P = R.left;
if (this.center = [ P + v / 2 + f + g, y + m / 2 + p + u ], !c) {
var w = this.coordinateMap[this.direction].call(this), C = (0, _slicedToArray2.default)(w, 2), b = C[0], A = C[1];
r.style ? (r.style.left = "".concat(b, "px"), r.style.top = "".concat(A, "px")) : (r.left = "".concat(b, "px"),
r.top = "".concat(A, "px"));
}

@@ -84,0 +84,0 @@ }

@@ -173,3 +173,3 @@ "use strict";

}), (function(e) {
console.log("--获取CosConfig出错:", e), r[t]--;
console.log("--get Cos Config error:", e), r[t]--;
})));

@@ -176,0 +176,0 @@ } catch (e) {

{
"name": "dt2react",
"version": "2.2.1",
"version": "2.2.2",
"description": "one dom helper lib for react",

@@ -5,0 +5,0 @@ "main": "./lib/dt2react.js",

@@ -396,2 +396,33 @@ # dt2react

* getCacheRequest `dt2react/lib/utils/cacheRequest`
```js
import { getCacheRequest } from 'dt2react/lib/utils/cacheRequest';
function getInfoAction(){
return commonGet(url);
}
const cacheGetInfoAction = getCacheRequest(getInfoAction, url);
// 使用时:
cacheGetInfoAction().then(data => { ... });
// 有参数的
function getUserAction(userId){
const _url = formatUrl(userInfoUrl, { userId });
return commonGet(_url);
}
const tags = formatUrl(userInfoUrl, { userId: 333 });
const cacheUserAction = getCacheRequest(getUserAction, tags);
// 有参数,动态生成 actionTag
const globalActionMapping = {};
function cacheUserAction2(userId){
const tags = formatUrl(userInfoUrl, { userId });
if (!globalActionMapping[tags]){
globalActionMapping[tags] = getCacheRequest(getUserAction, tags);
}
return globalActionMapping[tags](userId);
}
// 使用
cacheUserAction2('112233').then(data => { ... });
```
------ utils end

@@ -398,0 +429,0 @@