@aifuxi/semi-ui-vue 0.1.0-alpha.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.
- package/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/Button-RCaDTqHh.js +249 -0
- package/dist/Collapsible-DeV0aJ4n.js +199 -0
- package/dist/Cropper-Dy1LPBDN.js +587 -0
- package/dist/Divider-BQmwhGfH.js +57 -0
- package/dist/Input-BYWFIgNn.js +593 -0
- package/dist/InputNumber-BaeViVtG.js +856 -0
- package/dist/Modal-BhmFYVFw.js +975 -0
- package/dist/Pagination-4JvS-gHR.js +572 -0
- package/dist/Progress-BulSV_JR.js +523 -0
- package/dist/SBOM.spdx.json +165 -0
- package/dist/SelectOption-Ce-Lst-e.js +1473 -0
- package/dist/Slider-w9sbxzBw.js +707 -0
- package/dist/Spin-CuFLkqev.js +222 -0
- package/dist/THIRD_PARTY_LICENSES/Semi-Design.txt +83 -0
- package/dist/THIRD_PARTY_LICENSES/async-validator.txt +9 -0
- package/dist/THIRD_PARTY_LICENSES/bezier-easing.txt +22 -0
- package/dist/THIRD_PARTY_LICENSES/date-fns-tz.txt +21 -0
- package/dist/THIRD_PARTY_LICENSES/date-fns.txt +21 -0
- package/dist/THIRD_PARTY_LICENSES/lodash.txt +47 -0
- package/dist/THIRD_PARTY_LICENSES/scroll-into-view-if-needed.txt +21 -0
- package/dist/THIRD_PARTY_NOTICES.md +23 -0
- package/dist/Tooltip-Bq7HZwnS.js +1321 -0
- package/dist/Tree-tqy5xBYJ.js +1275 -0
- package/dist/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/anchor/Anchor.vue.d.ts +29 -0
- package/dist/anchor/AnchorLink.vue.d.ts +16 -0
- package/dist/anchor/AnchorNodeRenderer.d.ts +15 -0
- package/dist/anchor/anchor-context.d.ts +18 -0
- package/dist/anchor/index.d.ts +11 -0
- package/dist/anchor/index.js +2 -0
- package/dist/anchor/types.d.ts +43 -0
- package/dist/anchor-DW0p2t-I.js +503 -0
- package/dist/arrayMove-ByVCXfhS.js +7 -0
- package/dist/auto-complete/AutoComplete.vue.d.ts +33 -0
- package/dist/auto-complete/AutoCompleteNodeRenderer.d.ts +15 -0
- package/dist/auto-complete/AutoCompleteOption.vue.d.ts +19 -0
- package/dist/auto-complete/index.d.ts +10 -0
- package/dist/auto-complete/index.js +2 -0
- package/dist/auto-complete/types.d.ts +117 -0
- package/dist/auto-complete/use-auto-complete-foundation.d.ts +40 -0
- package/dist/auto-complete-BeahBlt9.js +765 -0
- package/dist/avatar/Avatar.vue.d.ts +26 -0
- package/dist/avatar/AvatarGroup.d.ts +54 -0
- package/dist/avatar/AvatarNodeRenderer.d.ts +15 -0
- package/dist/avatar/TopSlotSvg.vue.d.ts +7 -0
- package/dist/avatar/index.d.ts +10 -0
- package/dist/avatar/index.js +2 -0
- package/dist/avatar/types.d.ts +86 -0
- package/dist/avatar-B00xjEzD.js +551 -0
- package/dist/back-top/BackTop.vue.d.ts +19 -0
- package/dist/back-top/index.d.ts +3 -0
- package/dist/back-top/index.js +2 -0
- package/dist/back-top/types.d.ts +15 -0
- package/dist/back-top-C2XqUzoN.js +123 -0
- package/dist/badge/Badge.vue.d.ts +23 -0
- package/dist/badge/BadgeNodeRenderer.d.ts +15 -0
- package/dist/badge/index.d.ts +6 -0
- package/dist/badge/index.js +2 -0
- package/dist/badge/types.d.ts +29 -0
- package/dist/badge-gWsDkzyt.js +120 -0
- package/dist/banner/Banner.vue.d.ts +19 -0
- package/dist/banner/BannerNodeRenderer.d.ts +15 -0
- package/dist/banner/index.d.ts +6 -0
- package/dist/banner/index.js +2 -0
- package/dist/banner/types.d.ts +25 -0
- package/dist/banner-B3O4uDoR.js +220 -0
- package/dist/breadcrumb/Breadcrumb.d.ts +129 -0
- package/dist/breadcrumb/BreadcrumbIconRenderer.d.ts +23 -0
- package/dist/breadcrumb/BreadcrumbItem.vue.d.ts +19 -0
- package/dist/breadcrumb/BreadcrumbNodeRenderer.d.ts +15 -0
- package/dist/breadcrumb/BreadcrumbPopover.vue.d.ts +17 -0
- package/dist/breadcrumb/BreadcrumbPopoverArrow.vue.d.ts +3 -0
- package/dist/breadcrumb/breadcrumb-context.d.ts +9 -0
- package/dist/breadcrumb/index.d.ts +11 -0
- package/dist/breadcrumb/index.js +2 -0
- package/dist/breadcrumb/types.d.ts +72 -0
- package/dist/breadcrumb-BmBbFmGK.js +451 -0
- package/dist/button/Button.vue.d.ts +34 -0
- package/dist/button/ButtonAiLoadingIcon.vue.d.ts +3 -0
- package/dist/button/ButtonGroup.d.ts +69 -0
- package/dist/button/ButtonIconRenderer.d.ts +28 -0
- package/dist/button/ButtonLoadingIcon.vue.d.ts +3 -0
- package/dist/button/SplitButtonGroup.vue.d.ts +16 -0
- package/dist/button/index.d.ts +5 -0
- package/dist/button/index.js +3 -0
- package/dist/button/types.d.ts +57 -0
- package/dist/button-Rcn5pYGh.js +134 -0
- package/dist/calendar/Calendar.vue.d.ts +29 -0
- package/dist/calendar/CalendarDay.vue.d.ts +3 -0
- package/dist/calendar/CalendarMonth.vue.d.ts +3 -0
- package/dist/calendar/CalendarNodeRenderer.d.ts +15 -0
- package/dist/calendar/CalendarTimeColumn.vue.d.ts +6 -0
- package/dist/calendar/CalendarWeek.vue.d.ts +8 -0
- package/dist/calendar/index.d.ts +6 -0
- package/dist/calendar/index.js +2 -0
- package/dist/calendar/types.d.ts +67 -0
- package/dist/calendar-CJTrr4y5.js +1172 -0
- package/dist/card/Card.vue.d.ts +16 -0
- package/dist/card/CardGroup.vue.d.ts +13 -0
- package/dist/card/CardMeta.vue.d.ts +11 -0
- package/dist/card/CardNodeRenderer.d.ts +15 -0
- package/dist/card/CardSkeleton.vue.d.ts +3 -0
- package/dist/card/card-content.d.ts +2 -0
- package/dist/card/index.d.ts +11 -0
- package/dist/card/index.js +2 -0
- package/dist/card/types.d.ts +56 -0
- package/dist/card-DwMOFi6_.js +348 -0
- package/dist/carousel/Carousel.vue.d.ts +29 -0
- package/dist/carousel/CarouselArrow.vue.d.ts +15 -0
- package/dist/carousel/CarouselIndicator.vue.d.ts +17 -0
- package/dist/carousel/CarouselItemRenderer.d.ts +34 -0
- package/dist/carousel/CarouselNodeRenderer.d.ts +15 -0
- package/dist/carousel/index.d.ts +6 -0
- package/dist/carousel/index.js +2 -0
- package/dist/carousel/types.d.ts +70 -0
- package/dist/carousel/use-carousel-foundation.d.ts +19 -0
- package/dist/carousel-B4WlIRJH.js +458 -0
- package/dist/cascader/Cascader.vue.d.ts +71 -0
- package/dist/cascader/CascaderNodeRenderer.d.ts +15 -0
- package/dist/cascader/CascaderPanel.vue.d.ts +36 -0
- package/dist/cascader/index.d.ts +6 -0
- package/dist/cascader/index.js +2 -0
- package/dist/cascader/types.d.ts +192 -0
- package/dist/cascader-Ch6clCeh.js +1525 -0
- package/dist/checkbox/Checkbox.vue.d.ts +19 -0
- package/dist/checkbox/CheckboxGroup.d.ts +161 -0
- package/dist/checkbox/CheckboxNodeRenderer.d.ts +15 -0
- package/dist/checkbox/checkbox-context.d.ts +11 -0
- package/dist/checkbox/index.d.ts +10 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox/types.d.ts +92 -0
- package/dist/checkbox-mJD1ou6k.js +479 -0
- package/dist/collapse/Collapse.vue.d.ts +140 -0
- package/dist/collapse/CollapseNodeRenderer.d.ts +15 -0
- package/dist/collapse/CollapsePanel.vue.d.ts +99 -0
- package/dist/collapse/collapse-context.d.ts +14 -0
- package/dist/collapse/index.d.ts +10 -0
- package/dist/collapse/index.js +2 -0
- package/dist/collapse/types.d.ts +50 -0
- package/dist/collapse-7YtQLWqt.js +278 -0
- package/dist/collapsible/Collapsible.vue.d.ts +136 -0
- package/dist/collapsible/index.d.ts +5 -0
- package/dist/collapsible/index.js +5 -0
- package/dist/collapsible/types.d.ts +28 -0
- package/dist/color-picker/AlphaSlider.vue.d.ts +14 -0
- package/dist/color-picker/ColorChooseArea.vue.d.ts +20 -0
- package/dist/color-picker/ColorDataPart.vue.d.ts +15 -0
- package/dist/color-picker/ColorPicker.vue.d.ts +28 -0
- package/dist/color-picker/ColorPickerNodeRenderer.d.ts +17 -0
- package/dist/color-picker/ColorPickerPanel.vue.d.ts +37 -0
- package/dist/color-picker/ColorSlider.vue.d.ts +13 -0
- package/dist/color-picker/index.d.ts +10 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/color-picker/types.d.ts +67 -0
- package/dist/color-picker-ChC7qsx0.js +885 -0
- package/dist/config-context-CyynTtDb.js +4 -0
- package/dist/config-provider/ConfigConsumer.vue.d.ts +11 -0
- package/dist/config-provider/ConfigProvider.vue.d.ts +16 -0
- package/dist/config-provider/config-context.d.ts +3 -0
- package/dist/config-provider/constants.d.ts +4 -0
- package/dist/config-provider/index.d.ts +13 -0
- package/dist/config-provider/index.js +3 -0
- package/dist/config-provider/semi-global.d.ts +6 -0
- package/dist/config-provider/types.d.ts +74 -0
- package/dist/config-provider/use-responsive-observe.d.ts +6 -0
- package/dist/config-provider-VMfNNSF1.js +188 -0
- package/dist/constants-BF9bZJyc.js +45 -0
- package/dist/constants-BNwzO87W.js +9 -0
- package/dist/cropper/Cropper.vue.d.ts +18 -0
- package/dist/cropper/index.d.ts +4 -0
- package/dist/cropper/index.js +5 -0
- package/dist/cropper/types.d.ts +51 -0
- package/dist/date-picker/DatePicker.vue.d.ts +41 -0
- package/dist/date-picker/DatePickerMonth.vue.d.ts +25 -0
- package/dist/date-picker/DatePickerNodeRenderer.d.ts +17 -0
- package/dist/date-picker/DatePickerPanel.vue.d.ts +33 -0
- package/dist/date-picker/index.d.ts +5 -0
- package/dist/date-picker/index.js +2 -0
- package/dist/date-picker/types.d.ts +211 -0
- package/dist/date-picker-B2lhlKHD.js +2207 -0
- package/dist/descriptions/Descriptions.vue.d.ts +96 -0
- package/dist/descriptions/DescriptionsItem.vue.d.ts +96 -0
- package/dist/descriptions/DescriptionsNodeRenderer.d.ts +15 -0
- package/dist/descriptions/descriptions-context.d.ts +7 -0
- package/dist/descriptions/index.d.ts +10 -0
- package/dist/descriptions/index.js +2 -0
- package/dist/descriptions/types.d.ts +45 -0
- package/dist/descriptions-BU6ahbge.js +272 -0
- package/dist/divider/Divider.vue.d.ts +15 -0
- package/dist/divider/DividerContentRenderer.d.ts +17 -0
- package/dist/divider/index.d.ts +3 -0
- package/dist/divider/index.js +3 -0
- package/dist/divider/types.d.ts +13 -0
- package/dist/divider-DA9U4uOl.js +8 -0
- package/dist/dropdown/Dropdown.vue.d.ts +23 -0
- package/dist/dropdown/DropdownDivider.vue.d.ts +4 -0
- package/dist/dropdown/DropdownItem.vue.d.ts +28 -0
- package/dist/dropdown/DropdownMenu.vue.d.ts +11 -0
- package/dist/dropdown/DropdownNodeRenderer.d.ts +15 -0
- package/dist/dropdown/DropdownTitle.vue.d.ts +11 -0
- package/dist/dropdown/DropdownTriggerRenderer.d.ts +45 -0
- package/dist/dropdown/dropdown-context.d.ts +8 -0
- package/dist/dropdown/index.d.ts +17 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/dropdown/types.d.ts +98 -0
- package/dist/dropdown-D0-UWd65.js +665 -0
- package/dist/empty/Empty.vue.d.ts +13 -0
- package/dist/empty/EmptyNodeRenderer.d.ts +15 -0
- package/dist/empty/index.d.ts +6 -0
- package/dist/empty/index.js +2 -0
- package/dist/empty/types.d.ts +27 -0
- package/dist/empty-Bpms8Z5w.js +152 -0
- package/dist/env-BeIzjQx7.js +4 -0
- package/dist/es-CAWQuPuV.js +93 -0
- package/dist/float-button/FloatButton.vue.d.ts +20 -0
- package/dist/float-button/FloatButtonBadge.vue.d.ts +18 -0
- package/dist/float-button/FloatButtonGroup.vue.d.ts +17 -0
- package/dist/float-button/FloatButtonNodeRenderer.d.ts +17 -0
- package/dist/float-button/index.d.ts +4 -0
- package/dist/float-button/index.js +2 -0
- package/dist/float-button/types.d.ts +59 -0
- package/dist/float-button-qU3b0WBX.js +190 -0
- package/dist/form/ArrayField.d.ts +24 -0
- package/dist/form/Form.vue.d.ts +38 -0
- package/dist/form/FormErrorMessage.vue.d.ts +4 -0
- package/dist/form/FormField.d.ts +9 -0
- package/dist/form/FormInputGroup.d.ts +62 -0
- package/dist/form/FormLabel.vue.d.ts +18 -0
- package/dist/form/FormNodeRenderer.d.ts +15 -0
- package/dist/form/FormSection.vue.d.ts +16 -0
- package/dist/form/FormSlot.d.ts +3 -0
- package/dist/form/form-context.d.ts +4 -0
- package/dist/form/index.d.ts +68 -0
- package/dist/form/index.js +3 -0
- package/dist/form/internal-types.d.ts +67 -0
- package/dist/form/types.d.ts +273 -0
- package/dist/form/use-form.d.ts +11 -0
- package/dist/form/with-form.d.ts +3 -0
- package/dist/form-CLhGuORQ.js +2030 -0
- package/dist/foundation-Cawx37mp.js +1819 -0
- package/dist/grid/Col.vue.d.ts +13 -0
- package/dist/grid/Row.vue.d.ts +14 -0
- package/dist/grid/grid-context.d.ts +6 -0
- package/dist/grid/index.d.ts +5 -0
- package/dist/grid/index.js +2 -0
- package/dist/grid/media-query.d.ts +2 -0
- package/dist/grid/types.d.ts +44 -0
- package/dist/grid-Cn2uBhRd.js +161 -0
- package/dist/highlight/Highlight.vue.d.ts +10 -0
- package/dist/highlight/HighlightNodeRenderer.d.ts +49 -0
- package/dist/highlight/index.d.ts +4 -0
- package/dist/highlight/index.js +2 -0
- package/dist/highlight/internal-types.d.ts +8 -0
- package/dist/highlight/types.d.ts +17 -0
- package/dist/highlight-DHX3RV0C.js +158 -0
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/image/Image.vue.d.ts +21 -0
- package/dist/image/ImageNodeRenderer.d.ts +15 -0
- package/dist/image/ImagePreview.vue.d.ts +56 -0
- package/dist/image/ImagePreviewFooter.vue.d.ts +38 -0
- package/dist/image/ImagePreviewHeader.vue.d.ts +17 -0
- package/dist/image/ImagePreviewImage.vue.d.ts +27 -0
- package/dist/image/ImagePreviewInner.vue.d.ts +54 -0
- package/dist/image/image-context.d.ts +14 -0
- package/dist/image/index.d.ts +6 -0
- package/dist/image/index.js +2 -0
- package/dist/image/types.d.ts +183 -0
- package/dist/image-C-ifCh_9.js +1615 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +75 -0
- package/dist/input/Input.vue.d.ts +58 -0
- package/dist/input/InputGroup.d.ts +69 -0
- package/dist/input/InputNodeRenderer.d.ts +15 -0
- package/dist/input/TextArea.vue.d.ts +50 -0
- package/dist/input/index.d.ts +11 -0
- package/dist/input/index.js +2 -0
- package/dist/input/types.d.ts +168 -0
- package/dist/input-number/InputNumber.vue.d.ts +52 -0
- package/dist/input-number/index.d.ts +10 -0
- package/dist/input-number/index.js +5 -0
- package/dist/input-number/types.d.ts +56 -0
- package/dist/input-wf0nZCRS.js +747 -0
- package/dist/isBefore-BG1hiM9f.js +37 -0
- package/dist/isElement-Cx0AsIov.js +11 -0
- package/dist/isEnterPress-HTy0eCBp.js +8 -0
- package/dist/isNullOrUndefined-Cg6MZ8r3.js +6 -0
- package/dist/isPromise-D2v3Ejff.js +11 -0
- package/dist/keyCode-DMNg63wX.js +110 -0
- package/dist/layout/Layout.vue.d.ts +14 -0
- package/dist/layout/LayoutContent.vue.d.ts +14 -0
- package/dist/layout/LayoutFooter.vue.d.ts +14 -0
- package/dist/layout/LayoutHeader.vue.d.ts +14 -0
- package/dist/layout/LayoutSection.vue.d.ts +17 -0
- package/dist/layout/LayoutSider.vue.d.ts +18 -0
- package/dist/layout/index.d.ts +17 -0
- package/dist/layout/index.js +2 -0
- package/dist/layout/layout-context.d.ts +6 -0
- package/dist/layout/media-query.d.ts +4 -0
- package/dist/layout/types.d.ts +31 -0
- package/dist/layout-tq-_l_O3.js +171 -0
- package/dist/list/List.vue.d.ts +22 -0
- package/dist/list/ListItem.vue.d.ts +88 -0
- package/dist/list/ListNodeRenderer.d.ts +15 -0
- package/dist/list/ListSpin.vue.d.ts +16 -0
- package/dist/list/index.d.ts +10 -0
- package/dist/list/index.js +2 -0
- package/dist/list/list-context.d.ts +8 -0
- package/dist/list/types.d.ts +66 -0
- package/dist/list-DHIOE2Y-.js +387 -0
- package/dist/modal/ConfirmModal.vue.d.ts +14 -0
- package/dist/modal/Modal.vue.d.ts +15 -0
- package/dist/modal/ModalDefaultFooter.vue.d.ts +22 -0
- package/dist/modal/ModalDialog.vue.d.ts +53 -0
- package/dist/modal/ModalInnerContent.vue.d.ts +38 -0
- package/dist/modal/ModalNodeRenderer.d.ts +15 -0
- package/dist/modal/imperative.d.ts +9 -0
- package/dist/modal/index.d.ts +8 -0
- package/dist/modal/index.js +2 -0
- package/dist/modal/types.d.ts +92 -0
- package/dist/modal/use-modal.d.ts +2 -0
- package/dist/modal-YVolL7Hz.js +221 -0
- package/dist/navigation/CollapseButton.vue.d.ts +12 -0
- package/dist/navigation/NavFooter.vue.d.ts +15 -0
- package/dist/navigation/NavHeader.vue.d.ts +13 -0
- package/dist/navigation/NavItem.d.ts +177 -0
- package/dist/navigation/Navigation.vue.d.ts +29 -0
- package/dist/navigation/NavigationContextProvider.d.ts +16 -0
- package/dist/navigation/NavigationIconRenderer.d.ts +45 -0
- package/dist/navigation/NavigationItemTree.vue.d.ts +8 -0
- package/dist/navigation/NavigationNodeRenderer.d.ts +18 -0
- package/dist/navigation/SubNav.vue.d.ts +18 -0
- package/dist/navigation/index.d.ts +14 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/navigation-context.d.ts +35 -0
- package/dist/navigation/types.d.ts +177 -0
- package/dist/navigation-DF8R5jFK.js +1479 -0
- package/dist/notification/NotificationHost.vue.d.ts +7 -0
- package/dist/notification/NotificationNodeRenderer.d.ts +15 -0
- package/dist/notification/NotificationNotice.vue.d.ts +16 -0
- package/dist/notification/imperative.d.ts +12 -0
- package/dist/notification/index.d.ts +6 -0
- package/dist/notification/index.js +2 -0
- package/dist/notification/notification-store.d.ts +24 -0
- package/dist/notification/types.d.ts +63 -0
- package/dist/notification/use-notification.d.ts +2 -0
- package/dist/notification-DIsvgiIO.js +445 -0
- package/dist/overflow-list/OverflowList.vue.d.ts +131 -0
- package/dist/overflow-list/OverflowListNodeRenderer.d.ts +35 -0
- package/dist/overflow-list/index.d.ts +5 -0
- package/dist/overflow-list/index.js +2 -0
- package/dist/overflow-list/types.d.ts +35 -0
- package/dist/overflow-list-Df6ixrtB.js +413 -0
- package/dist/pagination/Pagination.vue.d.ts +25 -0
- package/dist/pagination/PaginationNodeRenderer.d.ts +15 -0
- package/dist/pagination/PaginationPopover.vue.d.ts +25 -0
- package/dist/pagination/PaginationRestList.vue.d.ts +11 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/index.js +2 -0
- package/dist/pagination/types.d.ts +46 -0
- package/dist/pin-code/PinCode.vue.d.ts +20 -0
- package/dist/pin-code/index.d.ts +10 -0
- package/dist/pin-code/index.js +2 -0
- package/dist/pin-code/types.d.ts +25 -0
- package/dist/pin-code-wY5g0KLD.js +193 -0
- package/dist/popconfirm/Popconfirm.vue.d.ts +25 -0
- package/dist/popconfirm/PopconfirmNodeRenderer.d.ts +15 -0
- package/dist/popconfirm/index.d.ts +4 -0
- package/dist/popconfirm/index.js +2 -0
- package/dist/popconfirm/types.d.ts +57 -0
- package/dist/popconfirm-DQUtvI0A.js +389 -0
- package/dist/popover/Popover.vue.d.ts +23 -0
- package/dist/popover/PopoverArrow.vue.d.ts +10 -0
- package/dist/popover/index.d.ts +4 -0
- package/dist/popover/index.js +2 -0
- package/dist/popover/types.d.ts +35 -0
- package/dist/popover-hD77YpUM.js +292 -0
- package/dist/progress/Progress.vue.d.ts +24 -0
- package/dist/progress/ProgressCircle.vue.d.ts +26 -0
- package/dist/progress/ProgressLine.vue.d.ts +23 -0
- package/dist/progress/ProgressNodeRenderer.d.ts +15 -0
- package/dist/progress/index.d.ts +6 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/types.d.ts +44 -0
- package/dist/progress-DIIyWKKD.js +9 -0
- package/dist/radio/Radio.vue.d.ts +30 -0
- package/dist/radio/RadioGroup.d.ts +201 -0
- package/dist/radio/RadioNodeRenderer.d.ts +15 -0
- package/dist/radio/index.d.ts +10 -0
- package/dist/radio/index.js +2 -0
- package/dist/radio/radio-context.d.ts +15 -0
- package/dist/radio/types.d.ts +100 -0
- package/dist/radio-y9iAI359.js +565 -0
- package/dist/rating/Rating.vue.d.ts +39 -0
- package/dist/rating/RatingItem.vue.d.ts +33 -0
- package/dist/rating/RatingNodeRenderer.d.ts +17 -0
- package/dist/rating/index.d.ts +6 -0
- package/dist/rating/index.js +2 -0
- package/dist/rating/types.d.ts +57 -0
- package/dist/rating-CJkb4pkD.js +542 -0
- package/dist/resizable/Resizable.vue.d.ts +31 -0
- package/dist/resizable/ResizableNodeRenderer.d.ts +17 -0
- package/dist/resizable/ResizeGroup.vue.d.ts +13 -0
- package/dist/resizable/ResizeHandler.vue.d.ts +11 -0
- package/dist/resizable/ResizeItem.vue.d.ts +19 -0
- package/dist/resizable/SingleResizeHandle.vue.d.ts +21 -0
- package/dist/resizable/index.d.ts +6 -0
- package/dist/resizable/index.js +2 -0
- package/dist/resizable/resizable-context.d.ts +27 -0
- package/dist/resizable/types.d.ts +87 -0
- package/dist/resizable/use-resize-group.d.ts +21 -0
- package/dist/resizable/use-single-resize.d.ts +30 -0
- package/dist/resizable-CEB0ZdGT.js +814 -0
- package/dist/scroll-list/ScrollItem.vue.d.ts +21 -0
- package/dist/scroll-list/ScrollList.vue.d.ts +11 -0
- package/dist/scroll-list/ScrollListNodeRenderer.d.ts +15 -0
- package/dist/scroll-list/index.d.ts +10 -0
- package/dist/scroll-list/index.js +2 -0
- package/dist/scroll-list/types.d.ts +54 -0
- package/dist/scroll-list-BSXksNOR.js +466 -0
- package/dist/select/Select.vue.d.ts +39 -0
- package/dist/select/SelectFragment.d.ts +4 -0
- package/dist/select/SelectNodeRenderer.d.ts +15 -0
- package/dist/select/SelectOption.vue.d.ts +13 -0
- package/dist/select/SelectOptionCollector.d.ts +13 -0
- package/dist/select/SelectOptionGroup.vue.d.ts +14 -0
- package/dist/select/index.d.ts +12 -0
- package/dist/select/index.js +3 -0
- package/dist/select/types.d.ts +165 -0
- package/dist/select/use-select-foundation.d.ts +64 -0
- package/dist/select-BeM6gxAU.js +40 -0
- package/dist/side-sheet/SideSheet.vue.d.ts +19 -0
- package/dist/side-sheet/SideSheetContent.vue.d.ts +37 -0
- package/dist/side-sheet/SideSheetNodeRenderer.d.ts +15 -0
- package/dist/side-sheet/index.d.ts +4 -0
- package/dist/side-sheet/index.js +2 -0
- package/dist/side-sheet/types.d.ts +46 -0
- package/dist/side-sheet-9CBTk23r.js +542 -0
- package/dist/skeleton/Skeleton.vue.d.ts +15 -0
- package/dist/skeleton/SkeletonAvatar.vue.d.ts +9 -0
- package/dist/skeleton/SkeletonButton.vue.d.ts +7 -0
- package/dist/skeleton/SkeletonImage.vue.d.ts +7 -0
- package/dist/skeleton/SkeletonNodeRenderer.d.ts +15 -0
- package/dist/skeleton/SkeletonParagraph.vue.d.ts +8 -0
- package/dist/skeleton/SkeletonTitle.vue.d.ts +7 -0
- package/dist/skeleton/index.d.ts +18 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/skeleton/types.d.ts +36 -0
- package/dist/skeleton-p61lfhoz.js +302 -0
- package/dist/slider/Slider.vue.d.ts +32 -0
- package/dist/slider/SliderFragment.d.ts +4 -0
- package/dist/slider/index.d.ts +5 -0
- package/dist/slider/index.js +5 -0
- package/dist/slider/types.d.ts +57 -0
- package/dist/slider/use-slider-foundation.d.ts +47 -0
- package/dist/space/Space.vue.d.ts +16 -0
- package/dist/space/index.d.ts +3 -0
- package/dist/space/index.js +2 -0
- package/dist/space/types.d.ts +15 -0
- package/dist/space-DVnFbkCz.js +63 -0
- package/dist/spin/Spin.vue.d.ts +105 -0
- package/dist/spin/SpinNodeRenderer.d.ts +15 -0
- package/dist/spin/index.d.ts +6 -0
- package/dist/spin/index.js +2 -0
- package/dist/spin/types.d.ts +20 -0
- package/dist/spin-D-1P0WMW.js +9 -0
- package/dist/src-DNBBthjO.js +490 -0
- package/dist/steps/Step.vue.d.ts +22 -0
- package/dist/steps/Steps.vue.d.ts +24 -0
- package/dist/steps/StepsNodeRenderer.d.ts +17 -0
- package/dist/steps/index.d.ts +9 -0
- package/dist/steps/index.js +2 -0
- package/dist/steps/steps-context.d.ts +6 -0
- package/dist/steps/types.d.ts +54 -0
- package/dist/steps-6p04q-Lz.js +303 -0
- package/dist/switch/Switch.vue.d.ts +27 -0
- package/dist/switch/SwitchNodeRenderer.d.ts +15 -0
- package/dist/switch/SwitchSpin.vue.d.ts +7 -0
- package/dist/switch/index.d.ts +7 -0
- package/dist/switch/index.js +2 -0
- package/dist/switch/types.d.ts +28 -0
- package/dist/switch-Dte2Fl3l.js +284 -0
- package/dist/table/Table.vue.d.ts +29 -0
- package/dist/table/TableBody.vue.d.ts +70 -0
- package/dist/table/TableCell.vue.d.ts +37 -0
- package/dist/table/TableColumn.d.ts +81 -0
- package/dist/table/TableFilterMenu.vue.d.ts +18 -0
- package/dist/table/TableHeader.vue.d.ts +46 -0
- package/dist/table/TableNativeElement.d.ts +9 -0
- package/dist/table/TableNodeRenderer.d.ts +13 -0
- package/dist/table/TableSpin.vue.d.ts +16 -0
- package/dist/table/index.d.ts +13 -0
- package/dist/table/index.js +2 -0
- package/dist/table/table-utils.d.ts +43 -0
- package/dist/table/types.d.ts +323 -0
- package/dist/table-jZkHjf-W.js +2097 -0
- package/dist/tabs/TabBar.vue.d.ts +38 -0
- package/dist/tabs/TabItem.vue.d.ts +26 -0
- package/dist/tabs/TabPane.vue.d.ts +13 -0
- package/dist/tabs/Tabs.vue.d.ts +36 -0
- package/dist/tabs/TabsDropdown.vue.d.ts +27 -0
- package/dist/tabs/TabsNodeRenderer.d.ts +15 -0
- package/dist/tabs/index.d.ts +6 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs-context.d.ts +12 -0
- package/dist/tabs/types.d.ts +110 -0
- package/dist/tabs-CezuYzIu.js +874 -0
- package/dist/tag/SplitTagGroup.d.ts +36 -0
- package/dist/tag/Tag.vue.d.ts +33 -0
- package/dist/tag/TagGroup.d.ts +115 -0
- package/dist/tag/TagNodeRenderer.d.ts +15 -0
- package/dist/tag/index.d.ts +8 -0
- package/dist/tag/index.js +2 -0
- package/dist/tag/types.d.ts +82 -0
- package/dist/tag-BPD0bELU.js +348 -0
- package/dist/tag-input/TagInput.vue.d.ts +51 -0
- package/dist/tag-input/TagInputNodeRenderer.d.ts +17 -0
- package/dist/tag-input/TagInputRestPopover.vue.d.ts +19 -0
- package/dist/tag-input/TagInputTag.vue.d.ts +27 -0
- package/dist/tag-input/index.d.ts +5 -0
- package/dist/tag-input/index.js +2 -0
- package/dist/tag-input/types.d.ts +95 -0
- package/dist/tag-input/use-tag-input-foundation.d.ts +47 -0
- package/dist/tag-input-SxUfNqF0.js +784 -0
- package/dist/time-picker/TimePicker.vue.d.ts +27 -0
- package/dist/time-picker/TimePickerColumn.vue.d.ts +29 -0
- package/dist/time-picker/TimePickerNodeRenderer.d.ts +17 -0
- package/dist/time-picker/TimePickerPanel.vue.d.ts +32 -0
- package/dist/time-picker/index.d.ts +5 -0
- package/dist/time-picker/index.js +2 -0
- package/dist/time-picker/types.d.ts +146 -0
- package/dist/time-picker/use-time-picker-foundation.d.ts +36 -0
- package/dist/time-picker-D6p36ea8.js +3587 -0
- package/dist/timeline/Timeline.vue.d.ts +69 -0
- package/dist/timeline/TimelineItem.vue.d.ts +100 -0
- package/dist/timeline/TimelineNodeRenderer.d.ts +15 -0
- package/dist/timeline/index.d.ts +10 -0
- package/dist/timeline/index.js +2 -0
- package/dist/timeline/types.d.ts +43 -0
- package/dist/timeline-2D5xCZsU.js +191 -0
- package/dist/toast/ToastHost.vue.d.ts +7 -0
- package/dist/toast/ToastIconRenderer.d.ts +17 -0
- package/dist/toast/ToastNodeRenderer.d.ts +15 -0
- package/dist/toast/ToastNotice.vue.d.ts +20 -0
- package/dist/toast/imperative.d.ts +3 -0
- package/dist/toast/index.d.ts +6 -0
- package/dist/toast/index.js +2 -0
- package/dist/toast/toast-store.d.ts +30 -0
- package/dist/toast/types.d.ts +65 -0
- package/dist/toast/use-toast.d.ts +2 -0
- package/dist/toast-s8nFLf8t.js +523 -0
- package/dist/tooltip/Tooltip.vue.d.ts +23 -0
- package/dist/tooltip/TooltipArrow.vue.d.ts +8 -0
- package/dist/tooltip/TooltipNodeRenderer.d.ts +15 -0
- package/dist/tooltip/TooltipPortal.vue.d.ts +44 -0
- package/dist/tooltip/TooltipTriggerRenderer.d.ts +66 -0
- package/dist/tooltip/index.d.ts +5 -0
- package/dist/tooltip/index.js +3 -0
- package/dist/tooltip/types.d.ts +117 -0
- package/dist/tooltip/use-tooltip-foundation.d.ts +25 -0
- package/dist/tooltip-en9bvXRp.js +28 -0
- package/dist/transfer/Transfer.vue.d.ts +35 -0
- package/dist/transfer/TransferNodeRenderer.d.ts +15 -0
- package/dist/transfer/index.d.ts +5 -0
- package/dist/transfer/index.js +2 -0
- package/dist/transfer/types.d.ts +159 -0
- package/dist/transfer-Doq1sI9z.js +695 -0
- package/dist/tree/Tree.vue.d.ts +73 -0
- package/dist/tree/TreeNode.vue.d.ts +77 -0
- package/dist/tree/TreeNodeMotion.vue.d.ts +20 -0
- package/dist/tree/TreeNodeRenderer.d.ts +15 -0
- package/dist/tree/index.d.ts +9 -0
- package/dist/tree/index.js +5 -0
- package/dist/tree/types.d.ts +180 -0
- package/dist/tree-select/TreeSelect.vue.d.ts +76 -0
- package/dist/tree-select/TreeSelectNodeRenderer.d.ts +15 -0
- package/dist/tree-select/index.d.ts +6 -0
- package/dist/tree-select/index.js +2 -0
- package/dist/tree-select/types.d.ts +156 -0
- package/dist/tree-select-BIu6Owuq.js +1237 -0
- package/dist/treeUtil-IUdRJ6Ws.js +277 -0
- package/dist/typography/Numeral.vue.d.ts +32 -0
- package/dist/typography/Paragraph.vue.d.ts +30 -0
- package/dist/typography/Text.vue.d.ts +30 -0
- package/dist/typography/Title.vue.d.ts +28 -0
- package/dist/typography/Typography.vue.d.ts +13 -0
- package/dist/typography/TypographyBase.vue.d.ts +40 -0
- package/dist/typography/TypographyCopyable.vue.d.ts +29 -0
- package/dist/typography/TypographyDecorations.d.ts +34 -0
- package/dist/typography/TypographyNodeRenderer.d.ts +17 -0
- package/dist/typography/index.d.ts +17 -0
- package/dist/typography/index.js +2 -0
- package/dist/typography/types.d.ts +108 -0
- package/dist/typography/typography-locale.d.ts +5 -0
- package/dist/typography/typography-utils.d.ts +4 -0
- package/dist/typography-DF8KwKuL.js +914 -0
- package/dist/upload/Upload.vue.d.ts +69 -0
- package/dist/upload/UploadFileCard.vue.d.ts +4 -0
- package/dist/upload/UploadNodeRenderer.d.ts +15 -0
- package/dist/upload/index.d.ts +10 -0
- package/dist/upload/index.js +2 -0
- package/dist/upload/types.d.ts +250 -0
- package/dist/upload-BzdpoGJX.js +1777 -0
- package/dist/uuid-BUHV1G8U.js +21 -0
- package/dist/warning-naSiE8G7.js +6 -0
- package/dist/zh-CN-CCu7YvUA.js +1623 -0
- package/package.json +336 -0
|
@@ -0,0 +1,1777 @@
|
|
|
1
|
+
import "./src-DNBBthjO.js";
|
|
2
|
+
import { t as e } from "./foundation-Cawx37mp.js";
|
|
3
|
+
import { t } from "./env-BeIzjQx7.js";
|
|
4
|
+
import { t as n } from "./constants-BNwzO87W.js";
|
|
5
|
+
import { n as r } from "./uuid-BUHV1G8U.js";
|
|
6
|
+
import { t as i } from "./Cropper-Dy1LPBDN.js";
|
|
7
|
+
import { t as a } from "./Tooltip-Bq7HZwnS.js";
|
|
8
|
+
import { t as o } from "./isPromise-D2v3Ejff.js";
|
|
9
|
+
import { t as s } from "./Modal-BhmFYVFw.js";
|
|
10
|
+
import { t as c } from "./Progress-BulSV_JR.js";
|
|
11
|
+
import { t as l } from "./Spin-CuFLkqev.js";
|
|
12
|
+
import { u } from "./typography-DF8KwKuL.js";
|
|
13
|
+
import { t as d } from "./config-context-CyynTtDb.js";
|
|
14
|
+
import { t as f } from "./Button-RCaDTqHh.js";
|
|
15
|
+
import { Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as ee, createVNode as y, defineComponent as b, getCurrentInstance as te, inject as ne, markRaw as re, mergeProps as x, nextTick as ie, normalizeClass as S, normalizeStyle as C, onBeforeUnmount as ae, onMounted as oe, openBlock as w, renderList as se, renderSlot as T, shallowReactive as ce, shallowRef as E, toDisplayString as D, unref as O, useAttrs as k, useSlots as le, useTemplateRef as ue, watch as de, withCtx as A } from "vue";
|
|
16
|
+
import { IconAlertCircle as fe, IconClear as pe, IconClose as j, IconFile as M, IconPlus as me, IconRefresh as N, IconUpload as he } from "@aifuxi/semi-icons-vue";
|
|
17
|
+
//#region bundled-foundation
|
|
18
|
+
var ge = `${t}-upload`, P = "picture", _e = "list", ve = "none", ye = .95;
|
|
19
|
+
`${ge}`;
|
|
20
|
+
var be = "auto", xe = "custom", F = {
|
|
21
|
+
FILE_STATUS_UPLOADING: "uploading",
|
|
22
|
+
FILE_STATUS_SUCCESS: "success",
|
|
23
|
+
FILE_STATUS_UPLOAD_FAIL: "uploadFail",
|
|
24
|
+
FILE_STATUS_VALIDATING: "validating",
|
|
25
|
+
FILE_STATUS_VALID_FAIL: "validateFail",
|
|
26
|
+
FILE_STATUS_WAIT_UPLOAD: "wait",
|
|
27
|
+
FILE_LIST_PIC: P,
|
|
28
|
+
FILE_LIST_DEFAULT: _e,
|
|
29
|
+
LIST_TYPE: [
|
|
30
|
+
P,
|
|
31
|
+
_e,
|
|
32
|
+
ve
|
|
33
|
+
],
|
|
34
|
+
imageTypes: [
|
|
35
|
+
"image",
|
|
36
|
+
"webp",
|
|
37
|
+
"png",
|
|
38
|
+
"svg",
|
|
39
|
+
"gif",
|
|
40
|
+
"jpg",
|
|
41
|
+
"jpeg",
|
|
42
|
+
"bmp",
|
|
43
|
+
"dpg"
|
|
44
|
+
],
|
|
45
|
+
DRAG_AREA_DEFAULT: "default",
|
|
46
|
+
DRAG_AREA_LEGAL: "legal",
|
|
47
|
+
DRAG_AREA_ILLEGAL: "illegal",
|
|
48
|
+
TRIGGER_AUTO: be,
|
|
49
|
+
TRIGGER_CUSTOM: xe,
|
|
50
|
+
UPLOAD_TRIGGER: [be, xe],
|
|
51
|
+
VALIDATE_STATUS: n,
|
|
52
|
+
PROMPT_POSITION: [
|
|
53
|
+
"left",
|
|
54
|
+
"right",
|
|
55
|
+
"bottom"
|
|
56
|
+
]
|
|
57
|
+
}, Se = { PROGRESS_COEFFICIENT: ye }, I = 1024, L = 1048576;
|
|
58
|
+
function R(e) {
|
|
59
|
+
if (e < 1024) return `${(e / I).toFixed(2)}KB`;
|
|
60
|
+
if (e >= 1024 && e < 1048576) return `${(e / I).toFixed(1)}KB`;
|
|
61
|
+
if (e >= 1048576) return `${(e / L).toFixed(1)}MB`;
|
|
62
|
+
}
|
|
63
|
+
function Ce(e, t) {
|
|
64
|
+
return e.indexOf(t, e.length - t.length) !== -1;
|
|
65
|
+
}
|
|
66
|
+
async function we(e) {
|
|
67
|
+
return new Promise((t, n) => {
|
|
68
|
+
let r = e.createReader(), i = [];
|
|
69
|
+
function a() {
|
|
70
|
+
r.readEntries((e) => {
|
|
71
|
+
let n = Array.prototype.slice.apply(e);
|
|
72
|
+
i = i.concat(n), n.length ? a() : t(i);
|
|
73
|
+
}, n);
|
|
74
|
+
}
|
|
75
|
+
a();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async function z(e) {
|
|
79
|
+
let t = [], n = async (e, r) => {
|
|
80
|
+
if (r ||= "", e.path = r, e.isFile) t.push(new Promise((t, n) => {
|
|
81
|
+
e.file((n) => {
|
|
82
|
+
e.fullPath && !n.webkitRelativePath && (Object.defineProperties(n, { webkitRelativePath: { writable: !0 } }), n.webkitRelativePath = e.fullPath.replace(/^\//, ""), Object.defineProperties(n, { webkitRelativePath: { writable: !1 } })), t(n);
|
|
83
|
+
}, n);
|
|
84
|
+
}));
|
|
85
|
+
else if (e.isDirectory) {
|
|
86
|
+
let t = await we(e);
|
|
87
|
+
for (let i = 0; i < t.length; i++) {
|
|
88
|
+
let a = t[i];
|
|
89
|
+
await n(a, `${r}${e.name}/`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
try {
|
|
94
|
+
let r = e.map((e) => n(e.webkitGetAsEntry()));
|
|
95
|
+
return await Promise.all(r), await Promise.all(t);
|
|
96
|
+
} catch (e) {
|
|
97
|
+
return console.warn("Captured error while loop directory."), console.error(e), [];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region bundled-foundation
|
|
102
|
+
var { FILE_STATUS_UPLOADING: B, FILE_STATUS_SUCCESS: V, FILE_STATUS_UPLOAD_FAIL: Te, FILE_STATUS_VALID_FAIL: H, FILE_STATUS_WAIT_UPLOAD: Ee, DRAG_AREA_DEFAULT: De, DRAG_AREA_LEGAL: Oe, TRIGGER_AUTO: U } = F, ke = class extends e {
|
|
103
|
+
constructor(e) {
|
|
104
|
+
super({ ...e }), this.destroyState = !1, this._localUrls = {}, this._pasteHandled = !1;
|
|
105
|
+
}
|
|
106
|
+
init() {
|
|
107
|
+
this.destroyState = !1, this._syncLocalUrlsFromFileList();
|
|
108
|
+
let { disabled: e, addOnPasting: t } = this.getProps();
|
|
109
|
+
t && !e && this.bindPastingHandler();
|
|
110
|
+
}
|
|
111
|
+
_syncLocalUrlsFromFileList() {
|
|
112
|
+
let { fileList: e } = this.getStates(), t = {};
|
|
113
|
+
if (!Array.isArray(e)) {
|
|
114
|
+
this._localUrls = {}, this._adapter.updateLocalUrls([]);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
e.forEach((e) => {
|
|
118
|
+
let n = e && e.uid, r = e && e.url, i = e && e.fileInstance, a = typeof File < "u" && i instanceof File;
|
|
119
|
+
n && typeof r == "string" && r.startsWith("blob:") && a && (t[n] = r);
|
|
120
|
+
}), this._localUrls = t, this._adapter.updateLocalUrls(Object.values(this._localUrls));
|
|
121
|
+
}
|
|
122
|
+
destroy() {
|
|
123
|
+
let { disabled: e, addOnPasting: t } = this.getProps();
|
|
124
|
+
e || this.unbindPastingHandler(), this.destroyState = !0;
|
|
125
|
+
}
|
|
126
|
+
_releaseFileUrl(e) {
|
|
127
|
+
if (!e) return;
|
|
128
|
+
let t = this._localUrls && this._localUrls[e];
|
|
129
|
+
if (!t) return;
|
|
130
|
+
this._releaseBlob(t);
|
|
131
|
+
let n = { ...this._localUrls || {} };
|
|
132
|
+
delete n[e], this._localUrls = n, this._adapter.updateLocalUrls(Object.values(this._localUrls));
|
|
133
|
+
}
|
|
134
|
+
_releaseAllFileUrls() {
|
|
135
|
+
let e = this._localUrls;
|
|
136
|
+
!e || typeof e != "object" || (Object.keys(e).forEach((t) => {
|
|
137
|
+
let n = e[t];
|
|
138
|
+
n && this._releaseBlob(n);
|
|
139
|
+
}), this._localUrls = {}, this._adapter.updateLocalUrls([]));
|
|
140
|
+
}
|
|
141
|
+
getError({ action: e, xhr: t, message: n, fileName: r }) {
|
|
142
|
+
let i = t ? t.status : 0, a = n || `cannot post ${r} to ${e}, xhr status: ${i}'`, o = Error(a);
|
|
143
|
+
return o.status = i, o.method = "post", o.url = e, o;
|
|
144
|
+
}
|
|
145
|
+
getBody(e) {
|
|
146
|
+
if (!e) return;
|
|
147
|
+
let t = e.responseText || e.response;
|
|
148
|
+
if (!t) return t;
|
|
149
|
+
try {
|
|
150
|
+
return JSON.parse(t);
|
|
151
|
+
} catch {
|
|
152
|
+
return t;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
checkFileSize(e) {
|
|
156
|
+
let { size: t } = e, { maxSize: n, minSize: r } = this.getProps(), i = !1;
|
|
157
|
+
return (t > n * 1024 || t < r * 1024) && (i = !0), i;
|
|
158
|
+
}
|
|
159
|
+
handleChange(e) {
|
|
160
|
+
let t = [], { limit: n, transformFile: i, accept: a } = this.getProps(), { fileList: o } = this.getStates(), s = Array.from(e);
|
|
161
|
+
if (a !== void 0 && (s = s.filter((e) => {
|
|
162
|
+
let n = this.checkFileFormat(a, e);
|
|
163
|
+
return n || t.push(e), n;
|
|
164
|
+
}), t.length !== 0 && this._adapter.notifyAcceptInvalid(t), s.length === 0)) return;
|
|
165
|
+
s = s.map((e) => (i && (e = i(e)), e.uid || (e.uid = r()), this.checkFileSize(e) && (e._sizeInvalid = !0, e.status = H, this._adapter.notifySizeError(e, o)), e));
|
|
166
|
+
let c = o.length + s.length;
|
|
167
|
+
if (n !== void 0 && c > n) {
|
|
168
|
+
if (this._adapter.notifyExceed(s), n === 1) {
|
|
169
|
+
s = s.slice(-1), this._adapter.notifyFileSelect(s), this._adapter.resetInput(), this.replaceFileList(s);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
let e = n - o.length;
|
|
173
|
+
s = s.slice(0, e);
|
|
174
|
+
}
|
|
175
|
+
this._adapter.notifyFileSelect(s), this._adapter.resetInput(), this.addFilesToList(s);
|
|
176
|
+
}
|
|
177
|
+
handleReplaceChange(e) {
|
|
178
|
+
if (e.length === 0) return;
|
|
179
|
+
let { transformFile: t, uploadTrigger: n, accept: i } = this.getProps(), { replaceIdx: a, fileList: o } = this.getStates(), s = Array.from(e).pop();
|
|
180
|
+
if (i !== void 0 && !this.checkFileFormat(i, s)) {
|
|
181
|
+
this._adapter.notifyAcceptInvalid([s]);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
t && (s = t(s)), s.uid || (s.uid = r()), this.checkFileSize(s) && (s._sizeInvalid = !0, s.status = H, this._adapter.notifySizeError(s, o)), this._adapter.notifyFileSelect([s]);
|
|
185
|
+
let c = this.buildFileItem(s, n), l = [...o], u = l[a];
|
|
186
|
+
u && u.uid && this._releaseFileUrl(u.uid), l.splice(a, 1, c), this._adapter.notifyChange({
|
|
187
|
+
currentFile: c,
|
|
188
|
+
fileList: l
|
|
189
|
+
}), this._adapter.updateFileList(l, () => {
|
|
190
|
+
this._adapter.resetReplaceInput(), c._sizeInvalid || this.upload(c);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
buildFileItem(e, t) {
|
|
194
|
+
let { _sizeInvalid: n, status: r } = e;
|
|
195
|
+
try {
|
|
196
|
+
delete e._sizeInvalid, delete e.status;
|
|
197
|
+
} catch {}
|
|
198
|
+
let i = {
|
|
199
|
+
status: r || (t === U ? B : Ee),
|
|
200
|
+
name: e.name,
|
|
201
|
+
size: R(e.size),
|
|
202
|
+
uid: e.uid,
|
|
203
|
+
percent: 0,
|
|
204
|
+
fileInstance: e,
|
|
205
|
+
url: this._createURL(e, e.uid)
|
|
206
|
+
};
|
|
207
|
+
return n && (i._sizeInvalid = !0), this.isImage(e) && (i.preview = !0), i;
|
|
208
|
+
}
|
|
209
|
+
replaceFileList(e) {
|
|
210
|
+
let { uploadTrigger: t } = this.getProps(), n = e.map((e) => this.buildFileItem(e, t));
|
|
211
|
+
this._adapter.notifyChange({
|
|
212
|
+
fileList: n,
|
|
213
|
+
currentFile: n[0]
|
|
214
|
+
}), this._adapter.updateFileList(n, () => {
|
|
215
|
+
t === U && this.startUpload(n);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
addFilesToList(e) {
|
|
219
|
+
let t = this.getState("fileList").slice(), { uploadTrigger: n } = this.getProps(), r = e.map((e) => this.buildFileItem(e, n));
|
|
220
|
+
r.forEach((e) => {
|
|
221
|
+
let n = t.findIndex((t) => t.uid === e.uid);
|
|
222
|
+
n === -1 ? (t.push(e), this._adapter.notifyChange({
|
|
223
|
+
fileList: t,
|
|
224
|
+
currentFile: e
|
|
225
|
+
})) : t[n] = e;
|
|
226
|
+
}), this._adapter.updateFileList(t, () => {
|
|
227
|
+
n === U && this.startUpload(r);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
insertFileToList(e, t) {
|
|
231
|
+
let { limit: n, transformFile: i, accept: a, uploadTrigger: o } = this.getProps(), { fileList: s } = this.getStates(), c = [], l = Array.from(e);
|
|
232
|
+
if (a !== void 0 && (l = l.filter((e) => {
|
|
233
|
+
let t = this.checkFileFormat(a, e);
|
|
234
|
+
return t || c.push(e), t;
|
|
235
|
+
}), c.length !== 0 && this._adapter.notifyAcceptInvalid(c), l.length === 0)) return;
|
|
236
|
+
l = l.map((e) => (e.uid || (e.uid = r()), this.checkFileSize(e) && (e._sizeInvalid = !0, e.status = H, this._adapter.notifySizeError(e, s)), i && (e = i(e)), e));
|
|
237
|
+
let u = s.length + l.length;
|
|
238
|
+
if (n !== void 0 && u > n) {
|
|
239
|
+
if (n === 1) {
|
|
240
|
+
l = l.slice(-1), this._adapter.notifyFileSelect(l), this._adapter.resetInput(), this.replaceFileList(l);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
let e = n - s.length;
|
|
244
|
+
l = l.slice(0, e), this._adapter.notifyExceed(l);
|
|
245
|
+
}
|
|
246
|
+
let d = l.map((e) => this.buildFileItem(e, o)), f = s.slice();
|
|
247
|
+
t === void 0 ? f.push(...d) : f.splice(t, 0, ...d), this._adapter.notifyFileSelect(l), this._adapter.notifyChange({
|
|
248
|
+
fileList: f,
|
|
249
|
+
currentFile: null
|
|
250
|
+
}), this._adapter.updateFileList(f, () => {
|
|
251
|
+
o === U && this.startUpload(d);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/* istanbul ignore next */
|
|
255
|
+
manualUpload() {
|
|
256
|
+
let e = this.getState("fileList").filter((e) => e.status === Ee);
|
|
257
|
+
this.startUpload(e);
|
|
258
|
+
}
|
|
259
|
+
startUpload(e) {
|
|
260
|
+
e.forEach((e) => {
|
|
261
|
+
e._sizeInvalid || this.upload(e);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
upload(e) {
|
|
265
|
+
let { beforeUpload: t } = this.getProps();
|
|
266
|
+
if (t === void 0) {
|
|
267
|
+
this.post(e);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (typeof t == "function") {
|
|
271
|
+
let { fileList: t } = this.getStates(), n = this._adapter.notifyBeforeUpload({
|
|
272
|
+
file: e,
|
|
273
|
+
fileList: t
|
|
274
|
+
});
|
|
275
|
+
switch (!0) {
|
|
276
|
+
case n === !0:
|
|
277
|
+
this.post(e);
|
|
278
|
+
break;
|
|
279
|
+
case n === !1: {
|
|
280
|
+
let t = {
|
|
281
|
+
shouldUpload: !1,
|
|
282
|
+
status: F.FILE_STATUS_VALID_FAIL
|
|
283
|
+
};
|
|
284
|
+
this.handleBeforeUploadResultInObject(t, e);
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case n && o(n):
|
|
288
|
+
Promise.resolve(n).then((t) => {
|
|
289
|
+
let n = { shouldUpload: !0 };
|
|
290
|
+
Object.prototype.toString.call(t).slice(8, -1) === "Object" && (n = {
|
|
291
|
+
...n,
|
|
292
|
+
...t
|
|
293
|
+
}), this.handleBeforeUploadResultInObject(n, e);
|
|
294
|
+
}, (t) => {
|
|
295
|
+
let n = {
|
|
296
|
+
shouldUpload: !1,
|
|
297
|
+
status: F.FILE_STATUS_VALID_FAIL
|
|
298
|
+
};
|
|
299
|
+
Object.prototype.toString.call(t).slice(8, -1) === "Object" && (n = {
|
|
300
|
+
...n,
|
|
301
|
+
...t
|
|
302
|
+
}), this.handleBeforeUploadResultInObject(n, e);
|
|
303
|
+
});
|
|
304
|
+
break;
|
|
305
|
+
case typeof n == "object": this.handleBeforeUploadResultInObject(n, e);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
handleBeforeUploadResultInObject(e, t) {
|
|
310
|
+
let { shouldUpload: n, status: r, autoRemove: i, validateMessage: a, fileInstance: o } = e, s = this.getState("fileList").slice();
|
|
311
|
+
if (i) this._releaseFileUrl(t.uid), s = s.filter((e) => e.uid !== t.uid);
|
|
312
|
+
else {
|
|
313
|
+
let e = this._getFileIndex(t, s);
|
|
314
|
+
if (e < 0) return;
|
|
315
|
+
r && (s[e].status = r), a && (s[e].validateMessage = a), o && (o.uid = t.uid, s[e].fileInstance = o, s[e].size = R(o.size), s[e].name = o.name, this._releaseFileUrl(t.uid), s[e].url = this._createURL(o, t.uid)), s[e].shouldUpload = n;
|
|
316
|
+
}
|
|
317
|
+
this._adapter.updateFileList(s), this._adapter.notifyChange({
|
|
318
|
+
fileList: s,
|
|
319
|
+
currentFile: t
|
|
320
|
+
}), n && this.post(t);
|
|
321
|
+
}
|
|
322
|
+
post(e) {
|
|
323
|
+
let { fileInstance: t } = e, n = this.getProps();
|
|
324
|
+
if (typeof XMLHttpRequest > "u") return;
|
|
325
|
+
let r = new XMLHttpRequest(), i = new FormData(), { action: a } = n, { data: o } = n;
|
|
326
|
+
o && (typeof o == "function" && (o = o(t)), Object.keys(o).forEach((e) => {
|
|
327
|
+
i.append(e, o[e]);
|
|
328
|
+
}));
|
|
329
|
+
let s = n.name || n.fileName || t.name;
|
|
330
|
+
if (n.customRequest) return n.customRequest({
|
|
331
|
+
fileName: s,
|
|
332
|
+
data: o,
|
|
333
|
+
file: e,
|
|
334
|
+
fileInstance: t,
|
|
335
|
+
onProgress: (e) => this.handleProgress({
|
|
336
|
+
e,
|
|
337
|
+
fileInstance: t
|
|
338
|
+
}),
|
|
339
|
+
onError: (e, n) => this.handleError({
|
|
340
|
+
e: n,
|
|
341
|
+
xhr: e,
|
|
342
|
+
fileInstance: t
|
|
343
|
+
}),
|
|
344
|
+
onSuccess: (e, n) => this.handleSuccess({
|
|
345
|
+
response: e,
|
|
346
|
+
fileInstance: t,
|
|
347
|
+
e: n,
|
|
348
|
+
isCustomRequest: !0
|
|
349
|
+
}),
|
|
350
|
+
withCredentials: n.withCredentials,
|
|
351
|
+
action: n.action
|
|
352
|
+
});
|
|
353
|
+
i.append(s, t), r.open("post", a, !0), n.withCredentials && "withCredentials" in r && (r.withCredentials = !0), r.upload && (r.upload.onprogress = (e) => {
|
|
354
|
+
this.destroyState ? r.abort() : this.handleProgress({
|
|
355
|
+
e,
|
|
356
|
+
fileInstance: t
|
|
357
|
+
});
|
|
358
|
+
}), r.onload = (e) => {
|
|
359
|
+
this.destroyState || this.handleOnLoad({
|
|
360
|
+
e,
|
|
361
|
+
xhr: r,
|
|
362
|
+
fileInstance: t
|
|
363
|
+
});
|
|
364
|
+
}, r.onerror = (e) => {
|
|
365
|
+
this.destroyState || this.handleError({
|
|
366
|
+
e,
|
|
367
|
+
xhr: r,
|
|
368
|
+
fileInstance: t
|
|
369
|
+
});
|
|
370
|
+
};
|
|
371
|
+
let c = n.headers || {};
|
|
372
|
+
typeof c == "function" && (c = c(t));
|
|
373
|
+
for (let e in c) Object.prototype.hasOwnProperty.call(c, e) && c[e] !== null && r.setRequestHeader(e, c[e]);
|
|
374
|
+
r.send(i);
|
|
375
|
+
}
|
|
376
|
+
handleProgress({ e, fileInstance: t }) {
|
|
377
|
+
let { fileList: n } = this.getStates(), r = n.slice(), i = 0;
|
|
378
|
+
e.total > 0 && (i = Number((e.loaded / e.total * 100 * Se.PROGRESS_COEFFICIENT).toFixed(0)) || 0);
|
|
379
|
+
let a = this._getFileIndex(t, r);
|
|
380
|
+
a < 0 || (r[a].percent = i, r[a].status = B, this._adapter.notifyProgress(i, t, r), this._adapter.updateFileList(r), this._adapter.notifyChange({
|
|
381
|
+
fileList: r,
|
|
382
|
+
currentFile: r[a]
|
|
383
|
+
}));
|
|
384
|
+
}
|
|
385
|
+
handleOnLoad({ e, xhr: t, fileInstance: n }) {
|
|
386
|
+
let { fileList: r } = this.getStates(), i = this._getFileIndex(n, r);
|
|
387
|
+
i < 0 || (t.status < 200 || t.status >= 300 ? this.handleError({
|
|
388
|
+
e,
|
|
389
|
+
xhr: t,
|
|
390
|
+
fileInstance: n
|
|
391
|
+
}) : this.handleSuccess({
|
|
392
|
+
e,
|
|
393
|
+
xhr: t,
|
|
394
|
+
fileInstance: n,
|
|
395
|
+
index: i
|
|
396
|
+
}));
|
|
397
|
+
}
|
|
398
|
+
handleSuccess({ e, fileInstance: t, isCustomRequest: n = !1, xhr: r, response: i }) {
|
|
399
|
+
let { fileList: a } = this.getStates(), o = null, s = this._getFileIndex(t, a);
|
|
400
|
+
if (s < 0) return;
|
|
401
|
+
o = n ? i : this.getBody(r);
|
|
402
|
+
let c = a.slice(), { afterUpload: l } = this.getProps();
|
|
403
|
+
if (c[s].status = V, c[s].percent = 100, this._adapter.notifyProgress(100, t, c), c[s].response = o, e && (c[s].event = e), l && typeof l == "function") {
|
|
404
|
+
let { autoRemove: e, status: t, validateMessage: n, name: r, url: i } = this._adapter.notifyAfterUpload({
|
|
405
|
+
response: o,
|
|
406
|
+
file: c[s],
|
|
407
|
+
fileList: c
|
|
408
|
+
}) || {};
|
|
409
|
+
t && (c[s].status = t), n && (c[s].validateMessage = n), r && (c[s].name = r), i && (this._releaseFileUrl(c[s].uid), c[s].url = i), e && (this._releaseFileUrl(c[s].uid), c.splice(s, 1));
|
|
410
|
+
}
|
|
411
|
+
this._adapter.notifySuccess(o, t, c), this._adapter.notifyChange({
|
|
412
|
+
fileList: c,
|
|
413
|
+
currentFile: c[s]
|
|
414
|
+
}), this._adapter.updateFileList(c);
|
|
415
|
+
}
|
|
416
|
+
_getFileIndex(e, t) {
|
|
417
|
+
return t.findIndex((t) => t.uid === e.uid);
|
|
418
|
+
}
|
|
419
|
+
handleRemove(e) {
|
|
420
|
+
let { disabled: t } = this.getProps();
|
|
421
|
+
if (t) return;
|
|
422
|
+
let { fileList: n } = this.getStates();
|
|
423
|
+
Promise.resolve(this._adapter.notifyBeforeRemove(e, n)).then((t) => {
|
|
424
|
+
if (t === !1) return;
|
|
425
|
+
let r = n.slice(), i = this._getFileIndex(e, n);
|
|
426
|
+
i < 0 || (r.splice(i, 1), this._releaseFileUrl(e.uid), this._adapter.notifyRemove(e.fileInstance, r, e), this._adapter.updateFileList(r), this._adapter.notifyChange({
|
|
427
|
+
fileList: r,
|
|
428
|
+
currentFile: e
|
|
429
|
+
}));
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
handleError({ e, xhr: t, fileInstance: n }) {
|
|
433
|
+
let { fileList: r } = this.getStates(), i = this._getFileIndex(n, r);
|
|
434
|
+
if (i < 0) return;
|
|
435
|
+
let { action: a } = this.getProps(), o = r.slice(), s = this.getError({
|
|
436
|
+
action: a,
|
|
437
|
+
xhr: t,
|
|
438
|
+
fileName: n.name
|
|
439
|
+
});
|
|
440
|
+
o[i].status = Te, o[i].response = s, o[i].event = e, this._adapter.notifyError(s, n, o, t), this._adapter.updateFileList(o), this._adapter.notifyChange({
|
|
441
|
+
currentFile: o[i],
|
|
442
|
+
fileList: o
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
handleClear() {
|
|
446
|
+
let { disabled: e } = this.getProps(), { fileList: t } = this.getStates();
|
|
447
|
+
e || Promise.resolve(this._adapter.notifyBeforeClear(t)).then((e) => {
|
|
448
|
+
e !== !1 && (this._releaseAllFileUrls(), this._adapter.updateFileList([]), this._adapter.notifyClear(), this._adapter.notifyChange({ fileList: [] }));
|
|
449
|
+
}).catch((e) => {});
|
|
450
|
+
}
|
|
451
|
+
_createURL(e, t) {
|
|
452
|
+
let n = URL.createObjectURL(e), r = { ...this._localUrls || {} };
|
|
453
|
+
return t && r[t] && r[t] !== n && this._releaseBlob(r[t]), t && (r[t] = n), this._localUrls = r, this._adapter.updateLocalUrls(Object.values(this._localUrls)), n;
|
|
454
|
+
}
|
|
455
|
+
releaseMemory() {
|
|
456
|
+
if (this._localUrls && Object.keys(this._localUrls).length) {
|
|
457
|
+
this._releaseAllFileUrls();
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
let { localUrls: e } = this.getStates();
|
|
461
|
+
if (e) {
|
|
462
|
+
if (Array.isArray(e)) {
|
|
463
|
+
e.forEach((e) => {
|
|
464
|
+
this._releaseBlob(e);
|
|
465
|
+
});
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
typeof e == "object" && Object.keys(e).forEach((t) => {
|
|
469
|
+
let n = e[t];
|
|
470
|
+
n && this._releaseBlob(n);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
_releaseBlob(e) {
|
|
475
|
+
try {
|
|
476
|
+
URL.revokeObjectURL(e);
|
|
477
|
+
} catch (e) {
|
|
478
|
+
console.log(e);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
isImage(e) {
|
|
482
|
+
return /(webp|svg|png|gif|jpg|jpeg|bmp|dpg)$/i.test(e.type);
|
|
483
|
+
}
|
|
484
|
+
/* istanbul ignore next */
|
|
485
|
+
isMultiple() {
|
|
486
|
+
return !!this.getProp("multiple");
|
|
487
|
+
}
|
|
488
|
+
handleDragEnter(e) {
|
|
489
|
+
e.preventDefault(), e.stopPropagation(), this._dragEnterTarget = e.currentTarget;
|
|
490
|
+
let { disabled: t } = this.getProps();
|
|
491
|
+
t || this._adapter.updateDragAreaStatus(Oe);
|
|
492
|
+
}
|
|
493
|
+
async handleDirectoryDrop(e) {
|
|
494
|
+
let t = this.getState("fileList").slice(), n = await z([].slice.call(e.dataTransfer.items));
|
|
495
|
+
this.handleChange(n), this._adapter.updateDragAreaStatus(De), this._adapter.notifyDrop(e, n, t);
|
|
496
|
+
}
|
|
497
|
+
handleDrop(e) {
|
|
498
|
+
e.preventDefault(), e.stopPropagation();
|
|
499
|
+
let { disabled: t, directory: n } = this.getProps(), r = this.getState("fileList").slice();
|
|
500
|
+
if (!t) {
|
|
501
|
+
if (n) {
|
|
502
|
+
this.handleDirectoryDrop(e);
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
let t = Array.from(e.dataTransfer.files);
|
|
506
|
+
this.handleChange(t), this._adapter.updateDragAreaStatus(De), this._adapter.notifyDrop(e, t, r);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
handleDragOver(e) {
|
|
510
|
+
e.preventDefault(), e.stopPropagation();
|
|
511
|
+
}
|
|
512
|
+
handleDragLeave(e) {
|
|
513
|
+
e.preventDefault(), e.stopPropagation(), this._dragEnterTarget === e.target && this._adapter.updateDragAreaStatus(De);
|
|
514
|
+
}
|
|
515
|
+
checkFileFormat(e, t) {
|
|
516
|
+
let n = e.split(",").map((e) => e.trim()).filter((e) => e), r = t.type || "", i = r.replace(/\/.*$/, "");
|
|
517
|
+
return n.some((e) => {
|
|
518
|
+
if (e.charAt(0) === ".") {
|
|
519
|
+
let n = t.name || "", r = e.split(".").pop().toLowerCase();
|
|
520
|
+
return Ce(n.toLowerCase(), r);
|
|
521
|
+
}
|
|
522
|
+
if (/\/\*$/.test(e)) {
|
|
523
|
+
let t = e.replace(/\/.*$/, "");
|
|
524
|
+
return i === t;
|
|
525
|
+
}
|
|
526
|
+
return /^[^\/]+\/[^\/]+$/.test(e) ? r === e : !1;
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
retry(e) {
|
|
530
|
+
let { onRetry: t } = this.getProps();
|
|
531
|
+
t && typeof t == "function" && t(e), this.post(e);
|
|
532
|
+
}
|
|
533
|
+
handlePreviewClick(e) {
|
|
534
|
+
this._adapter.notifyPreviewClick(e);
|
|
535
|
+
}
|
|
536
|
+
readFileFromClipboard(e) {
|
|
537
|
+
for (let t of e) for (let e of t.types) e.startsWith("image") && t.getType(e).then((e) => e.arrayBuffer()).then((t) => {
|
|
538
|
+
let n = e.split("/")[1], r = new File([t], `upload.${n}`, { type: e });
|
|
539
|
+
this.handleChange([r]);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
handlePasting(e) {
|
|
543
|
+
let { addOnPasting: t } = this.getProps();
|
|
544
|
+
if (t) {
|
|
545
|
+
if (e.type === "paste" && e.clipboardData && e.clipboardData.items) {
|
|
546
|
+
let t = e.clipboardData.items, n = [];
|
|
547
|
+
for (let e = 0; e < t.length; e++) {
|
|
548
|
+
let r = t[e];
|
|
549
|
+
if (r.kind === "file") {
|
|
550
|
+
let e = r.getAsFile();
|
|
551
|
+
e && n.push(e);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (n.length > 0) {
|
|
555
|
+
e.preventDefault(), this.handleChange(n), this._pasteHandled = !0, setTimeout(() => {
|
|
556
|
+
this._pasteHandled = !1;
|
|
557
|
+
}, 100);
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (this._pasteHandled) {
|
|
562
|
+
this._pasteHandled = !1;
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if ((this._adapter.isMac() ? e.metaKey : e.ctrlKey) && e.code === "KeyV") {
|
|
566
|
+
if (!navigator.clipboard || typeof navigator.clipboard.read != "function") return;
|
|
567
|
+
navigator.permissions.query({ name: "clipboard-read" }).then((e) => {
|
|
568
|
+
e.state === "granted" || e.state === "prompt" ? navigator.clipboard.read().then((e) => {
|
|
569
|
+
this.readFileFromClipboard(e);
|
|
570
|
+
}).catch((e) => {
|
|
571
|
+
this._adapter.notifyPastingError(e);
|
|
572
|
+
}) : this._adapter.notifyPastingError(e);
|
|
573
|
+
}).catch((e) => {
|
|
574
|
+
this._adapter.notifyPastingError(e);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
bindPastingHandler() {
|
|
580
|
+
this._adapter.registerPastingHandler((e) => this.handlePasting(e)), this._adapter.registerPasteEventHandler((e) => this.handlePasting(e));
|
|
581
|
+
}
|
|
582
|
+
unbindPastingHandler() {
|
|
583
|
+
this._adapter.unRegisterPastingHandler(), this._adapter.unRegisterPasteEventHandler();
|
|
584
|
+
}
|
|
585
|
+
}, Ae = class extends e {
|
|
586
|
+
constructor(e) {
|
|
587
|
+
super({ ...e });
|
|
588
|
+
}
|
|
589
|
+
handleImageError(e) {
|
|
590
|
+
this._adapter.updateFallbackPreview(!0);
|
|
591
|
+
}
|
|
592
|
+
}, W = b({
|
|
593
|
+
name: "UploadNodeRenderer",
|
|
594
|
+
props: { content: {
|
|
595
|
+
type: null,
|
|
596
|
+
default: void 0
|
|
597
|
+
} },
|
|
598
|
+
setup(e) {
|
|
599
|
+
return () => e.content;
|
|
600
|
+
}
|
|
601
|
+
}), je = ["src", "alt"], Me = {
|
|
602
|
+
key: 6,
|
|
603
|
+
class: "semi-upload-picture-file-card-preview"
|
|
604
|
+
}, Ne = {
|
|
605
|
+
key: 8,
|
|
606
|
+
class: "semi-upload-picture-file-card-pic-info"
|
|
607
|
+
}, G = {
|
|
608
|
+
key: 0,
|
|
609
|
+
class: "semi-upload-tooltip-children-wrapper semi-upload-picture-file-card-icon-loading"
|
|
610
|
+
}, Pe = {
|
|
611
|
+
key: 1,
|
|
612
|
+
class: "semi-upload-picture-file-card-icon-error"
|
|
613
|
+
}, Fe = ["src", "alt"], Ie = { class: "semi-upload-file-card-info-main" }, Le = { class: "semi-upload-file-card-info-main-text" }, Re = { class: "semi-upload-file-card-info-size" }, ze = { class: "semi-upload-tooltip-children-wrapper semi-upload-file-card-replace" }, Be = { class: "semi-upload-file-card-info-main-control" }, K = { class: "semi-upload-file-card-info-validate-message" }, Ve = /* @__PURE__ */ b({
|
|
614
|
+
name: "UploadFileCard",
|
|
615
|
+
inheritAttrs: !1,
|
|
616
|
+
__name: "UploadFileCard",
|
|
617
|
+
props: {
|
|
618
|
+
index: {},
|
|
619
|
+
listType: {},
|
|
620
|
+
onRemove: { type: Function },
|
|
621
|
+
onRetry: { type: Function },
|
|
622
|
+
onReplace: { type: Function },
|
|
623
|
+
showPicInfo: { type: Boolean },
|
|
624
|
+
showRetry: { type: Boolean },
|
|
625
|
+
showReplace: { type: Boolean },
|
|
626
|
+
style: { type: [
|
|
627
|
+
Boolean,
|
|
628
|
+
null,
|
|
629
|
+
String,
|
|
630
|
+
Object,
|
|
631
|
+
Array
|
|
632
|
+
] },
|
|
633
|
+
disabled: { type: Boolean },
|
|
634
|
+
onPreviewClick: { type: Function },
|
|
635
|
+
picWidth: {},
|
|
636
|
+
picHeight: {},
|
|
637
|
+
showTooltip: { type: [Boolean, Object] },
|
|
638
|
+
previewFile: { type: Function },
|
|
639
|
+
renderPicInfo: { type: Function },
|
|
640
|
+
renderThumbnail: { type: Function },
|
|
641
|
+
renderPicPreviewIcon: { type: Function },
|
|
642
|
+
renderPicClose: { type: Function },
|
|
643
|
+
renderFileOperation: { type: Function },
|
|
644
|
+
status: {},
|
|
645
|
+
name: {},
|
|
646
|
+
size: {},
|
|
647
|
+
uid: {},
|
|
648
|
+
url: {},
|
|
649
|
+
fileInstance: {},
|
|
650
|
+
percent: {},
|
|
651
|
+
_sizeInvalid: { type: Boolean },
|
|
652
|
+
preview: { type: Boolean },
|
|
653
|
+
validateMessage: { type: [
|
|
654
|
+
Object,
|
|
655
|
+
String,
|
|
656
|
+
Number,
|
|
657
|
+
Boolean,
|
|
658
|
+
null,
|
|
659
|
+
Array
|
|
660
|
+
] },
|
|
661
|
+
shouldUpload: { type: Boolean },
|
|
662
|
+
response: {},
|
|
663
|
+
event: {},
|
|
664
|
+
className: { type: [
|
|
665
|
+
Boolean,
|
|
666
|
+
null,
|
|
667
|
+
String,
|
|
668
|
+
Object,
|
|
669
|
+
Array
|
|
670
|
+
] },
|
|
671
|
+
_locale: {}
|
|
672
|
+
},
|
|
673
|
+
setup(e) {
|
|
674
|
+
let t = e, n = m(() => t._locale ?? {
|
|
675
|
+
mainText: "点击上传文件或拖拽文件到这里",
|
|
676
|
+
illegalTips: "不支持此类型文件",
|
|
677
|
+
legalTips: "松手开始上传",
|
|
678
|
+
retry: "重试",
|
|
679
|
+
replace: "替换文件",
|
|
680
|
+
clear: "清空",
|
|
681
|
+
selectedFiles: "已选择文件",
|
|
682
|
+
illegalSize: "文件尺寸不合法",
|
|
683
|
+
fail: "上传失败",
|
|
684
|
+
cropTitle: "裁切图片",
|
|
685
|
+
cropOk: "确定",
|
|
686
|
+
cropCancel: "取消"
|
|
687
|
+
}), r = ce({ fallbackPreview: !1 }), i = m(() => ({
|
|
688
|
+
...t,
|
|
689
|
+
disabled: t.disabled ?? !1,
|
|
690
|
+
index: t.index ?? 0,
|
|
691
|
+
listType: t.listType ?? "list",
|
|
692
|
+
name: t.name ?? "",
|
|
693
|
+
onRemove: t.onRemove ?? (() => void 0),
|
|
694
|
+
onReplace: t.onReplace ?? (() => void 0),
|
|
695
|
+
onRetry: t.onRetry ?? (() => void 0),
|
|
696
|
+
showPicInfo: t.showPicInfo ?? !1,
|
|
697
|
+
size: t.size ?? "",
|
|
698
|
+
status: t.status ?? "wait",
|
|
699
|
+
uid: t.uid ?? ""
|
|
700
|
+
})), o = m(() => ({
|
|
701
|
+
...i.value,
|
|
702
|
+
key: t.uid ?? ""
|
|
703
|
+
})), s = re(new Ae({
|
|
704
|
+
getContext: () => void 0,
|
|
705
|
+
getContexts: () => void 0,
|
|
706
|
+
getProp: (e) => t[e],
|
|
707
|
+
getProps: () => i.value,
|
|
708
|
+
getState: (e) => r[e],
|
|
709
|
+
getStates: () => r,
|
|
710
|
+
setState: (e, t) => {
|
|
711
|
+
Object.assign(r, e), t?.();
|
|
712
|
+
},
|
|
713
|
+
getCache: () => void 0,
|
|
714
|
+
getCaches: () => void 0,
|
|
715
|
+
setCache: () => void 0,
|
|
716
|
+
stopPropagation: (e) => e.stopPropagation?.(),
|
|
717
|
+
persistEvent: () => void 0,
|
|
718
|
+
updateFallbackPreview: (e) => {
|
|
719
|
+
r.fallbackPreview = e;
|
|
720
|
+
}
|
|
721
|
+
})), d = m(() => t.listType === "picture"), b = m(() => t.status === "uploading" && t.percent !== 100 && t.percent !== void 0), te = m(() => t.status === "uploadFail" && (t.showRetry ?? !0)), ne = m(() => t.status === "success" && t.showReplace), x = m(() => t.status === "success" && !t.showReplace), ie = m(() => typeof t.size == "number" ? R(t.size) : t.size), ae = m(() => [
|
|
722
|
+
"semi-upload-file-card",
|
|
723
|
+
["validateFail", "uploadFail"].includes(t.status) ? "semi-upload-file-card-fail" : null,
|
|
724
|
+
typeof t.onPreviewClick == "function" ? "semi-upload-file-card-show-pointer" : null,
|
|
725
|
+
t.className
|
|
726
|
+
]), oe = m(() => [
|
|
727
|
+
"semi-upload-picture-file-card",
|
|
728
|
+
r.fallbackPreview ? "semi-upload-picture-file-card-preview-fallback" : null,
|
|
729
|
+
t.disabled ? "semi-upload-picture-file-card-disabled" : null,
|
|
730
|
+
typeof t.onPreviewClick == "function" ? "semi-upload-picture-file-card-show-pointer" : null,
|
|
731
|
+
t.status === "uploadFail" ? "semi-upload-picture-file-card-error" : null,
|
|
732
|
+
b.value ? "semi-upload-picture-file-card-uploading" : null,
|
|
733
|
+
typeof t.renderThumbnail == "function" && t.picHeight && t.picWidth ? "semi-upload-picture-file-card-custom-thumbnail" : null,
|
|
734
|
+
t.className
|
|
735
|
+
]), se = m(() => [t.style, d.value ? {
|
|
736
|
+
height: t.picHeight,
|
|
737
|
+
width: t.picWidth
|
|
738
|
+
} : void 0]), T = m(() => ({
|
|
739
|
+
height: t.picHeight,
|
|
740
|
+
width: t.picWidth
|
|
741
|
+
})), E = m(() => {
|
|
742
|
+
if (t.validateMessage) return t.validateMessage;
|
|
743
|
+
if (t.status === "uploadFail") return n.value.fail;
|
|
744
|
+
if (t._sizeInvalid) return n.value.illegalSize;
|
|
745
|
+
});
|
|
746
|
+
function k(e, t) {
|
|
747
|
+
e.stopPropagation(), t();
|
|
748
|
+
}
|
|
749
|
+
function le(e) {
|
|
750
|
+
s.handleImageError(e);
|
|
751
|
+
}
|
|
752
|
+
return (e, i) => d.value ? (w(), _("div", {
|
|
753
|
+
key: 0,
|
|
754
|
+
role: "listitem",
|
|
755
|
+
class: S(oe.value),
|
|
756
|
+
style: C(se.value),
|
|
757
|
+
onClick: i[3] ||= (e) => t.onPreviewClick?.()
|
|
758
|
+
}, [
|
|
759
|
+
t.renderThumbnail ? (w(), h(O(W), {
|
|
760
|
+
key: 0,
|
|
761
|
+
content: t.renderThumbnail(o.value)
|
|
762
|
+
}, null, 8, ["content"])) : O(r).fallbackPreview ? (w(), h(O(M), {
|
|
763
|
+
key: 2,
|
|
764
|
+
size: "large"
|
|
765
|
+
})) : (w(), _("img", {
|
|
766
|
+
key: 1,
|
|
767
|
+
src: t.url,
|
|
768
|
+
alt: t.name,
|
|
769
|
+
style: C(T.value),
|
|
770
|
+
onError: le
|
|
771
|
+
}, null, 44, je)),
|
|
772
|
+
b.value ? (w(), h(c, {
|
|
773
|
+
key: 3,
|
|
774
|
+
percent: t.percent ?? 0,
|
|
775
|
+
type: "circle",
|
|
776
|
+
size: "small",
|
|
777
|
+
"orbit-stroke": "#FFF",
|
|
778
|
+
"aria-label": "uploading file progress"
|
|
779
|
+
}, null, 8, ["percent"])) : g("", !0),
|
|
780
|
+
te.value ? (w(), _("div", {
|
|
781
|
+
key: 4,
|
|
782
|
+
role: "button",
|
|
783
|
+
tabindex: "0",
|
|
784
|
+
class: "semi-upload-picture-file-card-retry",
|
|
785
|
+
onClick: i[0] ||= (e) => k(e, t.onRetry)
|
|
786
|
+
}, [y(O(N), { class: "semi-upload-picture-file-card-icon-retry" })])) : g("", !0),
|
|
787
|
+
ne.value ? (w(), h(a, {
|
|
788
|
+
key: 5,
|
|
789
|
+
trigger: "hover",
|
|
790
|
+
position: "top",
|
|
791
|
+
content: n.value.replace,
|
|
792
|
+
"show-arrow": !1,
|
|
793
|
+
spacing: 4
|
|
794
|
+
}, {
|
|
795
|
+
default: A(() => [v("div", {
|
|
796
|
+
role: "button",
|
|
797
|
+
tabindex: "0",
|
|
798
|
+
class: "semi-upload-picture-file-card-replace",
|
|
799
|
+
onClick: i[1] ||= (e) => k(e, t.onReplace)
|
|
800
|
+
}, [...i[8] ||= [v("svg", {
|
|
801
|
+
class: "semi-upload-picture-file-card-icon-replace",
|
|
802
|
+
focusable: "false",
|
|
803
|
+
"aria-hidden": "true",
|
|
804
|
+
width: "28",
|
|
805
|
+
height: "28",
|
|
806
|
+
viewBox: "0 0 28 28",
|
|
807
|
+
fill: "none"
|
|
808
|
+
}, [
|
|
809
|
+
v("circle", {
|
|
810
|
+
cx: "14",
|
|
811
|
+
cy: "14",
|
|
812
|
+
r: "14",
|
|
813
|
+
fill: "#16161A",
|
|
814
|
+
"fill-opacity": "0.6"
|
|
815
|
+
}),
|
|
816
|
+
v("path", {
|
|
817
|
+
d: "M9 10.25V18.25L10.25 13.25H17.875V11.75C17.875 11.4739 17.6511 11.25 17.375 11.25H14L12.75 9.75H9.5C9.22386 9.75 9 9.97386 9 10.25Z",
|
|
818
|
+
stroke: "currentColor",
|
|
819
|
+
"stroke-linecap": "round",
|
|
820
|
+
"stroke-linejoin": "round"
|
|
821
|
+
}),
|
|
822
|
+
v("path", {
|
|
823
|
+
d: "M18 18.25L19 13.25H10.2031L9 18.25H18Z",
|
|
824
|
+
stroke: "currentColor",
|
|
825
|
+
"stroke-linecap": "round",
|
|
826
|
+
"stroke-linejoin": "round"
|
|
827
|
+
})
|
|
828
|
+
], -1)]])]),
|
|
829
|
+
_: 1
|
|
830
|
+
}, 8, ["content"])) : g("", !0),
|
|
831
|
+
x.value ? (w(), _("div", Me, [t.renderPicPreviewIcon ? (w(), h(O(W), {
|
|
832
|
+
key: 0,
|
|
833
|
+
content: t.renderPicPreviewIcon(o.value)
|
|
834
|
+
}, null, 8, ["content"])) : g("", !0)])) : g("", !0),
|
|
835
|
+
t.showPicInfo && t.renderPicInfo ? (w(), h(O(W), {
|
|
836
|
+
key: 7,
|
|
837
|
+
content: t.renderPicInfo(o.value)
|
|
838
|
+
}, null, 8, ["content"])) : t.showPicInfo ? (w(), _("div", Ne, D(t.index + 1), 1)) : g("", !0),
|
|
839
|
+
!t.disabled && t.renderPicClose ? (w(), h(O(W), {
|
|
840
|
+
key: 9,
|
|
841
|
+
content: t.renderPicClose({
|
|
842
|
+
className: "semi-upload-picture-file-card-close",
|
|
843
|
+
remove: (e) => k(e, t.onRemove)
|
|
844
|
+
})
|
|
845
|
+
}, null, 8, ["content"])) : t.disabled ? g("", !0) : (w(), _("div", {
|
|
846
|
+
key: 10,
|
|
847
|
+
role: "button",
|
|
848
|
+
tabindex: "0",
|
|
849
|
+
class: "semi-upload-picture-file-card-close",
|
|
850
|
+
onClick: i[2] ||= (e) => k(e, t.onRemove)
|
|
851
|
+
}, [y(O(pe), { class: "semi-upload-picture-file-card-icon-close" })])),
|
|
852
|
+
E.value ? (w(), h(a, {
|
|
853
|
+
key: 11,
|
|
854
|
+
content: E.value,
|
|
855
|
+
trigger: "hover",
|
|
856
|
+
position: "bottom"
|
|
857
|
+
}, {
|
|
858
|
+
default: A(() => [t.status === "validating" ? (w(), _("span", G, [y(l, { size: "small" })])) : (w(), _("div", Pe, [...i[9] ||= [v("svg", {
|
|
859
|
+
focusable: "false",
|
|
860
|
+
"aria-hidden": "true",
|
|
861
|
+
width: "16",
|
|
862
|
+
height: "16",
|
|
863
|
+
viewBox: "0 0 16 16",
|
|
864
|
+
fill: "none"
|
|
865
|
+
}, [v("circle", {
|
|
866
|
+
cx: "8",
|
|
867
|
+
cy: "8",
|
|
868
|
+
r: "6.66667",
|
|
869
|
+
fill: "white"
|
|
870
|
+
}), v("path", {
|
|
871
|
+
"fill-rule": "evenodd",
|
|
872
|
+
"clip-rule": "evenodd",
|
|
873
|
+
d: "M15.3332 8.00008C15.3332 12.0502 12.0499 15.3334 7.99984 15.3334C3.94975 15.3334 0.666504 12.0502 0.666504 8.00008C0.666504 3.94999 3.94975 0.666748 7.99984 0.666748C12.0499 0.666748 15.3332 3.94999 15.3332 8.00008ZM8.99984 11.6667C8.99984 11.1145 8.55212 10.6667 7.99984 10.6667C7.44755 10.6667 6.99984 11.1145 6.99984 11.6667C6.99984 12.219 7.44755 12.6667 7.99984 12.6667ZM7.99984 3.33341C7.27573 3.33341 6.7003 3.94171 6.74046 4.66469L6.94437 8.33495C6.97549 8.89513 7.4388 9.33341 7.99984 9.33341C8.56087 9.33341 9.02419 8.89513 9.05531 8.33495L9.25921 4.66469C9.29938 3.94171 8.72394 3.33341 7.99984 3.33341Z",
|
|
874
|
+
fill: "#F93920"
|
|
875
|
+
})], -1)]]))]),
|
|
876
|
+
_: 1
|
|
877
|
+
}, 8, ["content"])) : g("", !0)
|
|
878
|
+
], 6)) : t.listType === "list" ? (w(), _("div", {
|
|
879
|
+
key: 1,
|
|
880
|
+
role: "listitem",
|
|
881
|
+
class: S(ae.value),
|
|
882
|
+
style: C(t.style),
|
|
883
|
+
onClick: i[7] ||= (e) => t.onPreviewClick?.()
|
|
884
|
+
}, [
|
|
885
|
+
v("div", { class: S(["semi-upload-file-card-preview", !t.preview || typeof t.previewFile == "function" || O(r).fallbackPreview ? "semi-upload-file-card-preview-placeholder" : null]) }, [t.previewFile ? (w(), h(O(W), {
|
|
886
|
+
key: 0,
|
|
887
|
+
content: t.previewFile(o.value)
|
|
888
|
+
}, null, 8, ["content"])) : t.preview && !O(r).fallbackPreview ? (w(), _("img", {
|
|
889
|
+
key: 1,
|
|
890
|
+
src: t.url,
|
|
891
|
+
alt: t.name,
|
|
892
|
+
onError: le
|
|
893
|
+
}, null, 40, Fe)) : (w(), h(O(M), {
|
|
894
|
+
key: 2,
|
|
895
|
+
size: "large"
|
|
896
|
+
}))], 2),
|
|
897
|
+
v("div", Ie, [
|
|
898
|
+
v("div", Le, [y(u, {
|
|
899
|
+
class: "semi-upload-file-card-info-name",
|
|
900
|
+
ellipsis: { showTooltip: t.showTooltip ?? !0 }
|
|
901
|
+
}, {
|
|
902
|
+
default: A(() => [ee(D(t.name), 1)]),
|
|
903
|
+
_: 1
|
|
904
|
+
}, 8, ["ellipsis"]), v("span", null, [v("span", Re, D(ie.value), 1), ne.value ? (w(), h(a, {
|
|
905
|
+
key: 0,
|
|
906
|
+
trigger: "hover",
|
|
907
|
+
position: "top",
|
|
908
|
+
"show-arrow": !1,
|
|
909
|
+
content: n.value.replace
|
|
910
|
+
}, {
|
|
911
|
+
default: A(() => [v("span", ze, [y(f, {
|
|
912
|
+
type: "tertiary",
|
|
913
|
+
theme: "borderless",
|
|
914
|
+
size: "small",
|
|
915
|
+
onClick: i[4] ||= (e) => k(e, t.onReplace)
|
|
916
|
+
}, {
|
|
917
|
+
icon: A(() => [...i[10] ||= [v("svg", {
|
|
918
|
+
focusable: "false",
|
|
919
|
+
"aria-hidden": "true",
|
|
920
|
+
width: "24",
|
|
921
|
+
height: "24",
|
|
922
|
+
viewBox: "0 0 24 24",
|
|
923
|
+
fill: "none"
|
|
924
|
+
}, [v("path", {
|
|
925
|
+
d: "M6 17V7.58824C6 7.26336 6.26863 7 6.6 7H10.5L12 8.76471H16.05C16.3814 8.76471 16.65 9.02806 16.65 9.35294V11.1176H7.5L6 17ZM6 17L7.44375 11.1176H18L16.8 17L6 17Z",
|
|
926
|
+
stroke: "currentColor",
|
|
927
|
+
"stroke-width": "1.5",
|
|
928
|
+
"stroke-linecap": "round",
|
|
929
|
+
"stroke-linejoin": "round"
|
|
930
|
+
})], -1)]]),
|
|
931
|
+
_: 1
|
|
932
|
+
})])]),
|
|
933
|
+
_: 1
|
|
934
|
+
}, 8, ["content"])) : g("", !0)])]),
|
|
935
|
+
b.value ? (w(), h(c, {
|
|
936
|
+
key: 0,
|
|
937
|
+
percent: t.percent ?? 0,
|
|
938
|
+
style: { width: "100%" },
|
|
939
|
+
"aria-label": "uploading file progress"
|
|
940
|
+
}, null, 8, ["percent"])) : g("", !0),
|
|
941
|
+
v("div", Be, [v("span", K, [typeof E.value == "string" ? (w(), _(p, { key: 0 }, [t.status === "validating" ? (w(), h(l, {
|
|
942
|
+
key: 0,
|
|
943
|
+
size: "small",
|
|
944
|
+
"wrapper-class-name": "semi-upload-file-card-icon-loading"
|
|
945
|
+
})) : (w(), h(O(fe), {
|
|
946
|
+
key: 1,
|
|
947
|
+
class: "semi-upload-file-card-icon-error"
|
|
948
|
+
})), ee(" " + D(E.value), 1)], 64)) : E.value ? (w(), h(O(W), {
|
|
949
|
+
key: 1,
|
|
950
|
+
content: E.value
|
|
951
|
+
}, null, 8, ["content"])) : g("", !0)]), te.value ? (w(), _("span", {
|
|
952
|
+
key: 0,
|
|
953
|
+
role: "button",
|
|
954
|
+
tabindex: "0",
|
|
955
|
+
class: "semi-upload-file-card-info-retry",
|
|
956
|
+
onClick: i[5] ||= (e) => k(e, t.onRetry)
|
|
957
|
+
}, D(n.value.retry), 1)) : g("", !0)])
|
|
958
|
+
]),
|
|
959
|
+
t.renderFileOperation ? (w(), h(O(W), {
|
|
960
|
+
key: 0,
|
|
961
|
+
content: t.renderFileOperation(o.value)
|
|
962
|
+
}, null, 8, ["content"])) : (w(), h(f, {
|
|
963
|
+
key: 1,
|
|
964
|
+
type: "tertiary",
|
|
965
|
+
theme: "borderless",
|
|
966
|
+
size: "small",
|
|
967
|
+
class: "semi-upload-file-card-close",
|
|
968
|
+
onClick: i[6] ||= (e) => k(e, t.onRemove)
|
|
969
|
+
}, {
|
|
970
|
+
icon: A(() => [y(O(j))]),
|
|
971
|
+
_: 1
|
|
972
|
+
}))
|
|
973
|
+
], 6)) : g("", !0);
|
|
974
|
+
}
|
|
975
|
+
}), He = ["x-prompt-pos"], Ue = [
|
|
976
|
+
"capture",
|
|
977
|
+
"multiple",
|
|
978
|
+
"accept"
|
|
979
|
+
], We = ["accept"], Ge = ["aria-disabled"], Ke = {
|
|
980
|
+
class: "semi-upload-drag-area-icon",
|
|
981
|
+
"x-semi-prop": "dragIcon"
|
|
982
|
+
}, qe = { class: "semi-upload-drag-area-text" }, Je = {
|
|
983
|
+
class: "semi-upload-drag-area-main-text",
|
|
984
|
+
"x-semi-prop": "dragMainText"
|
|
985
|
+
}, Ye = {
|
|
986
|
+
class: "semi-upload-drag-area-sub-text",
|
|
987
|
+
"x-semi-prop": "dragSubText"
|
|
988
|
+
}, Xe = { class: "semi-upload-drag-area-tips" }, Ze = {
|
|
989
|
+
key: 0,
|
|
990
|
+
class: "semi-upload-drag-area-tips-legal"
|
|
991
|
+
}, Qe = {
|
|
992
|
+
key: 1,
|
|
993
|
+
class: "semi-upload-drag-area-tips-illegal"
|
|
994
|
+
}, $e = ["aria-disabled"], et = {
|
|
995
|
+
key: 1,
|
|
996
|
+
class: "semi-upload-prompt",
|
|
997
|
+
"x-semi-prop": "prompt"
|
|
998
|
+
}, tt = {
|
|
999
|
+
key: 2,
|
|
1000
|
+
class: "semi-upload-validate-message",
|
|
1001
|
+
"x-semi-prop": "validateMessage"
|
|
1002
|
+
}, nt = {
|
|
1003
|
+
key: 0,
|
|
1004
|
+
class: "semi-upload-file-list semi-upload-picture-file-list"
|
|
1005
|
+
}, rt = {
|
|
1006
|
+
class: "semi-upload-file-list-main",
|
|
1007
|
+
role: "list",
|
|
1008
|
+
"aria-label": "picture list"
|
|
1009
|
+
}, it = {
|
|
1010
|
+
key: 4,
|
|
1011
|
+
class: "semi-upload-file-list"
|
|
1012
|
+
}, at = {
|
|
1013
|
+
key: 0,
|
|
1014
|
+
class: "semi-upload-file-list-title"
|
|
1015
|
+
}, ot = { class: "semi-upload-file-list-title-choosen" }, st = {
|
|
1016
|
+
class: "semi-upload-file-list-main",
|
|
1017
|
+
role: "list",
|
|
1018
|
+
"aria-label": "file list"
|
|
1019
|
+
}, q = /* @__PURE__ */ b({
|
|
1020
|
+
name: "Upload",
|
|
1021
|
+
inheritAttrs: !1,
|
|
1022
|
+
__name: "Upload",
|
|
1023
|
+
props: {
|
|
1024
|
+
accept: {},
|
|
1025
|
+
action: {},
|
|
1026
|
+
afterUpload: {},
|
|
1027
|
+
beforeUpload: {},
|
|
1028
|
+
beforeClear: {
|
|
1029
|
+
type: Function,
|
|
1030
|
+
default: () => !0
|
|
1031
|
+
},
|
|
1032
|
+
beforeRemove: {
|
|
1033
|
+
type: Function,
|
|
1034
|
+
default: () => !0
|
|
1035
|
+
},
|
|
1036
|
+
capture: { type: [Boolean, String] },
|
|
1037
|
+
class: { type: [
|
|
1038
|
+
Boolean,
|
|
1039
|
+
null,
|
|
1040
|
+
String,
|
|
1041
|
+
Object,
|
|
1042
|
+
Array
|
|
1043
|
+
] },
|
|
1044
|
+
className: { type: [
|
|
1045
|
+
Boolean,
|
|
1046
|
+
null,
|
|
1047
|
+
String,
|
|
1048
|
+
Object,
|
|
1049
|
+
Array
|
|
1050
|
+
] },
|
|
1051
|
+
customRequest: {},
|
|
1052
|
+
data: {},
|
|
1053
|
+
defaultFileList: { default: () => [] },
|
|
1054
|
+
directory: {
|
|
1055
|
+
type: Boolean,
|
|
1056
|
+
default: !1
|
|
1057
|
+
},
|
|
1058
|
+
disabled: {
|
|
1059
|
+
type: Boolean,
|
|
1060
|
+
default: !1
|
|
1061
|
+
},
|
|
1062
|
+
dragIcon: { type: [
|
|
1063
|
+
Object,
|
|
1064
|
+
String,
|
|
1065
|
+
Number,
|
|
1066
|
+
Boolean,
|
|
1067
|
+
null,
|
|
1068
|
+
Array
|
|
1069
|
+
] },
|
|
1070
|
+
dragMainText: { type: [
|
|
1071
|
+
Object,
|
|
1072
|
+
String,
|
|
1073
|
+
Number,
|
|
1074
|
+
Boolean,
|
|
1075
|
+
null,
|
|
1076
|
+
Array
|
|
1077
|
+
] },
|
|
1078
|
+
dragSubText: { type: [
|
|
1079
|
+
Object,
|
|
1080
|
+
String,
|
|
1081
|
+
Number,
|
|
1082
|
+
Boolean,
|
|
1083
|
+
null,
|
|
1084
|
+
Array
|
|
1085
|
+
] },
|
|
1086
|
+
draggable: {
|
|
1087
|
+
type: Boolean,
|
|
1088
|
+
default: !1
|
|
1089
|
+
},
|
|
1090
|
+
addOnPasting: {
|
|
1091
|
+
type: Boolean,
|
|
1092
|
+
default: !1
|
|
1093
|
+
},
|
|
1094
|
+
fileList: {},
|
|
1095
|
+
modelValue: {},
|
|
1096
|
+
fileName: {},
|
|
1097
|
+
headers: {},
|
|
1098
|
+
hotSpotLocation: { default: "end" },
|
|
1099
|
+
itemStyle: { type: [
|
|
1100
|
+
Boolean,
|
|
1101
|
+
null,
|
|
1102
|
+
String,
|
|
1103
|
+
Object,
|
|
1104
|
+
Array
|
|
1105
|
+
] },
|
|
1106
|
+
limit: {},
|
|
1107
|
+
listType: { default: "list" },
|
|
1108
|
+
maxSize: {},
|
|
1109
|
+
minSize: {},
|
|
1110
|
+
multiple: {
|
|
1111
|
+
type: Boolean,
|
|
1112
|
+
default: !1
|
|
1113
|
+
},
|
|
1114
|
+
name: {},
|
|
1115
|
+
picHeight: {},
|
|
1116
|
+
picWidth: {},
|
|
1117
|
+
prompt: { type: [
|
|
1118
|
+
Object,
|
|
1119
|
+
String,
|
|
1120
|
+
Number,
|
|
1121
|
+
Boolean,
|
|
1122
|
+
null,
|
|
1123
|
+
Array
|
|
1124
|
+
] },
|
|
1125
|
+
promptPosition: { default: "right" },
|
|
1126
|
+
showClear: {
|
|
1127
|
+
type: Boolean,
|
|
1128
|
+
default: !0
|
|
1129
|
+
},
|
|
1130
|
+
showPicInfo: {
|
|
1131
|
+
type: Boolean,
|
|
1132
|
+
default: !1
|
|
1133
|
+
},
|
|
1134
|
+
showReplace: {
|
|
1135
|
+
type: Boolean,
|
|
1136
|
+
default: !1
|
|
1137
|
+
},
|
|
1138
|
+
showRetry: {
|
|
1139
|
+
type: Boolean,
|
|
1140
|
+
default: !0
|
|
1141
|
+
},
|
|
1142
|
+
showTooltip: {
|
|
1143
|
+
type: [Boolean, Object],
|
|
1144
|
+
default: !0
|
|
1145
|
+
},
|
|
1146
|
+
showUploadList: {
|
|
1147
|
+
type: Boolean,
|
|
1148
|
+
default: !0
|
|
1149
|
+
},
|
|
1150
|
+
style: { type: [
|
|
1151
|
+
Boolean,
|
|
1152
|
+
null,
|
|
1153
|
+
String,
|
|
1154
|
+
Object,
|
|
1155
|
+
Array
|
|
1156
|
+
] },
|
|
1157
|
+
timeout: {},
|
|
1158
|
+
transformFile: {},
|
|
1159
|
+
uploadTrigger: { default: "auto" },
|
|
1160
|
+
validateMessage: { type: [
|
|
1161
|
+
Object,
|
|
1162
|
+
String,
|
|
1163
|
+
Number,
|
|
1164
|
+
Boolean,
|
|
1165
|
+
null,
|
|
1166
|
+
Array
|
|
1167
|
+
] },
|
|
1168
|
+
validateStatus: {},
|
|
1169
|
+
withCredentials: {
|
|
1170
|
+
type: Boolean,
|
|
1171
|
+
default: !1
|
|
1172
|
+
},
|
|
1173
|
+
crop: { type: [Boolean, Object] },
|
|
1174
|
+
beforeCrop: {},
|
|
1175
|
+
onCropError: {},
|
|
1176
|
+
cropModalProps: {},
|
|
1177
|
+
previewFile: {},
|
|
1178
|
+
renderFileItem: {},
|
|
1179
|
+
renderPicInfo: {},
|
|
1180
|
+
renderThumbnail: {},
|
|
1181
|
+
renderPicPreviewIcon: {},
|
|
1182
|
+
renderPicClose: {},
|
|
1183
|
+
renderFileOperation: {},
|
|
1184
|
+
fileListTitle: { type: [
|
|
1185
|
+
Object,
|
|
1186
|
+
String,
|
|
1187
|
+
Number,
|
|
1188
|
+
Boolean,
|
|
1189
|
+
null,
|
|
1190
|
+
Array,
|
|
1191
|
+
Function
|
|
1192
|
+
] }
|
|
1193
|
+
},
|
|
1194
|
+
emits: [
|
|
1195
|
+
"acceptInvalid",
|
|
1196
|
+
"change",
|
|
1197
|
+
"clear",
|
|
1198
|
+
"cropError",
|
|
1199
|
+
"drop",
|
|
1200
|
+
"error",
|
|
1201
|
+
"exceed",
|
|
1202
|
+
"fileChange",
|
|
1203
|
+
"openFileDialog",
|
|
1204
|
+
"pastingError",
|
|
1205
|
+
"previewClick",
|
|
1206
|
+
"progress",
|
|
1207
|
+
"remove",
|
|
1208
|
+
"retry",
|
|
1209
|
+
"sizeError",
|
|
1210
|
+
"success",
|
|
1211
|
+
"update:fileList",
|
|
1212
|
+
"update:modelValue"
|
|
1213
|
+
],
|
|
1214
|
+
setup(e, { expose: t, emit: n }) {
|
|
1215
|
+
let r = Object.freeze({
|
|
1216
|
+
mainText: "点击上传文件或拖拽文件到这里",
|
|
1217
|
+
illegalTips: "不支持此类型文件",
|
|
1218
|
+
legalTips: "松手开始上传",
|
|
1219
|
+
retry: "重试",
|
|
1220
|
+
replace: "替换文件",
|
|
1221
|
+
clear: "清空",
|
|
1222
|
+
selectedFiles: "已选择文件",
|
|
1223
|
+
illegalSize: "文件尺寸不合法",
|
|
1224
|
+
fail: "上传失败",
|
|
1225
|
+
cropTitle: "裁切图片",
|
|
1226
|
+
cropOk: "确定",
|
|
1227
|
+
cropCancel: "取消"
|
|
1228
|
+
}), a = Object.freeze({
|
|
1229
|
+
mainText: "Click to Upload File or Drag File to here",
|
|
1230
|
+
illegalTips: "This type of file is not supported",
|
|
1231
|
+
legalTips: "Release and start uploading",
|
|
1232
|
+
retry: "Retry",
|
|
1233
|
+
replace: "Replace File",
|
|
1234
|
+
clear: "Clear",
|
|
1235
|
+
selectedFiles: "Selected Files",
|
|
1236
|
+
illegalSize: "Illegal file size",
|
|
1237
|
+
fail: "Upload fail",
|
|
1238
|
+
cropTitle: "Crop Image",
|
|
1239
|
+
cropOk: "OK",
|
|
1240
|
+
cropCancel: "Cancel"
|
|
1241
|
+
}), o = e, c = n, l = k(), u = le(), f = te(), b = ne(d, void 0), fe = ue("inputRef"), pe = ue("replaceInputRef"), j = ue("cropperRef");
|
|
1242
|
+
function M(e) {
|
|
1243
|
+
let t = f?.vnode.props, n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
1244
|
+
return !!(t && (Object.prototype.hasOwnProperty.call(t, e) || Object.prototype.hasOwnProperty.call(t, n)));
|
|
1245
|
+
}
|
|
1246
|
+
function N(e) {
|
|
1247
|
+
return !M(e) || o[e] !== !1;
|
|
1248
|
+
}
|
|
1249
|
+
let ge = m(() => N("showClear")), P = m(() => N("showRetry")), _e = m(() => !M("showTooltip") || o.showTooltip !== !1 && o.showTooltip), ve = m(() => N("showUploadList")), ye = m(() => M("fileList")), be = m(() => M("modelValue")), xe = m(() => ye.value || be.value), F = m(() => be.value ? o.modelValue ?? [] : ye.value ? o.fileList ?? [] : void 0), Se = m(() => b ? b.value : {
|
|
1250
|
+
direction: "ltr",
|
|
1251
|
+
locale: { code: "zh-CN" }
|
|
1252
|
+
}), I = m(() => ({
|
|
1253
|
+
...Se.value.locale.code === "en-US" ? a : r,
|
|
1254
|
+
...Se.value.locale.Upload
|
|
1255
|
+
})), L = ce({
|
|
1256
|
+
croppedFiles: [],
|
|
1257
|
+
dragAreaStatus: "default",
|
|
1258
|
+
fileList: [...F.value ?? o.defaultFileList],
|
|
1259
|
+
inputKey: 0,
|
|
1260
|
+
isReplaceOperation: !1,
|
|
1261
|
+
localUrls: [],
|
|
1262
|
+
nonImageFiles: [],
|
|
1263
|
+
pendingImageFiles: [],
|
|
1264
|
+
replaceIdx: -1,
|
|
1265
|
+
replaceInputKey: 0
|
|
1266
|
+
}), R = m(() => xe.value ? [...F.value ?? []] : L.fileList);
|
|
1267
|
+
de(F, (e) => {
|
|
1268
|
+
xe.value && (L.fileList = [...e ?? []]);
|
|
1269
|
+
});
|
|
1270
|
+
function Ce() {
|
|
1271
|
+
return {
|
|
1272
|
+
...o,
|
|
1273
|
+
addOnPasting: o.addOnPasting,
|
|
1274
|
+
beforeClear: o.beforeClear,
|
|
1275
|
+
beforeRemove: o.beforeRemove,
|
|
1276
|
+
disabled: o.disabled,
|
|
1277
|
+
fileList: L.fileList,
|
|
1278
|
+
listType: o.listType,
|
|
1279
|
+
multiple: o.multiple,
|
|
1280
|
+
showClear: ge.value,
|
|
1281
|
+
showRetry: P.value,
|
|
1282
|
+
showUploadList: ve.value,
|
|
1283
|
+
uploadTrigger: o.uploadTrigger,
|
|
1284
|
+
withCredentials: o.withCredentials
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
let we = /* @__PURE__ */ new Map(), z = E(null), B = E(null);
|
|
1288
|
+
function V(e) {
|
|
1289
|
+
return e.map((e) => ({ ...e }));
|
|
1290
|
+
}
|
|
1291
|
+
let Te = {
|
|
1292
|
+
getContext: () => void 0,
|
|
1293
|
+
getContexts: () => void 0,
|
|
1294
|
+
getProp: (e) => Ce()[e],
|
|
1295
|
+
getProps: Ce,
|
|
1296
|
+
getState: (e) => L[e],
|
|
1297
|
+
getStates: () => L,
|
|
1298
|
+
setState: (e, t) => {
|
|
1299
|
+
Object.assign(L, e), t?.();
|
|
1300
|
+
},
|
|
1301
|
+
getCache: (e) => we.get(e),
|
|
1302
|
+
getCaches: () => we,
|
|
1303
|
+
setCache: (e, t) => we.set(e, t),
|
|
1304
|
+
stopPropagation: (e) => e.stopPropagation?.(),
|
|
1305
|
+
persistEvent: () => void 0,
|
|
1306
|
+
notifyFileSelect: (e) => c("fileChange", e),
|
|
1307
|
+
notifyError: (e, t, n, r) => c("error", e, t, V(n), r),
|
|
1308
|
+
notifySuccess: (e, t, n) => c("success", e, t, V(n)),
|
|
1309
|
+
notifyProgress: (e, t, n) => c("progress", e, t, V(n)),
|
|
1310
|
+
notifyRemove: (e, t, n) => c("remove", e, V(t), { ...n }),
|
|
1311
|
+
notifySizeError: (e, t) => c("sizeError", e, V(t)),
|
|
1312
|
+
notifyExceed: (e) => c("exceed", e),
|
|
1313
|
+
updateFileList: (e, t) => {
|
|
1314
|
+
L.fileList = V(e), t?.();
|
|
1315
|
+
},
|
|
1316
|
+
notifyBeforeUpload: ({ file: e, fileList: t }) => o.beforeUpload?.({
|
|
1317
|
+
file: { ...e },
|
|
1318
|
+
fileList: V(t)
|
|
1319
|
+
}) ?? !0,
|
|
1320
|
+
notifyAfterUpload: ({ response: e, file: t, fileList: n }) => o.afterUpload?.({
|
|
1321
|
+
response: e,
|
|
1322
|
+
file: { ...t },
|
|
1323
|
+
fileList: V(n)
|
|
1324
|
+
}) ?? {},
|
|
1325
|
+
resetInput: () => {
|
|
1326
|
+
L.inputKey += 1;
|
|
1327
|
+
},
|
|
1328
|
+
resetReplaceInput: () => {
|
|
1329
|
+
L.replaceInputKey += 1;
|
|
1330
|
+
},
|
|
1331
|
+
updateDragAreaStatus: (e) => {
|
|
1332
|
+
L.dragAreaStatus = e;
|
|
1333
|
+
},
|
|
1334
|
+
notifyBeforeRemove: (e, t) => o.beforeRemove({ ...e }, V(t)),
|
|
1335
|
+
notifyBeforeClear: (e) => o.beforeClear(V(e)),
|
|
1336
|
+
notifyChange: ({ currentFile: e, fileList: t }) => {
|
|
1337
|
+
let n = {
|
|
1338
|
+
fileList: V(t),
|
|
1339
|
+
...e === void 0 ? {} : { currentFile: e && { ...e } }
|
|
1340
|
+
};
|
|
1341
|
+
c("change", n), c("update:fileList", n.fileList), c("update:modelValue", n.fileList);
|
|
1342
|
+
},
|
|
1343
|
+
updateLocalUrls: (e) => {
|
|
1344
|
+
L.localUrls = [...e];
|
|
1345
|
+
},
|
|
1346
|
+
notifyClear: () => c("clear"),
|
|
1347
|
+
notifyPreviewClick: (e) => c("previewClick", { ...e }),
|
|
1348
|
+
notifyDrop: (e, t, n) => c("drop", e, t, V(n)),
|
|
1349
|
+
notifyAcceptInvalid: (e) => c("acceptInvalid", e),
|
|
1350
|
+
registerPastingHandler: (e) => {
|
|
1351
|
+
if (typeof document > "u" || !e) return;
|
|
1352
|
+
let t = (t) => {
|
|
1353
|
+
if (o.crop && t.type === "keydown" && "code" in t && (Te.isMac() ? t.metaKey : t.ctrlKey) && t.code === "KeyV" && "clipboard" in navigator) {
|
|
1354
|
+
bt();
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
e(t);
|
|
1358
|
+
};
|
|
1359
|
+
document.body.addEventListener("keydown", t), z.value = t;
|
|
1360
|
+
},
|
|
1361
|
+
unRegisterPastingHandler: () => {
|
|
1362
|
+
typeof document < "u" && z.value && document.body.removeEventListener("keydown", z.value), z.value = null;
|
|
1363
|
+
},
|
|
1364
|
+
registerPasteEventHandler: (e) => {
|
|
1365
|
+
if (typeof document > "u" || !e) return;
|
|
1366
|
+
let t = (t) => {
|
|
1367
|
+
let n = Array.from(t.clipboardData?.items ?? []).filter((e) => e.kind === "file").map((e) => e.getAsFile()).filter((e) => !!e);
|
|
1368
|
+
if (o.crop && n.some(Q)) {
|
|
1369
|
+
t.preventDefault(), $(n);
|
|
1370
|
+
return;
|
|
1371
|
+
}
|
|
1372
|
+
e(t);
|
|
1373
|
+
};
|
|
1374
|
+
document.body.addEventListener("paste", t), B.value = t;
|
|
1375
|
+
},
|
|
1376
|
+
unRegisterPasteEventHandler: () => {
|
|
1377
|
+
typeof document < "u" && B.value && document.body.removeEventListener("paste", B.value), B.value = null;
|
|
1378
|
+
},
|
|
1379
|
+
isMac: () => typeof navigator < "u" && /MAC/i.test(navigator.platform),
|
|
1380
|
+
notifyPastingError: (e) => c("pastingError", e)
|
|
1381
|
+
}, H = re(new ke(Te));
|
|
1382
|
+
oe(() => H.init()), ae(() => {
|
|
1383
|
+
H.destroy(), Z.value && URL.revokeObjectURL(Z.value);
|
|
1384
|
+
});
|
|
1385
|
+
let Ee = m(() => [
|
|
1386
|
+
"semi-upload",
|
|
1387
|
+
o.listType === "picture" ? "semi-upload-picture" : null,
|
|
1388
|
+
o.disabled ? "semi-upload-disabled" : null,
|
|
1389
|
+
o.validateStatus ? `semi-upload-${o.validateStatus}` : null,
|
|
1390
|
+
Se.value.direction === "rtl" ? "semi-rtl" : null,
|
|
1391
|
+
o.className,
|
|
1392
|
+
o.class,
|
|
1393
|
+
l.class
|
|
1394
|
+
]), De = m(() => [o.style, l.style]), Oe = m(() => Object.fromEntries(Object.entries(l).filter(([e]) => !["class", "style"].includes(e) && (e.startsWith("data-") || e.startsWith("aria-"))))), U = m(() => o.directory ? {
|
|
1395
|
+
directory: "directory",
|
|
1396
|
+
webkitdirectory: "webkitdirectory"
|
|
1397
|
+
} : {}), Ae = m(() => o.limit === void 0 || o.limit > R.value.length), je = m(() => o.limit !== 1 && R.value.length > 0), Me = m(() => [
|
|
1398
|
+
"semi-upload-add",
|
|
1399
|
+
"semi-upload-picture-add",
|
|
1400
|
+
o.disabled ? "semi-upload-picture-add-disabled" : null,
|
|
1401
|
+
o.draggable && L.dragAreaStatus === "legal" ? "semi-upload-drag-area-legal" : null,
|
|
1402
|
+
o.draggable && L.dragAreaStatus === "illegal" ? "semi-upload-drag-area-illegal" : null
|
|
1403
|
+
]), Ne = m(() => [
|
|
1404
|
+
"semi-upload-drag-area",
|
|
1405
|
+
L.dragAreaStatus === "legal" ? "semi-upload-drag-area-legal" : null,
|
|
1406
|
+
L.dragAreaStatus === "illegal" ? "semi-upload-drag-area-illegal" : null,
|
|
1407
|
+
u.default ? "semi-upload-drag-area-custom" : null
|
|
1408
|
+
]);
|
|
1409
|
+
function G() {
|
|
1410
|
+
o.disabled || !fe.value || (fe.value.click(), c("openFileDialog"));
|
|
1411
|
+
}
|
|
1412
|
+
function Pe(e) {
|
|
1413
|
+
let t = e.target.files;
|
|
1414
|
+
t?.length && H.handleChange(t);
|
|
1415
|
+
}
|
|
1416
|
+
function Fe(e) {
|
|
1417
|
+
let t = e.target.files;
|
|
1418
|
+
if (!t?.length) return;
|
|
1419
|
+
let n = Array.from(t);
|
|
1420
|
+
if (o.crop && n.some(Q)) {
|
|
1421
|
+
$(n, !0);
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
H.handleReplaceChange(t);
|
|
1425
|
+
}
|
|
1426
|
+
function Ie(e) {
|
|
1427
|
+
H.handleRemove(e);
|
|
1428
|
+
}
|
|
1429
|
+
function Le() {
|
|
1430
|
+
H.handleClear();
|
|
1431
|
+
}
|
|
1432
|
+
function Re(e) {
|
|
1433
|
+
o.disabled || (L.replaceIdx = e, ie(() => pe.value?.click()));
|
|
1434
|
+
}
|
|
1435
|
+
function ze(e, t) {
|
|
1436
|
+
H.insertFileToList(e, t);
|
|
1437
|
+
}
|
|
1438
|
+
function Be() {
|
|
1439
|
+
H.manualUpload();
|
|
1440
|
+
}
|
|
1441
|
+
function K(e) {
|
|
1442
|
+
let t = Array.from(e.dataTransfer?.files ?? []);
|
|
1443
|
+
if (o.crop && !o.disabled && !o.directory && t.some(Q)) {
|
|
1444
|
+
e.preventDefault(), e.stopPropagation(), L.dragAreaStatus = "default", c("drop", e, t, [...L.fileList]), $(t);
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
H.handleDrop(e);
|
|
1448
|
+
}
|
|
1449
|
+
function q(e) {
|
|
1450
|
+
H.handleDragOver(e);
|
|
1451
|
+
}
|
|
1452
|
+
function J(e) {
|
|
1453
|
+
H.handleDragLeave(e);
|
|
1454
|
+
}
|
|
1455
|
+
function Y(e) {
|
|
1456
|
+
H.handleDragEnter(e);
|
|
1457
|
+
}
|
|
1458
|
+
function ct(e, t) {
|
|
1459
|
+
let n = e.validateMessage ?? (e.status === "uploadFail" ? I.value.fail : e._sizeInvalid ? I.value.illegalSize : void 0), r = {
|
|
1460
|
+
...e,
|
|
1461
|
+
index: t,
|
|
1462
|
+
key: e.uid || `${e.name}${t}`,
|
|
1463
|
+
listType: o.listType,
|
|
1464
|
+
disabled: o.disabled,
|
|
1465
|
+
onRemove: () => Ie(e),
|
|
1466
|
+
onRetry: () => {
|
|
1467
|
+
c("retry", e), H.retry(e);
|
|
1468
|
+
},
|
|
1469
|
+
onReplace: () => Re(t),
|
|
1470
|
+
...o.renderFileOperation ? { renderFileOperation: o.renderFileOperation } : {},
|
|
1471
|
+
...o.renderPicClose ? { renderPicClose: o.renderPicClose } : {},
|
|
1472
|
+
...o.renderPicInfo ? { renderPicInfo: o.renderPicInfo } : {},
|
|
1473
|
+
...o.renderPicPreviewIcon ? { renderPicPreviewIcon: o.renderPicPreviewIcon } : {},
|
|
1474
|
+
...o.renderThumbnail ? { renderThumbnail: o.renderThumbnail } : {},
|
|
1475
|
+
...o.previewFile ? { previewFile: o.previewFile } : {},
|
|
1476
|
+
...o.itemStyle ? { style: o.itemStyle } : {},
|
|
1477
|
+
...M("onPreviewClick") ? { onPreviewClick: () => H.handlePreviewClick(e) } : {},
|
|
1478
|
+
showPicInfo: o.showPicInfo,
|
|
1479
|
+
showReplace: e.showReplace ?? o.showReplace,
|
|
1480
|
+
showRetry: e.showRetry ?? P.value,
|
|
1481
|
+
showTooltip: _e.value
|
|
1482
|
+
};
|
|
1483
|
+
return o.picHeight !== void 0 && (r.picHeight = o.picHeight), o.picWidth !== void 0 && (r.picWidth = o.picWidth), n !== void 0 && (r.validateMessage = n), r;
|
|
1484
|
+
}
|
|
1485
|
+
function lt(e, t) {
|
|
1486
|
+
let n = ct(e, t);
|
|
1487
|
+
return u.fileItem?.(n) ?? o.renderFileItem?.(n);
|
|
1488
|
+
}
|
|
1489
|
+
let ut = m(() => R.value.map((e, t) => ({
|
|
1490
|
+
file: e,
|
|
1491
|
+
cardProps: ct(e, t),
|
|
1492
|
+
content: lt(e, t)
|
|
1493
|
+
})));
|
|
1494
|
+
function dt() {
|
|
1495
|
+
return {
|
|
1496
|
+
fileList: [...R.value],
|
|
1497
|
+
onClear: Le,
|
|
1498
|
+
clearText: I.value.clear
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
function ft() {
|
|
1502
|
+
let e = dt();
|
|
1503
|
+
return u.fileListTitle?.(e) ?? (typeof o.fileListTitle == "function" ? o.fileListTitle(e) : void 0);
|
|
1504
|
+
}
|
|
1505
|
+
let pt = m(() => ft()), mt = E(!1), X = E(null), Z = E("");
|
|
1506
|
+
function Q(e) {
|
|
1507
|
+
return e.type.startsWith("image/");
|
|
1508
|
+
}
|
|
1509
|
+
function ht(e, t) {
|
|
1510
|
+
t ? H.handleReplaceChange(e) : H.handleChange(e);
|
|
1511
|
+
}
|
|
1512
|
+
async function gt(e, t) {
|
|
1513
|
+
if (!o.beforeCrop) return !0;
|
|
1514
|
+
try {
|
|
1515
|
+
return await o.beforeCrop(e, t) !== !1;
|
|
1516
|
+
} catch (e) {
|
|
1517
|
+
let t = e instanceof Error ? e : Error(String(e));
|
|
1518
|
+
return o.onCropError?.(t), c("cropError", t), !1;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
async function $(e, t = !1) {
|
|
1522
|
+
let n = e.filter(Q), r = e.filter((e) => !Q(e)), i = n[0];
|
|
1523
|
+
if (!o.crop || !i) {
|
|
1524
|
+
ht(e, t);
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
if (!await gt(i, e)) {
|
|
1528
|
+
ht(e, t);
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1531
|
+
let [a, ...s] = t ? [i] : n;
|
|
1532
|
+
a && (X.value = a, Z.value = URL.createObjectURL(a), L.pendingImageFiles = s, L.nonImageFiles = t ? [] : r, L.croppedFiles = [], L.isReplaceOperation = t, mt.value = !0);
|
|
1533
|
+
}
|
|
1534
|
+
async function _t() {
|
|
1535
|
+
if (!(!X.value || !j.value)) try {
|
|
1536
|
+
let e = j.value.getCropperCanvas(), t = typeof o.crop == "object" ? o.crop : {}, n = await new Promise((n, r) => e.toBlob((e) => e ? n(e) : r(/* @__PURE__ */ Error("Failed to create blob")), X.value?.type || "image/png", t.quality ?? .92)), r = new File([n], X.value.name, {
|
|
1537
|
+
type: X.value.type,
|
|
1538
|
+
lastModified: X.value.lastModified
|
|
1539
|
+
}), i = [...L.croppedFiles, r], a = L.pendingImageFiles[0];
|
|
1540
|
+
if (a) {
|
|
1541
|
+
Z.value && URL.revokeObjectURL(Z.value), X.value = a, Z.value = URL.createObjectURL(a), L.pendingImageFiles = L.pendingImageFiles.slice(1), L.croppedFiles = i;
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
let s = [...i, ...L.nonImageFiles], c = L.isReplaceOperation;
|
|
1545
|
+
vt(), ht(s, c);
|
|
1546
|
+
} catch (e) {
|
|
1547
|
+
let t = e instanceof Error ? e : Error(String(e));
|
|
1548
|
+
o.onCropError?.(t), c("cropError", t);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
function vt() {
|
|
1552
|
+
Z.value && URL.revokeObjectURL(Z.value), mt.value = !1, X.value = null, Z.value = "", L.pendingImageFiles = [], L.nonImageFiles = [], L.croppedFiles = [], L.isReplaceOperation = !1, L.inputKey += 1, L.replaceInputKey += 1;
|
|
1553
|
+
}
|
|
1554
|
+
async function yt(e) {
|
|
1555
|
+
let t = Array.from(e.target.files ?? []);
|
|
1556
|
+
t.length && await $(t);
|
|
1557
|
+
}
|
|
1558
|
+
async function bt() {
|
|
1559
|
+
try {
|
|
1560
|
+
let e = await navigator.permissions.query({ name: "clipboard-read" });
|
|
1561
|
+
if (e.state !== "granted" && e.state !== "prompt") {
|
|
1562
|
+
c("pastingError", e);
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1565
|
+
let t = await navigator.clipboard.read(), n = [];
|
|
1566
|
+
for (let e of t) for (let t of e.types.filter((e) => e.startsWith("image/"))) {
|
|
1567
|
+
let r = await e.getType(t), i = t.split("/")[1] ?? "png";
|
|
1568
|
+
n.push(new File([await r.arrayBuffer()], `paste.${i}`, { type: t }));
|
|
1569
|
+
}
|
|
1570
|
+
n.length && await $(n);
|
|
1571
|
+
} catch (e) {
|
|
1572
|
+
c("pastingError", e instanceof Error ? e : Error(String(e)));
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
return t({
|
|
1576
|
+
insert: ze,
|
|
1577
|
+
upload: Be,
|
|
1578
|
+
openFileDialog: G,
|
|
1579
|
+
clear: Le,
|
|
1580
|
+
remove: Ie
|
|
1581
|
+
}), (e, t) => (w(), _("div", x(Oe.value, {
|
|
1582
|
+
class: Ee.value,
|
|
1583
|
+
style: De.value,
|
|
1584
|
+
"x-prompt-pos": o.promptPosition
|
|
1585
|
+
}), [
|
|
1586
|
+
(w(), _("input", x({
|
|
1587
|
+
key: O(L).inputKey,
|
|
1588
|
+
ref_key: "inputRef",
|
|
1589
|
+
ref: fe
|
|
1590
|
+
}, U.value, {
|
|
1591
|
+
capture: o.capture || void 0,
|
|
1592
|
+
multiple: o.multiple,
|
|
1593
|
+
accept: o.accept,
|
|
1594
|
+
type: "file",
|
|
1595
|
+
autocomplete: "off",
|
|
1596
|
+
tabindex: "-1",
|
|
1597
|
+
class: "semi-upload-hidden-input",
|
|
1598
|
+
onChange: t[0] ||= (e) => o.crop ? yt(e) : Pe(e)
|
|
1599
|
+
}), null, 16, Ue)),
|
|
1600
|
+
(w(), _("input", {
|
|
1601
|
+
key: O(L).replaceInputKey,
|
|
1602
|
+
ref_key: "replaceInputRef",
|
|
1603
|
+
ref: pe,
|
|
1604
|
+
accept: o.accept,
|
|
1605
|
+
type: "file",
|
|
1606
|
+
autocomplete: "off",
|
|
1607
|
+
tabindex: "-1",
|
|
1608
|
+
class: "semi-upload-hidden-input-replace",
|
|
1609
|
+
onChange: Fe
|
|
1610
|
+
}, null, 40, We)),
|
|
1611
|
+
o.listType === "picture" ? g("", !0) : (w(), _(p, { key: 0 }, [o.draggable ? (w(), _("div", {
|
|
1612
|
+
key: 0,
|
|
1613
|
+
role: "button",
|
|
1614
|
+
tabindex: "0",
|
|
1615
|
+
"aria-disabled": o.disabled,
|
|
1616
|
+
class: S(Ne.value),
|
|
1617
|
+
onDrop: K,
|
|
1618
|
+
onDragover: q,
|
|
1619
|
+
onDragleave: J,
|
|
1620
|
+
onDragenter: Y,
|
|
1621
|
+
onClick: G
|
|
1622
|
+
}, [O(u).default ? T(e.$slots, "default", {}, void 0, void 0, 0) : (w(), _(p, { key: 1 }, [v("div", Ke, [T(e.$slots, "dragIcon", {}, () => [o.dragIcon ? (w(), h(O(W), {
|
|
1623
|
+
key: 0,
|
|
1624
|
+
content: o.dragIcon
|
|
1625
|
+
}, null, 8, ["content"])) : (w(), h(O(he), {
|
|
1626
|
+
key: 1,
|
|
1627
|
+
size: "extra-large"
|
|
1628
|
+
}))])]), v("div", qe, [
|
|
1629
|
+
v("div", Je, [T(e.$slots, "dragMainText", {}, () => [o.dragMainText ? (w(), h(O(W), {
|
|
1630
|
+
key: 0,
|
|
1631
|
+
content: o.dragMainText
|
|
1632
|
+
}, null, 8, ["content"])) : (w(), _(p, { key: 1 }, [ee(D(I.value.mainText), 1)], 64))])]),
|
|
1633
|
+
v("div", Ye, [T(e.$slots, "dragSubText", {}, () => [o.dragSubText ? (w(), h(O(W), {
|
|
1634
|
+
key: 0,
|
|
1635
|
+
content: o.dragSubText
|
|
1636
|
+
}, null, 8, ["content"])) : g("", !0)])]),
|
|
1637
|
+
v("div", Xe, [O(L).dragAreaStatus === "legal" ? (w(), _("span", Ze, D(I.value.legalTips), 1)) : g("", !0), O(L).dragAreaStatus === "illegal" ? (w(), _("span", Qe, D(I.value.illegalTips), 1)) : g("", !0)])
|
|
1638
|
+
])], 64))], 42, Ge)) : (w(), _("div", {
|
|
1639
|
+
key: 1,
|
|
1640
|
+
role: "button",
|
|
1641
|
+
tabindex: "0",
|
|
1642
|
+
"aria-disabled": o.disabled,
|
|
1643
|
+
class: "semi-upload-add",
|
|
1644
|
+
onClick: G
|
|
1645
|
+
}, [T(e.$slots, "default")], 8, $e))], 64)),
|
|
1646
|
+
O(u).prompt || o.prompt ? (w(), _("div", et, [T(e.$slots, "prompt", {}, () => [y(O(W), { content: o.prompt }, null, 8, ["content"])])])) : g("", !0),
|
|
1647
|
+
o.validateMessage ? (w(), _("div", tt, [y(O(W), { content: o.validateMessage }, null, 8, ["content"])])) : g("", !0),
|
|
1648
|
+
o.listType === "picture" ? (w(), _(p, { key: 3 }, [ve.value && R.value.length ? (w(), _("div", nt, [v("div", rt, [
|
|
1649
|
+
Ae.value && o.hotSpotLocation === "start" ? (w(), _("div", {
|
|
1650
|
+
key: 0,
|
|
1651
|
+
role: "button",
|
|
1652
|
+
class: S(Me.value),
|
|
1653
|
+
style: C({
|
|
1654
|
+
height: o.picHeight,
|
|
1655
|
+
width: o.picWidth
|
|
1656
|
+
}),
|
|
1657
|
+
"x-semi-prop": "children",
|
|
1658
|
+
onClick: G,
|
|
1659
|
+
onDrop: t[1] ||= (e) => o.draggable ? K(e) : void 0,
|
|
1660
|
+
onDragover: t[2] ||= (e) => o.draggable ? q(e) : void 0,
|
|
1661
|
+
onDragleave: t[3] ||= (e) => o.draggable ? J(e) : void 0,
|
|
1662
|
+
onDragenter: t[4] ||= (e) => o.draggable ? Y(e) : void 0
|
|
1663
|
+
}, [T(e.$slots, "default", {}, () => [y(O(me))])], 38)) : g("", !0),
|
|
1664
|
+
(w(!0), _(p, null, se(ut.value, (e) => (w(), _(p, { key: e.cardProps.key }, [e.content === void 0 ? (w(), h(Ve, x({
|
|
1665
|
+
key: 1,
|
|
1666
|
+
ref_for: !0
|
|
1667
|
+
}, e.cardProps, { _locale: I.value }), null, 16, ["_locale"])) : (w(), h(O(W), {
|
|
1668
|
+
key: 0,
|
|
1669
|
+
content: e.content
|
|
1670
|
+
}, null, 8, ["content"]))], 64))), 128)),
|
|
1671
|
+
Ae.value && o.hotSpotLocation === "end" ? (w(), _("div", {
|
|
1672
|
+
key: 1,
|
|
1673
|
+
role: "button",
|
|
1674
|
+
class: S(Me.value),
|
|
1675
|
+
style: C({
|
|
1676
|
+
height: o.picHeight,
|
|
1677
|
+
width: o.picWidth
|
|
1678
|
+
}),
|
|
1679
|
+
"x-semi-prop": "children",
|
|
1680
|
+
onClick: G,
|
|
1681
|
+
onDrop: t[5] ||= (e) => o.draggable ? K(e) : void 0,
|
|
1682
|
+
onDragover: t[6] ||= (e) => o.draggable ? q(e) : void 0,
|
|
1683
|
+
onDragleave: t[7] ||= (e) => o.draggable ? J(e) : void 0,
|
|
1684
|
+
onDragenter: t[8] ||= (e) => o.draggable ? Y(e) : void 0
|
|
1685
|
+
}, [T(e.$slots, "default", {}, () => [y(O(me))])], 38)) : g("", !0)
|
|
1686
|
+
])])) : Ae.value ? (w(), _("div", {
|
|
1687
|
+
key: 1,
|
|
1688
|
+
role: "button",
|
|
1689
|
+
class: S(Me.value),
|
|
1690
|
+
style: C({
|
|
1691
|
+
height: o.picHeight,
|
|
1692
|
+
width: o.picWidth
|
|
1693
|
+
}),
|
|
1694
|
+
"x-semi-prop": "children",
|
|
1695
|
+
onClick: G,
|
|
1696
|
+
onDrop: t[9] ||= (e) => o.draggable ? K(e) : void 0,
|
|
1697
|
+
onDragover: t[10] ||= (e) => o.draggable ? q(e) : void 0,
|
|
1698
|
+
onDragleave: t[11] ||= (e) => o.draggable ? J(e) : void 0,
|
|
1699
|
+
onDragenter: t[12] ||= (e) => o.draggable ? Y(e) : void 0
|
|
1700
|
+
}, [T(e.$slots, "default", {}, () => [y(O(me))])], 38)) : g("", !0)], 64)) : o.listType === "list" && ve.value && R.value.length ? (w(), _("div", it, [je.value ? (w(), _("div", at, [pt.value === void 0 ? (w(), _(p, { key: 1 }, [v("span", ot, [o.fileListTitle && typeof o.fileListTitle != "function" ? (w(), h(O(W), {
|
|
1701
|
+
key: 0,
|
|
1702
|
+
content: o.fileListTitle
|
|
1703
|
+
}, null, 8, ["content"])) : (w(), _(p, { key: 1 }, [ee(D(I.value.selectedFiles), 1)], 64))]), ge.value && !o.disabled ? (w(), _("span", {
|
|
1704
|
+
key: 0,
|
|
1705
|
+
role: "button",
|
|
1706
|
+
tabindex: "0",
|
|
1707
|
+
class: "semi-upload-file-list-title-clear",
|
|
1708
|
+
onClick: Le
|
|
1709
|
+
}, D(I.value.clear), 1)) : g("", !0)], 64)) : (w(), h(O(W), {
|
|
1710
|
+
key: 0,
|
|
1711
|
+
content: pt.value
|
|
1712
|
+
}, null, 8, ["content"]))])) : g("", !0), v("div", st, [(w(!0), _(p, null, se(ut.value, (e) => (w(), _(p, { key: e.cardProps.key }, [e.content === void 0 ? (w(), h(Ve, x({
|
|
1713
|
+
key: 1,
|
|
1714
|
+
ref_for: !0
|
|
1715
|
+
}, e.cardProps, { _locale: I.value }), null, 16, ["_locale"])) : (w(), h(O(W), {
|
|
1716
|
+
key: 0,
|
|
1717
|
+
content: e.content
|
|
1718
|
+
}, null, 8, ["content"]))], 64))), 128))])])) : g("", !0),
|
|
1719
|
+
o.crop ? (w(), h(s, x({ key: 5 }, o.cropModalProps, {
|
|
1720
|
+
visible: mt.value,
|
|
1721
|
+
title: typeof o.crop == "object" && o.crop.modalTitle ? o.crop.modalTitle : I.value.cropTitle,
|
|
1722
|
+
"ok-text": typeof o.crop == "object" && o.crop.modalOkText ? o.crop.modalOkText : I.value.cropOk,
|
|
1723
|
+
"cancel-text": typeof o.crop == "object" && o.crop.modalCancelText ? o.crop.modalCancelText : I.value.cropCancel,
|
|
1724
|
+
"on-ok": _t,
|
|
1725
|
+
"on-cancel": vt
|
|
1726
|
+
}), {
|
|
1727
|
+
default: A(() => [Z.value ? (w(), h(i, {
|
|
1728
|
+
key: 0,
|
|
1729
|
+
ref_key: "cropperRef",
|
|
1730
|
+
ref: j,
|
|
1731
|
+
src: Z.value,
|
|
1732
|
+
shape: typeof o.crop == "object" ? o.crop.shape ?? "rect" : "rect",
|
|
1733
|
+
"aspect-ratio": typeof o.crop == "object" ? o.crop.aspectRatio : void 0,
|
|
1734
|
+
"min-zoom": typeof o.crop == "object" ? o.crop.minZoom : void 0,
|
|
1735
|
+
"max-zoom": typeof o.crop == "object" ? o.crop.maxZoom : void 0,
|
|
1736
|
+
"zoom-step": typeof o.crop == "object" ? o.crop.zoomStep : void 0,
|
|
1737
|
+
fill: typeof o.crop == "object" ? o.crop.fill : void 0,
|
|
1738
|
+
style: {
|
|
1739
|
+
width: "100%",
|
|
1740
|
+
height: "100%"
|
|
1741
|
+
}
|
|
1742
|
+
}, null, 8, [
|
|
1743
|
+
"src",
|
|
1744
|
+
"shape",
|
|
1745
|
+
"aspect-ratio",
|
|
1746
|
+
"min-zoom",
|
|
1747
|
+
"max-zoom",
|
|
1748
|
+
"zoom-step",
|
|
1749
|
+
"fill"
|
|
1750
|
+
])) : g("", !0)]),
|
|
1751
|
+
_: 1
|
|
1752
|
+
}, 16, [
|
|
1753
|
+
"visible",
|
|
1754
|
+
"title",
|
|
1755
|
+
"ok-text",
|
|
1756
|
+
"cancel-text"
|
|
1757
|
+
])) : g("", !0)
|
|
1758
|
+
], 16, He));
|
|
1759
|
+
}
|
|
1760
|
+
}), J = [
|
|
1761
|
+
"picture",
|
|
1762
|
+
"list",
|
|
1763
|
+
"none"
|
|
1764
|
+
], Y = [
|
|
1765
|
+
"left",
|
|
1766
|
+
"right",
|
|
1767
|
+
"bottom"
|
|
1768
|
+
], ct = ["auto", "custom"], lt = [
|
|
1769
|
+
"success",
|
|
1770
|
+
"uploadFail",
|
|
1771
|
+
"validateFail",
|
|
1772
|
+
"validating",
|
|
1773
|
+
"uploading",
|
|
1774
|
+
"wait"
|
|
1775
|
+
], ut = Object.assign(q, { FileCard: Ve });
|
|
1776
|
+
//#endregion
|
|
1777
|
+
export { ct as a, Y as i, lt as n, Ve as o, J as r, ut as t };
|