@w-run/wdesign-ui 0.0.0-stage → 1.1.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/README.md +255 -2
- package/dist/index.d.ts +1013 -0
- package/dist/parts/WdAffix.js +159 -0
- package/dist/parts/WdAiMessage.js +277 -0
- package/dist/parts/WdAlert.js +92 -0
- package/dist/parts/WdAnchor.js +159 -0
- package/dist/parts/WdAudioPlayer.js +1024 -0
- package/dist/parts/WdAvatar.js +6 -0
- package/dist/parts/WdAvatarGroup.js +46 -0
- package/dist/parts/WdBacktop.js +120 -0
- package/dist/parts/WdBadge.js +61 -0
- package/dist/parts/WdBento.js +40 -0
- package/dist/parts/WdBentoItem.js +43 -0
- package/dist/parts/WdBottomSheet.js +263 -0
- package/dist/parts/WdBreadcrumb.js +64 -0
- package/dist/parts/WdButton.js +94 -0
- package/dist/parts/WdCalendar.js +11 -0
- package/dist/parts/WdCard.js +113 -0
- package/dist/parts/WdCarousel.js +365 -0
- package/dist/parts/WdCascader.js +386 -0
- package/dist/parts/WdCheckbox.js +81 -0
- package/dist/parts/WdCollapse.js +135 -0
- package/dist/parts/WdColorPicker.js +592 -0
- package/dist/parts/WdCommand.js +357 -0
- package/dist/parts/WdContainer.js +37 -0
- package/dist/parts/WdCountdown.js +163 -0
- package/dist/parts/WdDanmaku.js +6 -0
- package/dist/parts/WdDatePicker.js +169 -0
- package/dist/parts/WdDateTimePicker.js +162 -0
- package/dist/parts/WdDescriptions.js +146 -0
- package/dist/parts/WdDivider.js +64 -0
- package/dist/parts/WdDrawer.js +176 -0
- package/dist/parts/WdDropdown.js +140 -0
- package/dist/parts/WdEmpty.js +79 -0
- package/dist/parts/WdExplorer.js +336 -0
- package/dist/parts/WdFileList.js +177 -0
- package/dist/parts/WdForm.js +111 -0
- package/dist/parts/WdFormItem.js +156 -0
- package/dist/parts/WdGrid.js +40 -0
- package/dist/parts/WdGroup.js +68 -0
- package/dist/parts/WdImagePreview.js +274 -0
- package/dist/parts/WdInput.js +10 -0
- package/dist/parts/WdInputNumber.js +253 -0
- package/dist/parts/WdListItem.js +60 -0
- package/dist/parts/WdLoading.js +128 -0
- package/dist/parts/WdMarkdown.js +172 -0
- package/dist/parts/WdMarquee.js +80 -0
- package/dist/parts/WdMasonry.js +40 -0
- package/dist/parts/WdMediaCard.js +302 -0
- package/dist/parts/WdMentions.js +277 -0
- package/dist/parts/WdModal.js +149 -0
- package/dist/parts/WdNav.js +311 -0
- package/dist/parts/WdNotification.js +112 -0
- package/dist/parts/WdOtp.js +107 -0
- package/dist/parts/WdPagination.js +252 -0
- package/dist/parts/WdPopconfirm.js +214 -0
- package/dist/parts/WdPopover.js +203 -0
- package/dist/parts/WdPostItem.js +84 -0
- package/dist/parts/WdProgress.js +48 -0
- package/dist/parts/WdProgressRing.js +101 -0
- package/dist/parts/WdPullRefresh.js +167 -0
- package/dist/parts/WdQRCode.js +1909 -0
- package/dist/parts/WdRadioGroup.js +95 -0
- package/dist/parts/WdRate.js +128 -0
- package/dist/parts/WdResult.js +86 -0
- package/dist/parts/WdScrollbar.js +186 -0
- package/dist/parts/WdSegmented.js +11 -0
- package/dist/parts/WdSelect.js +465 -0
- package/dist/parts/WdSkeleton.js +69 -0
- package/dist/parts/WdSlider.js +100 -0
- package/dist/parts/WdSortableList.js +291 -0
- package/dist/parts/WdSpace.js +46 -0
- package/dist/parts/WdSparkline.js +148 -0
- package/dist/parts/WdSpinner.js +6 -0
- package/dist/parts/WdSplitter.js +183 -0
- package/dist/parts/WdStatBar.js +202 -0
- package/dist/parts/WdStatistic.js +131 -0
- package/dist/parts/WdSteps.js +110 -0
- package/dist/parts/WdSwitch.js +63 -0
- package/dist/parts/WdTabBar.js +84 -0
- package/dist/parts/WdTable.js +589 -0
- package/dist/parts/WdTabs.js +219 -0
- package/dist/parts/WdTag.js +6 -0
- package/dist/parts/WdTagInput.js +181 -0
- package/dist/parts/WdTimePicker.js +12 -0
- package/dist/parts/WdTimeline.js +145 -0
- package/dist/parts/WdTooltip.js +108 -0
- package/dist/parts/WdTour.js +264 -0
- package/dist/parts/WdTransfer.js +446 -0
- package/dist/parts/WdTree.js +322 -0
- package/dist/parts/WdUpload.js +309 -0
- package/dist/parts/WdVideoPlayer.js +1006 -0
- package/dist/parts/WdVirtualList.js +169 -0
- package/dist/parts/WdWatermark.js +150 -0
- package/dist/parts/chunk-3LVE72ZK.js +361 -0
- package/dist/parts/chunk-5HYOQ52I.js +101 -0
- package/dist/parts/chunk-7M3MUL3B.js +275 -0
- package/dist/parts/chunk-AOTJ63HN.js +15 -0
- package/dist/parts/chunk-AXEF2U2A.js +41 -0
- package/dist/parts/chunk-CY3QOSFP.js +645 -0
- package/dist/parts/chunk-G7NN4A6J.js +40 -0
- package/dist/parts/chunk-HAKYCUAR.js +9 -0
- package/dist/parts/chunk-JDE4AHBR.js +160 -0
- package/dist/parts/chunk-LT3NTWIT.js +117 -0
- package/dist/parts/chunk-OGHYFT7B.js +387 -0
- package/dist/parts/chunk-Q34U2HES.js +261 -0
- package/dist/parts/chunk-RLSVPJHM.js +10 -0
- package/dist/parts/chunk-U2CDKD2T.js +30 -0
- package/dist/parts/chunk-UYUNYHZD.js +40 -0
- package/dist/parts/chunk-VUJL2HGD.js +23 -0
- package/dist/parts/chunk-WCFG5KNT.js +51 -0
- package/dist/parts/chunk-WDDAALPI.js +42 -0
- package/dist/parts/chunk-WFXLDBP2.js +149 -0
- package/dist/style/affix.css +566 -0
- package/dist/style/ai-msg.css +746 -0
- package/dist/style/alert.css +636 -0
- package/dist/style/anchor.css +630 -0
- package/dist/style/audio.css +1954 -0
- package/dist/style/avatar.css +651 -0
- package/dist/style/backtop.css +625 -0
- package/dist/style/badge.css +632 -0
- package/dist/style/bento.css +763 -0
- package/dist/style/bottom-sheet.css +776 -0
- package/dist/style/breadcrumb.css +629 -0
- package/dist/style/button.css +829 -0
- package/dist/style/calendar.css +1512 -0
- package/dist/style/card.css +748 -0
- package/dist/style/carousel.css +670 -0
- package/dist/style/cascader.css +862 -0
- package/dist/style/checkbox.css +706 -0
- package/dist/style/chevron.css +575 -0
- package/dist/style/collapse.css +648 -0
- package/dist/style/colorpicker.css +876 -0
- package/dist/style/command.css +760 -0
- package/dist/style/container.css +550 -0
- package/dist/style/countdown.css +722 -0
- package/dist/style/danmaku.css +644 -0
- package/dist/style/datepicker.css +683 -0
- package/dist/style/datetime-picker.css +714 -0
- package/dist/style/descriptions.css +712 -0
- package/dist/style/divider.css +604 -0
- package/dist/style/dot.css +585 -0
- package/dist/style/drawer.css +743 -0
- package/dist/style/dropdown.css +645 -0
- package/dist/style/empty.css +657 -0
- package/dist/style/explorer.css +944 -0
- package/dist/style/file-list.css +664 -0
- package/dist/style/flip.css +600 -0
- package/dist/style/form.css +638 -0
- package/dist/style/grid.css +618 -0
- package/dist/style/group.css +1022 -0
- package/dist/style/icon-btn.css +641 -0
- package/dist/style/image-preview.css +725 -0
- package/dist/style/input-number.css +680 -0
- package/dist/style/input.css +682 -0
- package/dist/style/list.css +630 -0
- package/dist/style/loading.css +667 -0
- package/dist/style/markdown.css +884 -0
- package/dist/style/marquee.css +678 -0
- package/dist/style/masonry.css +614 -0
- package/dist/style/media-card.css +1229 -0
- package/dist/style/mentions.css +690 -0
- package/dist/style/modal.css +775 -0
- package/dist/style/nav.css +1046 -0
- package/dist/style/notification.css +601 -0
- package/dist/style/otp.css +699 -0
- package/dist/style/pagination.css +680 -0
- package/dist/style/popconfirm.css +645 -0
- package/dist/style/popover.css +740 -0
- package/dist/style/post-item.css +676 -0
- package/dist/style/progress-ring.css +640 -0
- package/dist/style/progress.css +576 -0
- package/dist/style/pull-refresh.css +637 -0
- package/dist/style/qrcode.css +613 -0
- package/dist/style/radio.css +705 -0
- package/dist/style/rate.css +637 -0
- package/dist/style/result.css +597 -0
- package/dist/style/scroll-reveal.css +613 -0
- package/dist/style/scrollbar.css +644 -0
- package/dist/style/segmented-picker.css +679 -0
- package/dist/style/segmented.css +894 -0
- package/dist/style/select.css +937 -0
- package/dist/style/skeleton.css +590 -0
- package/dist/style/slider.css +642 -0
- package/dist/style/sortable.css +714 -0
- package/dist/style/space.css +568 -0
- package/dist/style/sparkline.css +606 -0
- package/dist/style/spinner.css +586 -0
- package/dist/style/splitter.css +711 -0
- package/dist/style/stat-bar.css +767 -0
- package/dist/style/statistic.css +589 -0
- package/dist/style/steps.css +724 -0
- package/dist/style/switch.css +676 -0
- package/dist/style/tab-bar.css +647 -0
- package/dist/style/table.css +1229 -0
- package/dist/style/tabs.css +756 -0
- package/dist/style/tag-input.css +710 -0
- package/dist/style/tag.css +682 -0
- package/dist/style/time-picker.css +749 -0
- package/dist/style/timeline.css +1082 -0
- package/dist/style/toast.css +598 -0
- package/dist/style/tooltip.css +604 -0
- package/dist/style/tour.css +683 -0
- package/dist/style/transfer.css +858 -0
- package/dist/style/tree.css +786 -0
- package/dist/style/typography.css +947 -0
- package/dist/style/upload.css +758 -0
- package/dist/style/vlist.css +591 -0
- package/dist/style/vplayer.css +1588 -0
- package/dist/style/watermark.css +570 -0
- package/dist/wdesign-ui.css +21093 -0
- package/dist/wdesign-ui.esm.js +20265 -0
- package/package.json +134 -4
- package/tokens.json +385 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import {
|
|
2
|
+
popDuration
|
|
3
|
+
} from "./chunk-HAKYCUAR.js";
|
|
4
|
+
import {
|
|
5
|
+
useFocusTrap,
|
|
6
|
+
useScrollLock
|
|
7
|
+
} from "./chunk-LT3NTWIT.js";
|
|
8
|
+
import {
|
|
9
|
+
nextZIndex
|
|
10
|
+
} from "./chunk-5HYOQ52I.js";
|
|
11
|
+
import {
|
|
12
|
+
WdIcon_default
|
|
13
|
+
} from "./chunk-Q34U2HES.js";
|
|
14
|
+
|
|
15
|
+
// .lib-build/WdDrawer.ts
|
|
16
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
17
|
+
import { createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, unref as _unref, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeStyle as _normalizeStyle, vShow as _vShow, mergeProps as _mergeProps, withDirectives as _withDirectives, Teleport as _Teleport, createBlock as _createBlock } from "vue";
|
|
18
|
+
import { computed, ref, toRef, watchEffect } from "vue";
|
|
19
|
+
var _hoisted_1 = ["aria-label"];
|
|
20
|
+
var _hoisted_2 = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "wd-drawer__head"
|
|
23
|
+
};
|
|
24
|
+
var _hoisted_3 = { class: "wd-drawer__title" };
|
|
25
|
+
var _hoisted_4 = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "wd-drawer__close-float"
|
|
28
|
+
};
|
|
29
|
+
var _hoisted_5 = { class: "wd-drawer__body" };
|
|
30
|
+
var _hoisted_6 = {
|
|
31
|
+
key: 2,
|
|
32
|
+
class: "wd-drawer__foot"
|
|
33
|
+
};
|
|
34
|
+
var WdDrawer_default = /* @__PURE__ */ _defineComponent({
|
|
35
|
+
...{ name: "WdDrawer" },
|
|
36
|
+
__name: "WdDrawer",
|
|
37
|
+
props: {
|
|
38
|
+
modelValue: { type: Boolean, required: false, default: false },
|
|
39
|
+
title: { type: String, required: false, default: "" },
|
|
40
|
+
side: { type: String, required: false, default: "right" },
|
|
41
|
+
closeOnMask: { type: Boolean, required: false, default: true },
|
|
42
|
+
width: { type: [String, Number], required: false },
|
|
43
|
+
size: { type: String, required: false, default: "md" },
|
|
44
|
+
destroyOnClose: { type: Boolean, required: false, default: false },
|
|
45
|
+
bodyFlush: { type: Boolean, required: false, default: false }
|
|
46
|
+
},
|
|
47
|
+
emits: ["update:modelValue"],
|
|
48
|
+
setup(__props, { emit: __emit }) {
|
|
49
|
+
const POP_DURATION = popDuration();
|
|
50
|
+
const props = __props;
|
|
51
|
+
const emit = __emit;
|
|
52
|
+
const classes = computed(() => [
|
|
53
|
+
"wd-drawer",
|
|
54
|
+
props.side === "left" ? "wd-drawer--left" : "",
|
|
55
|
+
"wd-drawer--" + props.size,
|
|
56
|
+
props.bodyFlush ? "wd-drawer--flush" : ""
|
|
57
|
+
]);
|
|
58
|
+
const panelStyle = computed(() => {
|
|
59
|
+
if (props.width === void 0 || props.width === "") return void 0;
|
|
60
|
+
const w = typeof props.width === "number" ? props.width + "px" : props.width;
|
|
61
|
+
return { width: w };
|
|
62
|
+
});
|
|
63
|
+
const panel = ref(null);
|
|
64
|
+
const mounted = ref(false);
|
|
65
|
+
watchEffect(() => {
|
|
66
|
+
if (props.modelValue) mounted.value = true;
|
|
67
|
+
});
|
|
68
|
+
const contentAlive = ref(false);
|
|
69
|
+
let destroyTimer = null;
|
|
70
|
+
watchEffect(() => {
|
|
71
|
+
if (props.modelValue) {
|
|
72
|
+
contentAlive.value = true;
|
|
73
|
+
if (destroyTimer) {
|
|
74
|
+
window.clearTimeout(destroyTimer);
|
|
75
|
+
destroyTimer = null;
|
|
76
|
+
}
|
|
77
|
+
} else if (props.destroyOnClose && contentAlive.value) {
|
|
78
|
+
if (destroyTimer) window.clearTimeout(destroyTimer);
|
|
79
|
+
destroyTimer = window.setTimeout(() => {
|
|
80
|
+
contentAlive.value = false;
|
|
81
|
+
}, POP_DURATION);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const openRef = toRef(props, "modelValue");
|
|
85
|
+
const myZ = ref(0);
|
|
86
|
+
watchEffect(() => {
|
|
87
|
+
if (props.modelValue) myZ.value = nextZIndex();
|
|
88
|
+
});
|
|
89
|
+
useScrollLock(openRef);
|
|
90
|
+
useFocusTrap(openRef, panel, () => {
|
|
91
|
+
close();
|
|
92
|
+
return true;
|
|
93
|
+
});
|
|
94
|
+
function close() {
|
|
95
|
+
emit("update:modelValue", false);
|
|
96
|
+
}
|
|
97
|
+
return (_ctx, _cache) => {
|
|
98
|
+
return _openBlock(), _createBlock(_Teleport, { to: "body" }, [
|
|
99
|
+
_createCommentVNode(" \u540C Modal\uFF1A\u663E\u9690\u7531 .is-open + display \u4FDD\u8BC1\uFF0C\u4E0D\u4F9D\u8D56 Transition \u7684\u65F6\u5E8F "),
|
|
100
|
+
_withDirectives(_createElementVNode("div", _mergeProps(_ctx.$attrs, {
|
|
101
|
+
class: [classes.value, { "is-open": __props.modelValue }],
|
|
102
|
+
role: "dialog",
|
|
103
|
+
"aria-modal": "true",
|
|
104
|
+
"aria-label": __props.title || void 0,
|
|
105
|
+
style: { zIndex: myZ.value }
|
|
106
|
+
}), [
|
|
107
|
+
_createElementVNode("div", {
|
|
108
|
+
class: "wd-drawer__mask",
|
|
109
|
+
onClick: _cache[0] || (_cache[0] = ($event) => __props.closeOnMask && close())
|
|
110
|
+
}),
|
|
111
|
+
_createElementVNode(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
ref_key: "panel",
|
|
115
|
+
ref: panel,
|
|
116
|
+
class: "wd-drawer__panel",
|
|
117
|
+
style: _normalizeStyle(panelStyle.value),
|
|
118
|
+
tabindex: "-1"
|
|
119
|
+
},
|
|
120
|
+
[
|
|
121
|
+
__props.title || _ctx.$slots.header || _ctx.$slots.title ? (_openBlock(), _createElementBlock("div", _hoisted_2, [
|
|
122
|
+
_renderSlot(_ctx.$slots, "header", {}, () => [
|
|
123
|
+
_createElementVNode("div", _hoisted_3, [
|
|
124
|
+
_renderSlot(_ctx.$slots, "title", {}, () => [
|
|
125
|
+
_createTextVNode(
|
|
126
|
+
_toDisplayString(__props.title),
|
|
127
|
+
1
|
|
128
|
+
/* TEXT */
|
|
129
|
+
)
|
|
130
|
+
])
|
|
131
|
+
])
|
|
132
|
+
]),
|
|
133
|
+
_createElementVNode("button", {
|
|
134
|
+
type: "button",
|
|
135
|
+
class: "wd-icon-btn",
|
|
136
|
+
"aria-label": "\u5173\u95ED",
|
|
137
|
+
onClick: close
|
|
138
|
+
}, [
|
|
139
|
+
_createVNode(_unref(WdIcon_default), {
|
|
140
|
+
name: "close",
|
|
141
|
+
size: 15
|
|
142
|
+
})
|
|
143
|
+
])
|
|
144
|
+
])) : (_openBlock(), _createElementBlock("div", _hoisted_4, [
|
|
145
|
+
_createElementVNode("button", {
|
|
146
|
+
type: "button",
|
|
147
|
+
class: "wd-icon-btn",
|
|
148
|
+
"aria-label": "\u5173\u95ED",
|
|
149
|
+
onClick: close
|
|
150
|
+
}, [
|
|
151
|
+
_createVNode(_unref(WdIcon_default), {
|
|
152
|
+
name: "close",
|
|
153
|
+
size: 15
|
|
154
|
+
})
|
|
155
|
+
])
|
|
156
|
+
])),
|
|
157
|
+
_createElementVNode("div", _hoisted_5, [
|
|
158
|
+
contentAlive.value || !__props.destroyOnClose ? _renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : _createCommentVNode("v-if", true)
|
|
159
|
+
]),
|
|
160
|
+
_ctx.$slots.footer ? (_openBlock(), _createElementBlock("div", _hoisted_6, [
|
|
161
|
+
_renderSlot(_ctx.$slots, "footer")
|
|
162
|
+
])) : _createCommentVNode("v-if", true)
|
|
163
|
+
],
|
|
164
|
+
4
|
|
165
|
+
/* STYLE */
|
|
166
|
+
)
|
|
167
|
+
], 16, _hoisted_1), [
|
|
168
|
+
[_vShow, mounted.value]
|
|
169
|
+
])
|
|
170
|
+
]);
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
export {
|
|
175
|
+
WdDrawer_default as WdDrawer
|
|
176
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
popDuration
|
|
3
|
+
} from "./chunk-HAKYCUAR.js";
|
|
4
|
+
import {
|
|
5
|
+
useOverlayLayer
|
|
6
|
+
} from "./chunk-5HYOQ52I.js";
|
|
7
|
+
import {
|
|
8
|
+
useAnchoredPosition,
|
|
9
|
+
useDismiss
|
|
10
|
+
} from "./chunk-WFXLDBP2.js";
|
|
11
|
+
|
|
12
|
+
// .lib-build/WdDropdown.ts
|
|
13
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
14
|
+
import { renderSlot as _renderSlot, withModifiers as _withModifiers, withKeys as _withKeys, createElementVNode as _createElementVNode, mergeProps as _mergeProps, unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, Teleport as _Teleport, createBlock as _createBlock } from "vue";
|
|
15
|
+
import { onBeforeUnmount, onMounted, onUpdated, ref } from "vue";
|
|
16
|
+
var _hoisted_1 = ["role", "tabindex", "aria-expanded", "onKeydown"];
|
|
17
|
+
var _hoisted_2 = ["data-placement"];
|
|
18
|
+
var _hoisted_3 = ["onClick"];
|
|
19
|
+
var WdDropdown_default = /* @__PURE__ */ _defineComponent({
|
|
20
|
+
...{ name: "WdDropdown" },
|
|
21
|
+
__name: "WdDropdown",
|
|
22
|
+
props: {
|
|
23
|
+
items: { type: Array, required: false, default: () => [] }
|
|
24
|
+
},
|
|
25
|
+
emits: ["select"],
|
|
26
|
+
setup(__props, { emit: __emit }) {
|
|
27
|
+
const POP_DURATION = popDuration();
|
|
28
|
+
const props = __props;
|
|
29
|
+
const emit = __emit;
|
|
30
|
+
const open = ref(false);
|
|
31
|
+
const root = ref();
|
|
32
|
+
const triggerEl = ref(null);
|
|
33
|
+
const menuEl = ref(null);
|
|
34
|
+
useDismiss([root, triggerEl, menuEl], () => {
|
|
35
|
+
open.value = false;
|
|
36
|
+
}, open);
|
|
37
|
+
const { pos, actual } = useAnchoredPosition(open, triggerEl, menuEl, {
|
|
38
|
+
placement: "bottom-start",
|
|
39
|
+
gap: 6,
|
|
40
|
+
matchWidth: false
|
|
41
|
+
});
|
|
42
|
+
useOverlayLayer(open, root, () => {
|
|
43
|
+
open.value = false;
|
|
44
|
+
return true;
|
|
45
|
+
});
|
|
46
|
+
function pick(item) {
|
|
47
|
+
if (item.disabled) return;
|
|
48
|
+
emit("select", item.value);
|
|
49
|
+
open.value = false;
|
|
50
|
+
}
|
|
51
|
+
const hasFocusableChild = ref(false);
|
|
52
|
+
function detectInteractiveTrigger() {
|
|
53
|
+
const el = triggerEl.value;
|
|
54
|
+
hasFocusableChild.value = !!(el && el.querySelector('button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
|
|
55
|
+
}
|
|
56
|
+
function onTriggerKey() {
|
|
57
|
+
if (hasFocusableChild.value) return;
|
|
58
|
+
open.value = !open.value;
|
|
59
|
+
}
|
|
60
|
+
function onKey(e) {
|
|
61
|
+
}
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
document.addEventListener("keydown", onKey);
|
|
64
|
+
detectInteractiveTrigger();
|
|
65
|
+
});
|
|
66
|
+
onUpdated(() => {
|
|
67
|
+
detectInteractiveTrigger();
|
|
68
|
+
});
|
|
69
|
+
onBeforeUnmount(() => {
|
|
70
|
+
document.removeEventListener("keydown", onKey);
|
|
71
|
+
});
|
|
72
|
+
return (_ctx, _cache) => {
|
|
73
|
+
return _openBlock(), _createElementBlock(
|
|
74
|
+
_Fragment,
|
|
75
|
+
null,
|
|
76
|
+
[
|
|
77
|
+
_createElementVNode(
|
|
78
|
+
"span",
|
|
79
|
+
_mergeProps({
|
|
80
|
+
ref_key: "root",
|
|
81
|
+
ref: root
|
|
82
|
+
}, _ctx.$attrs, { class: "wd-dropdown" }),
|
|
83
|
+
[
|
|
84
|
+
_createElementVNode("span", {
|
|
85
|
+
ref_key: "triggerEl",
|
|
86
|
+
ref: triggerEl,
|
|
87
|
+
class: "wd-dropdown__trigger",
|
|
88
|
+
role: hasFocusableChild.value ? void 0 : "button",
|
|
89
|
+
tabindex: hasFocusableChild.value ? void 0 : 0,
|
|
90
|
+
"aria-haspopup": true,
|
|
91
|
+
"aria-expanded": open.value,
|
|
92
|
+
onKeydown: [
|
|
93
|
+
_withKeys(_withModifiers(onTriggerKey, ["prevent"]), ["enter"]),
|
|
94
|
+
_withKeys(_withModifiers(onTriggerKey, ["prevent"]), ["space"])
|
|
95
|
+
],
|
|
96
|
+
onClick: _cache[0] || (_cache[0] = ($event) => open.value = !open.value)
|
|
97
|
+
}, [
|
|
98
|
+
_renderSlot(_ctx.$slots, "default")
|
|
99
|
+
], 40, _hoisted_1)
|
|
100
|
+
],
|
|
101
|
+
16
|
|
102
|
+
/* FULL_PROPS */
|
|
103
|
+
),
|
|
104
|
+
(_openBlock(), _createBlock(_Teleport, { to: "body" }, [
|
|
105
|
+
_createElementVNode("div", {
|
|
106
|
+
ref_key: "menuEl",
|
|
107
|
+
ref: menuEl,
|
|
108
|
+
class: _normalizeClass(["wd-dropdown__menu", { "is-open": open.value }]),
|
|
109
|
+
style: _normalizeStyle({ top: _unref(pos).top + "px", left: _unref(pos).left + "px" }),
|
|
110
|
+
"data-placement": _unref(actual),
|
|
111
|
+
role: "menu"
|
|
112
|
+
}, [
|
|
113
|
+
(_openBlock(true), _createElementBlock(
|
|
114
|
+
_Fragment,
|
|
115
|
+
null,
|
|
116
|
+
_renderList(props.items, (it) => {
|
|
117
|
+
return _openBlock(), _createElementBlock("button", {
|
|
118
|
+
key: it.value,
|
|
119
|
+
type: "button",
|
|
120
|
+
role: "menuitem",
|
|
121
|
+
class: _normalizeClass(["wd-dropdown__item", { "wd-dropdown__item--danger": it.danger, "wd-dropdown__item--disabled": it.disabled }]),
|
|
122
|
+
"data-wd-hover": "",
|
|
123
|
+
onClick: ($event) => pick(it)
|
|
124
|
+
}, _toDisplayString(it.label), 11, _hoisted_3);
|
|
125
|
+
}),
|
|
126
|
+
128
|
|
127
|
+
/* KEYED_FRAGMENT */
|
|
128
|
+
))
|
|
129
|
+
], 14, _hoisted_2)
|
|
130
|
+
]))
|
|
131
|
+
],
|
|
132
|
+
64
|
|
133
|
+
/* STABLE_FRAGMENT */
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
export {
|
|
139
|
+
WdDropdown_default as WdDropdown
|
|
140
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WdIcon_default
|
|
3
|
+
} from "./chunk-Q34U2HES.js";
|
|
4
|
+
|
|
5
|
+
// .lib-build/WdEmpty.ts
|
|
6
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
7
|
+
import { renderSlot as _renderSlot, unref as _unref, createVNode as _createVNode, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, normalizeClass as _normalizeClass } from "vue";
|
|
8
|
+
import { computed } from "vue";
|
|
9
|
+
var _hoisted_1 = ["role"];
|
|
10
|
+
var _hoisted_2 = { class: "wd-empty__icon" };
|
|
11
|
+
var _hoisted_3 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "wd-empty__title"
|
|
14
|
+
};
|
|
15
|
+
var _hoisted_4 = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "wd-empty__desc"
|
|
18
|
+
};
|
|
19
|
+
var _hoisted_5 = {
|
|
20
|
+
key: 2,
|
|
21
|
+
class: "wd-empty__action"
|
|
22
|
+
};
|
|
23
|
+
var WdEmpty_default = /* @__PURE__ */ _defineComponent({
|
|
24
|
+
...{ name: "WdEmpty" },
|
|
25
|
+
__name: "WdEmpty",
|
|
26
|
+
props: {
|
|
27
|
+
title: { type: String, required: false, default: "" },
|
|
28
|
+
description: { type: String, required: false, default: "" },
|
|
29
|
+
size: { type: String, required: false, default: "md" },
|
|
30
|
+
variant: { type: String, required: false, default: "empty" },
|
|
31
|
+
icon: { type: String, required: false, default: "" }
|
|
32
|
+
},
|
|
33
|
+
setup(__props) {
|
|
34
|
+
const props = __props;
|
|
35
|
+
const resolvedIcon = computed(() => {
|
|
36
|
+
if (props.icon) return props.icon;
|
|
37
|
+
return props.variant === "search" ? "search" : "folder-open";
|
|
38
|
+
});
|
|
39
|
+
const iconSize = computed(() => props.size === "sm" ? 22 : props.size === "lg" ? 38 : 30);
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
return _openBlock(), _createElementBlock("div", {
|
|
42
|
+
class: _normalizeClass(["wd-empty", [`wd-empty--${__props.size}`, `wd-empty--${__props.variant}`]]),
|
|
43
|
+
role: __props.variant === "error" ? "alert" : void 0
|
|
44
|
+
}, [
|
|
45
|
+
_createElementVNode("div", _hoisted_2, [
|
|
46
|
+
_renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
47
|
+
_createVNode(_unref(WdIcon_default), {
|
|
48
|
+
name: resolvedIcon.value,
|
|
49
|
+
size: iconSize.value,
|
|
50
|
+
style: { "opacity": ".5" }
|
|
51
|
+
}, null, 8, ["name", "size"])
|
|
52
|
+
])
|
|
53
|
+
]),
|
|
54
|
+
__props.title ? (_openBlock(), _createElementBlock(
|
|
55
|
+
"div",
|
|
56
|
+
_hoisted_3,
|
|
57
|
+
_toDisplayString(__props.title),
|
|
58
|
+
1
|
|
59
|
+
/* TEXT */
|
|
60
|
+
)) : _createCommentVNode("v-if", true),
|
|
61
|
+
__props.description || _ctx.$slots.description ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
|
|
62
|
+
_renderSlot(_ctx.$slots, "description", {}, () => [
|
|
63
|
+
_createTextVNode(
|
|
64
|
+
_toDisplayString(__props.description),
|
|
65
|
+
1
|
|
66
|
+
/* TEXT */
|
|
67
|
+
)
|
|
68
|
+
])
|
|
69
|
+
])) : _createCommentVNode("v-if", true),
|
|
70
|
+
_ctx.$slots.action ? (_openBlock(), _createElementBlock("div", _hoisted_5, [
|
|
71
|
+
_renderSlot(_ctx.$slots, "action")
|
|
72
|
+
])) : _createCommentVNode("v-if", true)
|
|
73
|
+
], 10, _hoisted_1);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
export {
|
|
78
|
+
WdEmpty_default as WdEmpty
|
|
79
|
+
};
|