@sdata/web-vue 3.12.0 → 3.14.0
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/sd.css +288 -126
- package/dist/sd.min.css +43 -1
- package/es/_components/input-label/input-label.d.ts +2 -0
- package/es/_components/input-label/input-label.js +4 -2
- package/es/_components/input-label/style/index.css +2 -2
- package/es/_components/picker/input-range.vue.d.ts +6 -7
- package/es/_components/picker/input-range.vue_vue_type_script_setup_true_lang.js +63 -46
- package/es/_components/picker/input.vue.d.ts +5 -6
- package/es/_components/picker/input.vue_vue_type_script_setup_true_lang.js +52 -35
- package/es/_components/picker/style/index.scss +8 -2
- package/es/_components/resize-observer.js +1 -1
- package/es/_components/resize-trigger.vue_vue_type_script_setup_true_lang.js +9 -2
- package/es/_components/select-view/select-view.d.ts +2 -0
- package/es/_components/select-view/select-view.js +5 -1
- package/es/_components/select-view/style/index.css +5 -5
- package/es/_hooks/use-focus-trap.d.ts +10 -0
- package/es/_hooks/use-focus-trap.js +115 -0
- package/es/_hooks/use-readonly-tip.d.ts +11 -0
- package/es/_hooks/use-readonly-tip.js +66 -0
- package/es/_utils/dom.js +1 -10
- package/es/_utils/keyboard.d.ts +4 -0
- package/es/_utils/keyboard.js +21 -2
- package/es/alert/alert.vue.d.ts +2 -2
- package/es/alert/alert.vue_vue_type_script_setup_true_lang.js +12 -3
- package/es/alert/index.d.ts +5 -5
- package/es/alert/style/index.css +1 -1
- package/es/alert/style/index.scss +1 -1
- package/es/anchor/anchor-link.vue_vue_type_script_setup_true_lang.js +3 -1
- package/es/anchor/anchor.vue_vue_type_script_setup_true_lang.js +2 -0
- package/es/anchor/style/index.css +1 -1
- package/es/anchor/style/index.scss +3 -1
- package/es/auto-complete/auto-complete.d.ts +9 -0
- package/es/auto-complete/auto-complete.js +19 -1
- package/es/auto-complete/index.d.ts +15 -0
- package/es/avatar/avatar.vue_vue_type_script_setup_true_lang.js +8 -2
- package/es/avatar/style/index.css +2 -2
- package/es/avatar/style/index.scss +2 -2
- package/es/back-top/back-top.vue_vue_type_script_setup_true_lang.js +5 -1
- package/es/back-top/style/index.css +1 -1
- package/es/back-top/style/index.scss +2 -1
- package/es/badge/badge.js +4 -1
- package/es/badge/style/index.css +3 -3
- package/es/badge/style/index.scss +3 -3
- package/es/breadcrumb/breadcrumb.js +1 -0
- package/es/button/button.vue.d.ts +16 -7
- package/es/button/button.vue_vue_type_script_setup_true_lang.js +62 -31
- package/es/button/index.d.ts +11 -0
- package/es/button/interface.d.ts +2 -0
- package/es/button/style/index.css +15 -6
- package/es/button/style/index.scss +25 -7
- package/es/calendar/style/event.scss +2 -2
- package/es/calendar/style/index.css +2 -2
- package/es/card/card.d.ts +312 -0
- package/es/card/card.js +39 -7
- package/es/card/index.d.ts +616 -0
- package/es/card/style/index.css +26 -3
- package/es/card/style/index.scss +34 -3
- package/es/carousel/carousel-arrow.vue.d.ts +4 -4
- package/es/carousel/carousel-arrow.vue_vue_type_script_setup_true_lang.js +20 -4
- package/es/carousel/carousel-indicator.vue_vue_type_script_setup_true_lang.js +23 -4
- package/es/carousel/carousel-item.vue_vue_type_script_setup_true_lang.js +8 -1
- package/es/carousel/carousel.js +18 -1
- package/es/carousel/style/index.css +1 -1
- package/es/carousel/style/index.scss +1 -1
- package/es/cascader/cascader.vue.d.ts +9 -8
- package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +158 -128
- package/es/cascader/style/index.css +2 -2
- package/es/cascader/style/index.scss +3 -1
- package/es/cascader/types.d.ts +1 -0
- package/es/checkbox/checkbox-group.js +4 -1
- package/es/checkbox/checkbox.d.ts +9 -0
- package/es/checkbox/checkbox.js +14 -0
- package/es/checkbox/index.d.ts +15 -0
- package/es/checkbox/style/index.css +1 -1
- package/es/checkbox/style/index.scss +1 -1
- package/es/collapse/collapse-item.js +21 -3
- package/es/collapse/context.d.ts +1 -1
- package/es/color-picker/color-picker.d.ts +9 -0
- package/es/color-picker/color-picker.js +39 -11
- package/es/color-picker/index.d.ts +15 -0
- package/es/config-provider/context.d.ts +9 -9
- package/es/copy/copy.vue_vue_type_script_setup_true_lang.js +11 -3
- package/es/date-picker/index.d.ts +3 -6
- package/es/date-picker/panels/body.vue_vue_type_script_setup_true_lang.js +14 -1
- package/es/date-picker/picker.vue.d.ts +2 -3
- package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +6 -5
- package/es/date-picker/range-picker.vue.d.ts +2 -3
- package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +4 -4
- package/es/date-picker/style/index.css +5 -5
- package/es/date-picker/style/index.scss +4 -3
- package/es/drawer/drawer.vue.d.ts +1 -1
- package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +30 -9
- package/es/drawer/index.d.ts +3 -3
- package/es/dropdown/dropdown-option.vue_vue_type_script_setup_true_lang.js +5 -1
- package/es/dropdown/dropdown-panel.vue.d.ts +9 -0
- package/es/dropdown/dropdown-panel.vue_vue_type_script_setup_true_lang.js +75 -2
- package/es/dropdown/dropdown-submenu.vue_vue_type_script_setup_true_lang.js +5 -2
- package/es/dropdown/dropdown.vue_vue_type_script_setup_true_lang.js +4 -2
- package/es/dropdown/style/index.css +1 -1
- package/es/dropdown/style/index.scss +3 -1
- package/es/empty/empty.js +1 -1
- package/es/file-previewer/file-previewer.vue.d.ts +1 -1
- package/es/file-previewer/file-previewer.vue_vue_type_script_setup_true_lang.js +7 -3
- package/es/file-previewer/index.d.ts +3 -3
- package/es/form/context.d.ts +1 -0
- package/es/form/form-item.vue_vue_type_script_setup_true_lang.js +6 -2
- package/es/form/style/index.css +2 -2
- package/es/form/style/index.scss +2 -2
- package/es/image/image.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/image/preview-action.d.ts +7 -127
- package/es/image/preview.vue.d.ts +1 -1
- package/es/image/preview.vue_vue_type_script_setup_true_lang.js +3 -3
- package/es/index.css +288 -126
- package/es/index.js +3 -3
- package/es/input/index.d.ts +6 -6
- package/es/input/input.d.ts +3 -3
- package/es/input/input.js +34 -8
- package/es/input/style/index.css +2 -2
- package/es/input/style/input.scss +4 -4
- package/es/input-number/index.d.ts +9 -9
- package/es/input-number/input-number.d.ts +5 -5
- package/es/input-number/input-number.js +13 -9
- package/es/input-number/style/index.css +3 -3
- package/es/input-number/style/index.scss +5 -1
- package/es/input-tag/index.d.ts +9 -6
- package/es/input-tag/input-tag.d.ts +5 -3
- package/es/input-tag/input-tag.js +49 -36
- package/es/input-tag/style/index.css +8 -8
- package/es/input-tag/style/index.scss +11 -5
- package/es/layout/sider.vue_vue_type_script_setup_true_lang.js +31 -6
- package/es/layout/style/index.css +2 -2
- package/es/layout/style/index.scss +4 -2
- package/es/link/style/index.css +1 -1
- package/es/link/style/index.scss +3 -1
- package/es/locale/interface.d.ts +1 -0
- package/es/locale/lang/en-us.js +1 -0
- package/es/locale/lang/zh-cn.js +1 -0
- package/es/locale/lang/zh-tw.js +1 -0
- package/es/mention/index.d.ts +15 -0
- package/es/mention/mention.d.ts +9 -0
- package/es/mention/mention.js +20 -1
- package/es/menu/base-menu.vue_vue_type_script_setup_true_lang.js +30 -4
- package/es/menu/item.js +14 -1
- package/es/menu/style/index.css +6 -6
- package/es/menu/style/index.scss +5 -3
- package/es/message/style/index.css +3 -3
- package/es/message/style/index.scss +5 -3
- package/es/modal/index.d.ts +3 -3
- package/es/modal/modal.vue.d.ts +1 -1
- package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +30 -15
- package/es/modal/style/index.css +2 -2
- package/es/modal/style/index.scss +3 -2
- package/es/notification/style/index.css +3 -3
- package/es/notification/style/index.scss +11 -3
- package/es/page-header/page-header.vue.d.ts +6 -6
- package/es/page-header/page-header.vue_vue_type_script_setup_true_lang.js +12 -1
- package/es/pagination/page-item-ellipsis.vue_vue_type_script_setup_true_lang.js +12 -2
- package/es/pagination/page-item-step.vue.d.ts +2 -2
- package/es/pagination/page-item-step.vue_vue_type_script_setup_true_lang.js +19 -2
- package/es/pagination/page-item.vue.d.ts +2 -2
- package/es/pagination/page-item.vue_vue_type_script_setup_true_lang.js +21 -3
- package/es/pagination/pagination.js +6 -2
- package/es/pagination/style/index.css +6 -1
- package/es/pagination/style/index.scss +9 -3
- package/es/popconfirm/popconfirm.vue_vue_type_script_setup_true_lang.js +4 -2
- package/es/popover/popover.vue_vue_type_script_setup_true_lang.js +3 -1
- package/es/progress/style/index.css +2 -2
- package/es/progress/style/index.scss +5 -3
- package/es/qr-code/qr-code-status.vue_vue_type_script_setup_true_lang.js +5 -1
- package/es/qr-code/qr-code.vue_vue_type_script_setup_true_lang.js +11 -6
- package/es/radio/context.d.ts +1 -0
- package/es/radio/radio-group.js +6 -2
- package/es/radio/radio.js +1 -0
- package/es/radio/style/index.css +2 -2
- package/es/radio/style/index.scss +4 -2
- package/es/rate/index.d.ts +6 -6
- package/es/rate/rate.d.ts +3 -3
- package/es/rate/rate.js +42 -8
- package/es/resize-box/resize-box.vue.d.ts +4 -4
- package/es/resize-box/resize-box.vue_vue_type_script_setup_true_lang.js +30 -1
- package/es/result/result.vue_vue_type_script_setup_true_lang.js +7 -4
- package/es/scrollbar/style/index.css +57 -15
- package/es/scrollbar/style/index.scss +63 -15
- package/es/sd-vue.js +3 -3
- package/es/secret/secret.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/select/index.d.ts +139 -0
- package/es/select/select-dropdown.vue_vue_type_script_setup_true_lang.js +4 -1
- package/es/select/select.d.ts +71 -0
- package/es/select/select.js +45 -6
- package/es/select/style/index.css +1 -1
- package/es/select/style/index.scss +3 -1
- package/es/selectable-card/style/index.css +2 -2
- package/es/selectable-card/style/index.scss +5 -5
- package/es/skeleton/skeleton.vue_vue_type_script_setup_true_lang.js +5 -1
- package/es/slider/slider-button.vue.d.ts +2 -0
- package/es/slider/slider-button.vue_vue_type_script_setup_true_lang.js +7 -2
- package/es/slider/slider.vue_vue_type_script_setup_true_lang.js +23 -2
- package/es/slider/style/index.css +1 -1
- package/es/slider/style/index.scss +3 -1
- package/es/spin/spin.js +7 -2
- package/es/spin/style/index.css +1 -1
- package/es/spin/style/index.scss +1 -1
- package/es/split/split.vue.d.ts +4 -4
- package/es/split/split.vue_vue_type_script_setup_true_lang.js +27 -3
- package/es/steps/context.d.ts +1 -0
- package/es/steps/step.vue_vue_type_script_setup_true_lang.js +15 -2
- package/es/steps/steps.vue_vue_type_script_setup_true_lang.js +6 -1
- package/es/steps/style/index.css +1 -1
- package/es/steps/style/index.scss +1 -1
- package/es/style/animation/index.scss +1 -0
- package/es/style/animation/reduced-motion.scss +22 -0
- package/es/style/animation/zoom.scss +7 -6
- package/es/style/icon.scss +9 -1
- package/es/style/normalize.scss +68 -0
- package/es/switch/style/index.css +1 -1
- package/es/switch/style/index.scss +4 -1
- package/es/switch/switch.vue_vue_type_script_setup_true_lang.js +6 -1
- package/es/table/style/index.css +8 -8
- package/es/table/style/index.scss +11 -8
- package/es/table/table-operation-td.d.ts +15 -0
- package/es/table/table-tbody.js +4 -1
- package/es/table/table-td.js +2 -1
- package/es/table/table-th.js +6 -4
- package/es/table/table-thead.js +4 -1
- package/es/table/table-tr.js +4 -1
- package/es/table/table.js +6 -2
- package/es/tabs/context.d.ts +3 -0
- package/es/tabs/index.d.ts +32 -0
- package/es/tabs/style/index.css +34 -5
- package/es/tabs/style/index.scss +45 -7
- package/es/tabs/tab-pane.vue.d.ts +4 -2
- package/es/tabs/tab-pane.vue_vue_type_script_setup_true_lang.js +39 -4
- package/es/tabs/tabs-nav.js +34 -1
- package/es/tabs/tabs-tab.vue_vue_type_script_setup_true_lang.js +27 -4
- package/es/tabs/tabs.d.ts +19 -0
- package/es/tabs/tabs.js +25 -2
- package/es/tag/index.d.ts +5 -5
- package/es/tag/style/index.css +1 -1
- package/es/tag/style/index.scss +3 -1
- package/es/tag/tag.vue.d.ts +2 -2
- package/es/tag/tag.vue_vue_type_script_setup_true_lang.js +19 -2
- package/es/textarea/index.d.ts +15 -0
- package/es/textarea/style/index.css +2 -2
- package/es/textarea/textarea.vue.d.ts +11 -2
- package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +84 -47
- package/es/time-picker/index.d.ts +3 -6
- package/es/time-picker/panel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/time-picker/time-column.vue_vue_type_script_setup_true_lang.js +11 -3
- package/es/time-picker/time-picker.vue.d.ts +2 -3
- package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +12 -6
- package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/tooltip/index.d.ts +8 -127
- package/es/tooltip/interface.d.ts +17 -0
- package/es/tooltip/tooltip.vue.d.ts +5 -88
- package/es/tooltip/tooltip.vue_vue_type_script_setup_true_lang.js +9 -69
- package/es/tour/tour.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/transfer/style/index.css +1 -1
- package/es/transfer/style/index.scss +1 -1
- package/es/transfer/transfer-list-item.js +16 -2
- package/es/tree/base-node.vue_vue_type_script_setup_true_lang.js +27 -7
- package/es/tree/context.d.ts +2 -0
- package/es/tree/style/index.css +1 -1
- package/es/tree/style/index.scss +1 -1
- package/es/tree/tree.vue_vue_type_script_setup_true_lang.js +82 -3
- package/es/tree-select/tree-select.vue.d.ts +16 -10
- package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +165 -133
- package/es/trigger/index.d.ts +45 -0
- package/es/trigger/trigger.d.ts +27 -0
- package/es/trigger/trigger.js +47 -5
- package/es/typography/base.js +1 -1
- package/es/typography/edit-content.vue_vue_type_script_setup_true_lang.js +11 -8
- package/es/typography/operations.vue_vue_type_script_setup_true_lang.js +38 -6
- package/es/typography/style/index.css +2 -2
- package/es/typography/style/index.scss +2 -2
- package/es/upload/style/index.css +9 -9
- package/es/upload/style/index.scss +15 -9
- package/es/upload/upload-button.js +1 -1
- package/es/upload/upload-list-item.js +18 -5
- package/es/upload/upload-picture-item.js +25 -3
- package/es/verification-code/index.d.ts +15 -6
- package/es/verification-code/verification-code.d.ts +9 -3
- package/es/verification-code/verification-code.js +10 -2
- package/json/vetur-attributes.json +63 -7
- package/json/vetur-tags.json +23 -7
- package/json/web-types.json +131 -10
- package/package.json +1 -1
- package/es/style/base.scss +0 -18
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { off, on } from "../_utils/dom.js";
|
|
2
|
+
import { KEYBOARD_KEY } from "../_utils/keyboard.js";
|
|
3
|
+
import { onBeforeUnmount } from "vue";
|
|
4
|
+
//#region components/_hooks/use-focus-trap.ts
|
|
5
|
+
/**
|
|
6
|
+
* 可聚焦元素选择器(排除显式 tabindex="-1" 由 isFocusableElement 再过滤)
|
|
7
|
+
*/
|
|
8
|
+
var FOCUSABLE_SELECTOR = [
|
|
9
|
+
"a[href]",
|
|
10
|
+
"button:not([disabled])",
|
|
11
|
+
"textarea:not([disabled])",
|
|
12
|
+
"input:not([disabled])",
|
|
13
|
+
"select:not([disabled])",
|
|
14
|
+
"iframe",
|
|
15
|
+
"[contenteditable]:not([contenteditable=\"false\"])",
|
|
16
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
17
|
+
].join(",");
|
|
18
|
+
var isFocusableElement = (el) => {
|
|
19
|
+
if (el.hasAttribute("disabled")) return false;
|
|
20
|
+
if (el.getAttribute("tabindex") === "-1") return false;
|
|
21
|
+
if (el.getAttribute("aria-hidden") === "true") return false;
|
|
22
|
+
const style = window.getComputedStyle(el);
|
|
23
|
+
if (style.display === "none" || style.visibility === "hidden") return false;
|
|
24
|
+
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 取容器内当前可见、可聚焦的元素列表(顺序即 DOM 顺序)。
|
|
28
|
+
*/
|
|
29
|
+
var getFocusableElements = (container) => {
|
|
30
|
+
const nodes = container.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
31
|
+
return Array.from(nodes).filter(isFocusableElement);
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 对话框/抽屉等弹层的焦点陷阱。
|
|
35
|
+
*
|
|
36
|
+
* - activate 时缓存 `document.activeElement`(通常是触发器),并把焦点移入容器;
|
|
37
|
+
* - 激活期间 Tab / Shift+Tab 在容器内循环,不会逃逸到背后的页面;
|
|
38
|
+
* - deactivate 时还原焦点到触发器。
|
|
39
|
+
*
|
|
40
|
+
* 不自动监听可见性,调用方应在弹层的 open/close 时机(如 transition 的
|
|
41
|
+
* after-enter / after-leave)显式调用 activate / deactivate。
|
|
42
|
+
*/
|
|
43
|
+
var useFocusTrap = (containerRef, options) => {
|
|
44
|
+
let savedFocus = null;
|
|
45
|
+
const handleKeydown = (ev) => {
|
|
46
|
+
if (ev.key !== KEYBOARD_KEY.TAB) return;
|
|
47
|
+
const container = containerRef.value;
|
|
48
|
+
if (!container) return;
|
|
49
|
+
const focusables = getFocusableElements(container);
|
|
50
|
+
if (focusables.length === 0) {
|
|
51
|
+
ev.preventDefault();
|
|
52
|
+
container.focus();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const first = focusables[0];
|
|
56
|
+
const last = focusables[focusables.length - 1];
|
|
57
|
+
const active = document.activeElement;
|
|
58
|
+
const atEdge = (el) => !container.contains(el) || el === container;
|
|
59
|
+
if (ev.shiftKey) {
|
|
60
|
+
if (active === first || atEdge(active)) {
|
|
61
|
+
ev.preventDefault();
|
|
62
|
+
last.focus();
|
|
63
|
+
}
|
|
64
|
+
} else if (active === last || atEdge(active)) {
|
|
65
|
+
ev.preventDefault();
|
|
66
|
+
first.focus();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
let focusRetryHandle = 0;
|
|
70
|
+
const focusIntoContainer = () => {
|
|
71
|
+
var _options$initialFocus;
|
|
72
|
+
const container = containerRef.value;
|
|
73
|
+
if (!container) return false;
|
|
74
|
+
const preferred = options === null || options === void 0 || (_options$initialFocus = options.initialFocus) === null || _options$initialFocus === void 0 ? void 0 : _options$initialFocus.call(options, container);
|
|
75
|
+
if (preferred) {
|
|
76
|
+
preferred.focus();
|
|
77
|
+
if (document.activeElement === preferred) return true;
|
|
78
|
+
}
|
|
79
|
+
const focusables = getFocusableElements(container);
|
|
80
|
+
if (focusables.length > 0) {
|
|
81
|
+
focusables[0].focus();
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
container.focus();
|
|
85
|
+
return document.activeElement === container;
|
|
86
|
+
};
|
|
87
|
+
const activate = () => {
|
|
88
|
+
var _document$activeEleme;
|
|
89
|
+
savedFocus = (_document$activeEleme = document.activeElement) !== null && _document$activeEleme !== void 0 ? _document$activeEleme : null;
|
|
90
|
+
on(document.documentElement, "keydown", handleKeydown, true);
|
|
91
|
+
if (focusIntoContainer()) return;
|
|
92
|
+
const retry = () => {
|
|
93
|
+
if (focusIntoContainer()) return;
|
|
94
|
+
focusRetryHandle = requestAnimationFrame(retry);
|
|
95
|
+
};
|
|
96
|
+
focusRetryHandle = requestAnimationFrame(retry);
|
|
97
|
+
};
|
|
98
|
+
const deactivate = () => {
|
|
99
|
+
if (focusRetryHandle) {
|
|
100
|
+
cancelAnimationFrame(focusRetryHandle);
|
|
101
|
+
focusRetryHandle = 0;
|
|
102
|
+
}
|
|
103
|
+
off(document.documentElement, "keydown", handleKeydown, true);
|
|
104
|
+
const target = savedFocus;
|
|
105
|
+
savedFocus = null;
|
|
106
|
+
if (target && typeof target.focus === "function") target.focus();
|
|
107
|
+
};
|
|
108
|
+
onBeforeUnmount(deactivate);
|
|
109
|
+
return {
|
|
110
|
+
activate,
|
|
111
|
+
deactivate
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { getFocusableElements, useFocusTrap };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export declare const isReadonlyModificationKey: (e: KeyboardEvent) => boolean;
|
|
3
|
+
export interface UseReadonlyTipOptions {
|
|
4
|
+
duration?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const useReadonlyTip: (readonly: Ref<boolean | string | undefined>, disabled: Ref<boolean>, options?: UseReadonlyTipOptions) => {
|
|
7
|
+
tipVisible: Ref<boolean, boolean>;
|
|
8
|
+
show: () => void;
|
|
9
|
+
hide: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const useReadonlyTipText: (readonly: Ref<boolean | string | undefined>) => import("vue").ComputedRef<string>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useI18n } from "../locale/index.js";
|
|
2
|
+
import { computed, onBeforeUnmount, ref } from "vue";
|
|
3
|
+
//#region components/_hooks/use-readonly-tip.ts
|
|
4
|
+
var DEFAULT_DURATION = 2e3;
|
|
5
|
+
/**
|
|
6
|
+
* @zh 判断按键是否会修改输入框的值,用于在只读状态下提示用户
|
|
7
|
+
* @en Whether the keystroke would modify the input value, used to prompt the user in readonly state
|
|
8
|
+
* @param e
|
|
9
|
+
*/
|
|
10
|
+
var isReadonlyModificationKey = (e) => {
|
|
11
|
+
const { key, ctrlKey, metaKey, altKey } = e;
|
|
12
|
+
if ((ctrlKey || metaKey) && (key === "v" || key === "V" || key === "x" || key === "X")) return true;
|
|
13
|
+
if (ctrlKey || metaKey || altKey) return false;
|
|
14
|
+
return key.length === 1 || key === "Backspace" || key === "Delete";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @zh 只读模式提示。在用户尝试修改只读组件时短暂显示 tooltip,每次新的修改尝试都会重置隐藏计时器。
|
|
18
|
+
* @en Readonly tip. Briefly shows a tooltip when the user attempts to modify a readonly component;
|
|
19
|
+
* each new attempt resets the hide timer.
|
|
20
|
+
* @param readonly
|
|
21
|
+
* @param disabled
|
|
22
|
+
* @param options
|
|
23
|
+
*/
|
|
24
|
+
var useReadonlyTip = (readonly, disabled, options) => {
|
|
25
|
+
var _options$duration;
|
|
26
|
+
const duration = (_options$duration = options === null || options === void 0 ? void 0 : options.duration) !== null && _options$duration !== void 0 ? _options$duration : DEFAULT_DURATION;
|
|
27
|
+
const tipVisible = ref(false);
|
|
28
|
+
let timer = null;
|
|
29
|
+
const hide = () => {
|
|
30
|
+
if (timer) {
|
|
31
|
+
clearTimeout(timer);
|
|
32
|
+
timer = null;
|
|
33
|
+
}
|
|
34
|
+
tipVisible.value = false;
|
|
35
|
+
};
|
|
36
|
+
const show = () => {
|
|
37
|
+
if (!readonly.value || disabled.value) return;
|
|
38
|
+
if (timer) clearTimeout(timer);
|
|
39
|
+
tipVisible.value = true;
|
|
40
|
+
timer = setTimeout(() => {
|
|
41
|
+
tipVisible.value = false;
|
|
42
|
+
timer = null;
|
|
43
|
+
}, duration);
|
|
44
|
+
};
|
|
45
|
+
onBeforeUnmount(hide);
|
|
46
|
+
return {
|
|
47
|
+
tipVisible,
|
|
48
|
+
show,
|
|
49
|
+
hide
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* @zh 获取只读提示文案:readonly 为字符串时直接使用该字符串,否则取自 i18n 的 `readonlyTip`(缺失时回退英文)
|
|
54
|
+
* @en Returns the readonly tip text: if `readonly` is a string, use it directly;
|
|
55
|
+
* otherwise fall back to i18n `readonlyTip` (English when missing).
|
|
56
|
+
*/
|
|
57
|
+
var useReadonlyTipText = (readonly) => {
|
|
58
|
+
const { t } = useI18n();
|
|
59
|
+
return computed(() => {
|
|
60
|
+
if (typeof readonly.value === "string") return readonly.value;
|
|
61
|
+
const text = t("readonlyTip");
|
|
62
|
+
return text === "readonlyTip" ? "Read-only mode" : text;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { isReadonlyModificationKey, useReadonlyTip, useReadonlyTipText };
|
package/es/_utils/dom.js
CHANGED
|
@@ -32,15 +32,6 @@ var off = (() => {
|
|
|
32
32
|
element.removeEventListener(type, handler, options);
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var contains = (root, ele) => {
|
|
36
|
-
if (!root || !ele) return false;
|
|
37
|
-
let node = ele;
|
|
38
|
-
while (node) {
|
|
39
|
-
if (node === root) return true;
|
|
40
|
-
node = node.parentNode;
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
};
|
|
44
35
|
var getOverlay = (type) => {
|
|
45
36
|
const popper = document.createElement("div");
|
|
46
37
|
popper.setAttribute("class", `sd-overlay sd-overlay-${type}`);
|
|
@@ -79,4 +70,4 @@ var getScrollBarWidth = (element) => {
|
|
|
79
70
|
return element.tagName === "BODY" ? window.innerWidth - getDocumentSize().width : element.offsetWidth - element.clientWidth;
|
|
80
71
|
};
|
|
81
72
|
//#endregion
|
|
82
|
-
export { NOOP,
|
|
73
|
+
export { NOOP, getDocumentSize, getElement, getOverlay, getRelativeRect, getScrollBarWidth, isScroll, isServerRendering, off, on, querySelector };
|
package/es/_utils/keyboard.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare const KEYBOARD_KEY: {
|
|
|
8
8
|
ARROW_DOWN: string;
|
|
9
9
|
ARROW_LEFT: string;
|
|
10
10
|
ARROW_RIGHT: string;
|
|
11
|
+
HOME: string;
|
|
12
|
+
END: string;
|
|
11
13
|
};
|
|
12
14
|
export interface CodeKey {
|
|
13
15
|
key: string;
|
|
@@ -16,4 +18,6 @@ export interface CodeKey {
|
|
|
16
18
|
alt?: boolean;
|
|
17
19
|
meta?: boolean;
|
|
18
20
|
}
|
|
21
|
+
export declare const isActivationKey: (e: KeyboardEvent) => boolean;
|
|
22
|
+
export declare const onActivate: (fn: (e: KeyboardEvent) => void, guard?: (e: KeyboardEvent) => boolean) => (e: KeyboardEvent) => void;
|
|
19
23
|
export declare const getKeyDownHandler: (codeKeyMap: Map<CodeKey | string, (e: Event) => void>) => (event: KeyboardEvent) => void;
|
package/es/_utils/keyboard.js
CHANGED
|
@@ -9,7 +9,9 @@ var KEYBOARD_KEY = {
|
|
|
9
9
|
ARROW_UP: "ArrowUp",
|
|
10
10
|
ARROW_DOWN: "ArrowDown",
|
|
11
11
|
ARROW_LEFT: "ArrowLeft",
|
|
12
|
-
ARROW_RIGHT: "ArrowRight"
|
|
12
|
+
ARROW_RIGHT: "ArrowRight",
|
|
13
|
+
HOME: "Home",
|
|
14
|
+
END: "End"
|
|
13
15
|
};
|
|
14
16
|
var stringifyCodeKey = (k) => {
|
|
15
17
|
return JSON.stringify({
|
|
@@ -20,6 +22,23 @@ var stringifyCodeKey = (k) => {
|
|
|
20
22
|
meta: Boolean(k.meta)
|
|
21
23
|
});
|
|
22
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* 是否为「激活键」(Enter / Space)。供 role="button" 等非原生可交互元素复用,
|
|
27
|
+
* 避免在各组件里硬编码 `e.key === 'Enter' || e.key === ' '`(注意 Space 的 key 是 ' ')。
|
|
28
|
+
*/
|
|
29
|
+
var isActivationKey = (e) => e.key === KEYBOARD_KEY.ENTER || e.key === KEYBOARD_KEY.SPACE;
|
|
30
|
+
/**
|
|
31
|
+
* 生成「Enter / Space 激活」的 keydown 处理器:命中激活键时 preventDefault
|
|
32
|
+
* (避免 Space 触发页面滚动)并调用 `fn`。可选 `guard` 返回 false 时跳过(禁用态等)。
|
|
33
|
+
*
|
|
34
|
+
* @example @keydown="onActivate(handleClose)"
|
|
35
|
+
*/
|
|
36
|
+
var onActivate = (fn, guard) => (e) => {
|
|
37
|
+
if (!isActivationKey(e)) return;
|
|
38
|
+
if (guard && !guard(e)) return;
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
fn(e);
|
|
41
|
+
};
|
|
23
42
|
var getKeyDownHandler = (codeKeyMap) => {
|
|
24
43
|
const map = {};
|
|
25
44
|
codeKeyMap.forEach((callback, codeKey) => {
|
|
@@ -41,4 +60,4 @@ var getKeyDownHandler = (codeKeyMap) => {
|
|
|
41
60
|
};
|
|
42
61
|
};
|
|
43
62
|
//#endregion
|
|
44
|
-
export { KEYBOARD_KEY, getKeyDownHandler };
|
|
63
|
+
export { KEYBOARD_KEY, getKeyDownHandler, isActivationKey, onActivate };
|
package/es/alert/alert.vue.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
35
35
|
default: boolean;
|
|
36
36
|
};
|
|
37
37
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
38
|
-
close: (_ev:
|
|
38
|
+
close: (_ev: Event) => any;
|
|
39
39
|
afterClose: () => any;
|
|
40
40
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
41
41
|
type: {
|
|
@@ -60,7 +60,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
60
60
|
default: boolean;
|
|
61
61
|
};
|
|
62
62
|
}>> & Readonly<{
|
|
63
|
-
onClose?: ((_ev:
|
|
63
|
+
onClose?: ((_ev: Event) => any) | undefined;
|
|
64
64
|
onAfterClose?: (() => any) | undefined;
|
|
65
65
|
}>, {
|
|
66
66
|
type: "normal" | "success" | "warning" | "info" | "error";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { getPrefixCls } from "../_utils/global-config.js";
|
|
3
3
|
import icon_hover_default from "../_components/icon-hover.js";
|
|
4
|
+
import { isActivationKey } from "../_utils/keyboard.js";
|
|
4
5
|
import IconCheckCircleFill from "../icon/icon-check-circle-fill/index.js";
|
|
5
6
|
import IconClose from "../icon/icon-close/index.js";
|
|
6
7
|
import IconCloseCircleFill from "../icon/icon-close-circle-fill/index.js";
|
|
@@ -90,6 +91,12 @@ var alert_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
90
91
|
visible.value = false;
|
|
91
92
|
emit("close", ev);
|
|
92
93
|
};
|
|
94
|
+
const onCloseKeydown = (ev) => {
|
|
95
|
+
if (isActivationKey(ev)) {
|
|
96
|
+
ev.preventDefault();
|
|
97
|
+
handleClose(ev);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
93
100
|
const handleAfterLeave = () => {
|
|
94
101
|
emit("afterClose");
|
|
95
102
|
};
|
|
@@ -114,6 +121,7 @@ var alert_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
114
121
|
}, [
|
|
115
122
|
__props.showIcon && !(__props.type === "normal" && !_ctx.$slots.icon) ? (openBlock(), createElementBlock("div", {
|
|
116
123
|
key: 0,
|
|
124
|
+
"aria-hidden": "true",
|
|
117
125
|
class: normalizeClass(`${unref(prefixCls)}-icon`)
|
|
118
126
|
}, [renderSlot(_ctx.$slots, "icon", {}, () => [__props.type === "info" ? (openBlock(), createBlock(unref(IconInfoCircleFill), { key: 0 })) : __props.type === "success" ? (openBlock(), createBlock(unref(IconCheckCircleFill), { key: 1 })) : __props.type === "warning" ? (openBlock(), createBlock(unref(IconExclamationCircleFill), { key: 2 })) : __props.type === "error" ? (openBlock(), createBlock(unref(IconCloseCircleFill), { key: 3 })) : createCommentVNode("", true)])], 2)) : createCommentVNode("", true),
|
|
119
127
|
createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-body`) }, [__props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
|
|
@@ -126,15 +134,16 @@ var alert_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
126
134
|
}, [renderSlot(_ctx.$slots, "action")], 2)) : createCommentVNode("", true),
|
|
127
135
|
__props.closable ? (openBlock(), createElementBlock("div", {
|
|
128
136
|
key: 2,
|
|
129
|
-
tabindex: "
|
|
137
|
+
tabindex: "0",
|
|
130
138
|
role: "button",
|
|
131
139
|
"aria-label": "Close",
|
|
132
140
|
class: normalizeClass(`${unref(prefixCls)}-close-btn`),
|
|
133
|
-
onClick: handleClose
|
|
141
|
+
onClick: handleClose,
|
|
142
|
+
onKeydown: onCloseKeydown
|
|
134
143
|
}, [renderSlot(_ctx.$slots, "close-element", {}, () => [createVNode(icon_hover_default, null, {
|
|
135
144
|
default: withCtx(() => [createVNode(unref(IconClose))]),
|
|
136
145
|
_: 1
|
|
137
|
-
})])],
|
|
146
|
+
})])], 34)) : createCommentVNode("", true)
|
|
138
147
|
], 2)) : createCommentVNode("", true)]),
|
|
139
148
|
_: 3
|
|
140
149
|
});
|
package/es/alert/index.d.ts
CHANGED
|
@@ -25,10 +25,10 @@ declare const Alert: {
|
|
|
25
25
|
default: boolean;
|
|
26
26
|
};
|
|
27
27
|
}>> & Readonly<{
|
|
28
|
-
onClose?: ((_ev:
|
|
28
|
+
onClose?: ((_ev: Event) => any) | undefined;
|
|
29
29
|
onAfterClose?: (() => any) | undefined;
|
|
30
30
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
|
-
close: (_ev:
|
|
31
|
+
close: (_ev: Event) => any;
|
|
32
32
|
afterClose: () => any;
|
|
33
33
|
}, import("vue").PublicProps, {
|
|
34
34
|
type: "normal" | "success" | "warning" | "info" | "error";
|
|
@@ -66,7 +66,7 @@ declare const Alert: {
|
|
|
66
66
|
default: boolean;
|
|
67
67
|
};
|
|
68
68
|
}>> & Readonly<{
|
|
69
|
-
onClose?: ((_ev:
|
|
69
|
+
onClose?: ((_ev: Event) => any) | undefined;
|
|
70
70
|
onAfterClose?: (() => any) | undefined;
|
|
71
71
|
}>, {}, {}, {}, {}, {
|
|
72
72
|
type: "normal" | "success" | "warning" | "info" | "error";
|
|
@@ -101,10 +101,10 @@ declare const Alert: {
|
|
|
101
101
|
default: boolean;
|
|
102
102
|
};
|
|
103
103
|
}>> & Readonly<{
|
|
104
|
-
onClose?: ((_ev:
|
|
104
|
+
onClose?: ((_ev: Event) => any) | undefined;
|
|
105
105
|
onAfterClose?: (() => any) | undefined;
|
|
106
106
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
107
|
-
close: (_ev:
|
|
107
|
+
close: (_ev: Event) => any;
|
|
108
108
|
afterClose: () => any;
|
|
109
109
|
}, string, {
|
|
110
110
|
type: "normal" | "success" | "warning" | "info" | "error";
|
package/es/alert/style/index.css
CHANGED
|
@@ -177,7 +177,7 @@ $alert-prefix-cls: string.unquote('#{theme.$prefix}-alert');
|
|
|
177
177
|
border: none;
|
|
178
178
|
outline: none;
|
|
179
179
|
cursor: pointer;
|
|
180
|
-
transition: color theme.$transition-duration-1 theme.$transition-timing-function-
|
|
180
|
+
transition: color theme.$transition-duration-1 theme.$transition-timing-function-standard;
|
|
181
181
|
|
|
182
182
|
&:hover {
|
|
183
183
|
color: $alert-color-close-icon_hover;
|
|
@@ -3,7 +3,7 @@ import { getPrefixCls } from "../_utils/global-config.js";
|
|
|
3
3
|
import { anchorInjectionKey } from "./context.js";
|
|
4
4
|
import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, inject, normalizeClass, onMounted, openBlock, ref, renderSlot, toDisplayString, unref } from "vue";
|
|
5
5
|
//#region components/anchor/anchor-link.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var _hoisted_1 = ["href"];
|
|
6
|
+
var _hoisted_1 = ["href", "aria-current"];
|
|
7
7
|
var anchor_link_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, { name: "AnchorLink" }), {}, {
|
|
8
8
|
__name: "anchor-link",
|
|
9
9
|
props: {
|
|
@@ -30,6 +30,7 @@ var anchor_link_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
30
30
|
const cls = computed(() => [`${linkCls}-item`, { [`${linkCls}-active`]: (context === null || context === void 0 ? void 0 : context.currentLink) === props.href }]);
|
|
31
31
|
const handleClick = (e) => context === null || context === void 0 ? void 0 : context.handleClick(e, props.href);
|
|
32
32
|
return (_ctx, _cache) => {
|
|
33
|
+
var _unref2;
|
|
33
34
|
return openBlock(), createElementBlock("li", {
|
|
34
35
|
ref_key: "linkRef",
|
|
35
36
|
ref: linkRef,
|
|
@@ -37,6 +38,7 @@ var anchor_link_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
37
38
|
}, [createElementVNode("a", {
|
|
38
39
|
class: normalizeClass(linkCls),
|
|
39
40
|
href: __props.href,
|
|
41
|
+
"aria-current": ((_unref2 = unref(context)) === null || _unref2 === void 0 ? void 0 : _unref2.currentLink) === props.href ? "location" : void 0,
|
|
40
42
|
onClick: handleClick
|
|
41
43
|
}, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 8, _hoisted_1), _ctx.$slots.sublist ? (openBlock(), createElementBlock("ul", {
|
|
42
44
|
key: 0,
|
|
@@ -232,6 +232,8 @@ var anchor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
232
232
|
default: withCtx(() => [createElementVNode("div", {
|
|
233
233
|
ref_key: "anchorRef",
|
|
234
234
|
ref: anchorRef,
|
|
235
|
+
role: "navigation",
|
|
236
|
+
"aria-label": "Anchor navigation",
|
|
235
237
|
class: normalizeClass(cls.value)
|
|
236
238
|
}, [!__props.lineLess ? (openBlock(), createElementBlock("div", {
|
|
237
239
|
key: 0,
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
.sd-anchor-link-active > .sd-anchor-link {
|
|
79
79
|
color: var(--sd-color-text-1);
|
|
80
80
|
font-weight: 500;
|
|
81
|
-
transition:
|
|
81
|
+
transition: color 0.1s cubic-bezier(0.34, 0.69, 0.1, 1), background-color 0.1s cubic-bezier(0.34, 0.69, 0.1, 1);
|
|
82
82
|
}
|
|
83
83
|
.sd-anchor-link-item .sd-anchor-link-item {
|
|
84
84
|
margin-left: 16px;
|
|
@@ -79,7 +79,9 @@ $anchor-prefix-cls: string.unquote('#{theme.$prefix}-anchor');
|
|
|
79
79
|
&-link-active > &-link {
|
|
80
80
|
color: $anchor-color-title_active;
|
|
81
81
|
font-weight: $anchor-font-weight-title_active;
|
|
82
|
-
transition:
|
|
82
|
+
transition:
|
|
83
|
+
color theme.$transition-duration-1 theme.$transition-timing-function-standard,
|
|
84
|
+
background-color theme.$transition-duration-1 theme.$transition-timing-function-standard;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
&-link-item &-link-item {
|
|
@@ -15,6 +15,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
15
15
|
type: BooleanConstructor;
|
|
16
16
|
default: boolean;
|
|
17
17
|
};
|
|
18
|
+
readonly: {
|
|
19
|
+
type: (StringConstructor | BooleanConstructor)[];
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
18
22
|
data: {
|
|
19
23
|
type: PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
|
|
20
24
|
default: () => never[];
|
|
@@ -67,6 +71,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
71
|
type: BooleanConstructor;
|
|
68
72
|
default: boolean;
|
|
69
73
|
};
|
|
74
|
+
readonly: {
|
|
75
|
+
type: (StringConstructor | BooleanConstructor)[];
|
|
76
|
+
default: boolean;
|
|
77
|
+
};
|
|
70
78
|
data: {
|
|
71
79
|
type: PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
|
|
72
80
|
default: () => never[];
|
|
@@ -101,6 +109,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
101
109
|
onDropdownScroll?: ((_ev: Event) => any) | undefined;
|
|
102
110
|
onDropdownReachBottom?: ((_ev: Event) => any) | undefined;
|
|
103
111
|
}>, {
|
|
112
|
+
readonly: string | boolean;
|
|
104
113
|
data: (string | number | SelectOptionData | SelectOptionGroup)[];
|
|
105
114
|
disabled: boolean;
|
|
106
115
|
defaultValue: string;
|
|
@@ -5,11 +5,11 @@ import virtual_list_default from "../_components/virtual-list/index.js";
|
|
|
5
5
|
import { useAllowClear } from "../_hooks/use-allow-clear.js";
|
|
6
6
|
import { useDropdownVirtualListProps } from "../_hooks/use-dropdown-virtual-list-props.js";
|
|
7
7
|
import { resolveDropdownVirtualListProps } from "../_utils/virtual-dropdown.js";
|
|
8
|
+
import Trigger from "../trigger/index.js";
|
|
8
9
|
import Input from "../input/index.js";
|
|
9
10
|
import { getKeyFromValue } from "../select/utils.js";
|
|
10
11
|
import { useSelect } from "../select/hooks/use-select.js";
|
|
11
12
|
import select_dropdown_default from "../select/select-dropdown.js";
|
|
12
|
-
import Trigger from "../trigger/index.js";
|
|
13
13
|
import { computed, createVNode, defineComponent, mergeProps, ref, toRef, toRefs, watch } from "vue";
|
|
14
14
|
//#region components/auto-complete/auto-complete.tsx
|
|
15
15
|
var DEFAULT_AUTOCOMPLETE_VIRTUAL_ITEM_SIZE = 36;
|
|
@@ -43,6 +43,14 @@ var auto_complete_default = /* @__PURE__ */ defineComponent({
|
|
|
43
43
|
default: false
|
|
44
44
|
},
|
|
45
45
|
/**
|
|
46
|
+
* @zh 是否为只读状态
|
|
47
|
+
* @en Whether it is read-only
|
|
48
|
+
*/
|
|
49
|
+
readonly: {
|
|
50
|
+
type: [Boolean, String],
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
46
54
|
* @zh 用于自动提示的数据
|
|
47
55
|
* @en Data used for auto-complete
|
|
48
56
|
*/
|
|
@@ -185,6 +193,7 @@ var auto_complete_default = /* @__PURE__ */ defineComponent({
|
|
|
185
193
|
return resolveDropdownVirtualListProps(mergedDropdownVirtualListProps.value, props.triggerProps, DEFAULT_AUTOCOMPLETE_VIRTUAL_ITEM_SIZE);
|
|
186
194
|
});
|
|
187
195
|
const handlePopupVisibleChange = (popupVisible) => {
|
|
196
|
+
if (popupVisible && props.readonly) return;
|
|
188
197
|
_popupVisible.value = popupVisible;
|
|
189
198
|
};
|
|
190
199
|
const strictFilterOption = (inputValue, option) => {
|
|
@@ -265,6 +274,8 @@ var auto_complete_default = /* @__PURE__ */ defineComponent({
|
|
|
265
274
|
},
|
|
266
275
|
"key": item.key,
|
|
267
276
|
"class": cls,
|
|
277
|
+
"role": "option",
|
|
278
|
+
"aria-disabled": item.disabled || void 0,
|
|
268
279
|
"onClick": (ev) => {
|
|
269
280
|
if (!item.disabled) handleSelect(item.key, ev);
|
|
270
281
|
},
|
|
@@ -308,6 +319,13 @@ var auto_complete_default = /* @__PURE__ */ defineComponent({
|
|
|
308
319
|
"allowClear": mergedAllowClear.value,
|
|
309
320
|
"modelValue": computedValue.value,
|
|
310
321
|
"disabled": mergedDisabled.value,
|
|
322
|
+
"readonly": props.readonly,
|
|
323
|
+
"inputAttrs": {
|
|
324
|
+
"role": "combobox",
|
|
325
|
+
"aria-haspopup": "listbox",
|
|
326
|
+
"aria-expanded": computedPopupVisible.value,
|
|
327
|
+
"aria-autocomplete": "list"
|
|
328
|
+
},
|
|
311
329
|
"onInput": handleInputValueChange,
|
|
312
330
|
"onClear": handleClear
|
|
313
331
|
}, { onKeydown: handleKeyDown }), slots)],
|
|
@@ -24,6 +24,10 @@ declare const AutoComplete: {
|
|
|
24
24
|
type: BooleanConstructor;
|
|
25
25
|
default: boolean;
|
|
26
26
|
};
|
|
27
|
+
readonly: {
|
|
28
|
+
type: (StringConstructor | BooleanConstructor)[];
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
27
31
|
data: {
|
|
28
32
|
type: import("vue").PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
|
|
29
33
|
default: () => never[];
|
|
@@ -72,6 +76,7 @@ declare const AutoComplete: {
|
|
|
72
76
|
dropdownScroll: (_ev: Event) => true;
|
|
73
77
|
dropdownReachBottom: (_ev: Event) => true;
|
|
74
78
|
}, import("vue").PublicProps, {
|
|
79
|
+
readonly: string | boolean;
|
|
75
80
|
data: (string | number | SelectOptionData | SelectOptionGroup)[];
|
|
76
81
|
disabled: boolean;
|
|
77
82
|
defaultValue: string;
|
|
@@ -99,6 +104,10 @@ declare const AutoComplete: {
|
|
|
99
104
|
type: BooleanConstructor;
|
|
100
105
|
default: boolean;
|
|
101
106
|
};
|
|
107
|
+
readonly: {
|
|
108
|
+
type: (StringConstructor | BooleanConstructor)[];
|
|
109
|
+
default: boolean;
|
|
110
|
+
};
|
|
102
111
|
data: {
|
|
103
112
|
type: import("vue").PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
|
|
104
113
|
default: () => never[];
|
|
@@ -139,6 +148,7 @@ declare const AutoComplete: {
|
|
|
139
148
|
focus(): void;
|
|
140
149
|
blur(): void;
|
|
141
150
|
}, {
|
|
151
|
+
readonly: string | boolean;
|
|
142
152
|
data: (string | number | SelectOptionData | SelectOptionGroup)[];
|
|
143
153
|
disabled: boolean;
|
|
144
154
|
defaultValue: string;
|
|
@@ -163,6 +173,10 @@ declare const AutoComplete: {
|
|
|
163
173
|
type: BooleanConstructor;
|
|
164
174
|
default: boolean;
|
|
165
175
|
};
|
|
176
|
+
readonly: {
|
|
177
|
+
type: (StringConstructor | BooleanConstructor)[];
|
|
178
|
+
default: boolean;
|
|
179
|
+
};
|
|
166
180
|
data: {
|
|
167
181
|
type: import("vue").PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
|
|
168
182
|
default: () => never[];
|
|
@@ -211,6 +225,7 @@ declare const AutoComplete: {
|
|
|
211
225
|
dropdownScroll: (_ev: Event) => true;
|
|
212
226
|
dropdownReachBottom: (_ev: Event) => true;
|
|
213
227
|
}, string, {
|
|
228
|
+
readonly: string | boolean;
|
|
214
229
|
data: (string | number | SelectOptionData | SelectOptionGroup)[];
|
|
215
230
|
disabled: boolean;
|
|
216
231
|
defaultValue: string;
|
|
@@ -176,8 +176,14 @@ var avatar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
176
176
|
ref: wrapperRef,
|
|
177
177
|
class: normalizeClass(wrapperCls.value)
|
|
178
178
|
}, [__props.imageUrl ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
179
|
-
hasError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [createElementVNode("div", {
|
|
180
|
-
|
|
179
|
+
hasError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [createElementVNode("div", {
|
|
180
|
+
class: normalizeClass(`${unref(prefixCls)}-image-icon`),
|
|
181
|
+
"aria-hidden": "true"
|
|
182
|
+
}, [createVNode(unref(IconImageClose))], 2)]) : createCommentVNode("", true),
|
|
183
|
+
!(hasError.value || !shouldLoad.value) && !isLoaded.value ? renderSlot(_ctx.$slots, "default", { key: 1 }, () => [createElementVNode("div", {
|
|
184
|
+
class: normalizeClass(`${unref(prefixCls)}-image-icon`),
|
|
185
|
+
"aria-hidden": "true"
|
|
186
|
+
}, [createVNode(unref(IconLoading))], 2)]) : createCommentVNode("", true),
|
|
181
187
|
!(hasError.value || !shouldLoad.value) ? (openBlock(), createElementBlock("img", {
|
|
182
188
|
key: 2,
|
|
183
189
|
src: __props.imageUrl,
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
text-align: center;
|
|
81
81
|
background-color: var(--sd-color-neutral-2);
|
|
82
82
|
border-radius: var(--sd-border-radius-circle);
|
|
83
|
-
transition: background-color 0.1s cubic-bezier(0, 0, 1, 1);
|
|
83
|
+
transition: background-color 0.1s cubic-bezier(0.34, 0.69, 0.1, 1);
|
|
84
84
|
}
|
|
85
85
|
.sd-avatar-trigger-icon-mask {
|
|
86
86
|
position: absolute;
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
background-color: color-mix(in srgb, #1d2129 60%, transparent);
|
|
98
98
|
border-radius: var(--sd-border-radius-medium);
|
|
99
99
|
opacity: 0;
|
|
100
|
-
transition:
|
|
100
|
+
transition: opacity 0.1s cubic-bezier(0.34, 0.69, 0.1, 1);
|
|
101
101
|
}
|
|
102
102
|
.sd-avatar-circle .sd-avatar-trigger-icon-mask {
|
|
103
103
|
border-radius: var(--sd-border-radius-circle);
|
|
@@ -80,7 +80,7 @@ $avatar-prefix-cls: string.unquote('#{theme.$prefix}-avatar');
|
|
|
80
80
|
background-color: $avatar-color-trigger-button-bg;
|
|
81
81
|
border-radius: $avatar-border-trigger-button-radius;
|
|
82
82
|
transition: background-color theme.$transition-duration-1
|
|
83
|
-
theme.$transition-timing-function-
|
|
83
|
+
theme.$transition-timing-function-standard;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
&-trigger-icon-mask {
|
|
@@ -102,7 +102,7 @@ $avatar-prefix-cls: string.unquote('#{theme.$prefix}-avatar');
|
|
|
102
102
|
);
|
|
103
103
|
border-radius: $avatar-square-border-radius;
|
|
104
104
|
opacity: 0;
|
|
105
|
-
transition:
|
|
105
|
+
transition: opacity theme.$transition-duration-1 theme.$transition-timing-function-standard;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
&-circle &-trigger-icon-mask {
|