@w-run/wdesign-ui 1.0.0 → 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.
Files changed (213) hide show
  1. package/README.md +208 -127
  2. package/dist/index.d.ts +1010 -80
  3. package/dist/parts/WdAffix.js +159 -0
  4. package/dist/parts/WdAiMessage.js +277 -0
  5. package/dist/parts/WdAlert.js +92 -0
  6. package/dist/parts/WdAnchor.js +159 -0
  7. package/dist/parts/WdAudioPlayer.js +1024 -0
  8. package/dist/parts/WdAvatar.js +6 -0
  9. package/dist/parts/WdAvatarGroup.js +46 -0
  10. package/dist/parts/WdBacktop.js +120 -0
  11. package/dist/parts/WdBadge.js +61 -0
  12. package/dist/parts/WdBento.js +40 -0
  13. package/dist/parts/WdBentoItem.js +43 -0
  14. package/dist/parts/WdBottomSheet.js +263 -0
  15. package/dist/parts/WdBreadcrumb.js +64 -0
  16. package/dist/parts/WdButton.js +94 -0
  17. package/dist/parts/WdCalendar.js +11 -0
  18. package/dist/parts/WdCard.js +113 -0
  19. package/dist/parts/WdCarousel.js +365 -0
  20. package/dist/parts/WdCascader.js +386 -0
  21. package/dist/parts/WdCheckbox.js +81 -0
  22. package/dist/parts/WdCollapse.js +135 -0
  23. package/dist/parts/WdColorPicker.js +592 -0
  24. package/dist/parts/WdCommand.js +357 -0
  25. package/dist/parts/WdContainer.js +37 -0
  26. package/dist/parts/WdCountdown.js +163 -0
  27. package/dist/parts/WdDanmaku.js +6 -0
  28. package/dist/parts/WdDatePicker.js +169 -0
  29. package/dist/parts/WdDateTimePicker.js +162 -0
  30. package/dist/parts/WdDescriptions.js +146 -0
  31. package/dist/parts/WdDivider.js +64 -0
  32. package/dist/parts/WdDrawer.js +176 -0
  33. package/dist/parts/WdDropdown.js +140 -0
  34. package/dist/parts/WdEmpty.js +79 -0
  35. package/dist/parts/WdExplorer.js +336 -0
  36. package/dist/parts/WdFileList.js +177 -0
  37. package/dist/parts/WdForm.js +111 -0
  38. package/dist/parts/WdFormItem.js +156 -0
  39. package/dist/parts/WdGrid.js +40 -0
  40. package/dist/parts/WdGroup.js +68 -0
  41. package/dist/parts/WdImagePreview.js +274 -0
  42. package/dist/parts/WdInput.js +10 -0
  43. package/dist/parts/WdInputNumber.js +253 -0
  44. package/dist/parts/WdListItem.js +60 -0
  45. package/dist/parts/WdLoading.js +128 -0
  46. package/dist/parts/WdMarkdown.js +172 -0
  47. package/dist/parts/WdMarquee.js +80 -0
  48. package/dist/parts/WdMasonry.js +40 -0
  49. package/dist/parts/WdMediaCard.js +302 -0
  50. package/dist/parts/WdMentions.js +277 -0
  51. package/dist/parts/WdModal.js +149 -0
  52. package/dist/parts/WdNav.js +311 -0
  53. package/dist/parts/WdNotification.js +112 -0
  54. package/dist/parts/WdOtp.js +107 -0
  55. package/dist/parts/WdPagination.js +252 -0
  56. package/dist/parts/WdPopconfirm.js +214 -0
  57. package/dist/parts/WdPopover.js +203 -0
  58. package/dist/parts/WdPostItem.js +84 -0
  59. package/dist/parts/WdProgress.js +48 -0
  60. package/dist/parts/WdProgressRing.js +101 -0
  61. package/dist/parts/WdPullRefresh.js +167 -0
  62. package/dist/parts/WdQRCode.js +1909 -0
  63. package/dist/parts/WdRadioGroup.js +95 -0
  64. package/dist/parts/WdRate.js +128 -0
  65. package/dist/parts/WdResult.js +86 -0
  66. package/dist/parts/WdScrollbar.js +186 -0
  67. package/dist/parts/WdSegmented.js +11 -0
  68. package/dist/parts/WdSelect.js +465 -0
  69. package/dist/parts/WdSkeleton.js +69 -0
  70. package/dist/parts/WdSlider.js +100 -0
  71. package/dist/parts/WdSortableList.js +291 -0
  72. package/dist/parts/WdSpace.js +46 -0
  73. package/dist/parts/WdSparkline.js +148 -0
  74. package/dist/parts/WdSpinner.js +6 -0
  75. package/dist/parts/WdSplitter.js +183 -0
  76. package/dist/parts/WdStatBar.js +202 -0
  77. package/dist/parts/WdStatistic.js +131 -0
  78. package/dist/parts/WdSteps.js +110 -0
  79. package/dist/parts/WdSwitch.js +63 -0
  80. package/dist/parts/WdTabBar.js +84 -0
  81. package/dist/parts/WdTable.js +589 -0
  82. package/dist/parts/WdTabs.js +219 -0
  83. package/dist/parts/WdTag.js +6 -0
  84. package/dist/parts/WdTagInput.js +181 -0
  85. package/dist/parts/WdTimePicker.js +12 -0
  86. package/dist/parts/WdTimeline.js +145 -0
  87. package/dist/parts/WdTooltip.js +108 -0
  88. package/dist/parts/WdTour.js +264 -0
  89. package/dist/parts/WdTransfer.js +446 -0
  90. package/dist/parts/WdTree.js +322 -0
  91. package/dist/parts/WdUpload.js +309 -0
  92. package/dist/parts/WdVideoPlayer.js +1006 -0
  93. package/dist/parts/WdVirtualList.js +169 -0
  94. package/dist/parts/WdWatermark.js +150 -0
  95. package/dist/parts/chunk-3LVE72ZK.js +361 -0
  96. package/dist/parts/chunk-5HYOQ52I.js +101 -0
  97. package/dist/parts/chunk-7M3MUL3B.js +275 -0
  98. package/dist/parts/chunk-AOTJ63HN.js +15 -0
  99. package/dist/parts/chunk-AXEF2U2A.js +41 -0
  100. package/dist/parts/chunk-CY3QOSFP.js +645 -0
  101. package/dist/parts/chunk-G7NN4A6J.js +40 -0
  102. package/dist/parts/chunk-HAKYCUAR.js +9 -0
  103. package/dist/parts/chunk-JDE4AHBR.js +160 -0
  104. package/dist/parts/chunk-LT3NTWIT.js +117 -0
  105. package/dist/parts/chunk-OGHYFT7B.js +387 -0
  106. package/dist/parts/chunk-Q34U2HES.js +261 -0
  107. package/dist/parts/chunk-RLSVPJHM.js +10 -0
  108. package/dist/parts/chunk-U2CDKD2T.js +30 -0
  109. package/dist/parts/chunk-UYUNYHZD.js +40 -0
  110. package/dist/parts/chunk-VUJL2HGD.js +23 -0
  111. package/dist/parts/chunk-WCFG5KNT.js +51 -0
  112. package/dist/parts/chunk-WDDAALPI.js +42 -0
  113. package/dist/parts/chunk-WFXLDBP2.js +149 -0
  114. package/dist/style/affix.css +566 -0
  115. package/dist/style/ai-msg.css +572 -13
  116. package/dist/style/alert.css +577 -5
  117. package/dist/style/anchor.css +630 -0
  118. package/dist/style/audio.css +658 -67
  119. package/dist/style/avatar.css +575 -12
  120. package/dist/style/backtop.css +625 -0
  121. package/dist/style/badge.css +595 -11
  122. package/dist/style/bento.css +763 -0
  123. package/dist/style/bottom-sheet.css +776 -0
  124. package/dist/style/breadcrumb.css +579 -4
  125. package/dist/style/button.css +631 -36
  126. package/dist/style/calendar.css +1512 -0
  127. package/dist/style/card.css +683 -6
  128. package/dist/style/carousel.css +573 -4
  129. package/dist/style/cascader.css +862 -0
  130. package/dist/style/checkbox.css +584 -7
  131. package/dist/style/chevron.css +543 -1
  132. package/dist/style/collapse.css +586 -7
  133. package/dist/style/colorpicker.css +876 -0
  134. package/dist/style/command.css +572 -13
  135. package/dist/style/container.css +543 -0
  136. package/dist/style/countdown.css +722 -0
  137. package/dist/style/danmaku.css +644 -0
  138. package/dist/style/datepicker.css +606 -128
  139. package/dist/style/datetime-picker.css +714 -0
  140. package/dist/style/descriptions.css +604 -11
  141. package/dist/style/divider.css +544 -2
  142. package/dist/style/dot.css +556 -1
  143. package/dist/style/drawer.css +609 -11
  144. package/dist/style/dropdown.css +565 -3
  145. package/dist/style/empty.css +624 -3
  146. package/dist/style/explorer.css +632 -24
  147. package/dist/style/file-list.css +577 -5
  148. package/dist/style/flip.css +600 -0
  149. package/dist/style/form.css +550 -8
  150. package/dist/style/grid.css +614 -0
  151. package/dist/style/group.css +560 -16
  152. package/dist/style/icon-btn.css +570 -4
  153. package/dist/style/image-preview.css +652 -8
  154. package/dist/style/input-number.css +680 -0
  155. package/dist/style/input.css +571 -8
  156. package/dist/style/list.css +553 -4
  157. package/dist/style/loading.css +667 -0
  158. package/dist/style/markdown.css +592 -20
  159. package/dist/style/marquee.css +678 -0
  160. package/dist/style/masonry.css +614 -0
  161. package/dist/style/media-card.css +1229 -0
  162. package/dist/style/mentions.css +690 -0
  163. package/dist/style/modal.css +626 -15
  164. package/dist/style/nav.css +1046 -0
  165. package/dist/style/notification.css +556 -7
  166. package/dist/style/otp.css +567 -7
  167. package/dist/style/pagination.css +571 -11
  168. package/dist/style/popconfirm.css +568 -10
  169. package/dist/style/popover.css +645 -15
  170. package/dist/style/post-item.css +548 -6
  171. package/dist/style/progress-ring.css +640 -0
  172. package/dist/style/progress.css +543 -1
  173. package/dist/style/pull-refresh.css +637 -0
  174. package/dist/style/qrcode.css +613 -0
  175. package/dist/style/radio.css +584 -5
  176. package/dist/style/rate.css +594 -1
  177. package/dist/style/result.css +546 -3
  178. package/dist/style/scroll-reveal.css +613 -0
  179. package/dist/style/scrollbar.css +644 -0
  180. package/dist/style/segmented-picker.css +573 -14
  181. package/dist/style/segmented.css +711 -7
  182. package/dist/style/select.css +682 -26
  183. package/dist/style/skeleton.css +559 -0
  184. package/dist/style/slider.css +565 -4
  185. package/dist/style/sortable.css +593 -7
  186. package/dist/style/space.css +543 -0
  187. package/dist/style/sparkline.css +606 -0
  188. package/dist/style/spinner.css +559 -0
  189. package/dist/style/splitter.css +711 -0
  190. package/dist/style/stat-bar.css +767 -0
  191. package/dist/style/statistic.css +552 -7
  192. package/dist/style/steps.css +633 -9
  193. package/dist/style/switch.css +585 -4
  194. package/dist/style/tab-bar.css +647 -0
  195. package/dist/style/table.css +886 -36
  196. package/dist/style/tabs.css +599 -10
  197. package/dist/style/tag-input.css +710 -0
  198. package/dist/style/tag.css +603 -18
  199. package/dist/style/time-picker.css +749 -0
  200. package/dist/style/timeline.css +575 -14
  201. package/dist/style/toast.css +567 -6
  202. package/dist/style/tooltip.css +564 -5
  203. package/dist/style/tour.css +683 -0
  204. package/dist/style/transfer.css +858 -0
  205. package/dist/style/tree.css +613 -16
  206. package/dist/style/typography.css +884 -3
  207. package/dist/style/upload.css +602 -13
  208. package/dist/style/vlist.css +543 -1
  209. package/dist/style/vplayer.css +799 -57
  210. package/dist/style/watermark.css +570 -0
  211. package/dist/wdesign-ui.css +18055 -7262
  212. package/dist/wdesign-ui.esm.js +8976 -5044
  213. package/package.json +99 -13
@@ -0,0 +1,465 @@
1
+ import {
2
+ uid
3
+ } from "./chunk-RLSVPJHM.js";
4
+ import {
5
+ useControllable
6
+ } from "./chunk-G7NN4A6J.js";
7
+ import {
8
+ useComposition
9
+ } from "./chunk-U2CDKD2T.js";
10
+ import {
11
+ popDuration
12
+ } from "./chunk-HAKYCUAR.js";
13
+ import {
14
+ useOverlayLayer
15
+ } from "./chunk-5HYOQ52I.js";
16
+ import {
17
+ WdSpinner_default
18
+ } from "./chunk-WDDAALPI.js";
19
+ import {
20
+ useAnchoredPosition,
21
+ useDismiss
22
+ } from "./chunk-WFXLDBP2.js";
23
+ import {
24
+ useFormItemA11y
25
+ } from "./chunk-VUJL2HGD.js";
26
+ import "./chunk-UYUNYHZD.js";
27
+ import {
28
+ WdIcon_default
29
+ } from "./chunk-Q34U2HES.js";
30
+
31
+ // .lib-build/WdSelect.ts
32
+ import { defineComponent as _defineComponent } from "vue";
33
+ import { unref as _unref, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createVNode as _createVNode, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, mergeProps as _mergeProps, withModifiers as _withModifiers, renderSlot as _renderSlot, createBlock as _createBlock, normalizeStyle as _normalizeStyle, Teleport as _Teleport } from "vue";
34
+ import { computed, nextTick, ref, watch } from "vue";
35
+ var _hoisted_1 = ["disabled", "aria-expanded", "aria-controls", "aria-activedescendant"];
36
+ var _hoisted_2 = {
37
+ key: 0,
38
+ class: "wd-select__tags"
39
+ };
40
+ var _hoisted_3 = ["aria-label", "onClick"];
41
+ var _hoisted_4 = {
42
+ key: 0,
43
+ class: "wd-select__tag wd-select__tag--more"
44
+ };
45
+ var _hoisted_5 = { class: "wd-select__value" };
46
+ var _hoisted_6 = {
47
+ key: 2,
48
+ class: "wd-select__placeholder"
49
+ };
50
+ var _hoisted_7 = { class: "wd-select__actions" };
51
+ var _hoisted_8 = ["data-placement", "id", "aria-multiselectable"];
52
+ var _hoisted_9 = {
53
+ key: 0,
54
+ class: "wd-select__search"
55
+ };
56
+ var _hoisted_10 = ["value"];
57
+ var _hoisted_11 = ["role", "aria-label"];
58
+ var _hoisted_12 = {
59
+ key: 0,
60
+ class: "wd-select__group-label",
61
+ "aria-hidden": "true"
62
+ };
63
+ var _hoisted_13 = ["id", "aria-selected", "disabled", "onClick", "onMouseenter"];
64
+ var _hoisted_14 = {
65
+ key: 1,
66
+ class: "wd-select__loading",
67
+ role: "status",
68
+ "aria-live": "polite"
69
+ };
70
+ var _hoisted_15 = {
71
+ key: 2,
72
+ class: "wd-select__empty"
73
+ };
74
+ var WdSelect_default = /* @__PURE__ */ _defineComponent({
75
+ ...{ name: "WdSelect" },
76
+ __name: "WdSelect",
77
+ props: {
78
+ modelValue: { type: [String, Number, Array], required: false },
79
+ defaultValue: { type: [String, Number, Array], required: false },
80
+ options: { type: Array, required: false, default: () => [] },
81
+ loading: { type: Boolean, required: false, default: false },
82
+ emptyText: { type: String, required: false, default: "\u65E0\u5339\u914D\u9879" },
83
+ placeholder: { type: String, required: false, default: "\u8BF7\u9009\u62E9" },
84
+ disabled: { type: Boolean, required: false, default: false },
85
+ size: { type: String, required: false, default: "md" },
86
+ multiple: { type: Boolean, required: false, default: false },
87
+ filterable: { type: Boolean, required: false, default: false },
88
+ clearable: { type: Boolean, required: false, default: false },
89
+ maxTagCount: { type: Number, required: false, default: 3 }
90
+ },
91
+ emits: ["update:modelValue", "change", "clear"],
92
+ setup(__props, { emit: __emit }) {
93
+ const POP_DURATION = popDuration();
94
+ const formA11y = useFormItemA11y();
95
+ const listboxId = uid("wd-select-listbox");
96
+ const optId = (i) => `${listboxId}-opt-${i}`;
97
+ const props = __props;
98
+ const emit = __emit;
99
+ const open = ref(false);
100
+ const root = ref();
101
+ const triggerEl = ref(null);
102
+ const menuEl = ref(null);
103
+ const { pos, actual } = useAnchoredPosition(open, triggerEl, menuEl, {
104
+ placement: "bottom-start",
105
+ gap: 6,
106
+ matchWidth: true
107
+ });
108
+ useOverlayLayer(open, root, () => {
109
+ open.value = false;
110
+ return true;
111
+ });
112
+ const search = ref("");
113
+ const { onCompositionStart, onCompositionEnd, shouldSkip } = useComposition();
114
+ useDismiss([root], () => {
115
+ open.value = false;
116
+ search.value = "";
117
+ }, open);
118
+ const searchEl = ref(null);
119
+ const activeIndex = ref(-1);
120
+ const items = computed(
121
+ () => props.options.map((o) => typeof o === "string" ? { label: o, value: o, disabled: false } : { disabled: false, ...o })
122
+ );
123
+ const { value: ctlValue, set } = useControllable({
124
+ modelValue: computed(() => props.modelValue),
125
+ defaultValue: computed(() => props.defaultValue),
126
+ fallback: props.multiple ? [] : "",
127
+ /**
128
+ * ⚠️ 这里只能 emit,不能调上面的 set ——
129
+ * set 内部又会回调 onChange,等于自己调自己,
130
+ * 选中任何一项都会抛 `RangeError: Maximum call stack size exceeded`,
131
+ * 而且 v-model 永远不更新(界面停在初始值)。
132
+ */
133
+ onChange: (v) => {
134
+ emit("update:modelValue", v);
135
+ emit("change", v);
136
+ }
137
+ });
138
+ const selected = computed(() => {
139
+ const v = ctlValue.value;
140
+ if (props.multiple) return Array.isArray(v) ? v : [];
141
+ return v === "" || v === void 0 || Array.isArray(v) ? [] : [v];
142
+ });
143
+ const selectedItems = computed(() => selected.value.map((v) => items.value.find((o) => o.value === v)).filter(Boolean));
144
+ const visible = computed(() => {
145
+ if (props.loading) return [];
146
+ const kw = search.value.trim().toLowerCase();
147
+ if (!kw || !props.filterable) return items.value;
148
+ return items.value.filter((o) => String(o.label).toLowerCase().includes(kw));
149
+ });
150
+ const groupedVisible = computed(() => {
151
+ const out = [];
152
+ visible.value.forEach((o, i) => {
153
+ const g = o.group || "";
154
+ const last = out[out.length - 1];
155
+ if (last && last.label === g) last.items.push({ o, i });
156
+ else out.push({ label: g, items: [{ o, i }] });
157
+ });
158
+ return out;
159
+ });
160
+ const hasValue = computed(() => selected.value.length > 0);
161
+ const showClear = computed(() => props.clearable && hasValue.value && !props.disabled);
162
+ const shownTags = computed(() => selectedItems.value.slice(0, props.maxTagCount));
163
+ const overflowCount = computed(() => Math.max(0, selectedItems.value.length - props.maxTagCount));
164
+ const singleLabel = computed(() => selectedItems.value[0]?.label ?? "");
165
+ function toggle(v) {
166
+ const opt = items.value.find((o) => o.value === v);
167
+ if (opt?.disabled) return;
168
+ if (props.multiple) {
169
+ const picked = new Set(selected.value);
170
+ picked.has(v) ? picked.delete(v) : picked.add(v);
171
+ set(Array.from(picked));
172
+ } else {
173
+ set(v);
174
+ open.value = false;
175
+ }
176
+ search.value = "";
177
+ }
178
+ function removeTag(v, e) {
179
+ e.stopPropagation();
180
+ if (props.disabled) return;
181
+ const next = selected.value.filter((x) => x !== v);
182
+ set(next);
183
+ }
184
+ function clear(e) {
185
+ e?.stopPropagation();
186
+ const next = props.multiple ? [] : "";
187
+ set(next);
188
+ emit("clear");
189
+ }
190
+ async function toggleOpen() {
191
+ if (props.disabled) return;
192
+ open.value = !open.value;
193
+ if (open.value) {
194
+ activeIndex.value = Math.max(0, visible.value.findIndex((o) => o.value === selected.value[0]));
195
+ await nextTick();
196
+ if (props.filterable) searchEl.value?.focus();
197
+ } else {
198
+ search.value = "";
199
+ }
200
+ }
201
+ function onSearchInput(e) {
202
+ if (shouldSkip(e)) return;
203
+ search.value = e.target.value;
204
+ }
205
+ function onSearchCompositionEnd(e) {
206
+ onCompositionEnd(e);
207
+ search.value = e.target.value;
208
+ }
209
+ function onKeydown(e) {
210
+ if (props.disabled) return;
211
+ if (!open.value && (e.key === "Enter" || e.key === " " || e.key === "ArrowDown")) {
212
+ e.preventDefault();
213
+ toggleOpen();
214
+ return;
215
+ }
216
+ if (!open.value) return;
217
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
218
+ e.preventDefault();
219
+ const n = visible.value.length;
220
+ if (!n) return;
221
+ const dir = e.key === "ArrowDown" ? 1 : -1;
222
+ activeIndex.value = (activeIndex.value + dir + n) % n;
223
+ } else if (e.key === "Enter") {
224
+ e.preventDefault();
225
+ const opt = visible.value[activeIndex.value];
226
+ if (opt) toggle(opt.value);
227
+ }
228
+ }
229
+ watch(visible, (list) => {
230
+ if (activeIndex.value >= list.length) activeIndex.value = list.length - 1;
231
+ });
232
+ return (_ctx, _cache) => {
233
+ return _openBlock(), _createElementBlock(
234
+ _Fragment,
235
+ null,
236
+ [
237
+ _createElementVNode(
238
+ "div",
239
+ _mergeProps({
240
+ ref_key: "root",
241
+ ref: root,
242
+ class: ["wd-select", { "wd-select--open": open.value, "wd-select--disabled": __props.disabled, "wd-select--multiple": __props.multiple }],
243
+ onKeydown
244
+ }, { ..._ctx.$attrs, ..._unref(formA11y).attrs.value }),
245
+ [
246
+ _createElementVNode("button", {
247
+ ref_key: "triggerEl",
248
+ ref: triggerEl,
249
+ type: "button",
250
+ class: _normalizeClass(["wd-select__trigger", [`wd-select__trigger--${__props.size}`, { "wd-select__trigger--tags": __props.multiple && hasValue.value }]]),
251
+ disabled: __props.disabled,
252
+ "aria-expanded": open.value,
253
+ "aria-haspopup": "listbox",
254
+ "aria-controls": _unref(listboxId),
255
+ "aria-activedescendant": open.value && activeIndex.value >= 0 ? optId(activeIndex.value) : void 0,
256
+ onClick: toggleOpen
257
+ }, [
258
+ _createCommentVNode(" \u591A\u9009\uFF1A\u6807\u7B7E\u5806\u53E0 "),
259
+ __props.multiple && hasValue.value ? (_openBlock(), _createElementBlock("span", _hoisted_2, [
260
+ (_openBlock(true), _createElementBlock(
261
+ _Fragment,
262
+ null,
263
+ _renderList(shownTags.value, (o) => {
264
+ return _openBlock(), _createElementBlock("span", {
265
+ key: o.value,
266
+ class: "wd-select__tag"
267
+ }, [
268
+ _createTextVNode(
269
+ _toDisplayString(o.label) + " ",
270
+ 1
271
+ /* TEXT */
272
+ ),
273
+ !__props.disabled ? (_openBlock(), _createElementBlock("button", {
274
+ key: 0,
275
+ type: "button",
276
+ class: "wd-select__tag-x",
277
+ "aria-label": `\u79FB\u9664 ${o.label}`,
278
+ onClick: ($event) => removeTag(o.value, $event)
279
+ }, [
280
+ _createVNode(_unref(WdIcon_default), {
281
+ name: "close",
282
+ size: 12
283
+ })
284
+ ], 8, _hoisted_3)) : _createCommentVNode("v-if", true)
285
+ ]);
286
+ }),
287
+ 128
288
+ /* KEYED_FRAGMENT */
289
+ )),
290
+ overflowCount.value ? (_openBlock(), _createElementBlock(
291
+ "span",
292
+ _hoisted_4,
293
+ "+" + _toDisplayString(overflowCount.value),
294
+ 1
295
+ /* TEXT */
296
+ )) : _createCommentVNode("v-if", true)
297
+ ])) : !__props.multiple && hasValue.value ? (_openBlock(), _createElementBlock(
298
+ _Fragment,
299
+ { key: 1 },
300
+ [
301
+ _createCommentVNode(" \u5355\u9009 "),
302
+ _createElementVNode(
303
+ "span",
304
+ _hoisted_5,
305
+ _toDisplayString(singleLabel.value),
306
+ 1
307
+ /* TEXT */
308
+ )
309
+ ],
310
+ 2112
311
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
312
+ )) : (_openBlock(), _createElementBlock(
313
+ "span",
314
+ _hoisted_6,
315
+ _toDisplayString(__props.placeholder),
316
+ 1
317
+ /* TEXT */
318
+ )),
319
+ _createElementVNode("span", _hoisted_7, [
320
+ showClear.value ? (_openBlock(), _createElementBlock("button", {
321
+ key: 0,
322
+ type: "button",
323
+ class: "wd-select__clear",
324
+ "aria-label": "\u6E05\u9664",
325
+ onClick: clear
326
+ }, [
327
+ _createVNode(_unref(WdIcon_default), {
328
+ name: "close",
329
+ size: 12
330
+ })
331
+ ])) : _createCommentVNode("v-if", true),
332
+ _createVNode(_unref(WdIcon_default), {
333
+ class: _normalizeClass(["wd-chevron", { "wd-chevron--open": open.value }]),
334
+ name: "chevron-down",
335
+ size: 14
336
+ }, null, 8, ["class"])
337
+ ])
338
+ ], 10, _hoisted_1)
339
+ ],
340
+ 16
341
+ /* FULL_PROPS */
342
+ ),
343
+ (_openBlock(), _createBlock(_Teleport, { to: "body" }, [
344
+ _createElementVNode("div", {
345
+ ref_key: "menuEl",
346
+ ref: menuEl,
347
+ class: _normalizeClass(["wd-select__menu", { "is-open": open.value }]),
348
+ style: _normalizeStyle({ top: _unref(pos).top + "px", left: _unref(pos).left + "px", minWidth: "220px" }),
349
+ "data-placement": _unref(actual),
350
+ id: _unref(listboxId),
351
+ role: "listbox",
352
+ "aria-multiselectable": __props.multiple || void 0
353
+ }, [
354
+ _createCommentVNode(" \u641C\u7D22\u6846 "),
355
+ __props.filterable ? (_openBlock(), _createElementBlock("div", _hoisted_9, [
356
+ _createElementVNode("input", {
357
+ ref_key: "searchEl",
358
+ ref: searchEl,
359
+ value: search.value,
360
+ type: "text",
361
+ placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u7B5B\u9009\u2026",
362
+ onClick: _cache[0] || (_cache[0] = _withModifiers(() => {
363
+ }, ["stop"])),
364
+ onInput: onSearchInput,
365
+ onCompositionstart: _cache[1] || (_cache[1] = //@ts-ignore
366
+ (...args) => _unref(onCompositionStart) && _unref(onCompositionStart)(...args)),
367
+ onCompositionend: onSearchCompositionEnd
368
+ }, null, 40, _hoisted_10)
369
+ ])) : _createCommentVNode("v-if", true),
370
+ (_openBlock(true), _createElementBlock(
371
+ _Fragment,
372
+ null,
373
+ _renderList(groupedVisible.value, (grp) => {
374
+ return _openBlock(), _createElementBlock("div", {
375
+ key: grp.label,
376
+ class: "wd-select__group",
377
+ role: grp.label ? "group" : void 0,
378
+ "aria-label": grp.label || void 0
379
+ }, [
380
+ grp.label ? (_openBlock(), _createElementBlock(
381
+ "div",
382
+ _hoisted_12,
383
+ _toDisplayString(grp.label),
384
+ 1
385
+ /* TEXT */
386
+ )) : _createCommentVNode("v-if", true),
387
+ (_openBlock(true), _createElementBlock(
388
+ _Fragment,
389
+ null,
390
+ _renderList(grp.items, ({ o, i }) => {
391
+ return _openBlock(), _createElementBlock("button", {
392
+ key: i,
393
+ type: "button",
394
+ id: optId(i),
395
+ role: "option",
396
+ class: _normalizeClass(["wd-select__option", {
397
+ "wd-select__option--active": selected.value.includes(o.value),
398
+ "wd-select__option--hover": i === activeIndex.value,
399
+ "wd-select__option--disabled": o.disabled
400
+ }]),
401
+ "aria-selected": selected.value.includes(o.value),
402
+ disabled: o.disabled,
403
+ onClick: ($event) => toggle(o.value),
404
+ onMouseenter: ($event) => activeIndex.value = i
405
+ }, [
406
+ _renderSlot(_ctx.$slots, "option", {
407
+ item: o,
408
+ index: i,
409
+ selected: selected.value.includes(o.value),
410
+ active: i === activeIndex.value
411
+ }, () => [
412
+ _createElementVNode(
413
+ "span",
414
+ null,
415
+ _toDisplayString(o.label),
416
+ 1
417
+ /* TEXT */
418
+ ),
419
+ selected.value.includes(o.value) ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
420
+ key: 0,
421
+ class: "wd-select__option-mark",
422
+ name: "check",
423
+ size: 14
424
+ })) : _createCommentVNode("v-if", true)
425
+ ])
426
+ ], 42, _hoisted_13);
427
+ }),
428
+ 128
429
+ /* KEYED_FRAGMENT */
430
+ ))
431
+ ], 8, _hoisted_11);
432
+ }),
433
+ 128
434
+ /* KEYED_FRAGMENT */
435
+ )),
436
+ props.loading ? (_openBlock(), _createElementBlock("div", _hoisted_14, [
437
+ _createVNode(WdSpinner_default, { size: "sm" }),
438
+ _cache[2] || (_cache[2] = _createElementVNode(
439
+ "span",
440
+ null,
441
+ "\u52A0\u8F7D\u4E2D\u2026",
442
+ -1
443
+ /* CACHED */
444
+ ))
445
+ ])) : !visible.value.length ? (_openBlock(), _createElementBlock("div", _hoisted_15, [
446
+ _renderSlot(_ctx.$slots, "empty", {}, () => [
447
+ _createTextVNode(
448
+ _toDisplayString(props.emptyText),
449
+ 1
450
+ /* TEXT */
451
+ )
452
+ ])
453
+ ])) : _createCommentVNode("v-if", true)
454
+ ], 14, _hoisted_8)
455
+ ]))
456
+ ],
457
+ 64
458
+ /* STABLE_FRAGMENT */
459
+ );
460
+ };
461
+ }
462
+ });
463
+ export {
464
+ WdSelect_default as WdSelect
465
+ };
@@ -0,0 +1,69 @@
1
+ // .lib-build/WdSkeleton.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle } from "vue";
4
+ import { computed } from "vue";
5
+ var WdSkeleton_default = /* @__PURE__ */ _defineComponent({
6
+ ...{ name: "WdSkeleton" },
7
+ __name: "WdSkeleton",
8
+ props: {
9
+ variant: { type: String, required: false, default: "text" },
10
+ width: { type: [Number, String], required: false, default: "" },
11
+ height: { type: [Number, String], required: false, default: "" },
12
+ count: { type: Number, required: false, default: 3 }
13
+ },
14
+ setup(__props) {
15
+ const props = __props;
16
+ function toSize(v) {
17
+ if (v === "" || v === void 0 || v === null) return "";
18
+ return typeof v === "number" ? `${v}px` : v;
19
+ }
20
+ const itemStyle = computed(() => {
21
+ const style = {};
22
+ if (props.variant === "circle") {
23
+ const s = toSize(props.width) || "48px";
24
+ style.width = s;
25
+ style.height = toSize(props.height) || s;
26
+ } else {
27
+ if (props.width) style.width = toSize(props.width);
28
+ if (props.height) style.height = toSize(props.height);
29
+ if (props.variant === "rect" && !props.height) style.height = "80px";
30
+ }
31
+ return style;
32
+ });
33
+ return (_ctx, _cache) => {
34
+ return _openBlock(), _createElementBlock(
35
+ "div",
36
+ {
37
+ class: _normalizeClass(["wd-skeleton", `wd-skeleton--${__props.variant}`]),
38
+ "aria-hidden": "true"
39
+ },
40
+ [
41
+ (_openBlock(true), _createElementBlock(
42
+ _Fragment,
43
+ null,
44
+ _renderList(__props.count, (i) => {
45
+ return _openBlock(), _createElementBlock(
46
+ "span",
47
+ {
48
+ key: i,
49
+ class: _normalizeClass(["wd-skeleton__item", { "wd-skeleton__item--text": __props.variant === "text" }]),
50
+ style: _normalizeStyle(itemStyle.value)
51
+ },
52
+ null,
53
+ 6
54
+ /* CLASS, STYLE */
55
+ );
56
+ }),
57
+ 128
58
+ /* KEYED_FRAGMENT */
59
+ ))
60
+ ],
61
+ 2
62
+ /* CLASS */
63
+ );
64
+ };
65
+ }
66
+ });
67
+ export {
68
+ WdSkeleton_default as WdSkeleton
69
+ };
@@ -0,0 +1,100 @@
1
+ import {
2
+ useControllable
3
+ } from "./chunk-G7NN4A6J.js";
4
+ import {
5
+ useFormItemA11y
6
+ } from "./chunk-VUJL2HGD.js";
7
+ import "./chunk-UYUNYHZD.js";
8
+
9
+ // .lib-build/WdSlider.ts
10
+ import { defineComponent as _defineComponent } from "vue";
11
+ import { normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode } from "vue";
12
+ import { computed, ref, watch } from "vue";
13
+ var _hoisted_1 = ["min", "max", "step", "value"];
14
+ var _hoisted_2 = {
15
+ key: 0,
16
+ class: "wd-slider__value"
17
+ };
18
+ var WdSlider_default = /* @__PURE__ */ _defineComponent({
19
+ ...{ name: "WdSlider" },
20
+ __name: "WdSlider",
21
+ props: {
22
+ modelValue: { type: Number, required: false },
23
+ defaultValue: { type: Number, required: false },
24
+ min: { type: Number, required: false, default: 0 },
25
+ max: { type: Number, required: false, default: 100 },
26
+ step: { type: Number, required: false, default: 1 },
27
+ showValue: { type: Boolean, required: false, default: true },
28
+ color: { type: String, required: false, default: "" }
29
+ },
30
+ emits: ["update:modelValue", "change"],
31
+ setup(__props, { emit: __emit }) {
32
+ const formA11y = useFormItemA11y();
33
+ const props = __props;
34
+ const emit = __emit;
35
+ const el = ref(null);
36
+ const { value: ctl, set } = useControllable({
37
+ modelValue: computed(() => props.modelValue),
38
+ defaultValue: computed(() => props.defaultValue),
39
+ fallback: 0,
40
+ onChange: (v) => {
41
+ emit("update:modelValue", v);
42
+ emit("change", v);
43
+ }
44
+ });
45
+ const live = ref(null);
46
+ const current = computed(() => live.value !== null ? live.value : ctl.value);
47
+ const percent = computed(() => {
48
+ const span = props.max - props.min || 1;
49
+ return Math.max(0, Math.min(100, (current.value - props.min) / span * 100));
50
+ });
51
+ const trackStyle = computed(() => ({
52
+ background: `linear-gradient(to right, var(--wd-slider-color) 0%, var(--wd-slider-color) ${percent.value}%, var(--wd-field) ${percent.value}%, var(--wd-field) 100%)`
53
+ }));
54
+ function onInput(e) {
55
+ const v = Number(e.target.value);
56
+ live.value = v;
57
+ set(v);
58
+ }
59
+ watch(
60
+ () => props.modelValue,
61
+ (v) => {
62
+ if (live.value !== null && v !== live.value) live.value = null;
63
+ }
64
+ );
65
+ return (_ctx, _cache) => {
66
+ return _openBlock(), _createElementBlock(
67
+ "div",
68
+ {
69
+ class: "wd-slider",
70
+ style: _normalizeStyle(__props.color ? { "--wd-slider-color": __props.color } : void 0)
71
+ },
72
+ [
73
+ _createElementVNode("input", {
74
+ ref_key: "el",
75
+ ref: el,
76
+ type: "range",
77
+ min: __props.min,
78
+ max: __props.max,
79
+ step: __props.step,
80
+ value: current.value,
81
+ style: _normalizeStyle(trackStyle.value),
82
+ onInput
83
+ }, null, 44, _hoisted_1),
84
+ __props.showValue ? (_openBlock(), _createElementBlock(
85
+ "span",
86
+ _hoisted_2,
87
+ _toDisplayString(current.value),
88
+ 1
89
+ /* TEXT */
90
+ )) : _createCommentVNode("v-if", true)
91
+ ],
92
+ 4
93
+ /* STYLE */
94
+ );
95
+ };
96
+ }
97
+ });
98
+ export {
99
+ WdSlider_default as WdSlider
100
+ };