@domql/element 2.5.91 → 2.5.93
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/dist/cjs/methods/index.js +14 -6
- package/dist/cjs/utils/propEvents.js +3 -2
- package/methods/index.js +11 -5
- package/package.json +2 -2
- package/utils/component.js +1 -1
- package/utils/propEvents.js +3 -2
|
@@ -53,12 +53,20 @@ const spotByPath = function(path) {
|
|
|
53
53
|
}
|
|
54
54
|
return active;
|
|
55
55
|
};
|
|
56
|
-
const lookup = function(
|
|
57
|
-
const
|
|
58
|
-
let { parent } =
|
|
59
|
-
|
|
60
|
-
if (parent
|
|
61
|
-
return parent
|
|
56
|
+
const lookup = function(param) {
|
|
57
|
+
const el = this;
|
|
58
|
+
let { parent } = el;
|
|
59
|
+
if ((0, import_utils.isFunction)(param)) {
|
|
60
|
+
if (parent.state && param(parent, parent.state, parent.context))
|
|
61
|
+
return parent;
|
|
62
|
+
else if (parent.parent)
|
|
63
|
+
return parent.lookup(param);
|
|
64
|
+
else
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
while (parent.param !== param) {
|
|
68
|
+
if (parent[param])
|
|
69
|
+
return parent[param];
|
|
62
70
|
parent = parent.parent;
|
|
63
71
|
if (!parent)
|
|
64
72
|
return;
|
|
@@ -28,13 +28,14 @@ const propagateEventsFromProps = (element) => {
|
|
|
28
28
|
eventKeysFromProps.forEach((v) => {
|
|
29
29
|
const eventName = (0, import_utils.lowercaseFirstLetter)(v.split("on")[1]);
|
|
30
30
|
const origEvent = on[eventName];
|
|
31
|
+
const funcFromProps = props[v];
|
|
31
32
|
if ((0, import_utils.isFunction)(origEvent)) {
|
|
32
33
|
on[eventName] = (...args) => {
|
|
33
34
|
const originalEventRetunrs = origEvent(...args);
|
|
34
35
|
if (originalEventRetunrs !== false)
|
|
35
|
-
|
|
36
|
+
funcFromProps(...args);
|
|
36
37
|
};
|
|
37
38
|
} else
|
|
38
|
-
on[eventName] =
|
|
39
|
+
on[eventName] = funcFromProps;
|
|
39
40
|
});
|
|
40
41
|
};
|
package/methods/index.js
CHANGED
|
@@ -23,12 +23,18 @@ export const spotByPath = function (path) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// TODO: update these files
|
|
26
|
-
export const lookup = function (
|
|
27
|
-
const
|
|
28
|
-
let { parent } =
|
|
26
|
+
export const lookup = function (param) {
|
|
27
|
+
const el = this
|
|
28
|
+
let { parent } = el
|
|
29
|
+
|
|
30
|
+
if (isFunction(param)) {
|
|
31
|
+
if (parent.state && param(parent, parent.state, parent.context)) return parent
|
|
32
|
+
else if (parent.parent) return parent.lookup(param)
|
|
33
|
+
else return
|
|
34
|
+
}
|
|
29
35
|
|
|
30
|
-
while (parent.
|
|
31
|
-
if (parent[
|
|
36
|
+
while (parent.param !== param) {
|
|
37
|
+
if (parent[param]) return parent[param]
|
|
32
38
|
parent = parent.parent
|
|
33
39
|
if (!parent) return
|
|
34
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.93",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@domql/state": "latest",
|
|
32
32
|
"@domql/utils": "latest"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "6c5a9e10c74137700ad69ff9108b6ccc09745cc7",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/utils/component.js
CHANGED
|
@@ -73,7 +73,7 @@ export const extendizeByKey = (element, parent, key) => {
|
|
|
73
73
|
? key.split('+') // get array of componentKeys
|
|
74
74
|
: key.includes('_')
|
|
75
75
|
? key.split('_')[0] // get component key split _
|
|
76
|
-
: key.includes('.')
|
|
76
|
+
: key.includes('.') // TODO: add only Component.camelCase cases - avoud Component.Variant
|
|
77
77
|
? key.split('.')[0] // get component key split .
|
|
78
78
|
: [key]
|
|
79
79
|
|
package/utils/propEvents.js
CHANGED
|
@@ -8,11 +8,12 @@ export const propagateEventsFromProps = (element) => {
|
|
|
8
8
|
eventKeysFromProps.forEach(v => {
|
|
9
9
|
const eventName = lowercaseFirstLetter(v.split('on')[1])
|
|
10
10
|
const origEvent = on[eventName]
|
|
11
|
+
const funcFromProps = props[v]
|
|
11
12
|
if (isFunction(origEvent)) {
|
|
12
13
|
on[eventName] = (...args) => {
|
|
13
14
|
const originalEventRetunrs = origEvent(...args)
|
|
14
|
-
if (originalEventRetunrs !== false)
|
|
15
|
+
if (originalEventRetunrs !== false) funcFromProps(...args)
|
|
15
16
|
}
|
|
16
|
-
} else on[eventName] =
|
|
17
|
+
} else on[eventName] = funcFromProps
|
|
17
18
|
})
|
|
18
19
|
}
|