j-component 1.4.7 → 1.4.9
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "j-component",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "miniprogram custom component framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"expr-parser": "^1.0.0",
|
|
49
49
|
"miniprogram-api-typings": "^3.2.2",
|
|
50
|
-
"miniprogram-exparser": "
|
|
50
|
+
"miniprogram-exparser": "latest"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/componentmanager.js
CHANGED
|
@@ -128,6 +128,15 @@ class ComponentManager {
|
|
|
128
128
|
const exparserNodes = this.shadowRoot.querySelectorAll(selector)
|
|
129
129
|
return exparserNodes.map(item => getSelectComponentResult(item))
|
|
130
130
|
}
|
|
131
|
+
caller.selectOwnerComponent = () => {
|
|
132
|
+
const ownerShadowRoot = this.ownerShadowRoot
|
|
133
|
+
if (!(ownerShadowRoot instanceof exparser.ShadowRoot)) return null
|
|
134
|
+
|
|
135
|
+
const exparserNode = ownerShadowRoot.getHostNode()
|
|
136
|
+
if (!exparserNode) return null
|
|
137
|
+
|
|
138
|
+
return getSelectComponentResult(exparserNode)
|
|
139
|
+
}
|
|
131
140
|
caller.createSelectorQuery = () => new SelectorQuery(caller)
|
|
132
141
|
caller.createIntersectionObserver = options => new IntersectionObserver(caller, options)
|
|
133
142
|
caller.setData = (data, callback) => {
|
package/src/render/component.js
CHANGED
|
@@ -60,10 +60,10 @@ function exparserTreeToJSON(node) {
|
|
|
60
60
|
let children = array
|
|
61
61
|
const vt = node._vt
|
|
62
62
|
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
if (node instanceof exparser.TextNode) {
|
|
64
|
+
array.push(node.textContent)
|
|
65
|
+
} else if (node instanceof exparser.Element) {
|
|
66
|
+
if (!node.__virtual) {
|
|
67
67
|
children = []
|
|
68
68
|
const child = {
|
|
69
69
|
tagName: _.getTagName(vt.componentId || vt.tagName) || vt.tagName,
|
|
@@ -78,10 +78,9 @@ function exparserTreeToJSON(node) {
|
|
|
78
78
|
})
|
|
79
79
|
array.push(child)
|
|
80
80
|
}
|
|
81
|
+
;(node.__wxSlotChildren || []).forEach(child => _inner(child, children))
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
(node.__wxSlotChildren || []).forEach(child => _inner(child, children))
|
|
84
|
-
|
|
85
84
|
return array
|
|
86
85
|
}
|
|
87
86
|
|