@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,336 @@
1
+ import {
2
+ useControllable
3
+ } from "./chunk-G7NN4A6J.js";
4
+ import {
5
+ WdSpinner_default
6
+ } from "./chunk-WDDAALPI.js";
7
+ import {
8
+ WdIcon_default
9
+ } from "./chunk-Q34U2HES.js";
10
+
11
+ // .lib-build/WdExplorer.ts
12
+ import { defineComponent as _defineComponent } from "vue";
13
+ import { createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, unref as _unref, createVNode as _createVNode, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, renderSlot as _renderSlot, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode } from "vue";
14
+ import { computed } from "vue";
15
+ var _hoisted_1 = { class: "wd-explorer" };
16
+ var _hoisted_2 = { class: "wd-explorer__side" };
17
+ var _hoisted_3 = ["onClick"];
18
+ var _hoisted_4 = { class: "wd-explorer__folder-name" };
19
+ var _hoisted_5 = { class: "wd-explorer__count" };
20
+ var _hoisted_6 = { class: "wd-explorer__main" };
21
+ var _hoisted_7 = { class: "wd-explorer__bar" };
22
+ var _hoisted_8 = { class: "wd-explorer__path" };
23
+ var _hoisted_9 = { class: "wd-explorer__crumb wd-explorer__crumb--cur" };
24
+ var _hoisted_10 = { class: "wd-explorer__views" };
25
+ var _hoisted_11 = ["aria-pressed"];
26
+ var _hoisted_12 = ["aria-pressed"];
27
+ var _hoisted_13 = {
28
+ key: 0,
29
+ class: "wd-explorer__table"
30
+ };
31
+ var _hoisted_14 = ["onClick"];
32
+ var _hoisted_15 = { class: "wd-explorer__name" };
33
+ var _hoisted_16 = { class: "wd-explorer__file-chip" };
34
+ var _hoisted_17 = { class: "wd-explorer__file-name" };
35
+ var _hoisted_18 = { class: "is-num" };
36
+ var _hoisted_19 = { class: "is-num" };
37
+ var _hoisted_20 = {
38
+ key: 1,
39
+ class: "wd-explorer__grid"
40
+ };
41
+ var _hoisted_21 = ["disabled", "onClick"];
42
+ var _hoisted_22 = { class: "wd-explorer__tile-icon" };
43
+ var _hoisted_23 = { class: "wd-explorer__tile-name" };
44
+ var _hoisted_24 = { class: "wd-explorer__tile-size" };
45
+ var _hoisted_25 = {
46
+ key: 2,
47
+ class: "wd-explorer__loading",
48
+ role: "status",
49
+ "aria-live": "polite"
50
+ };
51
+ var _hoisted_26 = {
52
+ key: 3,
53
+ class: "wd-explorer__empty"
54
+ };
55
+ var WdExplorer_default = /* @__PURE__ */ _defineComponent({
56
+ ...{ name: "WdExplorer" },
57
+ __name: "WdExplorer",
58
+ props: {
59
+ folders: { type: Array, required: false, default: () => [] },
60
+ modelValue: { type: Number, required: false },
61
+ defaultValue: { type: Number, required: false, default: 0 },
62
+ view: { type: String, required: false },
63
+ defaultView: { type: String, required: false, default: "details" },
64
+ emptyText: { type: String, required: false, default: "\u6B64\u6587\u4EF6\u5939\u4E3A\u7A7A" },
65
+ loading: { type: Boolean, required: false, default: false }
66
+ },
67
+ emits: ["select", "update:modelValue", "update:view", "change"],
68
+ setup(__props, { emit: __emit }) {
69
+ const props = __props;
70
+ const emit = __emit;
71
+ const { value: active, set: setActive } = useControllable({
72
+ modelValue: computed(() => props.modelValue),
73
+ defaultValue: computed(() => props.defaultValue),
74
+ fallback: 0,
75
+ onChange: (v) => {
76
+ emit("update:modelValue", v);
77
+ emit("change", v, props.folders[v]);
78
+ }
79
+ });
80
+ const { value: mode, set: setMode } = useControllable({
81
+ modelValue: computed(() => props.view),
82
+ defaultValue: computed(() => props.defaultView),
83
+ fallback: "details",
84
+ onChange: (v) => emit("update:view", v)
85
+ });
86
+ const current = computed(() => props.folders[active.value] || { name: "", files: [] });
87
+ const files = computed(() => props.loading ? [] : current.value.files);
88
+ function pickFolder(i) {
89
+ setActive(i);
90
+ }
91
+ function pickFile(f) {
92
+ if (f.disabled) return;
93
+ emit("select", f);
94
+ }
95
+ function fmtSize(n) {
96
+ if (!n) return "\u2014";
97
+ if (n < 1024) return `${n} B`;
98
+ if (n < 1048576) return `${(n / 1024).toFixed(1)} KB`;
99
+ return `${(n / 1048576).toFixed(1)} MB`;
100
+ }
101
+ return (_ctx, _cache) => {
102
+ return _openBlock(), _createElementBlock("div", _hoisted_1, [
103
+ _createElementVNode("div", _hoisted_2, [
104
+ _cache[3] || (_cache[3] = _createElementVNode(
105
+ "div",
106
+ { class: "wd-explorer__side-title" },
107
+ "\u6587\u4EF6\u5939",
108
+ -1
109
+ /* CACHED */
110
+ )),
111
+ (_openBlock(true), _createElementBlock(
112
+ _Fragment,
113
+ null,
114
+ _renderList(__props.folders, (f, i) => {
115
+ return _openBlock(), _createElementBlock("button", {
116
+ key: i,
117
+ type: "button",
118
+ class: _normalizeClass(["wd-explorer__folder", { "wd-explorer__folder--active": i === _unref(active) }]),
119
+ onClick: ($event) => pickFolder(i)
120
+ }, [
121
+ _createVNode(_unref(WdIcon_default), {
122
+ name: "folder",
123
+ size: 15
124
+ }),
125
+ _createElementVNode(
126
+ "span",
127
+ _hoisted_4,
128
+ _toDisplayString(f.name),
129
+ 1
130
+ /* TEXT */
131
+ ),
132
+ _createElementVNode(
133
+ "span",
134
+ _hoisted_5,
135
+ _toDisplayString(f.files.length),
136
+ 1
137
+ /* TEXT */
138
+ )
139
+ ], 10, _hoisted_3);
140
+ }),
141
+ 128
142
+ /* KEYED_FRAGMENT */
143
+ ))
144
+ ]),
145
+ _createElementVNode("div", _hoisted_6, [
146
+ _createElementVNode("div", _hoisted_7, [
147
+ _createElementVNode("div", _hoisted_8, [
148
+ _createElementVNode("span", {
149
+ class: "wd-explorer__crumb",
150
+ onClick: _cache[0] || (_cache[0] = ($event) => pickFolder(0))
151
+ }, "\u5168\u90E8\u6587\u4EF6"),
152
+ _cache[4] || (_cache[4] = _createElementVNode(
153
+ "span",
154
+ { class: "wd-explorer__sep" },
155
+ "/",
156
+ -1
157
+ /* CACHED */
158
+ )),
159
+ _createElementVNode(
160
+ "span",
161
+ _hoisted_9,
162
+ _toDisplayString(current.value.name),
163
+ 1
164
+ /* TEXT */
165
+ )
166
+ ]),
167
+ _createElementVNode("div", _hoisted_10, [
168
+ _createElementVNode("button", {
169
+ type: "button",
170
+ class: _normalizeClass(["wd-explorer__view-btn", { "wd-explorer__view-btn--active": _unref(mode) === "details" }]),
171
+ title: "\u8BE6\u60C5",
172
+ "aria-label": "\u8BE6\u60C5\u89C6\u56FE",
173
+ "aria-pressed": _unref(mode) === "details",
174
+ onClick: _cache[1] || (_cache[1] = ($event) => _unref(setMode)("details"))
175
+ }, [
176
+ _createVNode(_unref(WdIcon_default), {
177
+ name: "rows",
178
+ size: 15
179
+ })
180
+ ], 10, _hoisted_11),
181
+ _createElementVNode("button", {
182
+ type: "button",
183
+ class: _normalizeClass(["wd-explorer__view-btn", { "wd-explorer__view-btn--active": _unref(mode) === "icons" }]),
184
+ title: "\u56FE\u6807",
185
+ "aria-label": "\u56FE\u6807\u89C6\u56FE",
186
+ "aria-pressed": _unref(mode) === "icons",
187
+ onClick: _cache[2] || (_cache[2] = ($event) => _unref(setMode)("icons"))
188
+ }, [
189
+ _createVNode(_unref(WdIcon_default), {
190
+ name: "layout-grid",
191
+ size: 15
192
+ })
193
+ ], 10, _hoisted_12)
194
+ ])
195
+ ]),
196
+ _unref(mode) === "details" ? (_openBlock(), _createElementBlock("table", _hoisted_13, [
197
+ _cache[5] || (_cache[5] = _createElementVNode(
198
+ "colgroup",
199
+ null,
200
+ [
201
+ _createElementVNode("col"),
202
+ _createElementVNode("col", { style: { "width": "96px" } }),
203
+ _createElementVNode("col", { style: { "width": "118px" } })
204
+ ],
205
+ -1
206
+ /* CACHED */
207
+ )),
208
+ _cache[6] || (_cache[6] = _createElementVNode(
209
+ "thead",
210
+ null,
211
+ [
212
+ _createElementVNode("tr", null, [
213
+ _createElementVNode("th", null, "\u540D\u79F0"),
214
+ _createElementVNode("th", { class: "is-num" }, "\u5927\u5C0F"),
215
+ _createElementVNode("th", { class: "is-num" }, "\u4FEE\u6539\u65F6\u95F4")
216
+ ])
217
+ ],
218
+ -1
219
+ /* CACHED */
220
+ )),
221
+ _createElementVNode("tbody", null, [
222
+ (_openBlock(true), _createElementBlock(
223
+ _Fragment,
224
+ null,
225
+ _renderList(files.value, (f, i) => {
226
+ return _openBlock(), _createElementBlock("tr", {
227
+ key: i,
228
+ class: _normalizeClass({ "is-disabled": f.disabled }),
229
+ onClick: ($event) => pickFile(f)
230
+ }, [
231
+ _renderSlot(_ctx.$slots, "item", {
232
+ file: f,
233
+ index: i
234
+ }, () => [
235
+ _createElementVNode("td", null, [
236
+ _createElementVNode("span", _hoisted_15, [
237
+ _createElementVNode("span", _hoisted_16, [
238
+ _createVNode(_unref(WdIcon_default), {
239
+ name: "file",
240
+ size: 15
241
+ })
242
+ ]),
243
+ _createElementVNode(
244
+ "span",
245
+ _hoisted_17,
246
+ _toDisplayString(f.name),
247
+ 1
248
+ /* TEXT */
249
+ )
250
+ ])
251
+ ]),
252
+ _createElementVNode(
253
+ "td",
254
+ _hoisted_18,
255
+ _toDisplayString(fmtSize(f.size)),
256
+ 1
257
+ /* TEXT */
258
+ ),
259
+ _createElementVNode(
260
+ "td",
261
+ _hoisted_19,
262
+ _toDisplayString(f.modified || "\u2014"),
263
+ 1
264
+ /* TEXT */
265
+ )
266
+ ])
267
+ ], 10, _hoisted_14);
268
+ }),
269
+ 128
270
+ /* KEYED_FRAGMENT */
271
+ ))
272
+ ])
273
+ ])) : (_openBlock(), _createElementBlock("div", _hoisted_20, [
274
+ (_openBlock(true), _createElementBlock(
275
+ _Fragment,
276
+ null,
277
+ _renderList(files.value, (f, i) => {
278
+ return _openBlock(), _createElementBlock("button", {
279
+ key: i,
280
+ type: "button",
281
+ class: _normalizeClass(["wd-explorer__tile", { "is-disabled": f.disabled }]),
282
+ disabled: f.disabled,
283
+ onClick: ($event) => pickFile(f)
284
+ }, [
285
+ _createElementVNode("span", _hoisted_22, [
286
+ _createVNode(_unref(WdIcon_default), {
287
+ name: "folder-open",
288
+ size: 22
289
+ })
290
+ ]),
291
+ _createElementVNode(
292
+ "span",
293
+ _hoisted_23,
294
+ _toDisplayString(f.name),
295
+ 1
296
+ /* TEXT */
297
+ ),
298
+ _createElementVNode(
299
+ "span",
300
+ _hoisted_24,
301
+ _toDisplayString(fmtSize(f.size)),
302
+ 1
303
+ /* TEXT */
304
+ )
305
+ ], 10, _hoisted_21);
306
+ }),
307
+ 128
308
+ /* KEYED_FRAGMENT */
309
+ ))
310
+ ])),
311
+ __props.loading ? (_openBlock(), _createElementBlock("div", _hoisted_25, [
312
+ _createVNode(WdSpinner_default, { size: "sm" }),
313
+ _cache[7] || (_cache[7] = _createElementVNode(
314
+ "span",
315
+ null,
316
+ "\u52A0\u8F7D\u4E2D\u2026",
317
+ -1
318
+ /* CACHED */
319
+ ))
320
+ ])) : !files.value.length ? (_openBlock(), _createElementBlock("div", _hoisted_26, [
321
+ _renderSlot(_ctx.$slots, "empty", {}, () => [
322
+ _createTextVNode(
323
+ _toDisplayString(__props.emptyText),
324
+ 1
325
+ /* TEXT */
326
+ )
327
+ ])
328
+ ])) : _createCommentVNode("v-if", true)
329
+ ])
330
+ ]);
331
+ };
332
+ }
333
+ });
334
+ export {
335
+ WdExplorer_default as WdExplorer
336
+ };
@@ -0,0 +1,177 @@
1
+ import {
2
+ WdSpinner_default
3
+ } from "./chunk-WDDAALPI.js";
4
+ import {
5
+ WdIcon_default
6
+ } from "./chunk-Q34U2HES.js";
7
+
8
+ // .lib-build/WdFileList.ts
9
+ import { defineComponent as _defineComponent } from "vue";
10
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, createCommentVNode as _createCommentVNode, unref as _unref, createBlock as _createBlock, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
11
+ import { computed, ref, watch } from "vue";
12
+ var _hoisted_1 = ["onClick"];
13
+ var _hoisted_2 = { class: "wd-file-list__icon" };
14
+ var _hoisted_3 = { class: "wd-file-list__name" };
15
+ var _hoisted_4 = { class: "wd-file-list__size" };
16
+ var _hoisted_5 = {
17
+ key: 0,
18
+ class: "wd-file-list__loading",
19
+ role: "status",
20
+ "aria-live": "polite"
21
+ };
22
+ var _hoisted_6 = {
23
+ key: 1,
24
+ class: "wd-file-list__empty"
25
+ };
26
+ var WdFileList_default = /* @__PURE__ */ _defineComponent({
27
+ ...{ name: "WdFileList" },
28
+ __name: "WdFileList",
29
+ props: {
30
+ items: { type: Array, required: false, default: () => [] },
31
+ defaultOpenPaths: { type: Array, required: false, default: () => [] },
32
+ emptyText: { type: String, required: false, default: "\u6682\u65E0\u6587\u4EF6" },
33
+ loading: { type: Boolean, required: false, default: false },
34
+ disabled: { type: Boolean, required: false, default: false }
35
+ },
36
+ emits: ["select", "expand"],
37
+ setup(__props, { emit: __emit }) {
38
+ const props = __props;
39
+ const emit = __emit;
40
+ const openPaths = ref(new Set(props.defaultOpenPaths));
41
+ watch(
42
+ () => props.defaultOpenPaths,
43
+ (v) => {
44
+ openPaths.value = new Set(v);
45
+ }
46
+ );
47
+ const rows = computed(() => {
48
+ if (props.loading) return [];
49
+ const out = [];
50
+ const walk = (nodes, depth, base) => {
51
+ nodes.forEach((n, i) => {
52
+ const path = base + i + "/";
53
+ out.push({ node: n, depth, path });
54
+ if (n.type === "folder" && openPaths.value.has(path)) {
55
+ walk(n.children || [], depth + 1, path);
56
+ }
57
+ });
58
+ };
59
+ walk(props.items, 0, "");
60
+ return out;
61
+ });
62
+ function onRow(row) {
63
+ if (props.disabled || row.node.disabled) return;
64
+ if (row.node.type === "folder") {
65
+ const s = new Set(openPaths.value);
66
+ if (s.has(row.path)) s.delete(row.path);
67
+ else s.add(row.path);
68
+ openPaths.value = s;
69
+ emit("expand", [...s]);
70
+ } else {
71
+ emit("select", row.node, row.path);
72
+ }
73
+ }
74
+ function fmtSize(n) {
75
+ if (!n) return "";
76
+ if (n < 1024) return n + " B";
77
+ if (n < 1048576) return (n / 1024).toFixed(1) + " KB";
78
+ return (n / 1048576).toFixed(1) + " MB";
79
+ }
80
+ return (_ctx, _cache) => {
81
+ return _openBlock(), _createElementBlock(
82
+ "div",
83
+ {
84
+ class: _normalizeClass(["wd-file-list", { "is-disabled": __props.disabled }])
85
+ },
86
+ [
87
+ (_openBlock(true), _createElementBlock(
88
+ _Fragment,
89
+ null,
90
+ _renderList(rows.value, (row) => {
91
+ return _openBlock(), _createElementBlock("div", {
92
+ key: row.path,
93
+ class: _normalizeClass(["wd-file-list__row", ["wd-file-list__row--" + (row.node.type || "file"), { "is-disabled": row.node.disabled }]]),
94
+ style: _normalizeStyle({ paddingLeft: 12 + row.depth * 20 + "px" }),
95
+ onClick: ($event) => onRow(row)
96
+ }, [
97
+ _renderSlot(_ctx.$slots, "item", {
98
+ item: row.node,
99
+ depth: row.depth,
100
+ path: row.path,
101
+ open: openPaths.value.has(row.path)
102
+ }, () => [
103
+ _createCommentVNode(" \u7BAD\u5934\u5217\u59CB\u7EC8\u5360\u4F4D\uFF1A\u6587\u4EF6\u5939\u4E0E\u6587\u4EF6\u7684\u56FE\u6807\u4FDD\u6301\u540C\u5217\u5BF9\u9F50 "),
104
+ _createElementVNode(
105
+ "span",
106
+ {
107
+ class: _normalizeClass(["wd-file-list__chevron wd-chevron wd-chevron--right", { "wd-chevron--open": openPaths.value.has(row.path) }])
108
+ },
109
+ [
110
+ row.node.type === "folder" ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
111
+ key: 0,
112
+ name: "chevron-down",
113
+ size: 12
114
+ })) : _createCommentVNode("v-if", true)
115
+ ],
116
+ 2
117
+ /* CLASS */
118
+ ),
119
+ _createElementVNode("span", _hoisted_2, [
120
+ row.node.type === "folder" ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
121
+ key: 0,
122
+ name: "folder",
123
+ size: 14
124
+ })) : (_openBlock(), _createBlock(_unref(WdIcon_default), {
125
+ key: 1,
126
+ name: "file",
127
+ size: 12
128
+ }))
129
+ ]),
130
+ _createElementVNode(
131
+ "span",
132
+ _hoisted_3,
133
+ _toDisplayString(row.node.name),
134
+ 1
135
+ /* TEXT */
136
+ ),
137
+ _createElementVNode(
138
+ "span",
139
+ _hoisted_4,
140
+ _toDisplayString(fmtSize(row.node.size)),
141
+ 1
142
+ /* TEXT */
143
+ )
144
+ ])
145
+ ], 14, _hoisted_1);
146
+ }),
147
+ 128
148
+ /* KEYED_FRAGMENT */
149
+ )),
150
+ __props.loading ? (_openBlock(), _createElementBlock("div", _hoisted_5, [
151
+ _createVNode(WdSpinner_default, { size: "sm" }),
152
+ _cache[0] || (_cache[0] = _createElementVNode(
153
+ "span",
154
+ null,
155
+ "\u52A0\u8F7D\u4E2D\u2026",
156
+ -1
157
+ /* CACHED */
158
+ ))
159
+ ])) : !rows.value.length ? (_openBlock(), _createElementBlock("div", _hoisted_6, [
160
+ _renderSlot(_ctx.$slots, "empty", {}, () => [
161
+ _createTextVNode(
162
+ _toDisplayString(__props.emptyText),
163
+ 1
164
+ /* TEXT */
165
+ )
166
+ ])
167
+ ])) : _createCommentVNode("v-if", true)
168
+ ],
169
+ 2
170
+ /* CLASS */
171
+ );
172
+ };
173
+ }
174
+ });
175
+ export {
176
+ WdFileList_default as WdFileList
177
+ };
@@ -0,0 +1,111 @@
1
+ import {
2
+ FORM_CONTEXT
3
+ } from "./chunk-UYUNYHZD.js";
4
+
5
+ // .lib-build/WdForm.ts
6
+ import { defineComponent as _defineComponent } from "vue";
7
+ import { renderSlot as _renderSlot, withModifiers as _withModifiers, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
8
+ import { provide, reactive, ref } from "vue";
9
+ var WdForm_default = /* @__PURE__ */ _defineComponent({
10
+ ...{ name: "WdForm" },
11
+ __name: "WdForm",
12
+ props: {
13
+ modelValue: { type: Object, required: false, default: () => ({}) },
14
+ rules: { type: null, required: false, default: () => ({}) },
15
+ labelPosition: { type: String, required: false, default: "top" },
16
+ labelWidth: { type: String, required: false, default: "96px" },
17
+ disabled: { type: Boolean, required: false, default: false },
18
+ scrollToError: { type: Boolean, required: false, default: true }
19
+ },
20
+ emits: ["update:modelValue", "submit", "validate"],
21
+ setup(__props, { expose: __expose, emit: __emit }) {
22
+ const props = __props;
23
+ const emit = __emit;
24
+ const items = reactive(/* @__PURE__ */ new Map());
25
+ function register(item) {
26
+ items.set(item.prop, item);
27
+ }
28
+ function unregister(item) {
29
+ items.delete(item.prop);
30
+ }
31
+ async function notifyChange(prop, trigger) {
32
+ const item = items.get(prop);
33
+ if (!item) return;
34
+ await item.validate(trigger);
35
+ }
36
+ provide(FORM_CONTEXT, {
37
+ model: () => props.modelValue,
38
+ rules: () => props.rules,
39
+ disabled: () => props.disabled,
40
+ labelPosition: () => props.labelPosition,
41
+ labelWidth: () => props.labelWidth,
42
+ register,
43
+ unregister,
44
+ notifyChange
45
+ });
46
+ const validating = ref(false);
47
+ async function validate(prop) {
48
+ validating.value = true;
49
+ try {
50
+ const targets = prop ? [items.get(prop)].filter(Boolean) : Array.from(items.values());
51
+ const results = await Promise.all(targets.map((it) => it.validate()));
52
+ const ok = results.every(Boolean);
53
+ const errors = {};
54
+ for (const it of targets) {
55
+ const e = it.getError();
56
+ if (e) errors[it.prop] = e;
57
+ }
58
+ emit("validate", ok, errors);
59
+ if (!ok && props.scrollToError) scrollToFirstError(errors);
60
+ return ok;
61
+ } finally {
62
+ validating.value = false;
63
+ }
64
+ }
65
+ function scrollToFirstError(errors) {
66
+ const first = Object.keys(errors)[0];
67
+ if (!first) return;
68
+ const el = formRef.value?.querySelector(`[data-form-prop="${first}"]`);
69
+ el?.scrollIntoView?.({ block: "center", behavior: "smooth" });
70
+ }
71
+ function clearValidate(prop) {
72
+ if (prop) items.get(prop)?.reset();
73
+ else items.forEach((it) => it.reset());
74
+ }
75
+ function resetFields() {
76
+ const model = { ...props.modelValue };
77
+ items.forEach((it, prop) => {
78
+ model[prop] = void 0;
79
+ it.reset();
80
+ });
81
+ emit("update:modelValue", model);
82
+ }
83
+ function onSubmit() {
84
+ validate().then((ok) => {
85
+ if (ok) emit("submit", props.modelValue);
86
+ });
87
+ }
88
+ const formRef = ref(null);
89
+ __expose({ validate, clearValidate, resetFields });
90
+ return (_ctx, _cache) => {
91
+ return _openBlock(), _createElementBlock(
92
+ "form",
93
+ {
94
+ ref_key: "formRef",
95
+ ref: formRef,
96
+ class: _normalizeClass(["wd-form", [`wd-form--label-${__props.labelPosition}`, { "wd-form--disabled": __props.disabled }]]),
97
+ novalidate: "",
98
+ onSubmit: _withModifiers(onSubmit, ["prevent"])
99
+ },
100
+ [
101
+ _renderSlot(_ctx.$slots, "default")
102
+ ],
103
+ 34
104
+ /* CLASS, NEED_HYDRATION */
105
+ );
106
+ };
107
+ }
108
+ });
109
+ export {
110
+ WdForm_default as WdForm
111
+ };