@tagplus/components 5.3.6 → 5.3.8
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/es/components.css +132 -132
- package/dist/es/node_modules/element-plus/es/hooks/use-focus-controller/index.mjs +13 -7
- package/dist/es/node_modules/element-plus/es/utils/dom/aria.mjs +27 -0
- package/dist/es/src/components/Autosuggest/Autosuggest.vue.mjs +264 -267
- package/dist/es/src/components/Autosuggest/Multisuggest.vue.mjs +5 -3
- package/dist/es/src/components/Autosuggest/core.mjs +4 -4
- package/dist/es/src/components/Autosuggest/option.vue.mjs +1 -1
- package/dist/es/src/components/Autosuggest/select-dropdown.vue.mjs +2 -3
- package/dist/es/src/components/Autosuggest/useOption.mjs +2 -2
- package/dist/es/src/components/Autosuggest/useSelect.mjs +26 -23
- package/dist/es/src/components/Inline/Inline.vue.mjs +2 -2
- package/dist/es/src/components/InputNumber/InputNumber.vue.mjs +12 -18
- package/dist/es/src/components/InputNumber/input-number.mjs +1 -1
- package/dist/es/src/components/Loader/Loader.vue.mjs +2 -2
- package/dist/es/src/components/Money/Money.vue.mjs +2 -2
- package/dist/es/src/components/OptionsList/OptionsList.vue.mjs +1 -1
- package/dist/es/src/components/OptionsListItem/OptionsListItem.vue.mjs +1 -1
- package/dist/es/src/components/Percent/Percent.vue.mjs +2 -2
- package/dist/es/src/components/Skeleton/Skeleton.vue.mjs +1 -1
- package/dist/es/src/components/Step/Step.vue.mjs +1 -1
- package/dist/es/src/components/Steps/Steps.vue.mjs +1 -1
- package/dist/es/src/components/Tip/Tip.vue.mjs +5 -3
- package/dist/es/src/locale/i18nCreator.mjs +1 -1
- package/dist/es/src/plugins/currency.mjs +4 -6
- package/dist/es/src/utils/runtime.mjs +3 -3
- package/dist/es/src/utils/use-form-common-props.mjs +3 -3
- package/dist/es/src/utils/use-form-item.mjs +5 -6
- package/dist/es/src/utils/use-id.mjs +1 -1
- package/dist/es/src/utils/use-input.mjs +2 -2
- package/dist/lib/components.css +132 -132
- package/dist/lib/node_modules/element-plus/es/hooks/use-focus-controller/index.js +12 -6
- package/dist/lib/node_modules/element-plus/es/utils/dom/aria.js +27 -0
- package/dist/lib/src/components/Autosuggest/Autosuggest.vue.js +264 -267
- package/dist/lib/src/components/Autosuggest/Multisuggest.vue.js +5 -3
- package/dist/lib/src/components/Autosuggest/core.js +4 -4
- package/dist/lib/src/components/Autosuggest/option.vue.js +1 -1
- package/dist/lib/src/components/Autosuggest/select-dropdown.vue.js +2 -3
- package/dist/lib/src/components/Autosuggest/useOption.js +2 -2
- package/dist/lib/src/components/Autosuggest/useSelect.js +26 -23
- package/dist/lib/src/components/Inline/Inline.vue.js +2 -2
- package/dist/lib/src/components/InputNumber/InputNumber.vue.js +12 -18
- package/dist/lib/src/components/InputNumber/input-number.js +1 -1
- package/dist/lib/src/components/Loader/Loader.vue.js +2 -2
- package/dist/lib/src/components/Money/Money.vue.js +2 -2
- package/dist/lib/src/components/OptionsList/OptionsList.vue.js +1 -1
- package/dist/lib/src/components/OptionsListItem/OptionsListItem.vue.js +1 -1
- package/dist/lib/src/components/Percent/Percent.vue.js +2 -2
- package/dist/lib/src/components/Skeleton/Skeleton.vue.js +1 -1
- package/dist/lib/src/components/Step/Step.vue.js +1 -1
- package/dist/lib/src/components/Steps/Steps.vue.js +1 -1
- package/dist/lib/src/components/Tip/Tip.vue.js +5 -3
- package/dist/lib/src/locale/i18nCreator.js +1 -1
- package/dist/lib/src/plugins/currency.js +4 -6
- package/dist/lib/src/utils/runtime.js +3 -3
- package/dist/lib/src/utils/use-form-common-props.js +3 -3
- package/dist/lib/src/utils/use-form-item.js +5 -6
- package/dist/lib/src/utils/use-id.js +1 -1
- package/dist/lib/src/utils/use-input.js +2 -2
- package/package.json +28 -36
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { getCurrentInstance, shallowRef, ref, watch, onMounted } from "vue";
|
|
1
|
+
import { getCurrentInstance, shallowRef, ref, watch, unref, onMounted } from "vue";
|
|
2
2
|
import { useEventListener } from "../../../../@vueuse/core/index.mjs";
|
|
3
3
|
import { isElement } from "../../utils/types.mjs";
|
|
4
|
+
import { isFocusable } from "../../utils/dom/aria.mjs";
|
|
4
5
|
import { isFunction } from "../../../../@vue/shared/dist/shared.esm-bundler.mjs";
|
|
5
6
|
function useFocusController(target, {
|
|
7
|
+
disabled,
|
|
6
8
|
beforeFocus,
|
|
7
9
|
afterFocus,
|
|
8
10
|
beforeBlur,
|
|
@@ -14,7 +16,7 @@ function useFocusController(target, {
|
|
|
14
16
|
const isFocused = ref(false);
|
|
15
17
|
const handleFocus = (event) => {
|
|
16
18
|
const cancelFocus = isFunction(beforeFocus) ? beforeFocus(event) : false;
|
|
17
|
-
if (
|
|
19
|
+
if (unref(disabled) || isFocused.value || cancelFocus)
|
|
18
20
|
return;
|
|
19
21
|
isFocused.value = true;
|
|
20
22
|
emit("focus", event);
|
|
@@ -23,20 +25,24 @@ function useFocusController(target, {
|
|
|
23
25
|
const handleBlur = (event) => {
|
|
24
26
|
var _a;
|
|
25
27
|
const cancelBlur = isFunction(beforeBlur) ? beforeBlur(event) : false;
|
|
26
|
-
if (
|
|
28
|
+
if (unref(disabled) || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)) || cancelBlur)
|
|
27
29
|
return;
|
|
28
30
|
isFocused.value = false;
|
|
29
31
|
emit("blur", event);
|
|
30
32
|
afterBlur == null ? void 0 : afterBlur();
|
|
31
33
|
};
|
|
32
|
-
const handleClick = () => {
|
|
34
|
+
const handleClick = (event) => {
|
|
33
35
|
var _a, _b;
|
|
34
|
-
if (((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
|
|
36
|
+
if (unref(disabled) || isFocusable(event.target) || ((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
|
|
35
37
|
return;
|
|
36
38
|
(_b = target.value) == null ? void 0 : _b.focus();
|
|
37
39
|
};
|
|
38
|
-
watch(wrapperRef, (el) => {
|
|
39
|
-
if (el)
|
|
40
|
+
watch([wrapperRef, () => unref(disabled)], ([el, disabled2]) => {
|
|
41
|
+
if (!el)
|
|
42
|
+
return;
|
|
43
|
+
if (disabled2) {
|
|
44
|
+
el.removeAttribute("tabindex");
|
|
45
|
+
} else {
|
|
40
46
|
el.setAttribute("tabindex", "-1");
|
|
41
47
|
}
|
|
42
48
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const isFocusable = (element) => {
|
|
2
|
+
if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
switch (element.nodeName) {
|
|
9
|
+
case "A": {
|
|
10
|
+
return !!element.href && element.rel !== "ignore";
|
|
11
|
+
}
|
|
12
|
+
case "INPUT": {
|
|
13
|
+
return !(element.type === "hidden" || element.type === "file");
|
|
14
|
+
}
|
|
15
|
+
case "BUTTON":
|
|
16
|
+
case "SELECT":
|
|
17
|
+
case "TEXTAREA": {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
default: {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
isFocusable
|
|
27
|
+
};
|