@rockshin/tao-ui 0.0.41 → 0.0.43
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/README.md +39 -7
- package/THIRD_PARTY_NOTICES.md +34 -0
- package/component-manifest.json +1352 -24
- package/dist/components/affix/affix.css +11 -0
- package/dist/components/affix/affix.d.ts +21 -0
- package/dist/components/affix/affix.js +140 -0
- package/dist/components/alert/alert.css +1 -0
- package/dist/components/app/app-modals.d.ts +2 -0
- package/dist/components/app/app-modals.js +266 -0
- package/dist/components/app/app-notices.d.ts +6 -0
- package/dist/components/app/app-notices.js +334 -0
- package/dist/components/app/app-types.d.ts +154 -0
- package/dist/components/app/app-types.js +0 -0
- package/dist/components/app/app.css +221 -0
- package/dist/components/app/app.d.ts +7 -0
- package/dist/components/app/app.js +69 -0
- package/dist/components/auto-complete/auto-complete.css +35 -0
- package/dist/components/auto-complete/auto-complete.d.ts +47 -0
- package/dist/components/auto-complete/auto-complete.js +106 -0
- package/dist/components/avatar/avatar.css +95 -0
- package/dist/components/avatar/avatar.d.ts +50 -0
- package/dist/components/avatar/avatar.js +159 -0
- package/dist/components/badge/badge.css +165 -0
- package/dist/components/badge/badge.d.ts +48 -0
- package/dist/components/badge/badge.js +412 -0
- package/dist/components/border-beam/border-beam.css +35 -0
- package/dist/components/border-beam/border-beam.d.ts +27 -0
- package/dist/components/border-beam/border-beam.js +215 -0
- package/dist/components/button/button.css +7 -0
- package/dist/components/calendar/calendar.css +126 -0
- package/dist/components/calendar/calendar.d.ts +56 -0
- package/dist/components/calendar/calendar.js +178 -0
- package/dist/components/card/card-tabs.d.ts +43 -0
- package/dist/components/card/card-tabs.js +455 -0
- package/dist/components/card/card.css +401 -0
- package/dist/components/card/card.d.ts +74 -0
- package/dist/components/card/card.js +362 -0
- package/dist/components/carousel/carousel.css +232 -0
- package/dist/components/carousel/carousel.d.ts +35 -0
- package/dist/components/carousel/carousel.js +248 -0
- package/dist/components/cascader/cascader.css +123 -0
- package/dist/components/cascader/cascader.d.ts +58 -0
- package/dist/components/cascader/cascader.js +132 -0
- package/dist/components/checkbox/checkbox.css +7 -0
- package/dist/components/collapse/collapse-panels.d.ts +4 -0
- package/dist/components/collapse/collapse-panels.js +413 -0
- package/dist/components/collapse/collapse.css +199 -0
- package/dist/components/collapse/collapse.d.ts +77 -0
- package/dist/components/{collapsible/collapsible.js → collapse/collapse.js} +26 -10
- package/dist/components/color-picker/color-picker-types.d.ts +78 -0
- package/dist/components/color-picker/color-picker-types.js +0 -0
- package/dist/components/color-picker/color-picker.css +265 -0
- package/dist/components/color-picker/color-picker.d.ts +5 -0
- package/dist/components/color-picker/color-picker.js +1049 -0
- package/dist/components/color-picker/color.d.ts +35 -0
- package/dist/components/color-picker/color.js +65 -0
- package/dist/components/date-picker/calendar/calendar-grid.js +4 -11
- package/dist/components/date-picker/calendar/calendar-header.js +76 -69
- package/dist/components/date-picker/calendar/month-grid.js +20 -31
- package/dist/components/date-picker/calendar/time-panel.js +46 -41
- package/dist/components/date-picker/date-picker.css +22 -56
- package/dist/components/date-picker/date-picker.d.ts +2 -0
- package/dist/components/date-picker/date-picker.js +14 -9
- package/dist/components/date-picker/presets.js +5 -2
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +16 -13
- package/dist/components/descriptions/descriptions.css +109 -0
- package/dist/components/descriptions/descriptions.d.ts +49 -0
- package/dist/components/descriptions/descriptions.js +189 -0
- package/dist/components/divider/divider.css +71 -0
- package/dist/components/divider/divider.d.ts +31 -0
- package/dist/components/divider/divider.js +83 -0
- package/dist/components/drawer/drawer.js +199 -184
- package/dist/components/empty/empty.css +35 -0
- package/dist/components/empty/empty.d.ts +25 -0
- package/dist/components/empty/empty.js +278 -0
- package/dist/components/float-button/float-button.css +146 -0
- package/dist/components/float-button/float-button.d.ts +67 -0
- package/dist/components/float-button/float-button.js +347 -0
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form-item.js +1 -0
- package/dist/components/form/form.css +15 -0
- package/dist/components/form/form.js +4 -1
- package/dist/components/form-field/form-field-view.d.ts +3 -1
- package/dist/components/form-field/form-field-view.js +109 -84
- package/dist/components/image/image-icons.d.ts +16 -0
- package/dist/components/image/image-icons.js +63 -0
- package/dist/components/image/image.css +253 -0
- package/dist/components/image/image.d.ts +75 -0
- package/dist/components/image/image.js +818 -0
- package/dist/components/input/base-input.d.ts +25 -0
- package/dist/components/input/base-input.js +104 -0
- package/dist/components/input/input-shared.css +75 -0
- package/dist/components/input/input-shared.d.ts +59 -0
- package/dist/components/input/input-shared.js +152 -0
- package/dist/components/input/input.css +107 -10
- package/dist/components/input/input.d.ts +12 -16
- package/dist/components/input/input.js +11 -154
- package/dist/components/input/otp.d.ts +29 -0
- package/dist/components/input/otp.js +335 -0
- package/dist/components/input/password.d.ts +12 -0
- package/dist/components/input/password.js +117 -0
- package/dist/components/input/search.d.ts +16 -0
- package/dist/components/input/search.js +99 -0
- package/dist/components/input-number/input-number.d.ts +2 -2
- package/dist/components/input-number/input-number.js +2 -2
- package/dist/components/list/list-pagination.css +127 -0
- package/dist/components/list/list-pagination.d.ts +38 -0
- package/dist/components/list/list-pagination.js +322 -0
- package/dist/components/list/list.css +225 -0
- package/dist/components/list/list.d.ts +77 -0
- package/dist/components/list/list.js +660 -0
- package/dist/components/listy/listy.css +55 -0
- package/dist/components/listy/listy.d.ts +20 -0
- package/dist/components/listy/listy.js +158 -0
- package/dist/components/masonry/masonry.css +13 -0
- package/dist/components/masonry/masonry.d.ts +39 -0
- package/dist/components/masonry/masonry.js +287 -0
- package/dist/components/mentions/mentions.css +179 -0
- package/dist/components/mentions/mentions.d.ts +48 -0
- package/dist/components/mentions/mentions.js +115 -0
- package/dist/components/modal/modal.css +1 -0
- package/dist/components/modal/modal.d.ts +30 -4
- package/dist/components/modal/modal.js +534 -241
- package/dist/components/pagination/pagination.css +10 -0
- package/dist/components/progress/progress.css +187 -0
- package/dist/components/progress/progress.d.ts +66 -0
- package/dist/components/progress/progress.js +567 -0
- package/dist/components/qr-code/qr-code.css +39 -0
- package/dist/components/qr-code/qr-code.d.ts +43 -0
- package/dist/components/qr-code/qr-code.js +286 -0
- package/dist/components/radio/radio.css +7 -0
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +78 -73
- package/dist/components/rate/rate.css +97 -0
- package/dist/components/rate/rate.d.ts +17 -0
- package/dist/components/rate/rate.js +172 -0
- package/dist/components/result/result.css +69 -0
- package/dist/components/result/result.d.ts +33 -0
- package/dist/components/result/result.js +320 -0
- package/dist/components/segmented/segmented.css +134 -0
- package/dist/components/segmented/segmented.d.ts +40 -0
- package/dist/components/segmented/segmented.js +169 -0
- package/dist/components/select/mobile-select.css +1 -16
- package/dist/components/select/mobile-select.d.ts +11 -4
- package/dist/components/select/mobile-select.js +172 -59
- package/dist/components/select/select-tags.js +178 -130
- package/dist/components/select/select-types.d.ts +53 -0
- package/dist/components/select/select.css +86 -8
- package/dist/components/select/select.js +59 -31
- package/dist/components/select/use-select-selection.js +44 -43
- package/dist/components/skeleton/skeleton.css +129 -0
- package/dist/components/skeleton/skeleton.d.ts +78 -0
- package/dist/components/skeleton/skeleton.js +457 -0
- package/dist/components/slider/slider.css +191 -0
- package/dist/components/slider/slider.d.ts +47 -0
- package/dist/components/slider/slider.js +310 -0
- package/dist/components/spinner/spinner.css +1 -1
- package/dist/components/statistic/statistic.css +34 -0
- package/dist/components/statistic/statistic.d.ts +46 -0
- package/dist/components/statistic/statistic.js +491 -0
- package/dist/components/steps/steps.css +53 -3
- package/dist/components/switch/switch-touch.css +20 -0
- package/dist/components/switch/switch.css +24 -13
- package/dist/components/switch/switch.js +8 -5
- package/dist/components/table/table.css +0 -5
- package/dist/components/table/table.js +21 -22
- package/dist/components/textarea/textarea.css +21 -1
- package/dist/components/textarea/textarea.d.ts +12 -6
- package/dist/components/textarea/textarea.js +120 -219
- package/dist/components/time-picker/time-picker.css +212 -0
- package/dist/components/time-picker/time-picker.d.ts +63 -0
- package/dist/components/time-picker/time-picker.js +356 -0
- package/dist/components/timeline/timeline.css +259 -0
- package/dist/components/timeline/timeline.d.ts +50 -0
- package/dist/components/timeline/timeline.js +140 -0
- package/dist/components/tour/tour.css +151 -0
- package/dist/components/tour/tour.d.ts +45 -0
- package/dist/components/tour/tour.js +575 -0
- package/dist/components/transfer/transfer-list.d.ts +2 -0
- package/dist/components/transfer/transfer-list.js +513 -0
- package/dist/components/transfer/transfer-parts.d.ts +3 -0
- package/dist/components/transfer/transfer-parts.js +163 -0
- package/dist/components/transfer/transfer-types.d.ts +163 -0
- package/dist/components/transfer/transfer-types.js +0 -0
- package/dist/components/transfer/transfer.css +226 -0
- package/dist/components/transfer/transfer.d.ts +13 -0
- package/dist/components/transfer/transfer.js +204 -0
- package/dist/components/tree/tree-check.d.ts +1 -0
- package/dist/components/tree/tree-check.js +36 -0
- package/dist/components/tree/tree.css +245 -0
- package/dist/components/tree/tree.d.ts +46 -0
- package/dist/components/tree/tree.js +388 -0
- package/dist/components/tree-select/select-engine.css +238 -0
- package/dist/components/tree-select/select-engine.d.ts +20 -0
- package/dist/components/tree-select/select-engine.js +46 -0
- package/dist/components/tree-select/tree-select.css +25 -0
- package/dist/components/tree-select/tree-select.d.ts +50 -0
- package/dist/components/tree-select/tree-select.js +130 -0
- package/dist/components/upload/upload-types.d.ts +135 -0
- package/dist/components/upload/upload-types.js +0 -0
- package/dist/components/upload/upload.css +166 -0
- package/dist/components/upload/upload.d.ts +12 -0
- package/dist/components/upload/upload.js +465 -0
- package/dist/components/watermark/watermark-context.d.ts +7 -0
- package/dist/components/watermark/watermark-context.js +20 -0
- package/dist/components/watermark/watermark.css +10 -0
- package/dist/components/watermark/watermark.d.ts +38 -0
- package/dist/components/watermark/watermark.js +436 -0
- package/dist/docs/component-docs.d.ts +35 -29
- package/dist/docs/component-docs.js +75 -3
- package/dist/docs/components/affix.doc.d.ts +14 -0
- package/dist/docs/components/affix.doc.js +22 -0
- package/dist/docs/components/app.doc.d.ts +18 -0
- package/dist/docs/components/app.doc.js +42 -0
- package/dist/docs/components/auto-complete.doc.d.ts +18 -0
- package/dist/docs/components/auto-complete.doc.js +49 -0
- package/dist/docs/components/avatar.doc.d.ts +17 -0
- package/dist/docs/components/avatar.doc.js +36 -0
- package/dist/docs/components/badge.doc.d.ts +17 -0
- package/dist/docs/components/badge.doc.js +34 -0
- package/dist/docs/components/border-beam.doc.d.ts +14 -0
- package/dist/docs/components/border-beam.doc.js +22 -0
- package/dist/docs/components/{collapsible.doc.d.ts → calendar.doc.d.ts} +1 -1
- package/dist/docs/components/calendar.doc.js +45 -0
- package/dist/docs/components/card.doc.d.ts +17 -0
- package/dist/docs/components/card.doc.js +39 -0
- package/dist/docs/components/carousel.doc.d.ts +15 -0
- package/dist/docs/components/carousel.doc.js +26 -0
- package/dist/docs/components/cascader.doc.d.ts +18 -0
- package/dist/docs/components/cascader.doc.js +54 -0
- package/dist/docs/components/collapse.doc.d.ts +18 -0
- package/dist/docs/components/collapse.doc.js +47 -0
- package/dist/docs/components/color-picker.doc.d.ts +18 -0
- package/dist/docs/components/color-picker.doc.js +46 -0
- package/dist/docs/components/descriptions.doc.d.ts +14 -0
- package/dist/docs/components/descriptions.doc.js +26 -0
- package/dist/docs/components/divider.doc.d.ts +17 -0
- package/dist/docs/components/divider.doc.js +34 -0
- package/dist/docs/components/empty.doc.d.ts +18 -0
- package/dist/docs/components/empty.doc.js +40 -0
- package/dist/docs/components/float-button.doc.d.ts +14 -0
- package/dist/docs/components/float-button.doc.js +23 -0
- package/dist/docs/components/form.doc.d.ts +1 -1
- package/dist/docs/components/image.doc.d.ts +15 -0
- package/dist/docs/components/image.doc.js +38 -0
- package/dist/docs/components/input.doc.js +11 -4
- package/dist/docs/components/list.doc.d.ts +18 -0
- package/dist/docs/components/list.doc.js +43 -0
- package/dist/docs/components/listy.doc.d.ts +18 -0
- package/dist/docs/components/listy.doc.js +40 -0
- package/dist/docs/components/masonry.doc.d.ts +14 -0
- package/dist/docs/components/masonry.doc.js +22 -0
- package/dist/docs/components/mentions.doc.d.ts +18 -0
- package/dist/docs/components/mentions.doc.js +43 -0
- package/dist/docs/components/modal.doc.js +3 -0
- package/dist/docs/components/progress.doc.d.ts +18 -0
- package/dist/docs/components/progress.doc.js +41 -0
- package/dist/docs/components/qr-code.doc.d.ts +18 -0
- package/dist/docs/components/qr-code.doc.js +41 -0
- package/dist/docs/components/rate.doc.d.ts +18 -0
- package/dist/docs/components/rate.doc.js +38 -0
- package/dist/docs/components/result.doc.d.ts +18 -0
- package/dist/docs/components/result.doc.js +42 -0
- package/dist/docs/components/segmented.doc.d.ts +14 -0
- package/dist/docs/components/segmented.doc.js +24 -0
- package/dist/docs/components/skeleton.doc.d.ts +18 -0
- package/dist/docs/components/skeleton.doc.js +42 -0
- package/dist/docs/components/slider.doc.d.ts +18 -0
- package/dist/docs/components/slider.doc.js +41 -0
- package/dist/docs/components/statistic.doc.d.ts +14 -0
- package/dist/docs/components/statistic.doc.js +27 -0
- package/dist/docs/components/textarea.doc.js +4 -2
- package/dist/docs/components/time-picker.doc.d.ts +18 -0
- package/dist/docs/components/time-picker.doc.js +45 -0
- package/dist/docs/components/timeline.doc.d.ts +14 -0
- package/dist/docs/components/timeline.doc.js +29 -0
- package/dist/docs/components/tooltip.doc.d.ts +2 -2
- package/dist/docs/components/tour.doc.d.ts +15 -0
- package/dist/docs/components/tour.doc.js +36 -0
- package/dist/docs/components/transfer.doc.d.ts +18 -0
- package/dist/docs/components/transfer.doc.js +48 -0
- package/dist/docs/components/tree-select.doc.d.ts +18 -0
- package/dist/docs/components/tree-select.doc.js +55 -0
- package/dist/docs/components/tree.doc.d.ts +18 -0
- package/dist/docs/components/tree.doc.js +46 -0
- package/dist/docs/components/upload.doc.d.ts +18 -0
- package/dist/docs/components/upload.doc.js +43 -0
- package/dist/docs/components/watermark.doc.d.ts +14 -0
- package/dist/docs/components/watermark.doc.js +22 -0
- package/dist/entries/affix.d.ts +3 -0
- package/dist/entries/{collapsible.js → affix.js} +1 -1
- package/dist/entries/app.d.ts +3 -0
- package/dist/entries/app.js +4 -0
- package/dist/entries/auto-complete.d.ts +4 -0
- package/dist/entries/auto-complete.js +4 -0
- package/dist/entries/avatar.d.ts +3 -0
- package/dist/entries/avatar.js +4 -0
- package/dist/entries/badge.d.ts +3 -0
- package/dist/entries/badge.js +4 -0
- package/dist/entries/border-beam.d.ts +3 -0
- package/dist/entries/border-beam.js +4 -0
- package/dist/entries/calendar.d.ts +3 -0
- package/dist/entries/calendar.js +4 -0
- package/dist/entries/card.d.ts +3 -0
- package/dist/entries/card.js +4 -0
- package/dist/entries/carousel.d.ts +3 -0
- package/dist/entries/carousel.js +4 -0
- package/dist/entries/cascader.d.ts +4 -0
- package/dist/entries/cascader.js +4 -0
- package/dist/entries/collapse.d.ts +3 -0
- package/dist/entries/collapse.js +4 -0
- package/dist/entries/color-picker.d.ts +5 -0
- package/dist/entries/color-picker.js +4 -0
- package/dist/entries/descriptions.d.ts +3 -0
- package/dist/entries/descriptions.js +4 -0
- package/dist/entries/divider.d.ts +3 -0
- package/dist/entries/divider.js +4 -0
- package/dist/entries/empty.d.ts +3 -0
- package/dist/entries/empty.js +4 -0
- package/dist/entries/float-button.d.ts +3 -0
- package/dist/entries/float-button.js +4 -0
- package/dist/entries/image.d.ts +3 -0
- package/dist/entries/image.js +4 -0
- package/dist/entries/input.d.ts +1 -1
- package/dist/entries/list.d.ts +3 -0
- package/dist/entries/list.js +4 -0
- package/dist/entries/listy.d.ts +3 -0
- package/dist/entries/listy.js +4 -0
- package/dist/entries/masonry.d.ts +3 -0
- package/dist/entries/masonry.js +4 -0
- package/dist/entries/mentions.d.ts +4 -0
- package/dist/entries/mentions.js +4 -0
- package/dist/entries/progress.d.ts +3 -0
- package/dist/entries/progress.js +4 -0
- package/dist/entries/provider.d.ts +1 -1
- package/dist/entries/provider.js +1 -1
- package/dist/entries/qr-code.d.ts +4 -0
- package/dist/entries/qr-code.js +4 -0
- package/dist/entries/rate.d.ts +3 -0
- package/dist/entries/rate.js +4 -0
- package/dist/entries/result.d.ts +3 -0
- package/dist/entries/result.js +4 -0
- package/dist/entries/segmented.d.ts +3 -0
- package/dist/entries/segmented.js +4 -0
- package/dist/entries/skeleton.d.ts +3 -0
- package/dist/entries/skeleton.js +4 -0
- package/dist/entries/slider.d.ts +3 -0
- package/dist/entries/slider.js +4 -0
- package/dist/entries/statistic.d.ts +3 -0
- package/dist/entries/statistic.js +4 -0
- package/dist/entries/textarea.d.ts +1 -1
- package/dist/entries/time-picker.d.ts +3 -0
- package/dist/entries/time-picker.js +4 -0
- package/dist/entries/timeline.d.ts +3 -0
- package/dist/entries/timeline.js +4 -0
- package/dist/entries/tour.d.ts +3 -0
- package/dist/entries/tour.js +4 -0
- package/dist/entries/transfer.d.ts +3 -0
- package/dist/entries/transfer.js +4 -0
- package/dist/entries/tree-select.d.ts +4 -0
- package/dist/entries/tree-select.js +4 -0
- package/dist/entries/tree.d.ts +3 -0
- package/dist/entries/tree.js +4 -0
- package/dist/entries/upload.d.ts +4 -0
- package/dist/entries/upload.js +4 -0
- package/dist/entries/util.d.ts +1 -0
- package/dist/entries/util.js +1 -0
- package/dist/entries/watermark.d.ts +3 -0
- package/dist/entries/watermark.js +4 -0
- package/dist/index.d.ts +51 -6
- package/dist/index.js +39 -3
- package/dist/provider/locale.d.ts +65 -0
- package/dist/provider/locale.js +146 -0
- package/dist/provider/tao-provider.d.ts +16 -1
- package/dist/provider/tao-provider.js +105 -87
- package/dist/theme/control.css +12 -2
- package/dist/theme/theme.css +4 -2
- package/dist/theme/tokens.d.ts +2 -2
- package/dist/theme/tokens.js +1 -0
- package/dist/utils/breakpoint.d.ts +2 -2
- package/dist/utils/breakpoint.js +3 -1
- package/dist/utils/field-label.d.ts +4 -0
- package/dist/utils/field-label.js +7 -0
- package/dist/utils/interop-default.d.ts +2 -0
- package/dist/utils/interop-default.js +4 -0
- package/dist/utils/types.d.ts +7 -0
- package/dist/utils/types.js +0 -0
- package/llms.txt +493 -22
- package/package.json +33 -9
- package/dist/components/collapsible/collapsible.css +0 -49
- package/dist/components/collapsible/collapsible.d.ts +0 -39
- package/dist/docs/components/collapsible.doc.js +0 -39
- package/dist/entries/collapsible.d.ts +0 -3
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
[data-tao-upload] {
|
|
3
|
+
gap: var(--tao-margin-xs);
|
|
4
|
+
min-width: 0;
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
color: var(--tao-color-text);
|
|
7
|
+
font: var(--tao-font-size) / var(--tao-line-height) var(--tao-font-family);
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
[data-tao-upload-trigger] {
|
|
13
|
+
align-items: center;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[data-tao-upload-trigger] > span {
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
align-items: center;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[data-tao-upload][data-type="drag"] {
|
|
24
|
+
display: flex;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[data-tao-upload][data-type="drag"] [data-tao-upload-trigger] {
|
|
28
|
+
min-height: 140px;
|
|
29
|
+
padding: var(--tao-padding-lg);
|
|
30
|
+
border: 1px dashed var(--tao-color-border);
|
|
31
|
+
border-radius: var(--tao-radius);
|
|
32
|
+
background: var(--tao-color-fill-quaternary);
|
|
33
|
+
text-align: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[data-tao-upload][data-type="drag"] [data-tao-upload-trigger] > span {
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
flex: 1;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-self: stretch;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[data-tao-upload][data-dragging] [data-tao-upload-trigger] {
|
|
45
|
+
border-color: var(--tao-primary);
|
|
46
|
+
background: var(--tao-primary-bg);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[data-tao-upload][data-disabled] [data-tao-upload-trigger] {
|
|
50
|
+
color: var(--tao-color-text-disabled);
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[data-tao-upload][data-disabled] [data-tao-upload-trigger] > span {
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[data-tao-upload-list] {
|
|
59
|
+
gap: var(--tao-margin-xs);
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
display: flex;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-tao-upload-item] {
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: var(--tao-margin-xs);
|
|
68
|
+
min-width: 0;
|
|
69
|
+
padding: var(--tao-padding-xxs);
|
|
70
|
+
border-radius: var(--tao-radius-sm);
|
|
71
|
+
display: flex;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[data-tao-upload-item]:hover {
|
|
75
|
+
background: var(--tao-color-bg-text-hover);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[data-tao-upload-item] > svg {
|
|
79
|
+
color: var(--tao-color-text-secondary);
|
|
80
|
+
flex-shrink: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[data-tao-upload-details] {
|
|
84
|
+
overflow-wrap: anywhere;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
flex: 1;
|
|
87
|
+
min-width: 0;
|
|
88
|
+
display: flex;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
[data-tao-upload-details] a {
|
|
92
|
+
color: var(--tao-primary);
|
|
93
|
+
text-decoration: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[data-tao-upload-actions] {
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
gap: 2px;
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
[data-tao-upload-actions] button {
|
|
103
|
+
width: 28px;
|
|
104
|
+
height: 28px;
|
|
105
|
+
color: var(--tao-color-text-secondary);
|
|
106
|
+
padding: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[data-tao-upload] :is(a, button, [role="button"]):focus-visible {
|
|
110
|
+
outline: 2px solid var(--tao-primary);
|
|
111
|
+
outline-offset: 2px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
[data-tao-upload-item][data-status="error"], [data-tao-upload-error] {
|
|
115
|
+
color: var(--tao-error);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[data-tao-upload-error] {
|
|
119
|
+
font-size: var(--tao-font-size-sm);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[data-tao-upload-thumbnail] {
|
|
123
|
+
flex-shrink: 0;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
align-items: center;
|
|
126
|
+
width: 48px;
|
|
127
|
+
height: 48px;
|
|
128
|
+
display: inline-flex;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
[data-tao-upload-thumbnail] img {
|
|
133
|
+
object-fit: contain;
|
|
134
|
+
width: 100%;
|
|
135
|
+
height: 100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[data-tao-upload][data-list-type="picture"] [data-tao-upload-item] {
|
|
139
|
+
padding: var(--tao-padding-xs);
|
|
140
|
+
border: 1px solid var(--tao-color-border-secondary);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
[data-tao-upload]:is([data-list-type="picture-card"], [data-list-type="picture-circle"]) [data-tao-upload-list] {
|
|
144
|
+
flex-flow: wrap;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
[data-tao-upload]:is([data-list-type="picture-card"], [data-list-type="picture-circle"]) [data-tao-upload-item] {
|
|
148
|
+
border: 1px solid var(--tao-color-border-secondary);
|
|
149
|
+
text-align: center;
|
|
150
|
+
flex-direction: column;
|
|
151
|
+
width: 120px;
|
|
152
|
+
min-height: 144px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-tao-upload][data-list-type="picture-circle"] [data-tao-upload-thumbnail] {
|
|
156
|
+
border-radius: 50%;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (pointer: coarse) {
|
|
160
|
+
[data-tao-upload-actions] button {
|
|
161
|
+
min-width: 44px;
|
|
162
|
+
min-height: 44px;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactElement, type Ref } from 'react';
|
|
2
|
+
import type { DraggerProps, UploadProps, UploadRef } from './upload-types.js';
|
|
3
|
+
import './upload.css';
|
|
4
|
+
export type * from './upload-types.js';
|
|
5
|
+
export declare const Upload: (<T = unknown>(props: UploadProps<T> & {
|
|
6
|
+
ref?: Ref<UploadRef<T>>;
|
|
7
|
+
}) => ReactElement) & {
|
|
8
|
+
Dragger: <T = unknown>(props: DraggerProps<T> & {
|
|
9
|
+
ref?: Ref<UploadRef<T>>;
|
|
10
|
+
}) => ReactElement;
|
|
11
|
+
LIST_IGNORE: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import upload from "@rc-component/upload";
|
|
4
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
5
|
+
import { flushSync } from "react-dom";
|
|
6
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
7
|
+
import { cx } from "../../utils/semantic.js";
|
|
8
|
+
import { Button } from "../button/button.js";
|
|
9
|
+
import { Progress } from "../progress/progress.js";
|
|
10
|
+
import "./upload.css";
|
|
11
|
+
import { interopDefault } from "../../utils/interop-default.js";
|
|
12
|
+
const RcUploaderComponent = /*#__PURE__*/ interopDefault(upload);
|
|
13
|
+
const LIST_IGNORE = '__TAO_UPLOAD_LIST_IGNORE__';
|
|
14
|
+
function toFile(file) {
|
|
15
|
+
return {
|
|
16
|
+
uid: file.uid,
|
|
17
|
+
name: file.name,
|
|
18
|
+
size: file.size,
|
|
19
|
+
type: file.type,
|
|
20
|
+
lastModified: file.lastModified,
|
|
21
|
+
lastModifiedDate: new Date(file.lastModified),
|
|
22
|
+
originFileObj: file,
|
|
23
|
+
percent: 0
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function readPreview(file) {
|
|
27
|
+
return new Promise((resolve, reject)=>{
|
|
28
|
+
const reader = new FileReader();
|
|
29
|
+
reader.onload = ()=>resolve(String(reader.result));
|
|
30
|
+
reader.onerror = ()=>reject(reader.error ?? new Error('Unable to read file preview'));
|
|
31
|
+
reader.readAsDataURL(file);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function FilePreview(t0) {
|
|
35
|
+
const $ = c(11);
|
|
36
|
+
const { file, previewFile } = t0;
|
|
37
|
+
const [preview, setPreview] = useState();
|
|
38
|
+
const [error, setError] = useState();
|
|
39
|
+
let t1;
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[0] !== file.originFileObj || $[1] !== file.thumbUrl || $[2] !== file.url || $[3] !== previewFile) {
|
|
42
|
+
t1 = ()=>{
|
|
43
|
+
if (file.thumbUrl || file.url || !file.originFileObj) return;
|
|
44
|
+
let active = true;
|
|
45
|
+
Promise.resolve((previewFile ?? readPreview)(file.originFileObj)).then((value)=>{
|
|
46
|
+
if (active) setPreview(value);
|
|
47
|
+
}, (reason)=>{
|
|
48
|
+
if (active) setError(reason instanceof Error ? reason.message : "Preview unavailable");
|
|
49
|
+
});
|
|
50
|
+
return ()=>{
|
|
51
|
+
active = false;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
t2 = [
|
|
55
|
+
file.originFileObj,
|
|
56
|
+
file.thumbUrl,
|
|
57
|
+
file.url,
|
|
58
|
+
previewFile
|
|
59
|
+
];
|
|
60
|
+
$[0] = file.originFileObj;
|
|
61
|
+
$[1] = file.thumbUrl;
|
|
62
|
+
$[2] = file.url;
|
|
63
|
+
$[3] = previewFile;
|
|
64
|
+
$[4] = t1;
|
|
65
|
+
$[5] = t2;
|
|
66
|
+
} else {
|
|
67
|
+
t1 = $[4];
|
|
68
|
+
t2 = $[5];
|
|
69
|
+
}
|
|
70
|
+
useEffect(t1, t2);
|
|
71
|
+
const src = file.thumbUrl ?? file.url ?? preview;
|
|
72
|
+
let t3;
|
|
73
|
+
if ($[6] !== error || $[7] !== file.crossOrigin || $[8] !== file.name || $[9] !== src) {
|
|
74
|
+
t3 = error ? /*#__PURE__*/ jsx("span", {
|
|
75
|
+
role: "status",
|
|
76
|
+
children: error
|
|
77
|
+
}) : src ? /*#__PURE__*/ jsx("img", {
|
|
78
|
+
src: src,
|
|
79
|
+
alt: file.name,
|
|
80
|
+
crossOrigin: file.crossOrigin
|
|
81
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
82
|
+
"aria-hidden": "true",
|
|
83
|
+
children: "▧"
|
|
84
|
+
});
|
|
85
|
+
$[6] = error;
|
|
86
|
+
$[7] = file.crossOrigin;
|
|
87
|
+
$[8] = file.name;
|
|
88
|
+
$[9] = src;
|
|
89
|
+
$[10] = t3;
|
|
90
|
+
} else t3 = $[10];
|
|
91
|
+
return t3;
|
|
92
|
+
}
|
|
93
|
+
function FileIcon(t0) {
|
|
94
|
+
const $ = c(2);
|
|
95
|
+
const { remove: t1 } = t0;
|
|
96
|
+
const remove = void 0 === t1 ? false : t1;
|
|
97
|
+
let t2;
|
|
98
|
+
if ($[0] !== remove) {
|
|
99
|
+
t2 = /*#__PURE__*/ jsx("svg", {
|
|
100
|
+
viewBox: "0 0 24 24",
|
|
101
|
+
width: "16",
|
|
102
|
+
height: "16",
|
|
103
|
+
fill: "none",
|
|
104
|
+
stroke: "currentColor",
|
|
105
|
+
strokeWidth: "1.8",
|
|
106
|
+
"aria-hidden": "true",
|
|
107
|
+
children: remove ? /*#__PURE__*/ jsx("path", {
|
|
108
|
+
d: "m6 6 12 12M18 6 6 18"
|
|
109
|
+
}) : /*#__PURE__*/ jsx("path", {
|
|
110
|
+
d: "M7 3h7l4 4v14H7V3Zm7 0v5h4M10 12h5M10 16h5"
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
$[0] = remove;
|
|
114
|
+
$[1] = t2;
|
|
115
|
+
} else t2 = $[1];
|
|
116
|
+
return t2;
|
|
117
|
+
}
|
|
118
|
+
const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
119
|
+
const config = useTaoConfig();
|
|
120
|
+
const [localFiles, setFiles] = useState(props.defaultFileList ?? []);
|
|
121
|
+
const files = props.fileList ?? localFiles;
|
|
122
|
+
const filesRef = useRef(files);
|
|
123
|
+
filesRef.current = files;
|
|
124
|
+
const propsRef = useRef(props);
|
|
125
|
+
propsRef.current = props;
|
|
126
|
+
const root = useRef(null), uploader = useRef(null);
|
|
127
|
+
const ignored = useRef(new Set());
|
|
128
|
+
const [dragging, setDragging] = useState(false), [removeError, setRemoveError] = useState();
|
|
129
|
+
const disabled = props.disabled ?? config.disabled;
|
|
130
|
+
const listType = props.listType ?? 'text', type = props.type ?? 'select';
|
|
131
|
+
const names = 'function' == typeof props.classNames ? props.classNames({
|
|
132
|
+
props: {
|
|
133
|
+
...props,
|
|
134
|
+
listType,
|
|
135
|
+
type,
|
|
136
|
+
disabled
|
|
137
|
+
}
|
|
138
|
+
}) : props.classNames;
|
|
139
|
+
const styles = 'function' == typeof props.styles ? props.styles({
|
|
140
|
+
props: {
|
|
141
|
+
...props,
|
|
142
|
+
listType,
|
|
143
|
+
type,
|
|
144
|
+
disabled
|
|
145
|
+
}
|
|
146
|
+
}) : props.styles;
|
|
147
|
+
const chinese = 'zh_CN' === config.locale.locale;
|
|
148
|
+
const locale = {
|
|
149
|
+
removeFile: chinese ? '删除文件' : 'Remove file',
|
|
150
|
+
previewFile: chinese ? '预览文件' : 'Preview file',
|
|
151
|
+
downloadFile: chinese ? '下载文件' : 'Download file',
|
|
152
|
+
uploadError: chinese ? '上传失败' : 'Upload failed',
|
|
153
|
+
...props.locale
|
|
154
|
+
};
|
|
155
|
+
const current = ()=>propsRef.current.fileList ?? filesRef.current;
|
|
156
|
+
const emit = (file, next, event)=>{
|
|
157
|
+
const max = propsRef.current.maxCount;
|
|
158
|
+
const limited = 1 === max ? next.slice(-1) : max ? next.slice(0, max) : next;
|
|
159
|
+
flushSync(()=>{
|
|
160
|
+
if (void 0 === propsRef.current.fileList) {
|
|
161
|
+
filesRef.current = limited;
|
|
162
|
+
setFiles(limited);
|
|
163
|
+
}
|
|
164
|
+
if ('removed' === file.status || limited.some((item)=>item.uid === file.uid)) propsRef.current.onChange?.({
|
|
165
|
+
file,
|
|
166
|
+
fileList: limited,
|
|
167
|
+
...event ? {
|
|
168
|
+
event
|
|
169
|
+
} : {}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
const update = (file_0, patch, event_0)=>{
|
|
174
|
+
const items = current(), found = items.find((item_0)=>item_0.uid === file_0.uid);
|
|
175
|
+
if (!found) return;
|
|
176
|
+
const changed = {
|
|
177
|
+
...found,
|
|
178
|
+
...patch
|
|
179
|
+
};
|
|
180
|
+
emit(changed, items.map((item_1)=>item_1.uid === file_0.uid ? changed : item_1), event_0);
|
|
181
|
+
};
|
|
182
|
+
const onSuccess = (response, file_1, xhr)=>update(file_1, {
|
|
183
|
+
status: 'done',
|
|
184
|
+
percent: 100,
|
|
185
|
+
response,
|
|
186
|
+
xhr
|
|
187
|
+
});
|
|
188
|
+
const onProgress = (event_1, file_2)=>update(file_2, {
|
|
189
|
+
status: 'uploading',
|
|
190
|
+
percent: event_1.percent
|
|
191
|
+
}, event_1);
|
|
192
|
+
const onError = (error, response_0, file_3)=>update(file_3, {
|
|
193
|
+
status: 'error',
|
|
194
|
+
error,
|
|
195
|
+
response: response_0
|
|
196
|
+
});
|
|
197
|
+
const onBatchStart = (batch)=>{
|
|
198
|
+
const allowed = batch.filter(({ file: file_4 })=>!ignored.current.delete(file_4.uid));
|
|
199
|
+
let next_0 = [
|
|
200
|
+
...current()
|
|
201
|
+
];
|
|
202
|
+
const additions = allowed.map(({ file: file_5, parsedFile })=>({
|
|
203
|
+
...toFile(file_5),
|
|
204
|
+
...parsedFile ? {
|
|
205
|
+
status: 'uploading'
|
|
206
|
+
} : {}
|
|
207
|
+
}));
|
|
208
|
+
for (const item_2 of additions)next_0 = [
|
|
209
|
+
...next_0.filter((old)=>old.uid !== item_2.uid),
|
|
210
|
+
item_2
|
|
211
|
+
];
|
|
212
|
+
for (const item_3 of additions)emit(item_3, next_0);
|
|
213
|
+
};
|
|
214
|
+
useImperativeHandle(ref, ()=>({
|
|
215
|
+
onBatchStart,
|
|
216
|
+
onSuccess,
|
|
217
|
+
onProgress,
|
|
218
|
+
onError,
|
|
219
|
+
fileList: files,
|
|
220
|
+
upload: uploader.current,
|
|
221
|
+
nativeElement: root.current
|
|
222
|
+
}));
|
|
223
|
+
const remove = async (file_6)=>{
|
|
224
|
+
try {
|
|
225
|
+
if (await propsRef.current.onRemove?.(file_6) === false) return;
|
|
226
|
+
const items_0 = current();
|
|
227
|
+
if (!items_0.some((item_4)=>item_4.uid === file_6.uid)) return;
|
|
228
|
+
uploader.current?.abort(file_6);
|
|
229
|
+
emit({
|
|
230
|
+
...file_6,
|
|
231
|
+
status: 'removed'
|
|
232
|
+
}, items_0.filter((item_5)=>item_5.uid !== file_6.uid));
|
|
233
|
+
setRemoveError(void 0);
|
|
234
|
+
} catch (error_0) {
|
|
235
|
+
setRemoveError(error_0 instanceof Error ? error_0.message : 'Unable to remove file');
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const download = (file_7)=>{
|
|
239
|
+
if (props.onDownload) props.onDownload(file_7);
|
|
240
|
+
else if (file_7.url) window.open(file_7.url, '_blank', 'noopener,noreferrer');
|
|
241
|
+
};
|
|
242
|
+
const listConfig = 'object' == typeof props.showUploadList ? props.showUploadList : {};
|
|
243
|
+
const visible = (option, file_8, fallback)=>'function' == typeof option ? option(file_8) : option ?? fallback;
|
|
244
|
+
const renderOption = (option_0, file_9)=>'function' == typeof option_0 ? option_0(file_9) : option_0;
|
|
245
|
+
const triggerStyle = {
|
|
246
|
+
...styles?.trigger
|
|
247
|
+
};
|
|
248
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
249
|
+
ref: root,
|
|
250
|
+
"data-tao-upload": "",
|
|
251
|
+
"data-type": type,
|
|
252
|
+
"data-list-type": listType,
|
|
253
|
+
"data-disabled": disabled || void 0,
|
|
254
|
+
"data-dragging": dragging || void 0,
|
|
255
|
+
className: cx(names?.root, props.className, props.rootClassName),
|
|
256
|
+
style: {
|
|
257
|
+
...styles?.root,
|
|
258
|
+
...props.style
|
|
259
|
+
},
|
|
260
|
+
children: [
|
|
261
|
+
/*#__PURE__*/ jsx("span", {
|
|
262
|
+
"data-tao-upload-trigger": "",
|
|
263
|
+
className: names?.trigger,
|
|
264
|
+
style: triggerStyle,
|
|
265
|
+
children: /*#__PURE__*/ jsx(RcUploaderComponent, {
|
|
266
|
+
onFocus: props.onFocus,
|
|
267
|
+
ref: uploader,
|
|
268
|
+
prefixCls: props.prefixCls ?? 'tao-upload-input',
|
|
269
|
+
component: "span",
|
|
270
|
+
action: props.action ?? '',
|
|
271
|
+
name: props.name,
|
|
272
|
+
method: props.method,
|
|
273
|
+
headers: props.headers,
|
|
274
|
+
data: 'function' == typeof props.data ? (file_10)=>props.data(toFile(file_10)) : props.data,
|
|
275
|
+
customRequest: props.customRequest,
|
|
276
|
+
withCredentials: props.withCredentials,
|
|
277
|
+
disabled: disabled,
|
|
278
|
+
multiple: props.multiple,
|
|
279
|
+
accept: props.accept,
|
|
280
|
+
directory: props.directory,
|
|
281
|
+
capture: props.capture,
|
|
282
|
+
pastable: props.pastable,
|
|
283
|
+
id: props.id,
|
|
284
|
+
openFileDialogOnClick: props.openFileDialogOnClick,
|
|
285
|
+
hasControlInside: props.hasControlInside ?? !!props.children,
|
|
286
|
+
beforeUpload: async (file_11, list)=>{
|
|
287
|
+
const result = await props.beforeUpload?.(file_11, list);
|
|
288
|
+
if (result === LIST_IGNORE) {
|
|
289
|
+
ignored.current.add(file_11.uid);
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
return result;
|
|
293
|
+
},
|
|
294
|
+
onBatchStart: onBatchStart,
|
|
295
|
+
onProgress: (event_2, file_12)=>onProgress({
|
|
296
|
+
percent: event_2.percent ?? 0
|
|
297
|
+
}, file_12),
|
|
298
|
+
onSuccess: onSuccess,
|
|
299
|
+
onError: onError,
|
|
300
|
+
onDragOver: ()=>setDragging(true),
|
|
301
|
+
onDragLeave: ()=>setDragging(false),
|
|
302
|
+
onDrop: (event_3)=>{
|
|
303
|
+
setDragging(false);
|
|
304
|
+
props.onDrop?.(event_3);
|
|
305
|
+
},
|
|
306
|
+
children: props.children ?? ('drag' === type ? chinese ? '点击或拖动文件到此区域上传' : 'Click or drop files here to upload' : chinese ? '上传文件' : 'Upload files')
|
|
307
|
+
})
|
|
308
|
+
}),
|
|
309
|
+
false !== props.showUploadList && /*#__PURE__*/ jsx("span", {
|
|
310
|
+
"data-tao-upload-list": "",
|
|
311
|
+
className: names?.list,
|
|
312
|
+
style: styles?.list,
|
|
313
|
+
children: files.map((file_13)=>{
|
|
314
|
+
const image = props.isImageUrl ? props.isImageUrl(file_13) : !!(file_13.type?.startsWith('image/') || /\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(file_13.url ?? file_13.name));
|
|
315
|
+
const actions = {
|
|
316
|
+
preview: ()=>props.onPreview?.(file_13),
|
|
317
|
+
download: ()=>download(file_13),
|
|
318
|
+
remove: ()=>{
|
|
319
|
+
remove(file_13);
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const node = /*#__PURE__*/ jsxs("span", {
|
|
323
|
+
"data-tao-upload-item": "",
|
|
324
|
+
"data-status": file_13.status,
|
|
325
|
+
className: names?.item,
|
|
326
|
+
style: styles?.item,
|
|
327
|
+
children: [
|
|
328
|
+
'text' !== listType && image ? /*#__PURE__*/ jsx("span", {
|
|
329
|
+
"data-tao-upload-thumbnail": "",
|
|
330
|
+
children: /*#__PURE__*/ jsx(FilePreview, {
|
|
331
|
+
file: file_13,
|
|
332
|
+
previewFile: props.previewFile
|
|
333
|
+
})
|
|
334
|
+
}) : props.iconRender?.(file_13, listType) ?? /*#__PURE__*/ jsx(FileIcon, {}),
|
|
335
|
+
/*#__PURE__*/ jsxs("span", {
|
|
336
|
+
"data-tao-upload-details": "",
|
|
337
|
+
children: [
|
|
338
|
+
file_13.url ? /*#__PURE__*/ jsx("a", {
|
|
339
|
+
...file_13.linkProps,
|
|
340
|
+
href: file_13.url,
|
|
341
|
+
target: "_blank",
|
|
342
|
+
rel: "noopener noreferrer",
|
|
343
|
+
onClick: (event_4)=>{
|
|
344
|
+
if (props.onPreview) {
|
|
345
|
+
event_4.preventDefault();
|
|
346
|
+
actions.preview();
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
children: file_13.name
|
|
350
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
351
|
+
children: file_13.name
|
|
352
|
+
}),
|
|
353
|
+
'error' === file_13.status && /*#__PURE__*/ jsx("span", {
|
|
354
|
+
"data-tao-upload-error": "",
|
|
355
|
+
role: "status",
|
|
356
|
+
children: file_13.error?.message ?? locale.uploadError
|
|
357
|
+
}),
|
|
358
|
+
'uploading' === file_13.status && /*#__PURE__*/ jsx(Progress, {
|
|
359
|
+
size: "small",
|
|
360
|
+
showInfo: false,
|
|
361
|
+
...props.progress,
|
|
362
|
+
percent: file_13.percent ?? 0,
|
|
363
|
+
"aria-label": file_13['aria-label'] ?? file_13.name,
|
|
364
|
+
"aria-labelledby": file_13['aria-labelledby']
|
|
365
|
+
}),
|
|
366
|
+
renderOption(listConfig.extra, file_13)
|
|
367
|
+
]
|
|
368
|
+
}),
|
|
369
|
+
/*#__PURE__*/ jsxs("span", {
|
|
370
|
+
"data-tao-upload-actions": "",
|
|
371
|
+
children: [
|
|
372
|
+
visible(listConfig.showPreviewIcon, file_13, 'picture-card' === listType || 'picture-circle' === listType) && /*#__PURE__*/ jsx(Button, {
|
|
373
|
+
variant: "ghost",
|
|
374
|
+
size: "small",
|
|
375
|
+
disabled: false,
|
|
376
|
+
type: "button",
|
|
377
|
+
"aria-label": `${locale.previewFile} ${file_13.name}`,
|
|
378
|
+
onClick: actions.preview,
|
|
379
|
+
children: renderOption(listConfig.previewIcon, file_13) ?? '↗'
|
|
380
|
+
}),
|
|
381
|
+
visible(listConfig.showDownloadIcon, file_13, false) && /*#__PURE__*/ jsx(Button, {
|
|
382
|
+
variant: "ghost",
|
|
383
|
+
size: "small",
|
|
384
|
+
disabled: false,
|
|
385
|
+
type: "button",
|
|
386
|
+
"aria-label": `${locale.downloadFile} ${file_13.name}`,
|
|
387
|
+
onClick: actions.download,
|
|
388
|
+
children: renderOption(listConfig.downloadIcon, file_13) ?? '↓'
|
|
389
|
+
}),
|
|
390
|
+
visible(listConfig.showRemoveIcon, file_13, true) && !disabled && /*#__PURE__*/ jsx(Button, {
|
|
391
|
+
variant: "ghost",
|
|
392
|
+
size: "small",
|
|
393
|
+
disabled: false,
|
|
394
|
+
type: "button",
|
|
395
|
+
"aria-label": `${locale.removeFile} ${file_13.name}`,
|
|
396
|
+
onClick: actions.remove,
|
|
397
|
+
children: renderOption(listConfig.removeIcon, file_13) ?? /*#__PURE__*/ jsx(FileIcon, {
|
|
398
|
+
remove: true
|
|
399
|
+
})
|
|
400
|
+
})
|
|
401
|
+
]
|
|
402
|
+
})
|
|
403
|
+
]
|
|
404
|
+
});
|
|
405
|
+
return /*#__PURE__*/ jsx("span", {
|
|
406
|
+
"data-tao-upload-row": "",
|
|
407
|
+
children: props.itemRender ? props.itemRender(node, file_13, files, actions) : node
|
|
408
|
+
}, file_13.uid);
|
|
409
|
+
})
|
|
410
|
+
}),
|
|
411
|
+
removeError && /*#__PURE__*/ jsx("span", {
|
|
412
|
+
role: "alert",
|
|
413
|
+
children: removeError
|
|
414
|
+
})
|
|
415
|
+
]
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
UploadRoot.displayName = 'Upload';
|
|
419
|
+
const Dragger = /*#__PURE__*/ forwardRef((t0, ref)=>{
|
|
420
|
+
const $ = c(11);
|
|
421
|
+
let height;
|
|
422
|
+
let props;
|
|
423
|
+
let style;
|
|
424
|
+
if ($[0] !== t0) {
|
|
425
|
+
({ height, style, ...props } = t0);
|
|
426
|
+
$[0] = t0;
|
|
427
|
+
$[1] = height;
|
|
428
|
+
$[2] = props;
|
|
429
|
+
$[3] = style;
|
|
430
|
+
} else {
|
|
431
|
+
height = $[1];
|
|
432
|
+
props = $[2];
|
|
433
|
+
style = $[3];
|
|
434
|
+
}
|
|
435
|
+
let t1;
|
|
436
|
+
if ($[4] !== height || $[5] !== style) {
|
|
437
|
+
t1 = {
|
|
438
|
+
height,
|
|
439
|
+
...style
|
|
440
|
+
};
|
|
441
|
+
$[4] = height;
|
|
442
|
+
$[5] = style;
|
|
443
|
+
$[6] = t1;
|
|
444
|
+
} else t1 = $[6];
|
|
445
|
+
let t2;
|
|
446
|
+
if ($[7] !== props || $[8] !== ref || $[9] !== t1) {
|
|
447
|
+
t2 = /*#__PURE__*/ jsx(UploadRoot, {
|
|
448
|
+
...props,
|
|
449
|
+
ref: ref,
|
|
450
|
+
type: "drag",
|
|
451
|
+
style: t1
|
|
452
|
+
});
|
|
453
|
+
$[7] = props;
|
|
454
|
+
$[8] = ref;
|
|
455
|
+
$[9] = t1;
|
|
456
|
+
$[10] = t2;
|
|
457
|
+
} else t2 = $[10];
|
|
458
|
+
return t2;
|
|
459
|
+
});
|
|
460
|
+
Dragger.displayName = 'Upload.Dragger';
|
|
461
|
+
const Upload = Object.assign(UploadRoot, {
|
|
462
|
+
Dragger: Dragger,
|
|
463
|
+
LIST_IGNORE: LIST_IGNORE
|
|
464
|
+
});
|
|
465
|
+
export { Upload };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface WatermarkContextValue {
|
|
2
|
+
add: (element: HTMLElement) => void;
|
|
3
|
+
remove: (element: HTMLElement) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const WatermarkContext: import("react").Context<WatermarkContextValue | null>;
|
|
6
|
+
/** Register a portaled Modal/Drawer panel with its closest inheritable watermark. */
|
|
7
|
+
export declare function useWatermarkPanelRef(): (element: HTMLElement | null) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { c } from "react-compiler-runtime";
|
|
2
|
+
import { createContext, useContext, useRef } from "react";
|
|
3
|
+
const WatermarkContext = createContext(null);
|
|
4
|
+
function useWatermarkPanelRef() {
|
|
5
|
+
const $ = c(2);
|
|
6
|
+
const context = useContext(WatermarkContext);
|
|
7
|
+
const previous = useRef(null);
|
|
8
|
+
let t0;
|
|
9
|
+
if ($[0] !== context) {
|
|
10
|
+
t0 = (element)=>{
|
|
11
|
+
if (previous.current) context?.remove(previous.current);
|
|
12
|
+
previous.current = element;
|
|
13
|
+
if (element) context?.add(element);
|
|
14
|
+
};
|
|
15
|
+
$[0] = context;
|
|
16
|
+
$[1] = t0;
|
|
17
|
+
} else t0 = $[1];
|
|
18
|
+
return t0;
|
|
19
|
+
}
|
|
20
|
+
export { WatermarkContext, useWatermarkPanelRef };
|