@v-c/util 1.0.11 → 1.0.12
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/Dom/focus.js +7 -5
- package/dist/dist/Dom/findDOMNode.js +17 -0
- package/dist/utils/set.js +1 -1
- package/package.json +1 -1
package/dist/Dom/focus.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getDOM } from "../dist/Dom/findDOMNode.js";
|
|
1
2
|
import isVisible_default from "./isVisible.js";
|
|
2
3
|
import { watch } from "vue";
|
|
3
4
|
function focusable(node, includePositive = false) {
|
|
@@ -87,11 +88,12 @@ function lockFocus(element) {
|
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
90
|
function useLockFocus(lock, getElement) {
|
|
90
|
-
watch(lock, (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
watch([lock, () => getElement()], ([nextLock, element], _o, onCleanup) => {
|
|
92
|
+
element = getDOM(element);
|
|
93
|
+
if (nextLock && element) onCleanup(lockFocus(element));
|
|
94
|
+
}, {
|
|
95
|
+
flush: "post",
|
|
96
|
+
immediate: true
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
99
|
export { getFocusNodeList, lockFocus, triggerFocus, useLockFocus };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { unref } from "vue";
|
|
2
|
+
function isDOM(node) {
|
|
3
|
+
return node instanceof HTMLElement || node instanceof SVGElement;
|
|
4
|
+
}
|
|
5
|
+
function getDOM(elementRef) {
|
|
6
|
+
const unrefElementRef = unref(elementRef);
|
|
7
|
+
const dom = findDOMNode(unrefElementRef) || (unrefElementRef && typeof unrefElementRef === "object" ? findDOMNode(unrefElementRef.nativeElement) : null);
|
|
8
|
+
if (dom && (dom.nodeType === 3 || dom.nodeType === 8) && dom.nextElementSibling) return dom.nextElementSibling;
|
|
9
|
+
return dom;
|
|
10
|
+
}
|
|
11
|
+
function findDOMNode(_node) {
|
|
12
|
+
const node = unref(_node);
|
|
13
|
+
if (isDOM(node)) return node;
|
|
14
|
+
else if (node && "$el" in node) return node.$el;
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
export { getDOM };
|
package/dist/utils/set.js
CHANGED
|
@@ -37,7 +37,7 @@ function mergeWith(sources, config = {}) {
|
|
|
37
37
|
if (isArr) clone = set(clone, path, finalPrepareArray(originValue, value));
|
|
38
38
|
else if (!originValue || typeof originValue !== "object") clone = set(clone, path, createEmpty(value));
|
|
39
39
|
keys(value).forEach((key) => {
|
|
40
|
-
if (Object
|
|
40
|
+
if (Object?.getOwnPropertyDescriptor?.(value, key)?.enumerable) internalMerge([...path, key], loopSet);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
} else clone = set(clone, path, value);
|