@rockshin/tao-ui 0.0.49 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button/button.css +9 -1
- package/dist/components/input/input.css +2 -1
- package/dist/components/modal/modal.css +1 -1
- package/dist/components/select/select.css +3 -2
- package/dist/components/transfer/transfer-list.js +2 -1
- package/dist/components/transfer/transfer.css +5 -0
- package/dist/components/upload/upload.css +199 -34
- package/dist/components/upload/upload.js +356 -203
- package/package.json +4 -3
|
@@ -136,7 +136,15 @@
|
|
|
136
136
|
display: inline-flex;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
[data-tao-button-icon-idle]
|
|
139
|
+
:where([data-tao-button-icon-idle] svg:not([width])) {
|
|
140
|
+
width: 1em;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:where([data-tao-button-icon-idle] svg:not([height])) {
|
|
144
|
+
height: 1em;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
[data-tao-button-spinner] {
|
|
140
148
|
width: 1em;
|
|
141
149
|
height: 1em;
|
|
142
150
|
}
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
line-height: var(--tao-input-line-height);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
[data-tao-input] input[type="password"] {
|
|
75
|
+
[data-tao-input] input[type="password"]:not(:placeholder-shown) {
|
|
76
76
|
font-family: Arial, sans-serif;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -121,6 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
[data-tao-input] > [data-tao-suffix] {
|
|
124
|
+
padding-inline-start: var(--tao-input-affix-padding);
|
|
124
125
|
padding-inline-end: var(--tao-input-affix-padding);
|
|
125
126
|
}
|
|
126
127
|
|
|
@@ -117,7 +117,7 @@ button[data-tao-modal-close]:focus-visible {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
[data-tao-modal-body] {
|
|
120
|
-
padding:
|
|
120
|
+
padding: max(var(--tao-padding-xxs), var(--tao-ring-width)) var(--tao-padding-lg);
|
|
121
121
|
color: var(--tao-color-text);
|
|
122
122
|
-webkit-overflow-scrolling: touch;
|
|
123
123
|
flex: 1;
|
|
@@ -432,8 +432,9 @@ legend[data-tao-select-group-label] {
|
|
|
432
432
|
[data-tao-select][data-tao-multiple] {
|
|
433
433
|
height: auto;
|
|
434
434
|
min-height: var(--tao-select-height);
|
|
435
|
+
padding-block: max(0px,
|
|
436
|
+
calc((var(--tao-select-height) - 24px) / 2 - var(--tao-line-width)));
|
|
435
437
|
flex-wrap: wrap;
|
|
436
|
-
padding-block: 4px;
|
|
437
438
|
padding-inline-start: 4px;
|
|
438
439
|
padding-inline-end: var(--tao-select-padding-inline);
|
|
439
440
|
}
|
|
@@ -444,7 +445,6 @@ legend[data-tao-select-group-label] {
|
|
|
444
445
|
align-items: center;
|
|
445
446
|
gap: 4px;
|
|
446
447
|
min-width: 0;
|
|
447
|
-
padding-block: 1px;
|
|
448
448
|
display: flex;
|
|
449
449
|
}
|
|
450
450
|
|
|
@@ -458,6 +458,7 @@ legend[data-tao-select-group-label] {
|
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
[data-tao-select-tag] {
|
|
461
|
+
box-sizing: border-box;
|
|
461
462
|
max-width: 160px;
|
|
462
463
|
font-size: var(--tao-font-size-sm);
|
|
463
464
|
height: 24px;
|
|
@@ -5,6 +5,7 @@ import { Checkbox } from "../checkbox/checkbox.js";
|
|
|
5
5
|
import { Dropdown } from "../dropdown/dropdown.js";
|
|
6
6
|
import { Empty } from "../empty/empty.js";
|
|
7
7
|
import { ListPaginationControl } from "../list/list-pagination.js";
|
|
8
|
+
import { ChevronDownIcon } from "../select/select-icons.js";
|
|
8
9
|
import { TransferSearch } from "./transfer-parts.js";
|
|
9
10
|
function TransferList(props) {
|
|
10
11
|
const { locale } = useTaoConfig();
|
|
@@ -145,7 +146,7 @@ function TransferList(props) {
|
|
|
145
146
|
type: "button",
|
|
146
147
|
"aria-label": `${locale.messages.selectionActions} ${sectionName}`,
|
|
147
148
|
disabled: disabled || !enabled.length,
|
|
148
|
-
children: selectionsIcon ??
|
|
149
|
+
children: selectionsIcon ?? /*#__PURE__*/ jsx(ChevronDownIcon, {})
|
|
149
150
|
})
|
|
150
151
|
})
|
|
151
152
|
]
|
|
@@ -64,6 +64,11 @@
|
|
|
64
64
|
height: 20px;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
[data-tao-transfer-selection]:disabled {
|
|
68
|
+
color: var(--tao-color-text-disabled);
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
[data-tao-transfer-clear], [data-tao-transfer-remove] {
|
|
68
73
|
border-radius: var(--tao-radius-sm);
|
|
69
74
|
width: 24px;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@layer components {
|
|
2
2
|
[data-tao-upload] {
|
|
3
|
+
--tao-upload-card-size: calc(var(--tao-control-height-lg) * 2.55);
|
|
3
4
|
gap: var(--tao-margin-xs);
|
|
4
5
|
min-width: 0;
|
|
5
6
|
max-width: 100%;
|
|
@@ -10,10 +11,15 @@
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
[data-tao-upload-trigger] {
|
|
14
|
+
box-sizing: border-box;
|
|
13
15
|
align-items: center;
|
|
14
16
|
display: inline-flex;
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
[data-tao-upload-trigger][hidden], [data-tao-upload-list]:empty {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
[data-tao-upload-trigger] > span {
|
|
18
24
|
cursor: pointer;
|
|
19
25
|
align-items: center;
|
|
@@ -25,33 +31,40 @@
|
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
[data-tao-upload][data-type="drag"] [data-tao-upload-trigger] {
|
|
28
|
-
min-height: 140px;
|
|
29
|
-
padding: var(--tao-padding-lg);
|
|
30
34
|
border: 1px dashed var(--tao-color-border);
|
|
31
|
-
border-radius: var(--tao-radius);
|
|
35
|
+
border-radius: var(--tao-radius-lg);
|
|
32
36
|
background: var(--tao-color-fill-quaternary);
|
|
33
37
|
text-align: center;
|
|
34
38
|
justify-content: center;
|
|
39
|
+
height: 140px;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
[data-tao-upload][data-type="drag"] [data-tao-upload-trigger] > span {
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
padding: var(--tao-padding);
|
|
40
45
|
justify-content: center;
|
|
41
46
|
align-self: stretch;
|
|
47
|
+
gap: var(--tao-margin-xs);
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
flex: 1;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
[data-tao-upload
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
[data-tao-upload-drag-icon] {
|
|
53
|
+
color: var(--tao-primary);
|
|
54
|
+
margin-bottom: var(--tao-margin-xs);
|
|
47
55
|
}
|
|
48
56
|
|
|
49
|
-
[data-tao-upload
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
[data-tao-upload-drag-icon] svg {
|
|
58
|
+
width: 48px;
|
|
59
|
+
height: 48px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-tao-upload]:not([data-disabled])[data-type="drag"] [data-tao-upload-trigger]:hover, [data-tao-upload][data-dragging] [data-tao-upload-trigger] {
|
|
63
|
+
border-color: var(--tao-primary);
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
[data-tao-upload][data-disabled] [data-tao-upload-trigger] > span {
|
|
66
|
+
[data-tao-upload][data-disabled] [data-tao-upload-trigger], [data-tao-upload][data-disabled] [data-tao-upload-trigger] > span {
|
|
67
|
+
color: var(--tao-color-text-disabled);
|
|
55
68
|
cursor: not-allowed;
|
|
56
69
|
}
|
|
57
70
|
|
|
@@ -62,37 +75,65 @@
|
|
|
62
75
|
display: flex;
|
|
63
76
|
}
|
|
64
77
|
|
|
78
|
+
[data-tao-upload-row] {
|
|
79
|
+
min-width: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
65
82
|
[data-tao-upload-item] {
|
|
83
|
+
box-sizing: border-box;
|
|
66
84
|
align-items: center;
|
|
67
85
|
gap: var(--tao-margin-xs);
|
|
68
|
-
min-width: 0;
|
|
69
|
-
padding: var(--tao-padding-xxs);
|
|
70
86
|
border-radius: var(--tao-radius-sm);
|
|
87
|
+
min-width: 0;
|
|
71
88
|
display: flex;
|
|
89
|
+
position: relative;
|
|
72
90
|
}
|
|
73
91
|
|
|
74
92
|
[data-tao-upload-item]:hover {
|
|
75
93
|
background: var(--tao-color-bg-text-hover);
|
|
76
94
|
}
|
|
77
95
|
|
|
78
|
-
[data-tao-upload-
|
|
96
|
+
[data-tao-upload-icon] {
|
|
79
97
|
color: var(--tao-color-text-secondary);
|
|
80
98
|
flex-shrink: 0;
|
|
99
|
+
display: inline-flex;
|
|
81
100
|
}
|
|
82
101
|
|
|
83
102
|
[data-tao-upload-details] {
|
|
84
|
-
overflow-wrap: anywhere;
|
|
85
103
|
flex-direction: column;
|
|
86
104
|
flex: 1;
|
|
87
105
|
min-width: 0;
|
|
88
106
|
display: flex;
|
|
89
107
|
}
|
|
90
108
|
|
|
91
|
-
[data-tao-upload-
|
|
109
|
+
[data-tao-upload-name] {
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
text-align: start;
|
|
113
|
+
display: block;
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
button[data-tao-upload-name], button[data-tao-upload-thumbnail] {
|
|
118
|
+
font: inherit;
|
|
119
|
+
color: inherit;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
background: none;
|
|
122
|
+
border: 0;
|
|
123
|
+
padding: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[data-tao-upload-details] a, button[data-tao-upload-name] {
|
|
92
127
|
color: var(--tao-primary);
|
|
93
128
|
text-decoration: none;
|
|
94
129
|
}
|
|
95
130
|
|
|
131
|
+
[data-tao-upload-extra] {
|
|
132
|
+
color: var(--tao-color-text-secondary);
|
|
133
|
+
font-size: var(--tao-font-size-sm);
|
|
134
|
+
overflow-wrap: anywhere;
|
|
135
|
+
}
|
|
136
|
+
|
|
96
137
|
[data-tao-upload-actions] {
|
|
97
138
|
flex-shrink: 0;
|
|
98
139
|
gap: 2px;
|
|
@@ -100,8 +141,8 @@
|
|
|
100
141
|
}
|
|
101
142
|
|
|
102
143
|
[data-tao-upload-actions] button {
|
|
103
|
-
width:
|
|
104
|
-
height:
|
|
144
|
+
width: 22px;
|
|
145
|
+
height: 22px;
|
|
105
146
|
color: var(--tao-color-text-secondary);
|
|
106
147
|
padding: 0;
|
|
107
148
|
}
|
|
@@ -111,28 +152,36 @@
|
|
|
111
152
|
outline-offset: 2px;
|
|
112
153
|
}
|
|
113
154
|
|
|
114
|
-
[data-tao-upload-item][data-status="error"], [data-tao-upload-error] {
|
|
155
|
+
[data-tao-upload-item][data-status="error"], [data-tao-upload-item][data-status="error"] :is([data-tao-upload-name], [data-tao-upload-icon]), [data-tao-upload-error] {
|
|
115
156
|
color: var(--tao-error);
|
|
116
157
|
}
|
|
117
158
|
|
|
118
159
|
[data-tao-upload-error] {
|
|
119
160
|
font-size: var(--tao-font-size-sm);
|
|
161
|
+
overflow-wrap: anywhere;
|
|
120
162
|
}
|
|
121
163
|
|
|
122
164
|
[data-tao-upload-thumbnail] {
|
|
165
|
+
width: 48px;
|
|
166
|
+
height: 48px;
|
|
167
|
+
color: var(--tao-primary);
|
|
123
168
|
flex-shrink: 0;
|
|
124
169
|
justify-content: center;
|
|
125
170
|
align-items: center;
|
|
126
|
-
width: 48px;
|
|
127
|
-
height: 48px;
|
|
128
171
|
display: inline-flex;
|
|
129
172
|
overflow: hidden;
|
|
130
173
|
}
|
|
131
174
|
|
|
175
|
+
[data-tao-upload-thumbnail] > svg {
|
|
176
|
+
width: 28px;
|
|
177
|
+
height: 28px;
|
|
178
|
+
}
|
|
179
|
+
|
|
132
180
|
[data-tao-upload-thumbnail] img {
|
|
133
181
|
object-fit: contain;
|
|
134
182
|
width: 100%;
|
|
135
183
|
height: 100%;
|
|
184
|
+
display: block;
|
|
136
185
|
}
|
|
137
186
|
|
|
138
187
|
[data-tao-upload-preview] img {
|
|
@@ -143,30 +192,146 @@
|
|
|
143
192
|
display: block;
|
|
144
193
|
}
|
|
145
194
|
|
|
146
|
-
[data-tao-upload][data-list-type="
|
|
195
|
+
[data-tao-upload]:not([data-list-type="text"]) [data-tao-upload-item] {
|
|
147
196
|
padding: var(--tao-padding-xs);
|
|
148
|
-
border: 1px solid var(--tao-color-border
|
|
197
|
+
border: 1px solid var(--tao-color-border);
|
|
198
|
+
border-radius: var(--tao-radius-lg);
|
|
149
199
|
}
|
|
150
200
|
|
|
151
|
-
[data-tao-upload]:
|
|
152
|
-
|
|
201
|
+
[data-tao-upload]:not([data-list-type="text"]) [data-tao-upload-item]:hover {
|
|
202
|
+
background: none;
|
|
153
203
|
}
|
|
154
204
|
|
|
155
|
-
[data-tao-upload]:
|
|
156
|
-
border:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
205
|
+
[data-tao-upload]:not([data-list-type="text"]) [data-tao-upload-item][data-status="error"] {
|
|
206
|
+
border-color: var(--tao-error);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
[data-tao-upload]:not([data-list-type="text"]) [data-tao-upload-item][data-status="uploading"] {
|
|
210
|
+
border-style: dashed;
|
|
161
211
|
}
|
|
162
212
|
|
|
163
|
-
[data-tao-upload][data-list-type="picture-
|
|
213
|
+
[data-tao-upload]:is([data-list-type="picture-card"], [data-list-type="picture-circle"]) {
|
|
214
|
+
display: flex;
|
|
215
|
+
|
|
216
|
+
& [data-tao-upload-list] {
|
|
217
|
+
flex-flow: wrap;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
& [data-tao-upload-row], & [data-tao-upload-trigger] {
|
|
221
|
+
width: var(--tao-upload-card-size);
|
|
222
|
+
height: var(--tao-upload-card-size);
|
|
223
|
+
flex: none;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
& [data-tao-upload-trigger] {
|
|
227
|
+
border: 1px dashed var(--tao-color-border);
|
|
228
|
+
border-radius: var(--tao-radius-lg);
|
|
229
|
+
background: var(--tao-color-fill-quaternary);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
& [data-tao-upload-trigger] > span {
|
|
233
|
+
box-sizing: border-box;
|
|
234
|
+
width: 100%;
|
|
235
|
+
height: 100%;
|
|
236
|
+
padding: var(--tao-padding-xs);
|
|
237
|
+
justify-content: center;
|
|
238
|
+
gap: var(--tao-margin-xs);
|
|
239
|
+
text-align: center;
|
|
240
|
+
flex-direction: column;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
&:not([data-disabled]) [data-tao-upload-trigger]:hover {
|
|
244
|
+
border-color: var(--tao-primary);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
& [data-tao-upload-item] {
|
|
248
|
+
justify-content: center;
|
|
249
|
+
gap: var(--tao-margin-xxs);
|
|
250
|
+
text-align: center;
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
width: 100%;
|
|
253
|
+
height: 100%;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
& [data-tao-upload-thumbnail] {
|
|
257
|
+
width: 100%;
|
|
258
|
+
height: 100%;
|
|
259
|
+
min-height: 0;
|
|
260
|
+
color: inherit;
|
|
261
|
+
flex: 1;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
& [data-tao-upload-details] {
|
|
265
|
+
flex: none;
|
|
266
|
+
width: 100%;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
& [data-tao-upload-name] {
|
|
270
|
+
text-align: center;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
& [data-thumbnail] [data-tao-upload-name], & [data-status="uploading"] [data-tao-upload-name] {
|
|
274
|
+
display: none;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
& [data-thumbnail] [data-tao-upload-details]:not(:has([data-tao-upload-extra])), & [data-tao-upload-error] {
|
|
278
|
+
clip-path: inset(50%);
|
|
279
|
+
width: 1px;
|
|
280
|
+
height: 1px;
|
|
281
|
+
position: absolute;
|
|
282
|
+
overflow: hidden;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
& [data-status="uploading"] {
|
|
286
|
+
background: var(--tao-color-fill-quaternary);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
& [data-tao-upload-actions] {
|
|
290
|
+
inset: var(--tao-padding-xs);
|
|
291
|
+
background: color(from var(--tao-color-bg-mask) srgb r g b / 65%);
|
|
292
|
+
opacity: 0;
|
|
293
|
+
pointer-events: none;
|
|
294
|
+
transition: opacity var(--tao-motion-duration-fast);
|
|
295
|
+
justify-content: center;
|
|
296
|
+
align-items: center;
|
|
297
|
+
gap: 0;
|
|
298
|
+
position: absolute;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
& [data-tao-upload-actions]:empty {
|
|
302
|
+
display: none;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
& [data-tao-upload-actions] button {
|
|
306
|
+
width: 26px;
|
|
307
|
+
height: 28px;
|
|
308
|
+
color: var(--tao-color-text-light-solid);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
& [data-tao-upload-actions] button:disabled {
|
|
312
|
+
opacity: .45;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
& [data-tao-upload-item]:is(:hover, :focus-within) [data-tao-upload-actions] {
|
|
316
|
+
opacity: 1;
|
|
317
|
+
pointer-events: auto;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
[data-tao-upload][data-list-type="picture-circle"] :is([data-tao-upload-trigger], [data-tao-upload-item], [data-tao-upload-thumbnail], [data-tao-upload-actions]) {
|
|
164
322
|
border-radius: 50%;
|
|
165
323
|
}
|
|
166
324
|
|
|
325
|
+
@media (hover: none) {
|
|
326
|
+
[data-tao-upload]:is([data-list-type="picture-card"], [data-list-type="picture-circle"]) [data-tao-upload-actions] {
|
|
327
|
+
opacity: 1;
|
|
328
|
+
pointer-events: auto;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
167
332
|
@media (pointer: coarse) {
|
|
168
333
|
[data-tao-upload-actions] button {
|
|
169
|
-
min-width:
|
|
334
|
+
min-width: 24px;
|
|
170
335
|
min-height: 44px;
|
|
171
336
|
}
|
|
172
337
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import upload from "@rc-component/upload";
|
|
4
4
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
@@ -8,6 +8,7 @@ import { cx } from "../../utils/semantic.js";
|
|
|
8
8
|
import { Button } from "../button/button.js";
|
|
9
9
|
import { Modal } from "../modal/modal.js";
|
|
10
10
|
import { Progress } from "../progress/progress.js";
|
|
11
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
11
12
|
import "./upload.css";
|
|
12
13
|
import { interopDefault } from "../../utils/interop-default.js";
|
|
13
14
|
const RcUploaderComponent = /*#__PURE__*/ interopDefault(upload);
|
|
@@ -40,6 +41,15 @@ function sameUploadFile(file, candidate) {
|
|
|
40
41
|
if (file.originFileObj || candidate.originFileObj) return file.originFileObj === candidate.originFileObj;
|
|
41
42
|
return file.name === candidate.name && file.url === candidate.url;
|
|
42
43
|
}
|
|
44
|
+
function isImageFile(file) {
|
|
45
|
+
if (file.type && !file.thumbUrl) return file.type.startsWith('image/');
|
|
46
|
+
const url = file.thumbUrl || file.url || '';
|
|
47
|
+
const name = (url || file.name).split(/[?#]/)[0].split('/').pop() ?? '';
|
|
48
|
+
const extension = /\.[^./\\]*$/.exec(name)?.[0];
|
|
49
|
+
if (/^data:image\//i.test(url)) return true;
|
|
50
|
+
if (/^data:/i.test(url)) return false;
|
|
51
|
+
return !extension || /^\.(avif|bmp|dpg|gif|heic|heif|ico|jfif|jpe?g|png|svg|tiff?|webp)$/i.test(extension);
|
|
52
|
+
}
|
|
43
53
|
function FilePreview(t0) {
|
|
44
54
|
const $ = c(13);
|
|
45
55
|
const { file, previewFile } = t0;
|
|
@@ -95,10 +105,7 @@ function FilePreview(t0) {
|
|
|
95
105
|
src: src,
|
|
96
106
|
alt: file.name,
|
|
97
107
|
crossOrigin: file.crossOrigin
|
|
98
|
-
}) : /*#__PURE__*/ jsx(
|
|
99
|
-
"aria-hidden": "true",
|
|
100
|
-
children: "▧"
|
|
101
|
-
});
|
|
108
|
+
}) : /*#__PURE__*/ jsx(FileIcon, {});
|
|
102
109
|
$[8] = error;
|
|
103
110
|
$[9] = file.crossOrigin;
|
|
104
111
|
$[10] = file.name;
|
|
@@ -108,12 +115,69 @@ function FilePreview(t0) {
|
|
|
108
115
|
return t3;
|
|
109
116
|
}
|
|
110
117
|
function FileIcon(t0) {
|
|
111
|
-
const $ = c(
|
|
112
|
-
const {
|
|
113
|
-
const
|
|
118
|
+
const $ = c(19);
|
|
119
|
+
const { kind: t1 } = t0;
|
|
120
|
+
const kind = void 0 === t1 ? "file" : t1;
|
|
114
121
|
let t2;
|
|
115
|
-
if ($[0] !==
|
|
116
|
-
t2 = /*#__PURE__*/ jsx("
|
|
122
|
+
if ($[0] !== kind) {
|
|
123
|
+
t2 = "file" === kind && /*#__PURE__*/ jsx("path", {
|
|
124
|
+
d: "M7 3h7l4 4v14H7V3Zm7 0v5h4M10 12h5M10 16h5"
|
|
125
|
+
});
|
|
126
|
+
$[0] = kind;
|
|
127
|
+
$[1] = t2;
|
|
128
|
+
} else t2 = $[1];
|
|
129
|
+
let t3;
|
|
130
|
+
if ($[2] !== kind) {
|
|
131
|
+
t3 = "remove" === kind && /*#__PURE__*/ jsx("path", {
|
|
132
|
+
d: "M4 6h16M9 6V3h6v3M6 6l1 15h10l1-15M10 10v7M14 10v7"
|
|
133
|
+
});
|
|
134
|
+
$[2] = kind;
|
|
135
|
+
$[3] = t3;
|
|
136
|
+
} else t3 = $[3];
|
|
137
|
+
let t4;
|
|
138
|
+
if ($[4] !== kind) {
|
|
139
|
+
t4 = "preview" === kind && /*#__PURE__*/ jsxs(Fragment, {
|
|
140
|
+
children: [
|
|
141
|
+
/*#__PURE__*/ jsx("path", {
|
|
142
|
+
d: "M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12Z"
|
|
143
|
+
}),
|
|
144
|
+
/*#__PURE__*/ jsx("circle", {
|
|
145
|
+
cx: "12",
|
|
146
|
+
cy: "12",
|
|
147
|
+
r: "3"
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
$[4] = kind;
|
|
152
|
+
$[5] = t4;
|
|
153
|
+
} else t4 = $[5];
|
|
154
|
+
let t5;
|
|
155
|
+
if ($[6] !== kind) {
|
|
156
|
+
t5 = "download" === kind && /*#__PURE__*/ jsx("path", {
|
|
157
|
+
d: "M12 3v12m-5-5 5 5 5-5M4 16v5h16v-5"
|
|
158
|
+
});
|
|
159
|
+
$[6] = kind;
|
|
160
|
+
$[7] = t5;
|
|
161
|
+
} else t5 = $[7];
|
|
162
|
+
let t6;
|
|
163
|
+
if ($[8] !== kind) {
|
|
164
|
+
t6 = "plus" === kind && /*#__PURE__*/ jsx("path", {
|
|
165
|
+
d: "M12 4v16M4 12h16"
|
|
166
|
+
});
|
|
167
|
+
$[8] = kind;
|
|
168
|
+
$[9] = t6;
|
|
169
|
+
} else t6 = $[9];
|
|
170
|
+
let t7;
|
|
171
|
+
if ($[10] !== kind) {
|
|
172
|
+
t7 = "upload" === kind && /*#__PURE__*/ jsx("path", {
|
|
173
|
+
d: "M12 16V3m-5 5 5-5 5 5M4 16v5h16v-5"
|
|
174
|
+
});
|
|
175
|
+
$[10] = kind;
|
|
176
|
+
$[11] = t7;
|
|
177
|
+
} else t7 = $[11];
|
|
178
|
+
let t8;
|
|
179
|
+
if ($[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== t5 || $[16] !== t6 || $[17] !== t7) {
|
|
180
|
+
t8 = /*#__PURE__*/ jsxs("svg", {
|
|
117
181
|
viewBox: "0 0 24 24",
|
|
118
182
|
width: "16",
|
|
119
183
|
height: "16",
|
|
@@ -121,16 +185,24 @@ function FileIcon(t0) {
|
|
|
121
185
|
stroke: "currentColor",
|
|
122
186
|
strokeWidth: "1.8",
|
|
123
187
|
"aria-hidden": "true",
|
|
124
|
-
children:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
188
|
+
children: [
|
|
189
|
+
t2,
|
|
190
|
+
t3,
|
|
191
|
+
t4,
|
|
192
|
+
t5,
|
|
193
|
+
t6,
|
|
194
|
+
t7
|
|
195
|
+
]
|
|
129
196
|
});
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
|
|
133
|
-
|
|
197
|
+
$[12] = t2;
|
|
198
|
+
$[13] = t3;
|
|
199
|
+
$[14] = t4;
|
|
200
|
+
$[15] = t5;
|
|
201
|
+
$[16] = t6;
|
|
202
|
+
$[17] = t7;
|
|
203
|
+
$[18] = t8;
|
|
204
|
+
} else t8 = $[18];
|
|
205
|
+
return t8;
|
|
134
206
|
}
|
|
135
207
|
const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
136
208
|
const config = useTaoConfig();
|
|
@@ -151,6 +223,7 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
151
223
|
const disabled = props.disabled ?? config.disabled;
|
|
152
224
|
if (disabled && dragging) setDragging(false);
|
|
153
225
|
const listType = props.listType ?? 'text', type = props.type ?? 'select';
|
|
226
|
+
const isCard = 'picture-card' === listType || 'picture-circle' === listType;
|
|
154
227
|
const names = 'function' == typeof props.classNames ? props.classNames({
|
|
155
228
|
props: {
|
|
156
229
|
...props,
|
|
@@ -168,6 +241,7 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
168
241
|
}
|
|
169
242
|
}) : props.styles;
|
|
170
243
|
const locale = {
|
|
244
|
+
uploading: config.locale.messages.loading,
|
|
171
245
|
removeFile: config.locale.messages.removeFile,
|
|
172
246
|
previewFile: config.locale.messages.previewFile,
|
|
173
247
|
downloadFile: config.locale.messages.downloadFile,
|
|
@@ -302,6 +376,98 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
302
376
|
const triggerStyle = {
|
|
303
377
|
...styles?.trigger
|
|
304
378
|
};
|
|
379
|
+
const trigger = /*#__PURE__*/ jsx("span", {
|
|
380
|
+
"data-tao-upload-trigger": "",
|
|
381
|
+
hidden: null === props.children || false === props.children,
|
|
382
|
+
className: names?.trigger,
|
|
383
|
+
style: triggerStyle,
|
|
384
|
+
onDragOver: disabled ? void 0 : ()=>setDragging(true),
|
|
385
|
+
onDragLeave: disabled ? void 0 : ()=>setDragging(false),
|
|
386
|
+
onDrop: disabled ? void 0 : (event_2)=>{
|
|
387
|
+
setDragging(false);
|
|
388
|
+
props.onDrop?.(event_2);
|
|
389
|
+
},
|
|
390
|
+
children: /*#__PURE__*/ jsx(RcUploaderComponent, {
|
|
391
|
+
onFocus: props.onFocus,
|
|
392
|
+
ref: uploader,
|
|
393
|
+
prefixCls: props.prefixCls ?? 'tao-upload-input',
|
|
394
|
+
component: "span",
|
|
395
|
+
action: (file_11)=>preparations.current.get(file_11)?.action ?? '',
|
|
396
|
+
name: props.name,
|
|
397
|
+
method: props.method,
|
|
398
|
+
headers: props.headers,
|
|
399
|
+
data: (file_12)=>preparations.current.get(file_12)?.data ?? {},
|
|
400
|
+
customRequest: request,
|
|
401
|
+
withCredentials: props.withCredentials,
|
|
402
|
+
disabled: disabled,
|
|
403
|
+
multiple: props.multiple,
|
|
404
|
+
accept: props.accept,
|
|
405
|
+
directory: props.directory,
|
|
406
|
+
capture: props.capture,
|
|
407
|
+
pastable: props.pastable && !disabled,
|
|
408
|
+
id: props.id,
|
|
409
|
+
openFileDialogOnClick: props.openFileDialogOnClick,
|
|
410
|
+
hasControlInside: props.hasControlInside ?? (!!props.children || !isCard && 'drag' !== type),
|
|
411
|
+
beforeUpload: async (file_13, list)=>{
|
|
412
|
+
preparations.current.delete(file_13);
|
|
413
|
+
const result = await props.beforeUpload?.(file_13, list);
|
|
414
|
+
if (result === LIST_IGNORE) {
|
|
415
|
+
ignored.current.add(file_13.uid);
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
if (false === result) return false;
|
|
419
|
+
const { action, data } = propsRef.current;
|
|
420
|
+
try {
|
|
421
|
+
preparations.current.set(file_13, {
|
|
422
|
+
action: 'function' == typeof action ? await action(file_13) : action,
|
|
423
|
+
data: 'function' == typeof data ? await data(toFile(file_13)) : data
|
|
424
|
+
});
|
|
425
|
+
} catch (reason_0) {
|
|
426
|
+
preparations.current.set(file_13, {
|
|
427
|
+
error: asError(reason_0)
|
|
428
|
+
});
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
return result;
|
|
432
|
+
},
|
|
433
|
+
onBatchStart: onBatchStart,
|
|
434
|
+
onProgress: (event_3, file_14)=>onProgress({
|
|
435
|
+
percent: event_3.percent ?? 0
|
|
436
|
+
}, file_14),
|
|
437
|
+
onSuccess: onSuccess,
|
|
438
|
+
onError: onError,
|
|
439
|
+
children: void 0 === props.children ? 'drag' === type ? /*#__PURE__*/ jsxs(Fragment, {
|
|
440
|
+
children: [
|
|
441
|
+
/*#__PURE__*/ jsx("span", {
|
|
442
|
+
"data-tao-upload-drag-icon": "",
|
|
443
|
+
children: /*#__PURE__*/ jsx(FileIcon, {
|
|
444
|
+
kind: "upload"
|
|
445
|
+
})
|
|
446
|
+
}),
|
|
447
|
+
/*#__PURE__*/ jsx("span", {
|
|
448
|
+
children: config.locale.messages.uploadDrop
|
|
449
|
+
})
|
|
450
|
+
]
|
|
451
|
+
}) : isCard ? /*#__PURE__*/ jsxs(Fragment, {
|
|
452
|
+
children: [
|
|
453
|
+
/*#__PURE__*/ jsx(FileIcon, {
|
|
454
|
+
kind: "plus"
|
|
455
|
+
}),
|
|
456
|
+
/*#__PURE__*/ jsx("span", {
|
|
457
|
+
children: config.locale.messages.uploadFile
|
|
458
|
+
})
|
|
459
|
+
]
|
|
460
|
+
}) : /*#__PURE__*/ jsxs(Button, {
|
|
461
|
+
disabled: disabled,
|
|
462
|
+
children: [
|
|
463
|
+
/*#__PURE__*/ jsx(FileIcon, {
|
|
464
|
+
kind: "upload"
|
|
465
|
+
}),
|
|
466
|
+
config.locale.messages.uploadFile
|
|
467
|
+
]
|
|
468
|
+
}) : props.children
|
|
469
|
+
})
|
|
470
|
+
});
|
|
305
471
|
return /*#__PURE__*/ jsxs("span", {
|
|
306
472
|
ref: root,
|
|
307
473
|
"data-tao-upload": "",
|
|
@@ -315,177 +481,153 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
315
481
|
...props.style
|
|
316
482
|
},
|
|
317
483
|
children: [
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
className: names?.trigger,
|
|
321
|
-
style: triggerStyle,
|
|
322
|
-
onDragOver: disabled ? void 0 : ()=>setDragging(true),
|
|
323
|
-
onDragLeave: disabled ? void 0 : ()=>setDragging(false),
|
|
324
|
-
onDrop: disabled ? void 0 : (event_2)=>{
|
|
325
|
-
setDragging(false);
|
|
326
|
-
props.onDrop?.(event_2);
|
|
327
|
-
},
|
|
328
|
-
children: /*#__PURE__*/ jsx(RcUploaderComponent, {
|
|
329
|
-
onFocus: props.onFocus,
|
|
330
|
-
ref: uploader,
|
|
331
|
-
prefixCls: props.prefixCls ?? 'tao-upload-input',
|
|
332
|
-
component: "span",
|
|
333
|
-
action: (file_11)=>preparations.current.get(file_11)?.action ?? '',
|
|
334
|
-
name: props.name,
|
|
335
|
-
method: props.method,
|
|
336
|
-
headers: props.headers,
|
|
337
|
-
data: (file_12)=>preparations.current.get(file_12)?.data ?? {},
|
|
338
|
-
customRequest: request,
|
|
339
|
-
withCredentials: props.withCredentials,
|
|
340
|
-
disabled: disabled,
|
|
341
|
-
multiple: props.multiple,
|
|
342
|
-
accept: props.accept,
|
|
343
|
-
directory: props.directory,
|
|
344
|
-
capture: props.capture,
|
|
345
|
-
pastable: props.pastable && !disabled,
|
|
346
|
-
id: props.id,
|
|
347
|
-
openFileDialogOnClick: props.openFileDialogOnClick,
|
|
348
|
-
hasControlInside: props.hasControlInside ?? !!props.children,
|
|
349
|
-
beforeUpload: async (file_13, list)=>{
|
|
350
|
-
preparations.current.delete(file_13);
|
|
351
|
-
const result = await props.beforeUpload?.(file_13, list);
|
|
352
|
-
if (result === LIST_IGNORE) {
|
|
353
|
-
ignored.current.add(file_13.uid);
|
|
354
|
-
return false;
|
|
355
|
-
}
|
|
356
|
-
if (false === result) return false;
|
|
357
|
-
const { action, data } = propsRef.current;
|
|
358
|
-
try {
|
|
359
|
-
preparations.current.set(file_13, {
|
|
360
|
-
action: 'function' == typeof action ? await action(file_13) : action,
|
|
361
|
-
data: 'function' == typeof data ? await data(toFile(file_13)) : data
|
|
362
|
-
});
|
|
363
|
-
} catch (reason_0) {
|
|
364
|
-
preparations.current.set(file_13, {
|
|
365
|
-
error: asError(reason_0)
|
|
366
|
-
});
|
|
367
|
-
return false;
|
|
368
|
-
}
|
|
369
|
-
return result;
|
|
370
|
-
},
|
|
371
|
-
onBatchStart: onBatchStart,
|
|
372
|
-
onProgress: (event_3, file_14)=>onProgress({
|
|
373
|
-
percent: event_3.percent ?? 0
|
|
374
|
-
}, file_14),
|
|
375
|
-
onSuccess: onSuccess,
|
|
376
|
-
onError: onError,
|
|
377
|
-
children: props.children ?? ('drag' === type ? config.locale.messages.uploadDrop : config.locale.messages.uploadFile)
|
|
378
|
-
})
|
|
379
|
-
}),
|
|
380
|
-
false !== props.showUploadList && /*#__PURE__*/ jsx("span", {
|
|
484
|
+
(!isCard || false === props.showUploadList) && trigger,
|
|
485
|
+
false !== props.showUploadList && /*#__PURE__*/ jsxs("span", {
|
|
381
486
|
"data-tao-upload-list": "",
|
|
382
487
|
className: names?.list,
|
|
383
488
|
style: styles?.list,
|
|
384
|
-
children:
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
const linkClick = file_15.linkProps?.onClick;
|
|
422
|
-
if ('function' == typeof linkClick) linkClick(event_4);
|
|
423
|
-
if (!event_4.defaultPrevented && props.onPreview) {
|
|
424
|
-
event_4.preventDefault();
|
|
425
|
-
actions.preview();
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
children: file_15.name
|
|
429
|
-
}) : /*#__PURE__*/ jsx("span", {
|
|
430
|
-
children: file_15.name
|
|
431
|
-
}),
|
|
432
|
-
'error' === file_15.status && /*#__PURE__*/ jsx("span", {
|
|
433
|
-
"data-tao-upload-error": "",
|
|
434
|
-
role: "status",
|
|
435
|
-
children: file_15.error?.message ?? locale.uploadError
|
|
436
|
-
}),
|
|
437
|
-
'uploading' === file_15.status && /*#__PURE__*/ jsx(Progress, {
|
|
438
|
-
size: "small",
|
|
439
|
-
showInfo: false,
|
|
440
|
-
...props.progress,
|
|
441
|
-
percent: file_15.percent ?? 0,
|
|
442
|
-
"aria-label": file_15['aria-label'] ?? file_15.name,
|
|
443
|
-
"aria-labelledby": file_15['aria-labelledby']
|
|
444
|
-
}),
|
|
445
|
-
renderOption(listConfig.extra, file_15)
|
|
446
|
-
]
|
|
447
|
-
}),
|
|
448
|
-
/*#__PURE__*/ jsxs("span", {
|
|
449
|
-
"data-tao-upload-actions": "",
|
|
450
|
-
children: [
|
|
451
|
-
visible(listConfig.showPreviewIcon, file_15, 'picture-card' === listType || 'picture-circle' === listType) && /*#__PURE__*/ jsx(Button, {
|
|
452
|
-
variant: "ghost",
|
|
453
|
-
size: "small",
|
|
454
|
-
disabled: !props.onPreview && !previewUrl && !localPreview,
|
|
455
|
-
type: "button",
|
|
456
|
-
"aria-label": `${locale.previewFile} ${file_15.name}`,
|
|
457
|
-
onClick: actions.preview,
|
|
458
|
-
children: renderOption(listConfig.previewIcon, file_15) ?? '↗'
|
|
459
|
-
}),
|
|
460
|
-
visible(listConfig.showDownloadIcon, file_15, false) && /*#__PURE__*/ jsx(Button, {
|
|
461
|
-
variant: "ghost",
|
|
462
|
-
size: "small",
|
|
463
|
-
disabled: !props.onDownload && !file_15.url,
|
|
464
|
-
type: "button",
|
|
465
|
-
"aria-label": `${locale.downloadFile} ${file_15.name}`,
|
|
466
|
-
onClick: actions.download,
|
|
467
|
-
children: renderOption(listConfig.downloadIcon, file_15) ?? '↓'
|
|
468
|
-
}),
|
|
469
|
-
visible(listConfig.showRemoveIcon, file_15, true) && !disabled && /*#__PURE__*/ jsx(Button, {
|
|
470
|
-
variant: "ghost",
|
|
471
|
-
size: "small",
|
|
472
|
-
disabled: false,
|
|
473
|
-
type: "button",
|
|
474
|
-
"aria-label": `${locale.removeFile} ${file_15.name}`,
|
|
475
|
-
onClick: actions.remove,
|
|
476
|
-
children: renderOption(listConfig.removeIcon, file_15) ?? /*#__PURE__*/ jsx(FileIcon, {
|
|
477
|
-
remove: true
|
|
478
|
-
})
|
|
489
|
+
children: [
|
|
490
|
+
files.map((file_15)=>{
|
|
491
|
+
const image = (props.isImageUrl ?? isImageFile)(file_15);
|
|
492
|
+
const uploading = 'uploading' === file_15.status;
|
|
493
|
+
const hasThumbnail = image && !!(file_15.thumbUrl || file_15.url || file_15.originFileObj) && !uploading;
|
|
494
|
+
const icon = props.iconRender?.(file_15, listType) ?? (uploading ? isCard ? locale.uploading : /*#__PURE__*/ jsx(Spinner, {
|
|
495
|
+
size: "small"
|
|
496
|
+
}) : /*#__PURE__*/ jsx(FileIcon, {}));
|
|
497
|
+
const localPreview = image && !!file_15.originFileObj;
|
|
498
|
+
const previewUrl = file_15.url ?? file_15.thumbUrl;
|
|
499
|
+
const actions = {
|
|
500
|
+
preview: ()=>{
|
|
501
|
+
if (props.onPreview) props.onPreview(file_15);
|
|
502
|
+
else if (previewUrl) window.open(previewUrl, '_blank', 'noopener,noreferrer');
|
|
503
|
+
else if (localPreview) setPreviewFile(file_15);
|
|
504
|
+
},
|
|
505
|
+
download: ()=>download(file_15),
|
|
506
|
+
remove: ()=>{
|
|
507
|
+
remove(file_15);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
const node = /*#__PURE__*/ jsxs("span", {
|
|
511
|
+
"data-tao-upload-item": "",
|
|
512
|
+
"data-status": file_15.status,
|
|
513
|
+
"data-thumbnail": hasThumbnail || void 0,
|
|
514
|
+
title: 'error' === file_15.status ? file_15.error?.message ?? locale.uploadError : file_15.name,
|
|
515
|
+
className: names?.item,
|
|
516
|
+
style: styles?.item,
|
|
517
|
+
children: [
|
|
518
|
+
'text' !== listType ? hasThumbnail ? /*#__PURE__*/ jsx("button", {
|
|
519
|
+
type: "button",
|
|
520
|
+
"data-tao-upload-thumbnail": "",
|
|
521
|
+
"aria-label": file_15.name,
|
|
522
|
+
onClick: actions.preview,
|
|
523
|
+
children: /*#__PURE__*/ jsx(FilePreview, {
|
|
524
|
+
file: file_15,
|
|
525
|
+
previewFile: props.previewFile
|
|
479
526
|
})
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
527
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
528
|
+
"data-tao-upload-thumbnail": "",
|
|
529
|
+
children: icon
|
|
530
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
531
|
+
"data-tao-upload-icon": "",
|
|
532
|
+
children: icon
|
|
533
|
+
}),
|
|
534
|
+
/*#__PURE__*/ jsxs("span", {
|
|
535
|
+
"data-tao-upload-details": "",
|
|
536
|
+
children: [
|
|
537
|
+
file_15.url ? /*#__PURE__*/ jsx("a", {
|
|
538
|
+
"data-tao-upload-name": "",
|
|
539
|
+
title: file_15.name,
|
|
540
|
+
...file_15.linkProps,
|
|
541
|
+
href: file_15.url,
|
|
542
|
+
target: "_blank",
|
|
543
|
+
rel: "noopener noreferrer",
|
|
544
|
+
onClick: (event_4)=>{
|
|
545
|
+
const linkClick = file_15.linkProps?.onClick;
|
|
546
|
+
if ('function' == typeof linkClick) linkClick(event_4);
|
|
547
|
+
if (!event_4.defaultPrevented && props.onPreview) {
|
|
548
|
+
event_4.preventDefault();
|
|
549
|
+
actions.preview();
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
children: file_15.name
|
|
553
|
+
}) : props.onPreview ? /*#__PURE__*/ jsx("button", {
|
|
554
|
+
type: "button",
|
|
555
|
+
"data-tao-upload-name": "",
|
|
556
|
+
title: file_15.name,
|
|
557
|
+
onClick: actions.preview,
|
|
558
|
+
children: file_15.name
|
|
559
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
560
|
+
"data-tao-upload-name": "",
|
|
561
|
+
title: file_15.name,
|
|
562
|
+
children: file_15.name
|
|
563
|
+
}),
|
|
564
|
+
'error' === file_15.status && /*#__PURE__*/ jsx("span", {
|
|
565
|
+
"data-tao-upload-error": "",
|
|
566
|
+
role: "status",
|
|
567
|
+
children: file_15.error?.message ?? locale.uploadError
|
|
568
|
+
}),
|
|
569
|
+
'uploading' === file_15.status && /*#__PURE__*/ jsx(Progress, {
|
|
570
|
+
size: "small",
|
|
571
|
+
strokeWidth: 2,
|
|
572
|
+
showInfo: false,
|
|
573
|
+
...props.progress,
|
|
574
|
+
percent: file_15.percent ?? 0,
|
|
575
|
+
"aria-label": file_15['aria-label'] ?? file_15.name,
|
|
576
|
+
"aria-labelledby": file_15['aria-labelledby']
|
|
577
|
+
}),
|
|
578
|
+
null != listConfig.extra && /*#__PURE__*/ jsx("span", {
|
|
579
|
+
"data-tao-upload-extra": "",
|
|
580
|
+
children: renderOption(listConfig.extra, file_15)
|
|
581
|
+
})
|
|
582
|
+
]
|
|
583
|
+
}),
|
|
584
|
+
(!isCard || !uploading) && /*#__PURE__*/ jsxs("span", {
|
|
585
|
+
"data-tao-upload-actions": "",
|
|
586
|
+
children: [
|
|
587
|
+
visible(listConfig.showPreviewIcon, file_15, 'picture-card' === listType || 'picture-circle' === listType) && /*#__PURE__*/ jsx(Button, {
|
|
588
|
+
variant: "ghost",
|
|
589
|
+
size: "small",
|
|
590
|
+
disabled: !props.onPreview && !previewUrl && !localPreview,
|
|
591
|
+
type: "button",
|
|
592
|
+
"aria-label": `${locale.previewFile} ${file_15.name}`,
|
|
593
|
+
onClick: actions.preview,
|
|
594
|
+
children: renderOption(listConfig.previewIcon, file_15) ?? /*#__PURE__*/ jsx(FileIcon, {
|
|
595
|
+
kind: "preview"
|
|
596
|
+
})
|
|
597
|
+
}),
|
|
598
|
+
'done' === file_15.status && visible(listConfig.showDownloadIcon, file_15, false) && /*#__PURE__*/ jsx(Button, {
|
|
599
|
+
variant: "ghost",
|
|
600
|
+
size: "small",
|
|
601
|
+
disabled: !props.onDownload && !file_15.url,
|
|
602
|
+
type: "button",
|
|
603
|
+
"aria-label": `${locale.downloadFile} ${file_15.name}`,
|
|
604
|
+
onClick: actions.download,
|
|
605
|
+
children: renderOption(listConfig.downloadIcon, file_15) ?? /*#__PURE__*/ jsx(FileIcon, {
|
|
606
|
+
kind: "download"
|
|
607
|
+
})
|
|
608
|
+
}),
|
|
609
|
+
visible(listConfig.showRemoveIcon, file_15, true) && !disabled && /*#__PURE__*/ jsx(Button, {
|
|
610
|
+
variant: "ghost",
|
|
611
|
+
size: "small",
|
|
612
|
+
disabled: false,
|
|
613
|
+
type: "button",
|
|
614
|
+
"aria-label": `${locale.removeFile} ${file_15.name}`,
|
|
615
|
+
onClick: actions.remove,
|
|
616
|
+
children: renderOption(listConfig.removeIcon, file_15) ?? /*#__PURE__*/ jsx(FileIcon, {
|
|
617
|
+
kind: "remove"
|
|
618
|
+
})
|
|
619
|
+
})
|
|
620
|
+
]
|
|
621
|
+
})
|
|
622
|
+
]
|
|
623
|
+
});
|
|
624
|
+
return /*#__PURE__*/ jsx("span", {
|
|
625
|
+
"data-tao-upload-row": "",
|
|
626
|
+
children: props.itemRender ? props.itemRender(node, file_15, files, actions) : node
|
|
627
|
+
}, file_15.uid);
|
|
628
|
+
}),
|
|
629
|
+
isCard && trigger
|
|
630
|
+
]
|
|
489
631
|
}),
|
|
490
632
|
previewFile && /*#__PURE__*/ jsx(Modal, {
|
|
491
633
|
open: true,
|
|
@@ -509,44 +651,55 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
509
651
|
});
|
|
510
652
|
UploadRoot.displayName = 'Upload';
|
|
511
653
|
const Dragger = /*#__PURE__*/ forwardRef((t0, ref)=>{
|
|
512
|
-
const $ = c(
|
|
654
|
+
const $ = c(13);
|
|
513
655
|
let height;
|
|
514
656
|
let props;
|
|
515
657
|
let style;
|
|
658
|
+
let styles;
|
|
516
659
|
if ($[0] !== t0) {
|
|
517
|
-
({ height, style, ...props } = t0);
|
|
660
|
+
({ height, style, styles, ...props } = t0);
|
|
518
661
|
$[0] = t0;
|
|
519
662
|
$[1] = height;
|
|
520
663
|
$[2] = props;
|
|
521
664
|
$[3] = style;
|
|
665
|
+
$[4] = styles;
|
|
522
666
|
} else {
|
|
523
667
|
height = $[1];
|
|
524
668
|
props = $[2];
|
|
525
669
|
style = $[3];
|
|
670
|
+
styles = $[4];
|
|
526
671
|
}
|
|
527
672
|
let t1;
|
|
528
|
-
if ($[
|
|
529
|
-
t1 = {
|
|
530
|
-
|
|
531
|
-
|
|
673
|
+
if ($[5] !== height || $[6] !== style || $[7] !== styles) {
|
|
674
|
+
t1 = (info)=>{
|
|
675
|
+
const resolved = "function" == typeof styles ? styles(info) : styles;
|
|
676
|
+
return {
|
|
677
|
+
...resolved,
|
|
678
|
+
trigger: {
|
|
679
|
+
height,
|
|
680
|
+
...style,
|
|
681
|
+
...resolved?.trigger
|
|
682
|
+
}
|
|
683
|
+
};
|
|
532
684
|
};
|
|
533
|
-
$[
|
|
534
|
-
$[
|
|
535
|
-
$[
|
|
536
|
-
|
|
685
|
+
$[5] = height;
|
|
686
|
+
$[6] = style;
|
|
687
|
+
$[7] = styles;
|
|
688
|
+
$[8] = t1;
|
|
689
|
+
} else t1 = $[8];
|
|
537
690
|
let t2;
|
|
538
|
-
if ($[
|
|
691
|
+
if ($[9] !== props || $[10] !== ref || $[11] !== t1) {
|
|
539
692
|
t2 = /*#__PURE__*/ jsx(UploadRoot, {
|
|
540
693
|
...props,
|
|
541
694
|
ref: ref,
|
|
542
695
|
type: "drag",
|
|
543
|
-
|
|
696
|
+
styles: t1
|
|
544
697
|
});
|
|
545
|
-
$[
|
|
546
|
-
$[
|
|
547
|
-
$[
|
|
548
|
-
$[
|
|
549
|
-
} else t2 = $[
|
|
698
|
+
$[9] = props;
|
|
699
|
+
$[10] = ref;
|
|
700
|
+
$[11] = t1;
|
|
701
|
+
$[12] = t2;
|
|
702
|
+
} else t2 = $[12];
|
|
550
703
|
return t2;
|
|
551
704
|
});
|
|
552
705
|
Dragger.displayName = 'Upload.Dragger';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockshin/tao-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A modern React component library with semantic DOM customization and OKLCH-based theming.",
|
|
6
6
|
"keywords": [
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"check:components": "node scripts/check-component-sync.mjs",
|
|
66
66
|
"dev": "rslib --watch",
|
|
67
67
|
"doc": "rspress dev",
|
|
68
|
-
"doc:build": "rspress build && node scripts/build-discovery.mjs",
|
|
68
|
+
"doc:build": "bun run --filter @rockshin/tao-icons build && rspress build && node scripts/build-discovery.mjs",
|
|
69
69
|
"doc:preview": "rspress preview",
|
|
70
70
|
"docs:generate": "node scripts/generate-component-manifest.mjs",
|
|
71
71
|
"docs:check": "node scripts/generate-component-manifest.mjs --check",
|
|
@@ -76,13 +76,14 @@
|
|
|
76
76
|
"test": "rstest",
|
|
77
77
|
"test:types": "tsc --noEmit --project tsconfig.type-tests.json && tsc --noEmit --project tsconfig.type-tests.react18.json",
|
|
78
78
|
"test:watch": "rstest --watch",
|
|
79
|
-
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
79
|
+
"typecheck": "bun run --filter @rockshin/tao-icons build && tsc --noEmit --project tsconfig.json",
|
|
80
80
|
"test:package": "bun scripts/check-package-exports.mjs"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@biomejs/biome": "2.5.15",
|
|
84
84
|
"@fontsource/geist-mono": "^5.3.0",
|
|
85
85
|
"@fontsource/geist-sans": "^5.3.0",
|
|
86
|
+
"@rockshin/tao-icons": "workspace:*",
|
|
86
87
|
"@rsbuild/core": "^2.2.14",
|
|
87
88
|
"@rsbuild/plugin-babel": "^2.1.0",
|
|
88
89
|
"@rsbuild/plugin-react": "^2.1.1",
|