@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,589 @@
1
+ import {
2
+ WdIcon_default
3
+ } from "./chunk-Q34U2HES.js";
4
+
5
+ // .lib-build/WdTable.ts
6
+ import { defineComponent as _defineComponent } from "vue";
7
+ import { createCommentVNode as _createCommentVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, unref as _unref, createBlock as _createBlock, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, createVNode as _createVNode, createTextVNode as _createTextVNode, withModifiers as _withModifiers, renderSlot as _renderSlot } from "vue";
8
+ import { computed, onBeforeUnmount, onMounted, ref } from "vue";
9
+ var _hoisted_1 = {
10
+ key: 0,
11
+ class: "wd-table__th wd-table__th--expand",
12
+ "aria-label": "\u5C55\u5F00"
13
+ };
14
+ var _hoisted_2 = {
15
+ key: 1,
16
+ class: "wd-table__th wd-table__th--check"
17
+ };
18
+ var _hoisted_3 = ["aria-checked"];
19
+ var _hoisted_4 = ["aria-sort", "onClick"];
20
+ var _hoisted_5 = {
21
+ key: 0,
22
+ class: "wd-table__sort"
23
+ };
24
+ var _hoisted_6 = ["onClick"];
25
+ var _hoisted_7 = ["aria-expanded", "onClick"];
26
+ var _hoisted_8 = ["aria-checked", "onClick"];
27
+ var _hoisted_9 = ["aria-expanded", "aria-label", "onClick"];
28
+ var _hoisted_10 = {
29
+ key: 0,
30
+ class: "wd-table__expand-row"
31
+ };
32
+ var _hoisted_11 = ["colspan"];
33
+ var _hoisted_12 = { key: 0 };
34
+ var _hoisted_13 = { key: 1 };
35
+ var _hoisted_14 = {
36
+ key: 1,
37
+ class: "wd-table__empty"
38
+ };
39
+ var _hoisted_15 = {
40
+ key: 2,
41
+ class: "wd-table__loading"
42
+ };
43
+ var WdTable_default = /* @__PURE__ */ _defineComponent({
44
+ ...{ name: "WdTable" },
45
+ __name: "WdTable",
46
+ props: {
47
+ columns: { type: Array, required: false, default: () => [] },
48
+ rows: { type: Array, required: false, default: () => [] },
49
+ striped: { type: Boolean, required: false, default: true },
50
+ emptyText: { type: String, required: false, default: "\u6682\u65E0\u6570\u636E" },
51
+ loading: { type: Boolean, required: false, default: false },
52
+ loadingText: { type: String, required: false, default: "\u52A0\u8F7D\u4E2D\u2026" },
53
+ selectable: { type: Boolean, required: false, default: false },
54
+ selected: { type: Array, required: false, default: () => [] },
55
+ rowKey: { type: String, required: false, default: "" },
56
+ maxHeight: { type: [Number, String], required: false, default: "" },
57
+ tree: { type: Boolean, required: false, default: false },
58
+ childrenKey: { type: String, required: false, default: "children" },
59
+ defaultExpandAll: { type: Boolean, required: false, default: false },
60
+ expandable: { type: Boolean, required: false, default: false },
61
+ expandColspan: { type: Number, required: false, default: 0 },
62
+ size: { type: String, required: false, default: "md" }
63
+ },
64
+ emits: ["update:selected", "change", "row-click", "expand-change"],
65
+ setup(__props, { emit: __emit }) {
66
+ const props = __props;
67
+ const emit = __emit;
68
+ const sortKey = ref("");
69
+ const sortDir = ref("asc");
70
+ const expandedKeys = ref(/* @__PURE__ */ new Set());
71
+ function rowKeyOf(row, i) {
72
+ const k = props.rowKey;
73
+ if (k && row[k] !== void 0) return String(row[k]);
74
+ return String(i);
75
+ }
76
+ function collectKeys(rows, prefix = "") {
77
+ const out = [];
78
+ rows.forEach((r, i) => {
79
+ const k = prefix ? `${prefix}-${i}` : String(i);
80
+ out.push(props.rowKey && r[props.rowKey] !== void 0 ? String(r[props.rowKey]) : k);
81
+ const kids = r[props.childrenKey];
82
+ if (Array.isArray(kids) && kids.length) out.push(...collectKeys(kids, k));
83
+ });
84
+ return out;
85
+ }
86
+ if (props.defaultExpandAll) {
87
+ expandedKeys.value = new Set(collectKeys(props.rows));
88
+ }
89
+ const flatRows = computed(() => {
90
+ if (!props.tree) {
91
+ return props.rows.map((row, i) => ({
92
+ row,
93
+ depth: 0,
94
+ key: rowKeyOf(row, i),
95
+ hasChildren: false,
96
+ expanded: false,
97
+ parentKey: null,
98
+ indexInParent: i,
99
+ hasNextSibling: i < props.rows.length - 1
100
+ }));
101
+ }
102
+ const out = [];
103
+ const walk = (rows, depth, parentKey) => {
104
+ rows.forEach((row, i) => {
105
+ const key = rowKeyOf(row, i) === String(i) && depth > 0 ? `${parentKey}-${i}` : rowKeyOf(row, i);
106
+ const kids = row[props.childrenKey];
107
+ const hasChildren = Array.isArray(kids) && kids.length > 0;
108
+ const expanded = expandedKeys.value.has(key);
109
+ out.push({
110
+ row,
111
+ depth,
112
+ key,
113
+ hasChildren,
114
+ expanded,
115
+ parentKey,
116
+ indexInParent: i,
117
+ hasNextSibling: i < rows.length - 1
118
+ });
119
+ if (hasChildren && expanded) {
120
+ walk(kids, depth + 1, key);
121
+ }
122
+ });
123
+ };
124
+ walk(props.rows, 0, null);
125
+ return out;
126
+ });
127
+ function toggleExpand(item, e) {
128
+ e?.stopPropagation();
129
+ const next = new Set(expandedKeys.value);
130
+ if (next.has(item.key)) next.delete(item.key);
131
+ else next.add(item.key);
132
+ expandedKeys.value = next;
133
+ emit("expand-change", item.row, next.has(item.key));
134
+ }
135
+ const sorted = computed(() => {
136
+ if (!sortKey.value || props.tree) return flatRows.value;
137
+ const arr = [...flatRows.value];
138
+ arr.sort((a, b) => {
139
+ const av = String(a.row[sortKey.value] ?? "");
140
+ const bv = String(b.row[sortKey.value] ?? "");
141
+ const cmp = av.localeCompare(bv, "zh-CN", { numeric: true });
142
+ return sortDir.value === "asc" ? cmp : -cmp;
143
+ });
144
+ return arr;
145
+ });
146
+ const selectedKeys = computed(() => new Set(props.selected.map((r, i) => rowKeyOf(r, i))));
147
+ function isChecked(row, i) {
148
+ return props.selected.some((r) => r === row || rowKeyOf(r, 0) === rowKeyOf(row, i));
149
+ }
150
+ const allChecked = computed(
151
+ () => props.rows.length > 0 && props.rows.every((r, i) => isChecked(r, i))
152
+ );
153
+ const someChecked = computed(() => props.selected.length > 0 && !allChecked.value);
154
+ function toggleRow(row) {
155
+ const next = props.selected.includes(row) ? props.selected.filter((r) => r !== row) : [...props.selected, row];
156
+ emit("update:selected", next);
157
+ emit("change", next);
158
+ }
159
+ function toggleAll() {
160
+ const next = allChecked.value ? [] : [...props.rows];
161
+ emit("update:selected", next);
162
+ emit("change", next);
163
+ }
164
+ function toggleSort(key, col) {
165
+ if (!col.sortable) return;
166
+ if (sortKey.value === key) {
167
+ sortDir.value = sortDir.value === "asc" ? "desc" : "asc";
168
+ } else {
169
+ sortKey.value = key;
170
+ sortDir.value = "asc";
171
+ }
172
+ }
173
+ const expandedRowKeys = ref(/* @__PURE__ */ new Set());
174
+ function toggleRowExpand(item, e) {
175
+ e?.stopPropagation();
176
+ const next = new Set(expandedRowKeys.value);
177
+ if (next.has(item.key)) next.delete(item.key);
178
+ else next.add(item.key);
179
+ expandedRowKeys.value = next;
180
+ }
181
+ const leftCols = computed(() => props.columns.filter((c) => c.fixed === "left"));
182
+ const rightCols = computed(() => props.columns.filter((c) => c.fixed === "right"));
183
+ const leftOffsets = computed(() => {
184
+ const map = {};
185
+ let acc = 0;
186
+ if (props.expandable) acc += 40;
187
+ if (props.selectable) acc += 44;
188
+ for (const c of leftCols.value) {
189
+ map[c.key] = acc + "px";
190
+ acc += parseWidth(c.width);
191
+ }
192
+ return map;
193
+ });
194
+ const rightOffsets = computed(() => {
195
+ const map = {};
196
+ let acc = 0;
197
+ for (let i = rightCols.value.length - 1; i >= 0; i--) {
198
+ const c = rightCols.value[i];
199
+ map[c.key] = acc + "px";
200
+ acc += parseWidth(c.width);
201
+ }
202
+ return map;
203
+ });
204
+ function parseWidth(w) {
205
+ if (!w) return 120;
206
+ const n = parseFloat(w);
207
+ return isNaN(n) ? 120 : n;
208
+ }
209
+ const wrapStyle = computed(
210
+ () => props.maxHeight ? { maxHeight: typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight } : void 0
211
+ );
212
+ const colspan = computed(() => {
213
+ if (props.expandColspan) return props.expandColspan;
214
+ return props.columns.length + (props.selectable ? 1 : 0) + (props.expandable ? 1 : 0);
215
+ });
216
+ const wrapEl = ref(null);
217
+ const scrolledX = ref(false);
218
+ const scrolledEnd = ref(false);
219
+ function syncScrollShadow() {
220
+ const el = wrapEl.value;
221
+ if (!el) return;
222
+ scrolledX.value = el.scrollLeft > 1;
223
+ scrolledEnd.value = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
224
+ }
225
+ onMounted(() => {
226
+ const el = wrapEl.value;
227
+ if (!el) return;
228
+ syncScrollShadow();
229
+ el.addEventListener("scroll", syncScrollShadow, { passive: true });
230
+ if (typeof ResizeObserver !== "undefined") {
231
+ ro = new ResizeObserver(syncScrollShadow);
232
+ ro.observe(el);
233
+ }
234
+ });
235
+ let ro = null;
236
+ onBeforeUnmount(() => {
237
+ wrapEl.value?.removeEventListener("scroll", syncScrollShadow);
238
+ ro?.disconnect();
239
+ ro = null;
240
+ });
241
+ return (_ctx, _cache) => {
242
+ return _openBlock(), _createElementBlock(
243
+ "div",
244
+ {
245
+ ref_key: "wrapEl",
246
+ ref: wrapEl,
247
+ class: _normalizeClass(["wd-table-wrap", {
248
+ "wd-table-wrap--loading": __props.loading,
249
+ "wd-table-wrap--fixed": leftCols.value.length || rightCols.value.length,
250
+ // 只有限制高度才需要纵向滚动 + 表头吸附
251
+ "wd-table-wrap--scrollable": !!__props.maxHeight,
252
+ "wd-table--scrolled-x": scrolledX.value,
253
+ "wd-table--scrolled-end": scrolledEnd.value
254
+ }]),
255
+ style: _normalizeStyle(wrapStyle.value)
256
+ },
257
+ [
258
+ _createCommentVNode("\n \u52A0\u8F7D\u4E2D\u4F46\u8FD8\u6CA1\u6709\u6570\u636E\u65F6\uFF0C\u8868\u683C\u4E5F\u5F97\u6E32\u67D3\u51FA\u6765\uFF08\u8868\u5934 + \u9AA8\u67B6\u884C\uFF09\u2014\u2014\n \u5426\u5219 `rows=[] && loading` \u4F1A\u8BA9\u6574\u4E2A table \u4E0D\u5B58\u5728\uFF0C\n \u5BB9\u5668\u9AD8\u5EA6\u584C\u6210 0\uFF0C\u7EDD\u5BF9\u5B9A\u4F4D\u7684\u906E\u7F69\u6EA2\u51FA\u6210\u4E00\u4E2A\u60AC\u7A7A\u7684\u8F6C\u5708\u3002\n \u5B9E\u6D4B\uFF1A\u6709\u6570\u636E 209px / \u7A7A\u7ED3\u679C 106px / **\u52A0\u8F7D\u4E2D 0px**\uFF0C\u5BB9\u5668\u76F4\u63A5\u6D88\u5931\u3002\n "),
259
+ props.rows.length || __props.loading ? (_openBlock(), _createElementBlock(
260
+ "table",
261
+ {
262
+ key: 0,
263
+ class: _normalizeClass(["wd-table", [`wd-table--${__props.size}`, { "wd-table--striped": __props.striped, "wd-table--tree": __props.tree }]])
264
+ },
265
+ [
266
+ _createElementVNode("thead", null, [
267
+ _createElementVNode("tr", null, [
268
+ __props.expandable ? (_openBlock(), _createElementBlock("th", _hoisted_1)) : _createCommentVNode("v-if", true),
269
+ __props.selectable ? (_openBlock(), _createElementBlock("th", _hoisted_2, [
270
+ _createElementVNode("button", {
271
+ type: "button",
272
+ class: _normalizeClass(["wd-table__check", { "wd-table__check--on": allChecked.value, "wd-table__check--part": someChecked.value }]),
273
+ "aria-checked": allChecked.value ? "true" : someChecked.value ? "mixed" : "false",
274
+ role: "checkbox",
275
+ "aria-label": "\u5168\u9009",
276
+ onClick: toggleAll
277
+ }, [
278
+ someChecked.value && !allChecked.value ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
279
+ key: 0,
280
+ name: "minus",
281
+ size: 10
282
+ })) : allChecked.value ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
283
+ key: 1,
284
+ name: "check",
285
+ size: 10
286
+ })) : _createCommentVNode("v-if", true)
287
+ ], 10, _hoisted_3)
288
+ ])) : _createCommentVNode("v-if", true),
289
+ (_openBlock(true), _createElementBlock(
290
+ _Fragment,
291
+ null,
292
+ _renderList(props.columns, (col) => {
293
+ return _openBlock(), _createElementBlock("th", {
294
+ key: col.key,
295
+ style: _normalizeStyle([
296
+ col.width ? { width: col.width } : void 0,
297
+ /*
298
+ * 表头也要跟数据列同样对齐。
299
+ *
300
+ * 之前只有 td 应用了 col.align,th 一律靠样式表默认的 left ——
301
+ * 于是「数字列整列靠右、表头却还靠左」,视觉上表头和数据错位。
302
+ * 实测 demo 里 stars 列写了 align:'right',数据靠右、表头没动。
303
+ */
304
+ col.align ? { textAlign: col.align } : void 0,
305
+ col.ellipsis && col.width ? { maxWidth: col.width } : void 0,
306
+ col.fixed === "left" ? { position: "sticky", left: leftOffsets.value[col.key], zIndex: 3 } : void 0,
307
+ col.fixed === "right" ? { position: "sticky", right: rightOffsets.value[col.key], zIndex: 3 } : void 0
308
+ ]),
309
+ class: _normalizeClass(["wd-table__th", {
310
+ "wd-table__th--sort": col.sortable,
311
+ "wd-table__th--fixed-left": col.fixed === "left",
312
+ "wd-table__th--fixed-right": col.fixed === "right",
313
+ "wd-table__th--ellipsis": col.ellipsis
314
+ }]),
315
+ "aria-sort": sortKey.value === col.key ? sortDir.value === "asc" ? "ascending" : "descending" : "none",
316
+ onClick: ($event) => toggleSort(col.key, col)
317
+ }, [
318
+ _createTextVNode(
319
+ _toDisplayString(col.title) + " ",
320
+ 1
321
+ /* TEXT */
322
+ ),
323
+ col.sortable ? (_openBlock(), _createElementBlock("span", _hoisted_5, [
324
+ _createVNode(_unref(WdIcon_default), {
325
+ name: sortKey.value !== col.key || sortDir.value === "asc" ? "arrow-up" : "arrow-down",
326
+ size: 12,
327
+ style: _normalizeStyle({ color: sortKey.value === col.key ? "var(--wd-red)" : "var(--wd-ink-3)" })
328
+ }, null, 8, ["name", "style"])
329
+ ])) : _createCommentVNode("v-if", true)
330
+ ], 14, _hoisted_4);
331
+ }),
332
+ 128
333
+ /* KEYED_FRAGMENT */
334
+ ))
335
+ ])
336
+ ]),
337
+ _createElementVNode("tbody", null, [
338
+ (_openBlock(true), _createElementBlock(
339
+ _Fragment,
340
+ null,
341
+ _renderList(sorted.value, (item, i) => {
342
+ return _openBlock(), _createElementBlock(
343
+ _Fragment,
344
+ {
345
+ key: item.key
346
+ },
347
+ [
348
+ _createElementVNode("tr", {
349
+ class: _normalizeClass(["wd-table__row", {
350
+ "wd-table__row--checked": __props.selectable && isChecked(item.row, i),
351
+ "wd-table__row--expanded": expandedRowKeys.value.has(item.key)
352
+ }]),
353
+ onClick: ($event) => emit("row-click", item.row, i)
354
+ }, [
355
+ _createCommentVNode(" \u5C55\u5F00\u5217 "),
356
+ __props.expandable ? (_openBlock(), _createElementBlock("td", {
357
+ key: 0,
358
+ class: "wd-table__td--expand",
359
+ onClick: _cache[0] || (_cache[0] = _withModifiers(() => {
360
+ }, ["stop"]))
361
+ }, [
362
+ _createElementVNode("button", {
363
+ type: "button",
364
+ class: _normalizeClass(["wd-table__expander", { "is-open": expandedRowKeys.value.has(item.key) }]),
365
+ "aria-expanded": expandedRowKeys.value.has(item.key),
366
+ "aria-label": "\u5C55\u5F00\u884C",
367
+ onClick: ($event) => toggleRowExpand(item, $event)
368
+ }, [
369
+ _createVNode(_unref(WdIcon_default), {
370
+ name: "chevron-right",
371
+ size: 13
372
+ })
373
+ ], 10, _hoisted_7)
374
+ ])) : _createCommentVNode("v-if", true),
375
+ _createCommentVNode(" \u52FE\u9009\u5217 "),
376
+ __props.selectable ? (_openBlock(), _createElementBlock("td", {
377
+ key: 1,
378
+ class: "wd-table__td--check",
379
+ onClick: _cache[1] || (_cache[1] = _withModifiers(() => {
380
+ }, ["stop"]))
381
+ }, [
382
+ _createElementVNode("button", {
383
+ type: "button",
384
+ class: _normalizeClass(["wd-table__check", { "wd-table__check--on": isChecked(item.row, i) }]),
385
+ "aria-checked": isChecked(item.row, i) ? "true" : "false",
386
+ role: "checkbox",
387
+ "aria-label": "\u9009\u62E9\u6B64\u884C",
388
+ onClick: ($event) => toggleRow(item.row)
389
+ }, [
390
+ isChecked(item.row, i) ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
391
+ key: 0,
392
+ name: "check",
393
+ size: 10
394
+ })) : _createCommentVNode("v-if", true)
395
+ ], 10, _hoisted_8)
396
+ ])) : _createCommentVNode("v-if", true),
397
+ _createCommentVNode(" \u6570\u636E\u5217 "),
398
+ (_openBlock(true), _createElementBlock(
399
+ _Fragment,
400
+ null,
401
+ _renderList(props.columns, (col, ci) => {
402
+ return _openBlock(), _createElementBlock(
403
+ "td",
404
+ {
405
+ key: col.key,
406
+ style: _normalizeStyle([
407
+ col.align ? { textAlign: col.align } : void 0,
408
+ /*
409
+ * ellipsis 列给宽度上限。
410
+ *
411
+ * 表格是 min-width: max-content(内容超宽时横向滚动),
412
+ * 不加 max-width 的话这一列会按内容撑到 388px,把表格顶出容器,
413
+ * 横向滚起来、省略号永远看不到 —— 等于 ellipsis 失效。
414
+ * 有上限后内容才真的被截断。没声明 width 的就不限。
415
+ */
416
+ col.ellipsis && col.width ? { maxWidth: col.width } : void 0,
417
+ col.fixed === "left" ? { position: "sticky", left: leftOffsets.value[col.key], zIndex: 2 } : void 0,
418
+ col.fixed === "right" ? { position: "sticky", right: rightOffsets.value[col.key], zIndex: 2 } : void 0
419
+ ]),
420
+ class: _normalizeClass({
421
+ "wd-table__td--fixed-left": col.fixed === "left",
422
+ "wd-table__td--fixed-right": col.fixed === "right",
423
+ "wd-table__td--ellipsis": col.ellipsis
424
+ })
425
+ },
426
+ [
427
+ _createCommentVNode("\n \u6811\u5F62\u7F29\u8FDB\u653E\u5728**\u7B2C\u4E00\u5217\u7684\u5355\u5143\u683C\u5185\u90E8**\uFF0C\u800C\u4E0D\u662F\u7ED9\u6574\u884C\u52A0 padding\uFF1A\n \u6574\u884C\u52A0 padding \u4F1A\u628A\u56FA\u5B9A\u5217\u4E5F\u63A8\u504F\uFF0C\u7F29\u8FDB\u5E94\u8BE5\u662F\u5185\u5BB9\u5C42\u7684\u5C5E\u6027\u3002\n "),
428
+ __props.tree && ci === 0 ? (_openBlock(), _createElementBlock(
429
+ "span",
430
+ {
431
+ key: 0,
432
+ class: "wd-table__indent",
433
+ style: _normalizeStyle({ paddingLeft: item.depth * 18 + "px" })
434
+ },
435
+ [
436
+ item.hasChildren ? (_openBlock(), _createElementBlock("button", {
437
+ key: 0,
438
+ type: "button",
439
+ class: _normalizeClass(["wd-table__tree-toggle", { "is-open": item.expanded }]),
440
+ "aria-expanded": item.expanded,
441
+ "aria-label": item.expanded ? "\u6536\u8D77" : "\u5C55\u5F00",
442
+ onClick: _withModifiers(($event) => toggleExpand(item, $event), ["stop"])
443
+ }, [
444
+ _createVNode(_unref(WdIcon_default), {
445
+ name: "chevron-right",
446
+ size: 12
447
+ })
448
+ ], 10, _hoisted_9)) : (_openBlock(), _createElementBlock(
449
+ _Fragment,
450
+ { key: 1 },
451
+ [
452
+ _createCommentVNode(" \u65E0\u5B50\u8282\u70B9\u7684\u53F6\u5B50\uFF1A\u5360\u4E00\u4E2A\u4E0E\u7BAD\u5934\u7B49\u5BBD\u7684\u4F4D\uFF0C\u4FDD\u6301\u6587\u5B57\u5BF9\u9F50 "),
453
+ _cache[2] || (_cache[2] = _createElementVNode(
454
+ "span",
455
+ { class: "wd-table__tree-spacer" },
456
+ null,
457
+ -1
458
+ /* CACHED */
459
+ ))
460
+ ],
461
+ 2112
462
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
463
+ ))
464
+ ],
465
+ 4
466
+ /* STYLE */
467
+ )) : _createCommentVNode("v-if", true),
468
+ _renderSlot(_ctx.$slots, `cell-${col.key}`, {
469
+ row: item.row,
470
+ value: item.row[col.key],
471
+ depth: item.depth
472
+ }, () => [
473
+ _createTextVNode(
474
+ _toDisplayString(item.row[col.key]),
475
+ 1
476
+ /* TEXT */
477
+ )
478
+ ])
479
+ ],
480
+ 6
481
+ /* CLASS, STYLE */
482
+ );
483
+ }),
484
+ 128
485
+ /* KEYED_FRAGMENT */
486
+ ))
487
+ ], 10, _hoisted_6),
488
+ _createCommentVNode(" \u884C\u5C55\u5F00\u8BE6\u60C5 "),
489
+ __props.expandable && expandedRowKeys.value.has(item.key) ? (_openBlock(), _createElementBlock("tr", _hoisted_10, [
490
+ _createElementVNode("td", {
491
+ colspan: colspan.value,
492
+ class: "wd-table__expand-cell"
493
+ }, [
494
+ _renderSlot(_ctx.$slots, "expand", {
495
+ row: item.row,
496
+ index: i
497
+ }, () => [
498
+ _cache[3] || (_cache[3] = _createElementVNode(
499
+ "span",
500
+ { class: "wd-table__expand-empty" },
501
+ "\u672A\u63D0\u4F9B expand \u63D2\u69FD",
502
+ -1
503
+ /* CACHED */
504
+ ))
505
+ ])
506
+ ], 8, _hoisted_11)
507
+ ])) : _createCommentVNode("v-if", true)
508
+ ],
509
+ 64
510
+ /* STABLE_FRAGMENT */
511
+ );
512
+ }),
513
+ 128
514
+ /* KEYED_FRAGMENT */
515
+ )),
516
+ _createCommentVNode("\n \u52A0\u8F7D\u4E2D\u4E14\u8FD8\u6CA1\u6709\u6570\u636E\uFF1A\u8865\u51E0\u884C\u5360\u4F4D\uFF0C\u8BA9\u5BB9\u5668\u9AD8\u5EA6\u63A5\u8FD1\u300C\u6709\u6570\u636E\u300D\u7684\u6837\u5B50\u3002\n \u5426\u5219\u53EA\u5269\u4E00\u6839\u8868\u5934 \u2014\u2014 \u867D\u7136\u4E0D\u518D\u584C\u6210 0\uFF0C\u4F46\u548C\u52A0\u8F7D\u5B8C\u7684\u9AD8\u5EA6\u4ECD\u5DEE\u4E00\u5927\u622A\uFF0C\n \u6570\u636E\u56DE\u6765\u65F6\u8FD8\u662F\u4F1A\u5F80\u4E0B\u9876\u4E00\u4E0B\u3002\n \u7528 aria-hidden\uFF0C\u8BFB\u5C4F\u4E0D\u5FF5\u8FD9\u4E9B\u7A7A\u58F3\u3002\n "),
517
+ (_openBlock(true), _createElementBlock(
518
+ _Fragment,
519
+ null,
520
+ _renderList(__props.loading && !sorted.value.length ? 3 : 0, (n) => {
521
+ return _openBlock(), _createElementBlock("tr", {
522
+ key: `ghost-${n}`,
523
+ class: "wd-table__ghost",
524
+ "aria-hidden": "true"
525
+ }, [
526
+ __props.expandable ? (_openBlock(), _createElementBlock("td", _hoisted_12)) : _createCommentVNode("v-if", true),
527
+ __props.selectable ? (_openBlock(), _createElementBlock("td", _hoisted_13)) : _createCommentVNode("v-if", true),
528
+ (_openBlock(true), _createElementBlock(
529
+ _Fragment,
530
+ null,
531
+ _renderList(props.columns, (col) => {
532
+ return _openBlock(), _createElementBlock("td", {
533
+ key: col.key
534
+ }, [..._cache[4] || (_cache[4] = [
535
+ _createElementVNode(
536
+ "span",
537
+ { class: "wd-table__ghost-bar" },
538
+ null,
539
+ -1
540
+ /* CACHED */
541
+ )
542
+ ])]);
543
+ }),
544
+ 128
545
+ /* KEYED_FRAGMENT */
546
+ ))
547
+ ]);
548
+ }),
549
+ 128
550
+ /* KEYED_FRAGMENT */
551
+ ))
552
+ ])
553
+ ],
554
+ 2
555
+ /* CLASS */
556
+ )) : !__props.loading ? (_openBlock(), _createElementBlock(
557
+ "div",
558
+ _hoisted_14,
559
+ _toDisplayString(__props.emptyText),
560
+ 1
561
+ /* TEXT */
562
+ )) : _createCommentVNode("v-if", true),
563
+ _createCommentVNode(" \u52A0\u8F7D\u4E2D\uFF1A\u76D6\u4E00\u5C42\u534A\u900F\u660E\u906E\u7F69 + \u8F6C\u5708\uFF0C\u4FDD\u7559\u8868\u5934\u7ED3\u6784 "),
564
+ __props.loading ? (_openBlock(), _createElementBlock("div", _hoisted_15, [
565
+ _cache[5] || (_cache[5] = _createElementVNode(
566
+ "span",
567
+ { class: "wd-spinner" },
568
+ null,
569
+ -1
570
+ /* CACHED */
571
+ )),
572
+ _createElementVNode(
573
+ "span",
574
+ null,
575
+ _toDisplayString(__props.loadingText),
576
+ 1
577
+ /* TEXT */
578
+ )
579
+ ])) : _createCommentVNode("v-if", true)
580
+ ],
581
+ 6
582
+ /* CLASS, STYLE */
583
+ );
584
+ };
585
+ }
586
+ });
587
+ export {
588
+ WdTable_default as WdTable
589
+ };