@mpxjs/api-proxy 2.9.28 → 2.9.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/common/js/utils.js +12 -1
- package/src/platform/api/create-intersection-observer/IntersectionObserver.js +7 -4
- package/src/platform/api/create-selector-query/SelectQuery.js +2 -1
- package/src/platform/api/device/network/onNetworkStatusChange.js +1 -1
- package/src/platform/api/window/index.web.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/api-proxy",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.38",
|
|
4
4
|
"description": "convert miniprogram API at each end",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"types": "@types/index.d.ts",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"axios": "^1.6.7"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "5e2740e2091edda91eda9ffe775989c7fd9838df"
|
|
43
43
|
}
|
package/src/common/js/utils.js
CHANGED
|
@@ -95,6 +95,16 @@ function makeMap (arr) {
|
|
|
95
95
|
}, {})
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
function parseDataset (dataset) {
|
|
99
|
+
const parsed = {}
|
|
100
|
+
for (const key in dataset) {
|
|
101
|
+
if (hasOwn(dataset, key)) {
|
|
102
|
+
parsed[key] = JSON.parse(dataset[key])
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return parsed
|
|
106
|
+
}
|
|
107
|
+
|
|
98
108
|
const isBrowser = typeof window !== 'undefined'
|
|
99
109
|
|
|
100
110
|
function throwSSRWarning (info) {
|
|
@@ -115,5 +125,6 @@ export {
|
|
|
115
125
|
isBrowser,
|
|
116
126
|
hasOwn,
|
|
117
127
|
throwSSRWarning,
|
|
118
|
-
ENV_OBJ
|
|
128
|
+
ENV_OBJ,
|
|
129
|
+
parseDataset
|
|
119
130
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nextTick } from '../next-tick'
|
|
2
|
+
import { parseDataset } from '../../../common/js'
|
|
2
3
|
|
|
3
4
|
let isInit = true
|
|
4
5
|
|
|
@@ -27,14 +28,16 @@ class WebIntersectionObserver {
|
|
|
27
28
|
if (!isInit || (isInit && (entry.intersectionRatio !== initialRatio && (this._minThreshold <= entry.intersectionRatio)))) {
|
|
28
29
|
Object.defineProperties(entry, {
|
|
29
30
|
id: {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
get () {
|
|
32
|
+
return entry.target.id || ''
|
|
33
|
+
},
|
|
32
34
|
enumerable: true,
|
|
33
35
|
configurable: true
|
|
34
36
|
},
|
|
35
37
|
dataset: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
get () {
|
|
39
|
+
return parseDataset(entry.target.dataset)
|
|
40
|
+
},
|
|
38
41
|
enumerable: true,
|
|
39
42
|
configurable: true
|
|
40
43
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import NodesRef from './NodesRef'
|
|
2
|
+
import { parseDataset } from '../../../common/js'
|
|
2
3
|
|
|
3
4
|
class SelectQuery {
|
|
4
5
|
constructor () {
|
|
@@ -82,7 +83,7 @@ class SelectQuery {
|
|
|
82
83
|
const res = {}
|
|
83
84
|
const isViewport = selector === 'html'
|
|
84
85
|
if (id) res.id = el.id
|
|
85
|
-
if (dataset) res.dataset =
|
|
86
|
+
if (dataset) res.dataset = parseDataset(el.dataset)
|
|
86
87
|
if (rect) {
|
|
87
88
|
if (isViewport) {
|
|
88
89
|
res.left = 0
|