x-next 1.6.0 → 1.8.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 (166) hide show
  1. package/AI_USAGE.md +182 -4
  2. package/CHANGELOG.md +74 -0
  3. package/dist/_hooks/use-chart-size.d.ts +25 -0
  4. package/dist/_utils/chart/index.d.ts +6 -0
  5. package/dist/_utils/chart/padding.d.ts +15 -0
  6. package/dist/_utils/chart/path.d.ts +34 -0
  7. package/dist/_utils/chart/scale.d.ts +55 -0
  8. package/dist/components/_components/chart/ChartAxis.d.ts +85 -0
  9. package/dist/components/_components/chart/ChartLegend.d.ts +26 -0
  10. package/dist/components/_components/chart/ChartTooltip.d.ts +76 -0
  11. package/dist/components/_components/chart/colors.d.ts +10 -0
  12. package/dist/components/_components/chart/interface.d.ts +38 -0
  13. package/dist/components/bar-chart/BarChart.d.ts +278 -0
  14. package/dist/components/bar-chart/helpers/layout.d.ts +55 -0
  15. package/dist/components/bar-chart/index.d.ts +600 -0
  16. package/dist/components/bar-chart/interface.d.ts +74 -0
  17. package/dist/components/bar-chart/props.d.ts +145 -0
  18. package/dist/components/date-picker/DatePicker.vue.d.ts +3 -3
  19. package/dist/components/date-picker/index.d.ts +6 -6
  20. package/dist/components/draggable/Draggable.d.ts +1 -1
  21. package/dist/components/draggable/index.d.ts +2 -2
  22. package/dist/components/drawer/index.d.ts +6 -6
  23. package/dist/components/drawer/src/Drawer.vue.d.ts +3 -3
  24. package/dist/components/dropdown/Dropdown.vue.d.ts +4 -4
  25. package/dist/components/dropdown/DropdownButton.vue.d.ts +5 -5
  26. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +4 -4
  27. package/dist/components/dropdown/index.d.ts +29 -29
  28. package/dist/components/form/FormItem.vue.d.ts +12 -12
  29. package/dist/components/form/form-item-label.vue.d.ts +3 -3
  30. package/dist/components/form/index.d.ts +24 -24
  31. package/dist/components/form-select/Select.d.ts +3 -3
  32. package/dist/components/form-select/index.d.ts +6 -6
  33. package/dist/components/form-slider/Slider.vue.d.ts +3 -3
  34. package/dist/components/form-slider/index.d.ts +6 -6
  35. package/dist/components/form-slider/slider-button.vue.d.ts +3 -3
  36. package/dist/components/grid/Row.vue.d.ts +3 -3
  37. package/dist/components/grid/index.d.ts +9 -9
  38. package/dist/components/heatmap/Heatmap.d.ts +10 -0
  39. package/dist/components/heatmap/index.d.ts +30 -0
  40. package/dist/components/image/Image.vue.d.ts +125 -17
  41. package/dist/components/image/ImagePreview.vue.d.ts +97 -7
  42. package/dist/components/image/ImagePreviewAction.d.ts +3 -3
  43. package/dist/components/image/ImagePreviewGroup.vue.d.ts +100 -7
  44. package/dist/components/image/hooks/use-image-drag.d.ts +2 -2
  45. package/dist/components/image/index.d.ts +712 -124
  46. package/dist/components/image/interface.d.ts +9 -1
  47. package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
  48. package/dist/components/index.d.ts +4 -0
  49. package/dist/components/line-chart/LineChart.d.ts +295 -0
  50. package/dist/components/line-chart/helpers/layout.d.ts +74 -0
  51. package/dist/components/line-chart/index.d.ts +614 -0
  52. package/dist/components/line-chart/interface.d.ts +76 -0
  53. package/dist/components/line-chart/props.d.ts +173 -0
  54. package/dist/components/menu/sub-menu-pop.vue.d.ts +3 -3
  55. package/dist/components/pagination/page-options.vue.d.ts +6 -6
  56. package/dist/components/pie-chart/PieChart.d.ts +219 -0
  57. package/dist/components/pie-chart/index.d.ts +470 -0
  58. package/dist/components/pie-chart/interface.d.ts +58 -0
  59. package/dist/components/pie-chart/props.d.ts +107 -0
  60. package/dist/components/popconfirm/src/popup.vue.d.ts +3 -3
  61. package/dist/components/popover/Popover.d.ts +1 -1
  62. package/dist/components/popover/index.d.ts +3 -3
  63. package/dist/components/popup/Popup.d.ts +1 -1
  64. package/dist/components/popup/index.d.ts +3 -3
  65. package/dist/components/space/Space.d.ts +1 -1
  66. package/dist/components/space/index.d.ts +3 -3
  67. package/dist/components/tabs/Tabs.d.ts +1 -1
  68. package/dist/components/tabs/index.d.ts +3 -3
  69. package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
  70. package/dist/components/time-picker/index.d.ts +6 -6
  71. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  72. package/dist/components/tooltip/index.d.ts +3 -3
  73. package/dist/components/trend-chart/components/TrendChart.d.ts +19 -96
  74. package/dist/components/trend-chart/index.d.ts +33 -187
  75. package/dist/components/trend-chart/props.d.ts +9 -78
  76. package/dist/components/trend-chart/themes.d.ts +0 -1
  77. package/dist/components/trigger/Trigger.d.ts +1 -1
  78. package/dist/components/trigger/index.d.ts +3 -3
  79. package/dist/components/upload/Upload.d.ts +372 -0
  80. package/dist/components/upload/context.d.ts +28 -0
  81. package/dist/components/upload/index.d.ts +656 -0
  82. package/dist/components/upload/interface.d.ts +110 -0
  83. package/dist/components/upload/props.d.ts +321 -0
  84. package/dist/components/upload/upload-list-item.d.ts +15 -0
  85. package/dist/components/upload/upload-list.d.ts +11 -0
  86. package/dist/components/upload/upload-picture-item.d.ts +20 -0
  87. package/dist/components/upload/upload-trigger.d.ts +8 -0
  88. package/dist/components/upload/utils.d.ts +48 -0
  89. package/dist/es/_hooks/use-chart-size.js +25 -0
  90. package/dist/es/_styles/palette-aliases.js +7 -4
  91. package/dist/es/_utils/chart/padding.js +22 -0
  92. package/dist/es/_utils/chart/path.js +69 -0
  93. package/dist/es/_utils/chart/scale.js +77 -0
  94. package/dist/es/components/_components/chart/ChartAxis.js +79 -0
  95. package/dist/es/components/_components/chart/ChartLegend.js +53 -0
  96. package/dist/es/components/_components/chart/ChartTooltip.js +64 -0
  97. package/dist/es/components/_components/chart/colors.js +12 -0
  98. package/dist/es/components/bar-chart/BarChart.js +470 -0
  99. package/dist/es/components/bar-chart/helpers/layout.js +53 -0
  100. package/dist/es/components/bar-chart/index.js +8 -0
  101. package/dist/es/components/bar-chart/props.js +148 -0
  102. package/dist/es/components/heatmap/Heatmap.js +244 -169
  103. package/dist/es/components/image/Image.vue.js +55 -45
  104. package/dist/es/components/image/Image.vue2.js +113 -92
  105. package/dist/es/components/image/ImagePreview.vue.js +66 -53
  106. package/dist/es/components/image/ImagePreview.vue2.js +219 -171
  107. package/dist/es/components/image/ImagePreviewAction.js +12 -15
  108. package/dist/es/components/image/ImagePreviewGroup.vue.js +21 -20
  109. package/dist/es/components/image/ImagePreviewGroup.vue2.js +45 -39
  110. package/dist/es/components/image/hooks/use-image-drag.js +16 -14
  111. package/dist/es/components/index.js +136 -128
  112. package/dist/es/components/line-chart/LineChart.js +532 -0
  113. package/dist/es/components/line-chart/helpers/layout.js +80 -0
  114. package/dist/es/components/line-chart/index.js +8 -0
  115. package/dist/es/components/line-chart/props.js +178 -0
  116. package/dist/es/components/pie-chart/PieChart.js +397 -0
  117. package/dist/es/components/pie-chart/index.js +8 -0
  118. package/dist/es/components/pie-chart/props.js +104 -0
  119. package/dist/es/components/trend-chart/components/TrendChart.js +143 -183
  120. package/dist/es/components/trend-chart/components/trend-chart-curve.js +85 -81
  121. package/dist/es/components/trend-chart/props.js +28 -74
  122. package/dist/es/components/trend-chart/themes.js +30 -31
  123. package/dist/es/components/upload/Upload.js +420 -0
  124. package/dist/es/components/upload/context.js +4 -0
  125. package/dist/es/components/upload/index.js +8 -0
  126. package/dist/es/components/upload/props.js +321 -0
  127. package/dist/es/components/upload/upload-list-item.js +138 -0
  128. package/dist/es/components/upload/upload-list.js +48 -0
  129. package/dist/es/components/upload/upload-picture-item.js +109 -0
  130. package/dist/es/components/upload/upload-trigger.js +89 -0
  131. package/dist/es/components/upload/utils.js +195 -0
  132. package/dist/es/icons/_self/upload-icons.js +103 -0
  133. package/dist/es/index.js +197 -189
  134. package/dist/es/locale/en-US.js +30 -1
  135. package/dist/es/locale/zh-CN.js +30 -1
  136. package/dist/es/style.css +1 -1
  137. package/dist/icons/_self/upload-icons.d.ts +523 -0
  138. package/dist/index.cjs +4 -4
  139. package/dist/index.umd.js +4 -4
  140. package/dist/locale/interface.d.ts +45 -0
  141. package/dist/style/bar-chart.css +1 -0
  142. package/dist/style/bar-chart.js +2 -0
  143. package/dist/style/base.css +1 -1
  144. package/dist/style/heatmap.css +1 -1
  145. package/dist/style/image.css +1 -1
  146. package/dist/style/line-chart.css +1 -0
  147. package/dist/style/line-chart.js +2 -0
  148. package/dist/style/pie-chart.css +1 -0
  149. package/dist/style/pie-chart.js +2 -0
  150. package/dist/style/upload.css +1 -0
  151. package/dist/style/upload.js +2 -0
  152. package/dist/style.css +1 -1
  153. package/dist/types.d.ts +4 -0
  154. package/package.json +1 -1
  155. package/volar.d.ts +4 -0
  156. package/dist/components/trend-chart/components/trend-chart-grid.d.ts +0 -55
  157. package/dist/components/trend-chart/components/trend-chart-labels.d.ts +0 -26
  158. package/dist/components/trend-chart/helpers/genPath.d.ts +0 -8
  159. package/dist/components/trend-chart/helpers/getPadding.d.ts +0 -8
  160. package/dist/components/trend-chart/helpers/validatePadding.d.ts +0 -2
  161. package/dist/es/_hooks/use-popup-overflow-hidden.js +0 -29
  162. package/dist/es/components/trend-chart/components/trend-chart-grid.js +0 -62
  163. package/dist/es/components/trend-chart/components/trend-chart-labels.js +0 -75
  164. package/dist/es/components/trend-chart/helpers/genPath.js +0 -22
  165. package/dist/es/components/trend-chart/helpers/getPadding.js +0 -21
  166. package/dist/es/components/trend-chart/helpers/validatePadding.js +0 -7
@@ -0,0 +1,4 @@
1
+ const o = Symbol("x-upload");
2
+ export {
3
+ o as uploadInjectionKey
4
+ };
@@ -0,0 +1,8 @@
1
+ import o from "./Upload.js";
2
+ import { generateComponent as t } from "../../_utils/vue-eco.js";
3
+ import { getComponentPrefix as e } from "../../_utils/config.js";
4
+ const a = t(e("Upload"), o);
5
+ export {
6
+ a as Upload,
7
+ a as default
8
+ };
@@ -0,0 +1,321 @@
1
+ const e = {
2
+ /**
3
+ * @zh 文件列表,支持 v-model:file-list 受控
4
+ * @en File list, controlled by v-model:file-list
5
+ * @vModel
6
+ */
7
+ fileList: {
8
+ type: Array,
9
+ default: void 0
10
+ },
11
+ /**
12
+ * @zh 非受控模式下的初始文件列表
13
+ * @en Initial file list in uncontrolled mode
14
+ * @defaultValue []
15
+ */
16
+ defaultFileList: {
17
+ type: Array,
18
+ default: () => []
19
+ },
20
+ /**
21
+ * @zh 上传地址,传函数时按文件动态解析并支持异步
22
+ * @en Upload URL; a function is resolved per file and may be async
23
+ */
24
+ action: {
25
+ type: [String, Function],
26
+ default: void 0
27
+ },
28
+ /**
29
+ * @zh 上传请求方法
30
+ * @en Upload request method
31
+ * @values 'post', 'put', 'patch'
32
+ * @defaultValue 'post'
33
+ */
34
+ method: {
35
+ type: String,
36
+ default: "post"
37
+ },
38
+ /**
39
+ * @zh 请求头
40
+ * @en Request headers
41
+ */
42
+ headers: {
43
+ type: Object,
44
+ default: void 0
45
+ },
46
+ /**
47
+ * @zh 附加表单字段,传函数时按文件动态解析
48
+ * @en Extra form fields; a function is resolved per file
49
+ */
50
+ data: {
51
+ type: [Object, Function],
52
+ default: void 0
53
+ },
54
+ /**
55
+ * @zh 文件字段名,传函数时按文件动态解析
56
+ * @en File field name; a function is resolved per file
57
+ * @defaultValue 'file'
58
+ */
59
+ name: {
60
+ type: [String, Function],
61
+ default: "file"
62
+ },
63
+ /**
64
+ * @zh 是否携带 Cookie
65
+ * @en Whether to send cookies
66
+ * @defaultValue false
67
+ */
68
+ withCredentials: {
69
+ type: Boolean,
70
+ default: !1
71
+ },
72
+ /**
73
+ * @zh 请求超时毫秒数,0 表示不超时
74
+ * @en Request timeout in milliseconds; 0 disables the timeout
75
+ * @defaultValue 0
76
+ */
77
+ timeout: {
78
+ type: Number,
79
+ default: 0
80
+ },
81
+ /**
82
+ * @zh 自定义上传请求;返回 Promise 时自动接管状态与结果,返回 `{ abort }` 时手动回调
83
+ * @en Custom upload request; a returned Promise drives the state automatically, an `{ abort }` handle keeps manual control
84
+ */
85
+ customRequest: {
86
+ type: Function,
87
+ default: void 0
88
+ },
89
+ /**
90
+ * @zh 接受的文件类型,同原生 accept
91
+ * @en Accepted file types, same as the native accept attribute
92
+ */
93
+ accept: {
94
+ type: String,
95
+ default: void 0
96
+ },
97
+ /**
98
+ * @zh 是否允许选择多个文件
99
+ * @en Whether multiple files can be selected
100
+ * @defaultValue false
101
+ */
102
+ multiple: {
103
+ type: Boolean,
104
+ default: !1
105
+ },
106
+ /**
107
+ * @zh 是否支持选择文件夹(含拖拽目录递归)
108
+ * @en Whether directory selection is enabled, including recursive drop traversal
109
+ * @defaultValue false
110
+ */
111
+ directory: {
112
+ type: Boolean,
113
+ default: !1
114
+ },
115
+ /**
116
+ * @zh 移动端捕获来源,透传给原生 input
117
+ * @en Capture source passed to the native input on mobile
118
+ * @values true, 'user', 'environment'
119
+ */
120
+ capture: {
121
+ type: [Boolean, String],
122
+ default: void 0
123
+ },
124
+ /**
125
+ * @zh 是否支持聚焦后粘贴文件(如截图后 Ctrl / Cmd + V)
126
+ * @en Whether pasting files is enabled while focused, e.g. a screenshot with Ctrl / Cmd + V
127
+ * @defaultValue false
128
+ */
129
+ paste: {
130
+ type: Boolean,
131
+ default: !1
132
+ },
133
+ /**
134
+ * @zh 是否渲染为拖拽上传区域
135
+ * @en Whether to render a drag and drop area
136
+ * @defaultValue false
137
+ */
138
+ draggable: {
139
+ type: Boolean,
140
+ default: !1
141
+ },
142
+ /**
143
+ * @zh 是否禁用
144
+ * @en Whether the upload is disabled
145
+ * @defaultValue false
146
+ */
147
+ disabled: {
148
+ type: Boolean,
149
+ default: void 0
150
+ },
151
+ /**
152
+ * @zh 是否选择后立即上传;关闭后需调用 submit 或点击开始上传
153
+ * @en Whether to upload immediately after selection; disable it to call submit manually
154
+ * @defaultValue true
155
+ */
156
+ autoUpload: {
157
+ type: Boolean,
158
+ default: !0
159
+ },
160
+ /**
161
+ * @zh 最大文件数量,0 表示不限;超出部分触发 exceed 事件
162
+ * @en Maximum number of files, 0 means unlimited; extra files trigger the exceed event
163
+ * @defaultValue 0
164
+ */
165
+ limit: {
166
+ type: Number,
167
+ default: 0
168
+ },
169
+ /**
170
+ * @zh 上传前置钩子,可拦截或替换文件
171
+ * @en Pre-upload hook that can intercept or replace files
172
+ */
173
+ beforeUpload: {
174
+ type: Function,
175
+ default: void 0
176
+ },
177
+ /**
178
+ * @zh 移除前置钩子,返回 false 或 reject 可阻止移除
179
+ * @en Pre-remove hook; returning false or rejecting prevents removal
180
+ */
181
+ beforeRemove: {
182
+ type: Function,
183
+ default: void 0
184
+ },
185
+ /**
186
+ * @zh 列表展示形态
187
+ * @en List display type
188
+ * @values 'text', 'picture', 'picture-card'
189
+ * @defaultValue 'text'
190
+ */
191
+ listType: {
192
+ type: String,
193
+ default: "text"
194
+ },
195
+ /**
196
+ * @zh 提示文案,拖拽区和图片卡中显示
197
+ * @en Tip text shown in the dragger and picture card
198
+ */
199
+ tip: {
200
+ type: String,
201
+ default: void 0
202
+ },
203
+ /**
204
+ * @zh 是否展示文件列表
205
+ * @en Whether to show the file list
206
+ * @defaultValue true
207
+ */
208
+ showFileList: {
209
+ type: Boolean,
210
+ default: !0
211
+ },
212
+ /**
213
+ * @zh 是否展示上传入口;对象形式可配置达到 limit 后仍显示
214
+ * @en Whether to show the upload trigger; the object form keeps it visible on limit
215
+ * @defaultValue true
216
+ */
217
+ showUploadButton: {
218
+ type: [Boolean, Object],
219
+ default: !0
220
+ },
221
+ /**
222
+ * @zh 是否展示移除按钮
223
+ * @en Whether to show the remove button
224
+ * @defaultValue true
225
+ */
226
+ showRemoveButton: {
227
+ type: Boolean,
228
+ default: !0
229
+ },
230
+ /**
231
+ * @zh 是否展示重试 / 开始上传按钮
232
+ * @en Whether to show retry / start buttons
233
+ * @defaultValue true
234
+ */
235
+ showRetryButton: {
236
+ type: Boolean,
237
+ default: !0
238
+ },
239
+ /**
240
+ * @zh 是否展示取消上传按钮
241
+ * @en Whether to show the cancel button
242
+ * @defaultValue true
243
+ */
244
+ showCancelButton: {
245
+ type: Boolean,
246
+ default: !0
247
+ },
248
+ /**
249
+ * @zh 是否展示预览按钮
250
+ * @en Whether to show the preview button
251
+ * @defaultValue true
252
+ */
253
+ showPreviewButton: {
254
+ type: Boolean,
255
+ default: !0
256
+ },
257
+ /**
258
+ * @zh 是否展示下载按钮
259
+ * @en Whether to show the download button
260
+ * @defaultValue false
261
+ */
262
+ showDownloadButton: {
263
+ type: Boolean,
264
+ default: !1
265
+ },
266
+ /**
267
+ * @zh 链接是否带 download 属性,点击直接下载
268
+ * @en Whether links carry the download attribute
269
+ * @defaultValue false
270
+ */
271
+ download: {
272
+ type: Boolean,
273
+ default: !1
274
+ },
275
+ /**
276
+ * @zh 有地址时是否渲染为链接
277
+ * @en Whether to render files with a URL as links
278
+ * @defaultValue true
279
+ */
280
+ showLink: {
281
+ type: Boolean,
282
+ default: !0
283
+ },
284
+ /**
285
+ * @zh 内置图片预览,点击图片用 ImagePreview 打开
286
+ * @en Built-in image preview using ImagePreview on click
287
+ * @defaultValue false
288
+ */
289
+ imagePreview: {
290
+ type: Boolean,
291
+ default: !1
292
+ },
293
+ /**
294
+ * @zh 缩略图的原生 loading 策略
295
+ * @en Native loading strategy for thumbnails
296
+ * @values 'eager', 'lazy'
297
+ */
298
+ imageLoading: {
299
+ type: String,
300
+ default: void 0
301
+ },
302
+ /**
303
+ * @zh 上传成功后从响应中提取 url 的字段名(支持 `data.url` 嵌套路径)或解析函数
304
+ * @en Field name (nested paths like `data.url` supported) or resolver extracting the file URL from the response
305
+ */
306
+ responseUrlKey: {
307
+ type: [String, Function],
308
+ default: void 0
309
+ },
310
+ /**
311
+ * @zh 上传入口的无障碍名称
312
+ * @en Accessible name of the upload trigger
313
+ */
314
+ ariaLabel: {
315
+ type: String,
316
+ default: void 0
317
+ }
318
+ };
319
+ export {
320
+ e as uploadProps
321
+ };
@@ -0,0 +1,138 @@
1
+ import { defineComponent as R, inject as j, computed as t, createVNode as n } from "vue";
2
+ import { getClassNameMixin as M } from "../../_utils/config.js";
3
+ import { useLocale as H } from "../../locale/index.js";
4
+ import r from "../_components/icon-hover/index.vue.js";
5
+ import K from "../../icons/default/close.js";
6
+ import q from "../../icons/default/exclamation.js";
7
+ import A from "../../icons/default/eye.js";
8
+ import F from "../progress/Progress.vue.js";
9
+ import { IconUploadRefresh as O, IconUploadDownload as S, IconUploadTrash as V, IconUploadImage as U, IconUploadFile as B } from "../../icons/_self/upload-icons.js";
10
+ import { uploadInjectionKey as _ } from "./context.js";
11
+ import { isImageItem as v } from "./utils.js";
12
+ const ae = /* @__PURE__ */ R({
13
+ name: "UploadListItem",
14
+ props: {
15
+ file: {
16
+ type: Object,
17
+ required: !0
18
+ }
19
+ },
20
+ setup(l) {
21
+ const e = j(_);
22
+ if (!e) return () => null;
23
+ const {
24
+ t: u
25
+ } = H(), a = M("upload"), o = t(() => l.file.status ?? "done"), f = t(() => o.value === "uploading"), T = t(() => o.value === "done"), h = t(() => o.value === "error"), P = t(() => e.listType.value === "picture"), c = t(() => l.file.thumbUrl || l.file.url), d = t(() => !!c.value && v(l.file)), z = t(() => Math.max(0, Math.min(1, l.file.percent ?? 0))), m = t(() => e.props.showPreviewButton && (d.value || !!l.file.url)), D = t(() => l.file.url || c.value), p = t(() => !!l.file.url && e.props.showLink), w = t(() => e.getErrorText(l.file)), L = t(() => [a.element("item"), a.element(`item-${o.value}`), e.listType.value === "picture" && a.element("item-picture")]), b = t(() => [a.element("item-name"), p.value && a.element("item-name-link")]), k = () => {
26
+ l.file.url && e.props.download || e.handlePreview(l.file);
27
+ }, E = () => e.slots.image ? n("span", {
28
+ class: a.element("item-thumbnail")
29
+ }, [e.slots.image({
30
+ file: l.file
31
+ })]) : d.value ? n("span", {
32
+ class: a.element("item-thumbnail")
33
+ }, [n("img", {
34
+ src: c.value,
35
+ alt: l.file.name,
36
+ loading: e.props.imageLoading,
37
+ draggable: !1
38
+ }, null)]) : n("span", {
39
+ class: [a.element("item-thumbnail"), a.element("item-file-icon")]
40
+ }, [v(l.file) ? n(U, {
41
+ size: 16
42
+ }, null) : n(B, {
43
+ size: 16
44
+ }, null)]);
45
+ return () => {
46
+ var y, I, C, x;
47
+ const g = ((I = (y = e.slots)["file-name"]) == null ? void 0 : I.call(y, {
48
+ file: l.file
49
+ })) ?? l.file.name, N = p.value ? n("a", {
50
+ class: b.value,
51
+ href: D.value,
52
+ target: e.props.download ? void 0 : "_blank",
53
+ rel: "noopener noreferrer",
54
+ download: e.props.download ? l.file.name : void 0,
55
+ title: l.file.name,
56
+ onClick: (s) => {
57
+ !e.props.download && e.props.imagePreview && d.value && s.preventDefault(), k();
58
+ }
59
+ }, [g]) : n("span", {
60
+ class: b.value,
61
+ title: l.file.name,
62
+ role: m.value ? "button" : void 0,
63
+ tabindex: m.value ? 0 : void 0,
64
+ onClick: k,
65
+ onKeydown: (s) => {
66
+ m.value && (s.key !== "Enter" && s.key !== " " || (s.preventDefault(), e.handlePreview(l.file)));
67
+ }
68
+ }, [g]), i = [];
69
+ return (h.value || o.value === "init") && l.file.file && e.props.showRetryButton && !e.disabled.value && i.push(n(r, {
70
+ key: "retry",
71
+ as: "button",
72
+ "aria-label": u(o.value === "init" ? "upload.start" : "upload.retry"),
73
+ onClick: () => e.handleRetry(l.file)
74
+ }, {
75
+ default: () => [n(O, null, null)]
76
+ })), f.value && e.props.showCancelButton && !e.disabled.value && i.push(n(r, {
77
+ key: "cancel",
78
+ as: "button",
79
+ "aria-label": u("upload.cancel"),
80
+ onClick: () => e.handleCancel(l.file)
81
+ }, {
82
+ default: () => [n(K, null, null)]
83
+ })), !f.value && m.value && i.push(n(r, {
84
+ key: "preview",
85
+ as: "button",
86
+ "aria-label": u("upload.preview"),
87
+ onClick: () => e.handlePreview(l.file)
88
+ }, {
89
+ default: () => [n(A, null, null)]
90
+ })), T.value && e.props.showDownloadButton && l.file.url && i.push(n(r, {
91
+ key: "download",
92
+ as: "button",
93
+ "aria-label": u("upload.download"),
94
+ onClick: () => e.handleDownload(l.file)
95
+ }, {
96
+ default: () => [n(S, null, null)]
97
+ })), e.slots["extra-button"] && i.push(n("span", {
98
+ key: "extra",
99
+ class: a.element("item-extra")
100
+ }, [e.slots["extra-button"]({
101
+ file: l.file
102
+ })])), e.props.showRemoveButton && !e.disabled.value && i.push(n(r, {
103
+ key: "remove",
104
+ as: "button",
105
+ "aria-label": u("upload.remove"),
106
+ onClick: () => e.handleRemove(l.file)
107
+ }, {
108
+ default: () => [n(V, null, null)]
109
+ })), n("div", {
110
+ class: L.value
111
+ }, [P.value ? E() : ((x = (C = e.slots)["file-icon"]) == null ? void 0 : x.call(C, {
112
+ file: l.file
113
+ })) ?? n("span", {
114
+ class: a.element("item-file-icon")
115
+ }, [v(l.file) ? n(U, {
116
+ size: 16
117
+ }, null) : n(B, {
118
+ size: 16
119
+ }, null)]), N, h.value && w.value && n("span", {
120
+ class: a.element("item-error-icon"),
121
+ title: w.value
122
+ }, [n(q, {
123
+ size: 12
124
+ }, null)]), f.value && n(F, {
125
+ class: a.element("item-progress"),
126
+ type: "line",
127
+ size: "small",
128
+ percent: z.value,
129
+ showText: !1
130
+ }, null), i.length > 0 && n("span", {
131
+ class: a.element("item-operations")
132
+ }, [i])]);
133
+ };
134
+ }
135
+ });
136
+ export {
137
+ ae as default
138
+ };
@@ -0,0 +1,48 @@
1
+ import { defineComponent as c, inject as d, computed as u, createVNode as t } from "vue";
2
+ import { getClassNameMixin as v } from "../../_utils/config.js";
3
+ import { uploadInjectionKey as g } from "./context.js";
4
+ import f from "./upload-list-item.js";
5
+ import y from "./upload-picture-item.js";
6
+ import T from "./upload-trigger.js";
7
+ const b = /* @__PURE__ */ c({
8
+ name: "UploadList",
9
+ setup() {
10
+ const e = d(g);
11
+ if (!e) return () => null;
12
+ const l = v("upload"), i = u(() => e.listType.value === "picture-card"), a = u(() => [l.element("list"), l.element(`list-${e.listType.value}`)]);
13
+ return () => {
14
+ if (!e.showTrigger.value && !e.fileList.value.length) return null;
15
+ const r = e.fileList.value, n = e.slots, o = (s, m) => t("div", {
16
+ class: l.element("item-wrapper"),
17
+ key: s.uid
18
+ }, [n["upload-item"] ? n["upload-item"]({
19
+ file: s,
20
+ index: m
21
+ }) : i.value ? t(y, {
22
+ file: s
23
+ }, null) : t(f, {
24
+ file: s
25
+ }, null)]), p = t(T, null, null);
26
+ return i.value ? t("div", {
27
+ class: a.value
28
+ }, [r.map(o), e.showTrigger.value && t("span", {
29
+ class: l.element("picture-entry")
30
+ }, [p, e.props.tip && t("span", {
31
+ class: l.element("picture-entry-tip")
32
+ }, [e.props.tip])])]) : t("div", {
33
+ class: a.value
34
+ }, [e.showTrigger.value && t("span", {
35
+ class: [
36
+ l.element("entry"),
37
+ // 拖拽区需要占满容器宽度,行内块会收缩到内容宽度
38
+ e.props.draggable && l.is("entry-block")
39
+ ]
40
+ }, [p]), r.length > 0 && t("div", {
41
+ class: l.element("items")
42
+ }, [r.map(o)])]);
43
+ };
44
+ }
45
+ });
46
+ export {
47
+ b as default
48
+ };
@@ -0,0 +1,109 @@
1
+ import { defineComponent as y, inject as I, computed as o, createVNode as e } from "vue";
2
+ import { getClassNameMixin as k } from "../../_utils/config.js";
3
+ import { useLocale as x } from "../../locale/index.js";
4
+ import m from "../_components/icon-hover/index.vue.js";
5
+ import C from "../../icons/default/eye.js";
6
+ import U from "../../icons/default/exclamation.js";
7
+ import P from "../../icons/default/close.js";
8
+ import B from "../progress/Progress.vue.js";
9
+ import { IconUploadFile as R, IconUploadRefresh as D, IconUploadDownload as E, IconUploadTrash as j } from "../../icons/_self/upload-icons.js";
10
+ import { uploadInjectionKey as z } from "./context.js";
11
+ import { isImageItem as M } from "./utils.js";
12
+ const G = /* @__PURE__ */ y({
13
+ name: "UploadPictureItem",
14
+ props: {
15
+ file: {
16
+ type: Object,
17
+ required: !0
18
+ }
19
+ },
20
+ setup(l) {
21
+ const t = I(z);
22
+ if (!t) return () => null;
23
+ const {
24
+ t: i
25
+ } = x(), a = k("upload"), u = o(() => l.file.status ?? "done"), d = o(() => u.value === "uploading"), h = o(() => u.value === "done"), r = o(() => u.value === "error"), b = o(() => Math.max(0, Math.min(1, l.file.percent ?? 0))), f = o(() => l.file.thumbUrl || l.file.url), p = o(() => t.disabled.value), g = o(() => [a.element("picture-item"), a.element(`picture-item-${u.value}`), d.value && a.is("uploading")]);
26
+ return () => {
27
+ var v;
28
+ const {
29
+ props: s,
30
+ slots: c
31
+ } = t, w = ((v = c.image) == null ? void 0 : v.call(c, {
32
+ file: l.file
33
+ })) ?? (f.value && M(l.file) ? e("img", {
34
+ class: a.element("picture-image"),
35
+ src: f.value,
36
+ alt: l.file.name,
37
+ loading: s.imageLoading,
38
+ draggable: !1
39
+ }, null) : e("span", {
40
+ class: a.element("picture-placeholder")
41
+ }, [e(R, {
42
+ size: 24
43
+ }, null), e("span", null, [l.file.name])])), n = [];
44
+ return (r.value || u.value === "init") && l.file.file && s.showRetryButton && !p.value && n.push(e(m, {
45
+ key: "retry",
46
+ as: "button",
47
+ "aria-label": i(u.value === "init" ? "upload.start" : "upload.retry"),
48
+ onClick: () => t.handleRetry(l.file)
49
+ }, {
50
+ default: () => [e(D, null, null)]
51
+ })), d.value && s.showCancelButton && !p.value && n.push(e(m, {
52
+ key: "cancel",
53
+ as: "button",
54
+ "aria-label": i("upload.cancel"),
55
+ onClick: () => t.handleCancel(l.file)
56
+ }, {
57
+ default: () => [e(P, null, null)]
58
+ })), f.value && s.showPreviewButton && !d.value && !r.value && n.push(e(m, {
59
+ key: "preview",
60
+ as: "button",
61
+ "aria-label": i("upload.preview"),
62
+ onClick: () => t.handlePreview(l.file)
63
+ }, {
64
+ default: () => [e(C, null, null)]
65
+ })), h.value && s.showDownloadButton && (l.file.url || f.value) && n.push(e(m, {
66
+ key: "download",
67
+ as: "button",
68
+ "aria-label": i("upload.download"),
69
+ onClick: () => t.handleDownload(l.file)
70
+ }, {
71
+ default: () => [e(E, null, null)]
72
+ })), c["extra-button"] && n.push(e("span", {
73
+ key: "extra",
74
+ class: a.element("picture-extra")
75
+ }, [c["extra-button"]({
76
+ file: l.file
77
+ })])), s.showRemoveButton && !p.value && n.push(e(m, {
78
+ key: "remove",
79
+ as: "button",
80
+ "aria-label": i("upload.remove"),
81
+ onClick: () => t.handleRemove(l.file)
82
+ }, {
83
+ default: () => [e(j, null, null)]
84
+ })), e("div", {
85
+ class: g.value
86
+ }, [d.value ? e("span", {
87
+ class: a.element("picture-uploading")
88
+ }, [e(B, {
89
+ type: "circle",
90
+ size: "small",
91
+ percent: b.value,
92
+ showText: !1
93
+ }, null)]) : r.value ? e("span", {
94
+ class: a.element("picture-error")
95
+ }, [e(U, {
96
+ size: 20
97
+ }, null)]) : w, (n.length > 0 || r.value) && e("span", {
98
+ class: [a.element("picture-mask"), r.value && a.is("error")]
99
+ }, [r.value && e("span", {
100
+ class: a.element("picture-error-tip")
101
+ }, [t.getErrorText(l.file) ?? i("upload.error")]), n.length > 0 && e("span", {
102
+ class: a.element("picture-operations")
103
+ }, [n])])]);
104
+ };
105
+ }
106
+ });
107
+ export {
108
+ G as default
109
+ };