vue-devui 1.0.0-alpha.1 → 1.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +161 -172
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +204 -1
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.d.ts +7 -0
- package/auto-complete/index.es.js +9051 -0
- package/auto-complete/index.umd.js +40 -0
- package/auto-complete/package.json +7 -0
- package/auto-complete/style.css +1 -0
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +308 -1
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +120 -1
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +5964 -1
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +89 -1
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +8207 -1
- package/checkbox/index.umd.js +38 -1
- package/checkbox/style.css +1 -1
- package/collapse/index.d.ts +7 -0
- package/collapse/index.es.js +195 -0
- package/collapse/index.umd.js +1 -0
- package/{carousel → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +217 -0
- package/countdown/index.umd.js +1 -0
- package/{accordion → countdown}/package.json +1 -1
- package/countdown/style.css +1 -0
- package/date-picker-pro/index.d.ts +7 -0
- package/date-picker-pro/index.es.js +12031 -0
- package/date-picker-pro/index.umd.js +38 -0
- package/date-picker-pro/package.json +7 -0
- package/date-picker-pro/style.css +1 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +248 -0
- package/drawer/index.umd.js +1 -0
- package/{anchor → drawer}/package.json +1 -1
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +743 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +991 -1
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +7751 -0
- package/form/index.umd.js +38 -0
- package/{toast → form}/package.json +1 -1
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +166 -0
- package/fullscreen/index.umd.js +1 -0
- package/fullscreen/package.json +7 -0
- package/fullscreen/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +271 -0
- package/grid/index.umd.js +1 -0
- package/{sticky → grid}/package.json +1 -1
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +218 -1
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +511 -1
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +8311 -1
- package/input/index.umd.js +38 -1
- package/input/style.css +1 -1
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +308 -1
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +115 -0
- package/layout/index.umd.js +1 -0
- package/layout/package.json +7 -0
- package/layout/style.css +1 -0
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +272 -1
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/message/index.d.ts +7 -0
- package/message/index.es.js +534 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +741 -0
- package/modal/index.umd.js +1 -0
- package/modal/package.json +7 -0
- package/modal/style.css +1 -0
- package/notification/index.d.ts +7 -0
- package/notification/index.es.js +528 -0
- package/notification/index.umd.js +1 -0
- package/notification/package.json +7 -0
- package/notification/style.css +1 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/AutoComplete.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/DrawerService.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/DropdownMenu.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/IFileOptions.js +3 -0
- package/nuxt/components/IUploadOptions.js +3 -0
- package/nuxt/components/Icon.js +3 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Message.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/Notification.js +3 -0
- package/nuxt/components/NotificationService.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/Step.js +3 -0
- package/nuxt/components/Steps.js +3 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/UploadStatus.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/badgeProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/datePickerProCommonProps.js +3 -0
- package/nuxt/components/datePickerProPanelProps.js +3 -0
- package/nuxt/components/datePickerProProps.js +3 -0
- package/nuxt/components/dropdownMenuProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/fixedOverlayProps.js +3 -0
- package/nuxt/components/flexibleOverlayProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/notificationProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/popoverProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/skeletonItemProps.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/stepProps.js +3 -0
- package/nuxt/components/stepsProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/tooltipProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/nuxt/components/uploadProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +293 -1
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +17 -82
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +820 -1
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +218 -1
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +6062 -1
- package/popover/index.umd.js +27 -1
- package/popover/style.css +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +207 -1
- package/progress/index.umd.js +3 -1
- package/progress/style.css +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +8056 -1
- package/radio/index.umd.js +38 -1
- package/radio/style.css +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +242 -1
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.d.ts +7 -0
- package/result/index.es.js +248 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +173 -1
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +8504 -2
- package/search/index.umd.js +38 -10
- package/search/style.css +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +9423 -1
- package/select/index.umd.js +38 -1
- package/select/style.css +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +145 -0
- package/skeleton/index.umd.js +1 -0
- package/skeleton/package.json +7 -0
- package/skeleton/style.css +1 -0
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +203 -1
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +6754 -1
- package/splitter/index.umd.js +27 -1
- package/splitter/style.css +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +253 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +63 -1
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps/index.d.ts +7 -0
- package/steps/index.es.js +386 -0
- package/steps/index.umd.js +1 -0
- package/steps/package.json +7 -0
- package/steps/style.css +1 -0
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +7852 -1
- package/switch/index.umd.js +38 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +11527 -0
- package/table/index.umd.js +38 -0
- package/table/package.json +7 -0
- package/table/style.css +1 -0
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +407 -1
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +156 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +7986 -0
- package/textarea/index.umd.js +46 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/{theme → theme/theme.scss} +0 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9556 -0
- package/time-picker/index.umd.js +38 -0
- package/{date-picker → time-picker}/package.json +1 -1
- package/time-picker/style.css +1 -0
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9604 -0
- package/time-select/index.umd.js +38 -0
- package/time-select/package.json +7 -0
- package/time-select/style.css +1 -0
- package/timeline/index.d.ts +7 -0
- package/timeline/index.es.js +427 -0
- package/timeline/index.umd.js +1 -0
- package/timeline/package.json +7 -0
- package/timeline/style.css +1 -0
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +5900 -1
- package/tooltip/index.umd.js +27 -1
- package/tooltip/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +10336 -1
- package/tree/index.umd.js +38 -1
- package/tree/style.css +1 -1
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +1398 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27443 -2
- package/vue-devui.umd.js +50 -10
- package/accordion/index.es.js +0 -1
- package/accordion/index.umd.js +0 -1
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -1
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/carousel/index.es.js +0 -1
- package/carousel/index.umd.js +0 -1
- package/carousel/style.css +0 -1
- package/date-picker/index.es.js +0 -1
- package/date-picker/index.umd.js +0 -1
- package/date-picker/style.css +0 -1
- package/quadrant-diagram/index.es.js +0 -10
- package/quadrant-diagram/index.umd.js +0 -10
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/sticky/index.es.js +0 -1
- package/sticky/index.umd.js +0 -1
- package/tag-input/index.es.js +0 -1
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/toast/index.es.js +0 -1
- package/toast/index.umd.js +0 -1
- package/toast/style.css +0 -1
- package/transfer/index.es.js +0 -10
- package/transfer/index.umd.js +0 -10
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
package/upload/index.es.js
CHANGED
|
@@ -1 +1,1398 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,l=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&a(e,n,t[n]);if(r)for(var n of r(t))i.call(t,n)&&a(e,n,t[n]);return e},u=("undefined"!=typeof require&&require,(e,t,n)=>(a(e,"symbol"!=typeof t?t+"":t,n),n));import{defineComponent as s,createVNode as c,getCurrentInstance as d,ref as p,computed as f,watch as v,nextTick as h,onUnmounted as y,mergeProps as b,createApp as m,toRefs as g,withDirectives as j,resolveComponent as _,createTextVNode as O,resolveDirective as F,Fragment as w,isVNode as x}from"vue";const T={value:{type:Array,required:!0,default:()=>[]},life:{type:Number,default:null},lifeMode:{type:String,default:"global"},sticky:{type:Boolean,default:!1},style:{type:Object,default:()=>({})},styleClass:{type:String},onCloseEvent:{type:Function},onValueChange:{type:Function}};var A=s({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup:e=>l({},e),render(){const{name:e,size:t,color:n,classPrefix:r}=this;return c("i",{class:`${r} ${r}-${e}`,style:{fontSize:t,color:n}},null)}});A.install=function(e){e.component(A.name,A)};var E=s({name:"DToastIconClose",props:{prefixCls:String,onClick:Function},emits:["click"],render(){const{prefixCls:e,$emit:t}=this;return c("div",{class:`${e}-icon-close`,onClick:e=>t("click",e)},[c(A,{name:"close",size:"14px"},null)])}}),S=s({name:"DToastImage",props:{prefixCls:String,severity:String},render(){const{prefixCls:e,severity:t}=this;return c("span",{class:[`${e}-image`,`${e}-image-${t||"common"}`]},["common"!==t?c(A,{name:{info:"info-o",success:"right-o",warn:"warning-o",error:"error-o"}[t],size:"14px"},null):null])}}),D="object"==typeof global&&global&&global.Object===Object&&global,U="object"==typeof self&&self&&self.Object===Object&&self,k=D||U||Function("return this")(),C=k.Symbol,M=Object.prototype,$=M.hasOwnProperty,I=M.toString,P=C?C.toStringTag:void 0;var z=Object.prototype.toString;var B=C?C.toStringTag:void 0;function N(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":B&&B in Object(e)?function(e){var t=$.call(e,P),n=e[P];try{e[P]=void 0;var r=!0}catch(i){}var o=I.call(e);return r&&(t?e[P]=n:delete e[P]),o}(e):function(e){return z.call(e)}(e)}function L(e){return null!=e&&"object"==typeof e}function R(e){return"symbol"==typeof e||L(e)&&"[object Symbol]"==N(e)}function q(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var V=Array.isArray,W=C?C.prototype:void 0,H=W?W.toString:void 0;function X(e){if("string"==typeof e)return e;if(V(e))return q(e,X)+"";if(R(e))return H?H.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}var G=/\s/;var J=/^\s+/;function K(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&G.test(e.charAt(t)););return t}(e)+1).replace(J,""):e}function Q(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var Y=/^[-+]0x[0-9a-f]+$/i,Z=/^0b[01]+$/i,ee=/^0o[0-7]+$/i,te=parseInt;function ne(e){if("number"==typeof e)return e;if(R(e))return NaN;if(Q(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Q(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=K(e);var n=Z.test(e);return n||ee.test(e)?te(e.slice(2),n?2:8):Y.test(e)?NaN:+e}function re(e){return e}function oe(e){if(!Q(e))return!1;var t=N(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var ie,ae=k["__core-js_shared__"],le=(ie=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||""))?"Symbol(src)_1."+ie:"";var ue=Function.prototype.toString;function se(e){if(null!=e){try{return ue.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var ce=/^\[object .+?Constructor\]$/,de=Function.prototype,pe=Object.prototype,fe=de.toString,ve=pe.hasOwnProperty,he=RegExp("^"+fe.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ye(e){return!(!Q(e)||(t=e,le&&le in t))&&(oe(e)?he:ce).test(se(e));var t}function be(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ye(n)?n:void 0}var me=be(k,"WeakMap"),ge=Object.create,je=function(){function e(){}return function(t){if(!Q(t))return{};if(ge)return ge(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function _e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Oe(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Fe=Date.now;var we,xe,Te,Ae=function(){try{var e=be(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Ee=(we=Ae?function(e,t){return Ae(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:re,xe=0,Te=0,function(){var e=Fe(),t=16-(e-Te);if(Te=e,t>0){if(++xe>=800)return arguments[0]}else xe=0;return we.apply(void 0,arguments)});var Se=/^(?:0|[1-9]\d*)$/;function De(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Se.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e,t,n){"__proto__"==t&&Ae?Ae(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ke(e,t){return e===t||e!=e&&t!=t}var Ce=Object.prototype.hasOwnProperty;function Me(e,t,n){var r=e[t];Ce.call(e,t)&&ke(r,n)&&(void 0!==n||t in e)||Ue(e,t,n)}function $e(e,t,n,r){var o=!n;n||(n={});for(var i=-1,a=t.length;++i<a;){var l=t[i],u=r?r(n[l],e[l],l,n,e):void 0;void 0===u&&(u=e[l]),o?Ue(n,l,u):Me(n,l,u)}return n}var Ie=Math.max;function Pe(e,t,n){return t=Ie(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=Ie(r.length-t,0),a=Array(i);++o<i;)a[o]=r[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=r[o];return l[t]=n(a),_e(e,this,l)}}function ze(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Be(e){return null!=e&&ze(e.length)&&!oe(e)}var Ne=Object.prototype;function Le(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ne)}function Re(e){return L(e)&&"[object Arguments]"==N(e)}var qe=Object.prototype,Ve=qe.hasOwnProperty,We=qe.propertyIsEnumerable,He=Re(function(){return arguments}())?Re:function(e){return L(e)&&Ve.call(e,"callee")&&!We.call(e,"callee")};var Xe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ge=Xe&&"object"==typeof module&&module&&!module.nodeType&&module,Je=Ge&&Ge.exports===Xe?k.Buffer:void 0,Ke=(Je?Je.isBuffer:void 0)||function(){return!1},Qe={};function Ye(e){return function(t){return e(t)}}Qe["[object Float32Array]"]=Qe["[object Float64Array]"]=Qe["[object Int8Array]"]=Qe["[object Int16Array]"]=Qe["[object Int32Array]"]=Qe["[object Uint8Array]"]=Qe["[object Uint8ClampedArray]"]=Qe["[object Uint16Array]"]=Qe["[object Uint32Array]"]=!0,Qe["[object Arguments]"]=Qe["[object Array]"]=Qe["[object ArrayBuffer]"]=Qe["[object Boolean]"]=Qe["[object DataView]"]=Qe["[object Date]"]=Qe["[object Error]"]=Qe["[object Function]"]=Qe["[object Map]"]=Qe["[object Number]"]=Qe["[object Object]"]=Qe["[object RegExp]"]=Qe["[object Set]"]=Qe["[object String]"]=Qe["[object WeakMap]"]=!1;var Ze="object"==typeof exports&&exports&&!exports.nodeType&&exports,et=Ze&&"object"==typeof module&&module&&!module.nodeType&&module,tt=et&&et.exports===Ze&&D.process,nt=function(){try{var e=et&&et.require&&et.require("util").types;return e||tt&&tt.binding&&tt.binding("util")}catch(t){}}(),rt=nt&&nt.isTypedArray,ot=rt?Ye(rt):function(e){return L(e)&&ze(e.length)&&!!Qe[N(e)]},it=Object.prototype.hasOwnProperty;function at(e,t){var n=V(e),r=!n&&He(e),o=!n&&!r&&Ke(e),i=!n&&!r&&!o&&ot(e),a=n||r||o||i,l=a?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],u=l.length;for(var s in e)!t&&!it.call(e,s)||a&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||De(s,u))||l.push(s);return l}function lt(e,t){return function(n){return e(t(n))}}var ut=lt(Object.keys,Object),st=Object.prototype.hasOwnProperty;function ct(e){return Be(e)?at(e):function(e){if(!Le(e))return ut(e);var t=[];for(var n in Object(e))st.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var dt=Object.prototype.hasOwnProperty;function pt(e){if(!Q(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Le(e),n=[];for(var r in e)("constructor"!=r||!t&&dt.call(e,r))&&n.push(r);return n}function ft(e){return Be(e)?at(e,!0):pt(e)}var vt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ht=/^\w*$/;var yt=be(Object,"create");var bt=Object.prototype.hasOwnProperty;var mt=Object.prototype.hasOwnProperty;function gt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function jt(e,t){for(var n=e.length;n--;)if(ke(e[n][0],t))return n;return-1}gt.prototype.clear=function(){this.__data__=yt?yt(null):{},this.size=0},gt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},gt.prototype.get=function(e){var t=this.__data__;if(yt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return bt.call(t,e)?t[e]:void 0},gt.prototype.has=function(e){var t=this.__data__;return yt?void 0!==t[e]:mt.call(t,e)},gt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=yt&&void 0===t?"__lodash_hash_undefined__":t,this};var _t=Array.prototype.splice;function Ot(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ot.prototype.clear=function(){this.__data__=[],this.size=0},Ot.prototype.delete=function(e){var t=this.__data__,n=jt(t,e);return!(n<0)&&(n==t.length-1?t.pop():_t.call(t,n,1),--this.size,!0)},Ot.prototype.get=function(e){var t=this.__data__,n=jt(t,e);return n<0?void 0:t[n][1]},Ot.prototype.has=function(e){return jt(this.__data__,e)>-1},Ot.prototype.set=function(e,t){var n=this.__data__,r=jt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Ft=be(k,"Map");function wt(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function xt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}xt.prototype.clear=function(){this.size=0,this.__data__={hash:new gt,map:new(Ft||Ot),string:new gt}},xt.prototype.delete=function(e){var t=wt(this,e).delete(e);return this.size-=t?1:0,t},xt.prototype.get=function(e){return wt(this,e).get(e)},xt.prototype.has=function(e){return wt(this,e).has(e)},xt.prototype.set=function(e,t){var n=wt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function Tt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Tt.Cache||xt),n}Tt.Cache=xt;var At=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Et=/\\(\\)?/g,St=function(e){var t=Tt(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(At,(function(e,n,r,o){t.push(r?o.replace(Et,"$1"):n||e)})),t}));function Dt(e,t){return V(e)?e:function(e,t){if(V(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!R(e))||ht.test(e)||!vt.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:St(function(e){return null==e?"":X(e)}(e))}function Ut(e){if("string"==typeof e||R(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}function kt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}var Ct=C?C.isConcatSpreadable:void 0;function Mt(e){return V(e)||He(e)||!!(Ct&&e&&e[Ct])}function $t(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=Mt),o||(o=[]);++i<a;){var l=e[i];t>0&&n(l)?t>1?$t(l,t-1,n,r,o):kt(o,l):r||(o[o.length]=l)}return o}function It(e){return(null==e?0:e.length)?$t(e,1):[]}var Pt=lt(Object.getPrototypeOf,Object),zt=Function.prototype,Bt=Object.prototype,Nt=zt.toString,Lt=Bt.hasOwnProperty,Rt=Nt.call(Object);function qt(e){if(!L(e)||"[object Object]"!=N(e))return!1;var t=Pt(e);if(null===t)return!0;var n=Lt.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Nt.call(n)==Rt}function Vt(e){var t=this.__data__=new Ot(e);this.size=t.size}Vt.prototype.clear=function(){this.__data__=new Ot,this.size=0},Vt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Vt.prototype.get=function(e){return this.__data__.get(e)},Vt.prototype.has=function(e){return this.__data__.has(e)},Vt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ot){var r=n.__data__;if(!Ft||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new xt(r)}return n.set(e,t),this.size=n.size,this};var Wt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ht=Wt&&"object"==typeof module&&module&&!module.nodeType&&module,Xt=Ht&&Ht.exports===Wt?k.Buffer:void 0,Gt=Xt?Xt.allocUnsafe:void 0;function Jt(e,t){if(t)return e.slice();var n=e.length,r=Gt?Gt(n):new e.constructor(n);return e.copy(r),r}function Kt(){return[]}var Qt=Object.prototype.propertyIsEnumerable,Yt=Object.getOwnPropertySymbols,Zt=Yt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}(Yt(e),(function(t){return Qt.call(e,t)})))}:Kt;var en=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)kt(t,Zt(e)),e=Pt(e);return t}:Kt;function tn(e,t,n){var r=t(e);return V(e)?r:kt(r,n(e))}function nn(e){return tn(e,ct,Zt)}function rn(e){return tn(e,ft,en)}var on=be(k,"DataView"),an=be(k,"Promise"),ln=be(k,"Set"),un=se(on),sn=se(Ft),cn=se(an),dn=se(ln),pn=se(me),fn=N;(on&&"[object DataView]"!=fn(new on(new ArrayBuffer(1)))||Ft&&"[object Map]"!=fn(new Ft)||an&&"[object Promise]"!=fn(an.resolve())||ln&&"[object Set]"!=fn(new ln)||me&&"[object WeakMap]"!=fn(new me))&&(fn=function(e){var t=N(e),n="[object Object]"==t?e.constructor:void 0,r=n?se(n):"";if(r)switch(r){case un:return"[object DataView]";case sn:return"[object Map]";case cn:return"[object Promise]";case dn:return"[object Set]";case pn:return"[object WeakMap]"}return t});var vn=fn,hn=Object.prototype.hasOwnProperty;var yn=k.Uint8Array;function bn(e){var t=new e.constructor(e.byteLength);return new yn(t).set(new yn(e)),t}var mn=/\w*$/;var gn=C?C.prototype:void 0,jn=gn?gn.valueOf:void 0;function _n(e,t){var n=t?bn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function On(e,t,n){var r,o,i,a=e.constructor;switch(t){case"[object ArrayBuffer]":return bn(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return function(e,t){var n=t?bn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return _n(e,n);case"[object Map]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(i=new(o=e).constructor(o.source,mn.exec(o))).lastIndex=o.lastIndex,i;case"[object Set]":return new a;case"[object Symbol]":return r=e,jn?Object(jn.call(r)):{}}}function Fn(e){return"function"!=typeof e.constructor||Le(e)?{}:je(Pt(e))}var wn=nt&&nt.isMap,xn=wn?Ye(wn):function(e){return L(e)&&"[object Map]"==vn(e)};var Tn=nt&&nt.isSet,An=Tn?Ye(Tn):function(e){return L(e)&&"[object Set]"==vn(e)},En={};function Sn(e,t,n,r,o,i){var a,l=1&t,u=2&t,s=4&t;if(n&&(a=o?n(e,r,o,i):n(e)),void 0!==a)return a;if(!Q(e))return e;var c=V(e);if(c){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&hn.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Oe(e,a)}else{var d=vn(e),p="[object Function]"==d||"[object GeneratorFunction]"==d;if(Ke(e))return Jt(e,l);if("[object Object]"==d||"[object Arguments]"==d||p&&!o){if(a=u||p?{}:Fn(e),!l)return u?function(e,t){return $e(e,en(e),t)}(e,function(e,t){return e&&$e(t,ft(t),e)}(a,e)):function(e,t){return $e(e,Zt(e),t)}(e,function(e,t){return e&&$e(t,ct(t),e)}(a,e))}else{if(!En[d])return o?e:{};a=On(e,d,l)}}i||(i=new Vt);var f=i.get(e);if(f)return f;i.set(e,a),An(e)?e.forEach((function(r){a.add(Sn(r,t,n,r,e,i))})):xn(e)&&e.forEach((function(r,o){a.set(o,Sn(r,t,n,o,e,i))}));var v=c?void 0:(s?u?rn:nn:u?ft:ct)(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(v||e,(function(r,o){v&&(r=e[o=r]),Me(a,o,Sn(r,t,n,o,e,i))})),a}En["[object Arguments]"]=En["[object Array]"]=En["[object ArrayBuffer]"]=En["[object DataView]"]=En["[object Boolean]"]=En["[object Date]"]=En["[object Float32Array]"]=En["[object Float64Array]"]=En["[object Int8Array]"]=En["[object Int16Array]"]=En["[object Int32Array]"]=En["[object Map]"]=En["[object Number]"]=En["[object Object]"]=En["[object RegExp]"]=En["[object Set]"]=En["[object String]"]=En["[object Symbol]"]=En["[object Uint8Array]"]=En["[object Uint8ClampedArray]"]=En["[object Uint16Array]"]=En["[object Uint32Array]"]=!0,En["[object Error]"]=En["[object Function]"]=En["[object WeakMap]"]=!1;function Dn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new xt;++t<n;)this.add(e[t])}function Un(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}Dn.prototype.add=Dn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Dn.prototype.has=function(e){return this.__data__.has(e)};function kn(e,t,n,r,o,i){var a=1&n,l=e.length,u=t.length;if(l!=u&&!(a&&u>l))return!1;var s=i.get(e),c=i.get(t);if(s&&c)return s==t&&c==e;var d=-1,p=!0,f=2&n?new Dn:void 0;for(i.set(e,t),i.set(t,e);++d<l;){var v=e[d],h=t[d];if(r)var y=a?r(h,v,d,t,e,i):r(v,h,d,e,t,i);if(void 0!==y){if(y)continue;p=!1;break}if(f){if(!Un(t,(function(e,t){if(a=t,!f.has(a)&&(v===e||o(v,e,n,r,i)))return f.push(t);var a}))){p=!1;break}}else if(v!==h&&!o(v,h,n,r,i)){p=!1;break}}return i.delete(e),i.delete(t),p}function Cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Mn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var $n=C?C.prototype:void 0,In=$n?$n.valueOf:void 0;var Pn=Object.prototype.hasOwnProperty;var zn="[object Object]",Bn=Object.prototype.hasOwnProperty;function Nn(e,t,n,r,o,i){var a=V(e),l=V(t),u=a?"[object Array]":vn(e),s=l?"[object Array]":vn(t),c=(u="[object Arguments]"==u?zn:u)==zn,d=(s="[object Arguments]"==s?zn:s)==zn,p=u==s;if(p&&Ke(e)){if(!Ke(t))return!1;a=!0,c=!1}if(p&&!c)return i||(i=new Vt),a||ot(e)?kn(e,t,n,r,o,i):function(e,t,n,r,o,i,a){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new yn(e),new yn(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ke(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=Cn;case"[object Set]":var u=1&r;if(l||(l=Mn),e.size!=t.size&&!u)return!1;var s=a.get(e);if(s)return s==t;r|=2,a.set(e,t);var c=kn(l(e),l(t),r,o,i,a);return a.delete(e),c;case"[object Symbol]":if(In)return In.call(e)==In.call(t)}return!1}(e,t,u,n,r,o,i);if(!(1&n)){var f=c&&Bn.call(e,"__wrapped__"),v=d&&Bn.call(t,"__wrapped__");if(f||v){var h=f?e.value():e,y=v?t.value():t;return i||(i=new Vt),o(h,y,n,r,i)}}return!!p&&(i||(i=new Vt),function(e,t,n,r,o,i){var a=1&n,l=nn(e),u=l.length;if(u!=nn(t).length&&!a)return!1;for(var s=u;s--;){var c=l[s];if(!(a?c in t:Pn.call(t,c)))return!1}var d=i.get(e),p=i.get(t);if(d&&p)return d==t&&p==e;var f=!0;i.set(e,t),i.set(t,e);for(var v=a;++s<u;){var h=e[c=l[s]],y=t[c];if(r)var b=a?r(y,h,c,t,e,i):r(h,y,c,e,t,i);if(!(void 0===b?h===y||o(h,y,n,r,i):b)){f=!1;break}v||(v="constructor"==c)}if(f&&!v){var m=e.constructor,g=t.constructor;m==g||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof g&&g instanceof g||(f=!1)}return i.delete(e),i.delete(t),f}(e,t,n,r,o,i))}function Ln(e,t,n,r,o){return e===t||(null==e||null==t||!L(e)&&!L(t)?e!=e&&t!=t:Nn(e,t,n,r,Ln,o))}var Rn,qn=function(e,t,n){for(var r=-1,o=Object(e),i=n(e),a=i.length;a--;){var l=i[Rn?a:++r];if(!1===t(o[l],l,o))break}return e},Vn=function(){return k.Date.now()},Wn=Math.max,Hn=Math.min;function Xn(e,t,n){var r,o,i,a,l,u,s=0,c=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=r,i=o;return r=o=void 0,s=t,a=e.apply(i,n)}function v(e){return s=e,l=setTimeout(y,t),c?f(e):a}function h(e){var n=e-u;return void 0===u||n>=t||n<0||d&&e-s>=i}function y(){var e=Vn();if(h(e))return b(e);l=setTimeout(y,function(e){var n=t-(e-u);return d?Hn(n,i-(e-s)):n}(e))}function b(e){return l=void 0,p&&r?f(e):(r=o=void 0,a)}function m(){var e=Vn(),n=h(e);if(r=arguments,o=this,u=e,n){if(void 0===l)return v(u);if(d)return clearTimeout(l),l=setTimeout(y,t),f(u)}return void 0===l&&(l=setTimeout(y,t)),a}return t=ne(t)||0,Q(n)&&(c=!!n.leading,i=(d="maxWait"in n)?Wn(ne(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p),m.cancel=function(){void 0!==l&&clearTimeout(l),s=0,r=u=o=l=void 0},m.flush=function(){return void 0===l?a:b(Vn())},m}function Gn(e,t,n){(void 0!==n&&!ke(e[t],n)||void 0===n&&!(t in e))&&Ue(e,t,n)}function Jn(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function Kn(e,t,n,r,o,i,a){var l=Jn(e,n),u=Jn(t,n),s=a.get(u);if(s)Gn(e,n,s);else{var c,d=i?i(l,u,n+"",e,t,a):void 0,p=void 0===d;if(p){var f=V(u),v=!f&&Ke(u),h=!f&&!v&&ot(u);d=u,f||v||h?V(l)?d=l:L(c=l)&&Be(c)?d=Oe(l):v?(p=!1,d=Jt(u,!0)):h?(p=!1,d=_n(u,!0)):d=[]:qt(u)||He(u)?(d=l,He(l)?d=function(e){return $e(e,ft(e))}(l):Q(l)&&!oe(l)||(d=Fn(u))):p=!1}p&&(a.set(u,d),o(d,u,r,i,a),a.delete(u)),Gn(e,n,d)}}function Qn(e,t,n,r,o){e!==t&&qn(t,(function(i,a){if(o||(o=new Vt),Q(i))Kn(e,t,a,n,Qn,r,o);else{var l=r?r(Jn(e,a),i,a+"",e,t,o):void 0;void 0===l&&(l=i),Gn(e,a,l)}}),ft)}function Yn(e,t){return t.length<2?e:function(e,t){for(var n=0,r=(t=Dt(t,e)).length;null!=e&&n<r;)e=e[Ut(t[n++])];return n&&n==r?e:void 0}(e,function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}(t,0,-1))}var Zn,er=(Zn=function(e,t,n){Qn(e,t,n)},function(e,t){return Ee(Pe(e,t,re),e+"")}((function(e,t){var n=-1,r=t.length,o=r>1?t[r-1]:void 0,i=r>2?t[2]:void 0;for(o=Zn.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(e,t,n){if(!Q(n))return!1;var r=typeof t;return!!("number"==r?Be(n)&&De(t,n.length):"string"==r&&t in n)&&ke(n[t],e)}(t[0],t[1],i)&&(o=r<3?void 0:o,r=1),e=Object(e);++n<r;){var a=t[n];a&&Zn(e,a,n,o)}return e})));function tr(e,t){return null==(e=Yn(e,t=Dt(t,e)))||delete e[Ut((n=t,r=null==n?0:n.length,r?n[r-1]:void 0))];var n,r}function nr(e){return qt(e)?void 0:e}var rr=function(e){return Ee(Pe(e,void 0,It),e+"")}((function(e,t){var n={};if(null==e)return n;var r=!1;t=q(t,(function(t){return t=Dt(t,e),r||(r=t.length>1),t})),$e(e,rn(e),n),r&&(n=Sn(n,7,nr));for(var o=t.length;o--;)tr(n,t[o]);return n}));const{ANIMATION_TIME:or}={ANIMATION_TIME:300,ANIMATION_NAME:"slide-in",ID_PREFIX:"toast-message"};let ir=1060;const{ANIMATION_NAME:ar,ANIMATION_TIME:lr,ID_PREFIX:ur}={ANIMATION_TIME:300,ANIMATION_NAME:"slide-in",ID_PREFIX:"toast-message"};var sr,cr,dr=s({name:"DToast",inheritAttrs:!1,props:T,emits:["closeEvent","valueChange"],setup(e,t){const{onCloseEvent:n,onHidden:r,onValueChange:o}=function(){const e=d();return{onCloseEvent:function(t){e.emit("closeEvent",t)},onValueChange:function(t){e.emit("valueChange",t)},onHidden:function(){setTimeout((()=>{var t,n;return null==(n=(t=e.attrs).onHidden)?void 0:n.call(t)}),or)}}}(),{severityDelay:i}={severityDelay:function(e){switch(e.severity){case"warn":case"error":return 1e4;default:return 5e3}}},a=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return Q(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Xn(e,t,{leading:r,maxWait:t,trailing:o})}((function(t){"single"===e.lifeMode&&g[t]&&(g[t]=clearTimeout(g[t]),g.splice(t,1));E(l.value[t]),setTimeout((()=>{n(l.value[t]),l.value.splice(t,1),o(l.value),"global"===e.lifeMode&&x()}),lr)}),lr),l=p([]),u=p([]),s=p(),c=p([]);let b,m=Date.now();const g=[],j=f((()=>null!==e.life?e.life:l.value.length>0?i(l.value[0]):5e3));function _(e=[]){const t=function(e){return Sn(e,5)}(e);l.value=t.map(((e,t)=>er(e,{id:`${ur}-${t}`}))),u.value=[]}function O(e,t){E(e),setTimeout((()=>{n(e),S()?l.value.splice(t,1):l.value=[],o(l.value)}),lr)}function F(t){if(!e.sticky&&b){b=clearTimeout(b);const e=j.value-(Date.now()-m);b=setTimeout((()=>t()),e)}}function w(){l.value.length>0&&(u.value=[],setTimeout((()=>{l.value.forEach((e=>n(e))),l.value=[],o(l.value)}),lr))}function x(t,n){if(!(-1===l.value.findIndex((e=>e===n)))&&(void 0===n||u.value.includes(n)))if("single"===e.lifeMode){const e=(n.life||i(n))-(Date.now()-m);g[t]=setTimeout((()=>O(n,t)),e)}else F((()=>w()))}function T(e){e<c.value.length&&e>-1&&a(e)}function A(e){const t=["id"];T(l.value.findIndex((n=>{return r=rr(n,t),o=rr(e,t),Ln(r,o);var r,o})))}function E(e){u.value=u.value.filter((t=>t!==e))}function S(){return u.value.length>0}return v((()=>e.value),(t=>{0!==t.length&&(S()&&_(),h((()=>{_(t),function(){if(function(){ir++}(),setTimeout((()=>{l.value.forEach((e=>u.value.push(e)))}),0),e.sticky)return;b&&(b=clearTimeout(b));g.length>0&&g.splice(0).forEach((e=>clearTimeout(e)));m=Date.now(),"single"===e.lifeMode?setTimeout((()=>{l.value.forEach(((e,t)=>{g[t]=setTimeout((()=>O(e,t)),e.life||i(e))}))})):b=setTimeout((()=>w()),j.value)}()})))}),{deep:!0,immediate:!0}),v(l,(e=>{0===e.length&&u.value.length>0&&(u.value=[])})),v(u,((e,t)=>{t.length>0&&0===e.length&&r()})),y((()=>{e.sticky||("single"===e.lifeMode?g.forEach((e=>e&&clearTimeout(e))):clearTimeout(b))})),{messages:l,msgAnimations:u,containerRef:s,msgItemRefs:c,interrupt:function(t){u.value.includes(l.value[t])&&("single"===e.lifeMode?g[t]&&(g[t]=clearTimeout(g[t])):F((()=>{l.value.forEach(((e,n)=>t!==n&&E(e)))})))},removeReset:x,removeThrottle:a,close:function(e){if(void 0===e)return w();"number"==typeof e?T(e):A(e)},msgItemRef:function(e){return c.value[e]}}},render(){const{style:e,styleClass:t,messages:n,msgAnimations:r,msgItemRefs:o,life:i,interrupt:a,removeReset:l,removeThrottle:u,$attrs:s,$slots:d}=this,p="devui-toast",f=e=>["devui-toast-item-container",`devui-toast-message-${e.severity}`,{[ar]:r.includes(e)}],v=e=>!(!e.summary&&null!==i),h=e=>"common"!==e.severity,y=e=>!!e.summary,m=e=>!!e.content,g=e=>!m(e)&&!!e.detail,j=e=>{var t;if("function"==typeof e.content)return e.content(e);if([null,void 0].includes(e.content))return null;const n="slot:";return String(e.content).startsWith(n)?null==(t=d[e.content.slice(n.length)])?void 0:t.call(d,e):e.content};return c("div",b({ref:"containerRef",style:[`z-index: ${ir}`,e],class:[p,t]},s),[n.map(((e,t)=>c("div",{ref:e=>o[t]=e,key:e.id,class:f(e),"aria-live":"polite",onMouseenter:()=>a(t),onMouseleave:()=>l(t,e)},[c("div",{class:"devui-toast-item"},[v(e)?c(E,{prefixCls:p,onClick:()=>u(t)},null):null,h(e)?c(S,{prefixCls:p,severity:e.severity},null):null,c("div",{class:"devui-toast-message"},[y(e)?c("span",{class:"devui-toast-title"},[e.summary]):null,m(e)?j(e):null,g(e)?c("p",{innerHTML:e.detail},null):null])])])))])}});class pr{static open(e){let r=document.body,o=document.createElement("div");r.appendChild(o);let i=function(e){return m(dr,e)}((a=l({},null!=e?e:{}),t(a,n({onHidden:()=>null==i?void 0:i.unmount()}))));var a;let u=i.mount(o);return y((()=>{r.removeChild(o),r=null,o=null,i=null,u=null}),u.$),{toastInstance:u}}}dr.install=function(e){e.component(dr.name,dr)},(cr=sr||(sr={}))[cr.preLoad=0]="preLoad",cr[cr.uploading=1]="uploading",cr[cr.uploaded=2]="uploaded",cr[cr.failed=3]="failed";const fr={uploadOptions:{type:Object,required:!0},fileOptions:{type:Object,required:!0},filePath:{type:String,required:!0},autoUpload:{type:Boolean,default:!1},placeholderText:{type:String,default:"选择文件"},uploadText:{type:String,default:"上传"},uploadedFiles:{type:Array,default:()=>[]},withoutBtn:{type:Boolean,default:!1},enableDrop:{type:Boolean,default:!1},beforeUpload:{type:Function},dynamicUploadOptionsFn:{type:Function},disabled:{type:Boolean,default:!1},showTip:{type:Boolean,default:!1},onChange:{type:Function},fileDrop:{type:Function,default:void 0},fileOver:{type:Function,default:void 0},fileSelect:{type:Function,default:void 0},errorEvent:{type:Function,default:void 0},successEvent:{type:Function,default:void 0},deleteUploadedFileEvent:{type:Function,default:void 0}},vr={uploadOptions:{type:Object,required:!0},fileOptions:{type:Object,required:!0},filePath:{type:String},autoUpload:{type:Boolean,default:!1},withoutBtn:{type:Boolean,default:!1},showTip:{type:Boolean,default:!1},uploadedFiles:{type:Array,default:()=>[]},enableDrop:{type:Boolean,default:!1},placeholderText:{type:String,default:"选择文件"},uploadText:{type:String,default:"上传"},oneTimeUpload:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},beforeUpload:{type:Function},fileDrop:{type:Function,default:void 0},fileOver:{type:Function,default:void 0},fileSelect:{type:Function,default:void 0},errorEvent:{type:Function,default:void 0},successEvent:{type:Function,default:void 0},deleteUploadedFileEvent:{type:Function,default:void 0},setCustomUploadOptions:{type:Function,default:void 0}};class hr{constructor(e,t){u(this,"xhr"),u(this,"status"),u(this,"response"),u(this,"percentage",0),this.file=e,this.uploadOptions=t,this.file=e,this.uploadOptions=t,this.status=sr.preLoad}send(e){return new Promise(((t,n)=>{const{uri:r,method:o,headers:i,authToken:a,authTokenHeader:l,additionalParameter:u,fileFieldName:s,withCredentials:c,responseType:d}=this.uploadOptions,p=l||"Authorization",f=s||"file";this.xhr=new XMLHttpRequest,this.xhr.open(o||"POST",r),c&&(this.xhr.withCredentials=c),d&&(this.xhr.responseType=d),a&&this.xhr.setRequestHeader(p,a),i&&Object.keys(i).forEach((e=>{this.xhr.setRequestHeader(e,i[e])})),this.xhr.upload.onprogress=e=>{this.percentage=Math.round(100*e.loaded/e.total)};const v=e&&e.length?this.oneTimeUploadFiles(f,u,e):this.parallelUploadFiles(f,u);this.xhr.send(v),this.status=sr.uploading,this.xhr.onabort=()=>{this.status=sr.preLoad,this.xhr=null},this.xhr.onerror=()=>{this.response=this.xhr.response,this.status=sr.failed,n({file:this.file,response:this.xhr.response})},this.xhr.onload=()=>{4===this.xhr.readyState&&this.xhr.status>=200&&this.xhr.status<300?(this.response=this.xhr.response,this.status=sr.uploaded,t({file:this.file,response:this.xhr.response})):(this.response=this.xhr.response,this.status=sr.failed,n({file:this.file,response:this.xhr.response}))}}))}parallelUploadFiles(e,t){const n=new FormData;return n.append(e,this.file,this.file.name),t&&Object.keys(t).forEach((e=>{n.append(e,t[e])})),n}oneTimeUploadFiles(e,t,n){const r=new FormData;return n.forEach((n=>{r.append(e,n.file,n.file.name),t&&Object.keys(t).forEach((e=>{r.append(e,t[e])}))})),r}cancel(){this.xhr&&this.xhr.abort()}}const yr=()=>{const e=p([]),t=p([]);return{fileUploaders:e,getFiles:()=>e.value.map((e=>e.file)),addFile:(n,r)=>{r&&r.checkSameName?(n=>{let r=!0;for(let o=0;o<e.value.length;o++)if(n===e.value[o].file.name){r=!1,-1===t.value.indexOf(n)&&t.value.push(n);break}return r})(n.name)&&e.value.push(new hr(n,r)):e.value.push(new hr(n,r))},getFullFiles:()=>e.value.map((e=>e)),deleteFile:t=>{e.value.find((e=>e.file===t)).cancel(),e.value=e.value.filter((e=>t!==e.file))},upload:async t=>{let n=[];if(t){t.percentage=0;const e=await t.send();n.push(e)}else{const t=e.value.filter((e=>e.status===sr.preLoad)),r=e.value.filter((e=>e.status===sr.failed)),o=t.length>0?t:r;n=await Promise.all(o.map((async e=>{e.percentage=0;return await e.send()})))}return n.length>0?Promise.resolve(n):Promise.reject("no files")},removeFiles:()=>{e.value=[],t.value=[]},getSameNameFiles:()=>t.value.join(),resetSameNameFiles:()=>{t.value=[]},_oneTimeUpload:()=>(async e=>{if(!e||!e.length)return Promise.reject("no files");let t=[];return await e[0].send(e).finally((()=>t=e.map((t=>(t.status=e[0].status,t.percentage=e[0].percentage,{file:t.file,response:e[0].response}))))),t})(e.value.filter((e=>e.status!==sr.uploaded)))}},br="上传中...",mr="上传失败",gr="上传成功!",jr="重新上传",_r=(e,t)=>`最大支持上传${t}MB的文件, 您上传的文件"${e}"超过可上传文件大小`,Or=()=>{const e=p(""),t=({multiple:e,accept:t,webkitdirectory:n})=>new Promise((r=>{const o=document.getElementById("d-upload-temp");o&&document.body.removeChild(o);const i=document.createElement("input");i.style.position="fixed",i.style.left="-2000px",i.style.top="-2000px",i.setAttribute("id","d-upload-temp"),i.setAttribute("type","file"),e&&i.setAttribute("multiple",""),t&&i.setAttribute("accept",t),n&&i.setAttribute("webkitdirectory",""),i.addEventListener("change",(e=>{r(Array.prototype.slice.call(e.target.files))})),document.body.appendChild(i),(e=>{const t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(t)})(i)})),n=(e,t)=>!!t&&e>1048576*t;return{triggerSelectFiles:e=>{const{multiple:n,accept:r,webkitdirectory:o}=e;return t({multiple:n,accept:r,webkitdirectory:o})},_validateFiles:(e,t,r)=>{return((e,t)=>{if(e){const n=e.split(","),r=t.type.replace(/\/.*$/,"");return n.some((e=>{const n=e.trim();return n.startsWith(".")?t.name.toLowerCase().indexOf(n.toLowerCase(),t.name.toLowerCase().length-n.toLowerCase().length)>-1:/\/\*$/.test(n)?r===n.replace(/\/.*$/,""):t.type===n}))}return!0})(t,e)?r&&n(e.size,r.maximumSize)?{checkError:!0,errorMsg:_r(e.name,r.maximumSize)}:{checkError:!1,errorMsg:void 0}:{checkError:!0,errorMsg:(o=e.name,i=t,`支持的文件类型: "${i}", 您上传的文件"${o}"不在允许范围内,请重新选择文件`)};var o,i},triggerDropFiles:e=>Promise.resolve(e),checkAllFilesSize:(t,r)=>{if(n(t,r))return e.value=`最大支持上传${r}MB的文件, 您本次上传的所有文件超过可上传文件大小`,{checkError:!0,errorMsg:e.value}}}};var Fr=s({name:"DSingleUpload",props:fr,emits:["fileDrop","fileOver","fileSelect","successEvent","errorEvent","deleteUploadedFileEvent","update:uploadedFiles"],setup(e,t){const{uploadOptions:n,fileOptions:r,placeholderText:o,autoUpload:i,withoutBtn:a,uploadText:l,disabled:u,beforeUpload:s,enableDrop:c,showTip:d,uploadedFiles:v}=g(e),h=p(!1),{getFiles:y,fileUploaders:b,addFile:m,getFullFiles:j,deleteFile:_,upload:O,removeFiles:F}=yr(),{triggerSelectFiles:w,_validateFiles:x,triggerDropFiles:T}=Or(),A=f((()=>(y()[0]||{}).name||"")),E=e=>{pr.open({value:[{severity:"warn",content:e}]})},S=()=>{(()=>{let e=Promise.resolve(!0);if(s.value){const t=s.value(j()[0]||{});void 0!==t&&(e=t.then?t:Promise.resolve(t))}return e})().then((e=>{e&&O().then((e=>{t.emit("successEvent",e);const n=[...e.map((e=>e.file)),...v.value];t.emit("update:uploadedFiles",n)})).catch((e=>{console.error(e),b.value[0]&&(b.value[0].percentage=0),t.emit("errorEvent",e)}))}))},D=o=>{o.then((o=>{var a;o.forEach((e=>{F(),m(e,n.value)})),b.value.forEach((e=>{const t=x(e.file,r.value.accept,e.uploadOptions);t.checkError&&(_(e.file),E(t.errorMsg))}));const l=null==(a=b.value[0])?void 0:a.file;e.onChange&&e.onChange(l),l&&t.emit("fileSelect",l),i.value&&S()})).catch((e=>{E(e.message)}))};return{placeholderText:o,filename:A,autoUpload:i,withoutBtn:a,fileUploaders:b,uploadText:l,handleClick:()=>{var e;u.value||b.value[0]&&(null==(e=b.value[0])?void 0:e.status)===sr.uploading||D(w(r.value))},onDeleteFile:e=>{e.stopPropagation();const t=y();_(t[0])},fileUpload:S,enableDrop:c,onFileDrop:e=>{h.value=!1,D(T(e)),t.emit("fileDrop",e[0])},onFileOver:e=>{h.value=e,t.emit("fileOver",e)},isDropOVer:h,showTip:d,uploadedFiles:v,deleteUploadedFile:e=>{const n=v.value.filter((t=>t.name!==e.name));t.emit("deleteUploadedFileEvent",e),t.emit("update:uploadedFiles",n)}}},render(){var e,t,n,r,o,i,a,l,u,s,d,p,f,v,h,y;const{placeholderText:b,filename:m,autoUpload:g,withoutBtn:w,fileUploaders:x,uploadText:T,handleClick:A,onDeleteFile:E,fileUpload:S,enableDrop:D,onFileDrop:U,onFileOver:k,isDropOVer:C,disabled:M,showTip:$,uploadedFiles:I,deleteUploadedFile:P}=this;return c("div",null,[j(c("div",{class:"devui-upload",style:"border: "+(C?"1px solid #15bf15":"0")},[(null==(t=(e=this.$slots).default)?void 0:t.call(e))?c("div",{onClick:A},[this.$slots.default()]):c("div",{class:"devui-input-group "+(M||(null==(n=x[0])?void 0:n.status)===sr.uploading?"disabled":""),onClick:A},[c("div",{class:"devui-form-control devui-files-list"},[!m&&c("div",{class:"devui-file-item devui-upload-placeholder"},[b]),!!m&&c("div",{class:"devui-file-tag devui-file-item",title:m,style:"display: inline-block; margin: 0 2px 2px 0"},[c("span",{class:"devui-filename "+((null==(r=x[0])?void 0:r.status)===sr.failed?"devui-failed-color":"")},[m]),c(_("d-icon"),{name:"close",class:`${(null==(o=x[0])?void 0:o.status)===sr.failed?"devui-upload-delete-file-button":""} ${(null==(i=x[0])?void 0:i.status)===sr.uploading||(null==(a=x[0])?void 0:a.status)===sr.uploaded?"devui-uploading-delete":""}`,onClick:e=>E(e)},null),(null==(l=x[0])?void 0:l.status)===sr.uploading&&c("div",{class:"icon devui-upload-progress"},[c(_("d-progress"),{isCircle:!0,percentage:x[0].percentage,barbgcolor:"#50D4AB",strokeWidth:8,showContent:!1},null)]),x[0].status===sr.failed&&c(_("d-icon"),{name:"running",onClick:S},null),x[0].status===sr.uploaded&&c(_("d-icon"),{name:"right",color:"#50d4ab"},null)])]),c("span",{class:"devui-input-group-addon"},[c(_("d-icon"),{name:"more-operate",color:"#252b3a"},null)])]),!g&&!w&&c(_("d-button"),{style:"marginLeft: 8px",bsStyle:"common",onClick:S,disabled:M||(null==(u=x[0])?void 0:u.status)===sr.uploading},{default:()=>{var e,t,n,r;return[(!x[0]||!(null==(e=x[0])?void 0:e.status))&&c("span",null,[T]),(null==(t=x[0])?void 0:t.status)===sr.uploading&&c("span",null,[O("上传中...")]),(null==(n=x[0])?void 0:n.status)===sr.uploaded&&c("span",null,[O("已上传")]),(null==(r=x[0])?void 0:r.status)===sr.failed&&c("span",null,[O("上传失败")])]}})]),[[F("file-drop"),{enableDrop:D,isSingle:!0,onFileDrop:U,onFileOver:k}]]),$&&c("div",{class:"devui-upload-tip"},[(null==(s=x[0])?void 0:s.status)===sr.uploading&&c("span",{class:"devui-loading"},[br]),(null==(d=x[0])?void 0:d.status)===sr.uploaded&&c("div",{class:"devui-loaded"},[c(_("d-icon"),{name:"right-o",color:"#50d4ab"},null),c("span",{style:"vertical-align: middle"},[gr])]),(null==(p=x[0])?void 0:p.status)===sr.failed&&c("div",{class:"devui-upload-failed"},[c(_("d-icon"),{name:"info-o",color:"#f66f6a"},null),c("span",{style:"vertical-align: middle"},[c("span",{style:"margin-right: 8px"},[mr]),c("a",{onClick:S},[jr])])])]),c("div",null,[null==(v=(f=this.$slots).preloadFiles)?void 0:v.call(f,{fileUploaders:x,deleteFile:E})]),c("div",null,[null==(y=(h=this.$slots).uploadedFiles)?void 0:y.call(h,{uploadedFiles:I,deleteFile:P})])])}});var wr=s({name:"DMultipleUpload",props:vr,emits:["fileDrop","fileOver","fileSelect","successEvent","errorEvent","deleteUploadedFileEvent","update:uploadedFiles"],setup(e,t){const{uploadOptions:n,fileOptions:r,placeholderText:o,autoUpload:i,withoutBtn:a,uploadText:l,disabled:u,beforeUpload:s,enableDrop:c,oneTimeUpload:d,showTip:f,uploadedFiles:v}=g(e),{triggerSelectFiles:h,_validateFiles:y,triggerDropFiles:b,checkAllFilesSize:m}=Or(),{getFiles:j,fileUploaders:_,addFile:O,getFullFiles:F,deleteFile:w,upload:x,resetSameNameFiles:T,removeFiles:A,_oneTimeUpload:E,getSameNameFiles:S}=yr(),D=p(!1),U=p(""),k=e=>{pr.open({value:[{severity:"warn",content:e}]})},C=e=>{T(),e.then((e=>{e.forEach((e=>{O(e,n.value)})),(()=>{let e=0;if(_.value.forEach((t=>{e+=t.file.size;const n=y(t.file,r.value.accept,t.uploadOptions);if(n&&n.checkError)return w(t.file),void k(n.errorMsg)})),d.value){const t=m(e,n.value.maximumSize);t&&t.checkError&&(A(),k(t.errorMsg))}})();const o=S();n.value.checkSameName&&o.length&&k(`您上传的 "${o}" 存在重名文件, 请重新选择文件`);const a=_.value.filter((e=>e.status===sr.preLoad)).map((e=>e.file));t.emit("fileSelect",a),i.value&&x()})).catch((e=>{k(e.message)}))};return{uploadOptions:n,fileOptions:r,placeholderText:o,autoUpload:i,withoutBtn:a,uploadText:l,disabled:u,beforeUpload:s,enableDrop:c,isDropOVer:D,onFileDrop:e=>{D.value=!1,C(b(e)),t.emit("fileDrop",e)},onFileOver:e=>{D.value=e,t.emit("fileOver",e)},handleClick:()=>{u.value||C(h(r.value))},fileUploaders:_,onDeleteFile:(e,t)=>{e.stopPropagation(),w(t)},fileUpload:(e,n)=>{e&&e.stopPropagation(),(()=>{let e=Promise.resolve(!0);if(s.value){const t=s.value(F());void 0!==t&&(e=t.then?t:Promise.resolve(t))}return e})().then((e=>{if(!e)return void A();(d.value?E():x(n)).then((e=>{t.emit("successEvent",e);const n=[...e.map((e=>e.file)),...v.value];t.emit("update:uploadedFiles",n)})).catch((e=>{t.emit("errorEvent",e)}))}))},showTip:f,getStatus:()=>{let e=0,t=0,n=0;const r=_.value.length;return _.value.forEach((r=>{r.status===sr.uploading?e++:r.status===sr.uploaded?t++:r.status===sr.failed&&n++})),n>0?(U.value=(e=>`${e}个文件上传失败!`)(n),"failed"):e>0?(U.value=((e,t)=>`${e}/${t}正在上传`)(e,r),"uploading"):t===r&&0!==t?"uploaded":0!==r?(U.value=(e=>`已添加${e}个文件`)(r),"selected"):void 0},uploadTips:U,cancelUpload:()=>{_.value=_.value.map((e=>(e.status===sr.uploading&&(e.cancel(),e.status=sr.failed),e)))},deleteUploadedFile:e=>{const n=v.value.filter((t=>t.name!==e.name));t.emit("deleteUploadedFileEvent",e),t.emit("update:uploadedFiles",n)}}},render(){var e,t,n,r,o,i;const{placeholderText:a,autoUpload:l,withoutBtn:u,uploadText:s,disabled:d,beforeUpload:p,enableDrop:f,isDropOVer:v,onFileDrop:h,onFileOver:y,handleClick:b,fileUploaders:m,onDeleteFile:g,fileUpload:O,showTip:T,getStatus:A,uploadTips:E,cancelUpload:S,uploadedFiles:D,deleteUploadedFile:U}=this;return c(w,null,[j(c("div",{class:"devui-upload",style:"border: "+(v?"1px solid #15bf15":"0")},[(null==(t=(e=this.$slots).default)?void 0:t.call(e))?c("div",{onClick:b},[this.$slots.default()]):c("div",{class:"devui-input-group "+(d?"disabled":""),onClick:b},[0===m.length&&c("div",{class:"devui-form-control devui-upload-placeholder"},[a]),m.length>0&&c("ul",{class:"devui-form-control devui-files-list"},[m.map(((e,t)=>c("li",{key:t,class:"devui-file-item devui-file-tag",style:"display: inline-block; margin: 0 2px 2px 0",title:e.file.name},[c("span",{class:"evui-filename "+(e.status===sr.failed?"devui-failed-color":"")},[e.file.name]),c(_("d-icon"),{name:"close",class:`${(null==e?void 0:e.status)===sr.failed?"devui-upload-delete-file-button":""} ${(null==e?void 0:e.status)===sr.uploading||(null==e?void 0:e.status)===sr.uploaded?"devui-uploading-delete":""}`,onClick:t=>g(t,e.file)},null),e.status===sr.uploading&&c("div",{class:"icon devui-upload-progress"},[c(_("d-progress"),{isCircle:!0,percentage:e.percentage,barbgcolor:"#50D4AB",strokeWidth:8,showContent:!1},null)]),e.status===sr.failed&&c(_("d-icon"),{name:"running",onClick:O},null),e.status===sr.uploaded&&c(_("d-icon"),{name:"right",color:"#50d4ab"},null)])))]),c("span",{class:"devui-input-group-addon"},[c(_("d-icon"),{name:"more-operate",color:"#252b3a"},null)])]),!l&&!u&&c(_("d-button"),{style:"marginLeft: 8px",bsStyle:"common",disabled:d,onClick:O},(k=s,"function"==typeof k||"[object Object]"===Object.prototype.toString.call(k)&&!x(k)?s:{default:()=>[s]}))]),[[F("file-drop"),{enableDrop:f,isSingle:!1,onFileDrop:h,onFileOver:y}]]),c("div",null,[null==(r=(n=this.$slots).preloadFiles)?void 0:r.call(n,{fileUploaders:m,deleteFile:g})]),c("div",null,[null==(i=(o=this.$slots).uploadedFiles)?void 0:i.call(o,{uploadedFiles:D,deleteFile:U})])]);var k}});const xr=e=>e.dataTransfer?e.dataTransfer:e.originalEvent.dataTransfer,Tr=e=>{e.preventDefault(),e.stopPropagation()},Ar={mounted:(e,t)=>{const{enableDrop:n}=t.value;n&&(((e,t)=>{const{onFileOver:n}=t.value;e.addEventListener("dragover",(e=>{var t;(t=xr(e).types)&&(t.indexOf?-1!==t.indexOf("Files"):t.contains&&t.contains("Files"))&&(Tr(e),n&&n(!0))}))})(e,t),((e,t)=>{const{onFileOver:n}=t.value;e.addEventListener("dragleave",(t=>{t.currentTarget!==e&&(Tr(t),n&&n(!0))}))})(e,t),((e,t)=>{const{onFileDrop:n,isSingle:r}=t.value;e.addEventListener("drop",(e=>{const t=xr(e);t&&(Tr(e),r?n&&n([t.files[0]]):n&&n(t.files))}))})(e,t))}};Fr.install=function(e){e.directive("file-drop",Ar),e.component(Fr.name,Fr),e.component(wr.name,wr)};var Er={title:"Upload 上传",category:"数据录入",install(e){e.use(Fr)}};export{wr as MultiUpload,Fr as Upload,Er as default};
|
|
1
|
+
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, Transition, reactive, createApp, onUnmounted, isVNode, ref, getCurrentInstance, withDirectives, resolveComponent, resolveDirective } from "vue";
|
|
2
|
+
const notificationProps = {
|
|
3
|
+
modelValue: {
|
|
4
|
+
type: Boolean,
|
|
5
|
+
default: false
|
|
6
|
+
},
|
|
7
|
+
title: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: ""
|
|
10
|
+
},
|
|
11
|
+
type: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "normal"
|
|
14
|
+
},
|
|
15
|
+
duration: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 3e3
|
|
18
|
+
},
|
|
19
|
+
onClose: {
|
|
20
|
+
type: Function
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const DEFAULT_PREFIX = "icon";
|
|
24
|
+
const iconProps = {
|
|
25
|
+
name: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "",
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
type: [Number, String],
|
|
32
|
+
default: "inherit"
|
|
33
|
+
},
|
|
34
|
+
color: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "inherit"
|
|
37
|
+
},
|
|
38
|
+
component: {
|
|
39
|
+
type: Object,
|
|
40
|
+
default: null
|
|
41
|
+
},
|
|
42
|
+
classPrefix: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: DEFAULT_PREFIX
|
|
45
|
+
},
|
|
46
|
+
operable: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
disabled: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
rotate: {
|
|
55
|
+
type: [Number, String]
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const svgIconProps = {
|
|
59
|
+
name: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "",
|
|
62
|
+
required: true
|
|
63
|
+
},
|
|
64
|
+
color: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "inherit"
|
|
67
|
+
},
|
|
68
|
+
size: {
|
|
69
|
+
type: [Number, String],
|
|
70
|
+
default: "inherit"
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
function createBem(namespace, element, modifier) {
|
|
74
|
+
let cls = namespace;
|
|
75
|
+
if (element) {
|
|
76
|
+
cls += `__${element}`;
|
|
77
|
+
}
|
|
78
|
+
if (modifier) {
|
|
79
|
+
cls += `--${modifier}`;
|
|
80
|
+
}
|
|
81
|
+
return cls;
|
|
82
|
+
}
|
|
83
|
+
function useNamespace(block, needDot = false) {
|
|
84
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
85
|
+
const b = () => createBem(namespace);
|
|
86
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
87
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
88
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
89
|
+
return {
|
|
90
|
+
b,
|
|
91
|
+
e,
|
|
92
|
+
m,
|
|
93
|
+
em
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var icon = "";
|
|
97
|
+
var svgIcon = defineComponent({
|
|
98
|
+
name: "DSvgIcon",
|
|
99
|
+
props: svgIconProps,
|
|
100
|
+
setup(props) {
|
|
101
|
+
const {
|
|
102
|
+
name,
|
|
103
|
+
color,
|
|
104
|
+
size
|
|
105
|
+
} = toRefs(props);
|
|
106
|
+
const ns2 = useNamespace("svg-icon");
|
|
107
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
108
|
+
const iconSize = computed(() => {
|
|
109
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
110
|
+
});
|
|
111
|
+
const styles = {
|
|
112
|
+
width: iconSize.value,
|
|
113
|
+
height: iconSize.value
|
|
114
|
+
};
|
|
115
|
+
return () => {
|
|
116
|
+
return createVNode("svg", {
|
|
117
|
+
"class": ns2.b(),
|
|
118
|
+
"style": styles
|
|
119
|
+
}, [createVNode("use", {
|
|
120
|
+
"xlink:href": iconName.value,
|
|
121
|
+
"fill": color.value
|
|
122
|
+
}, null)]);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
function isUrl(value) {
|
|
127
|
+
return /^((http|https):)?\/\//.test(value);
|
|
128
|
+
}
|
|
129
|
+
function useIconDom(props, ctx) {
|
|
130
|
+
const {
|
|
131
|
+
component,
|
|
132
|
+
name,
|
|
133
|
+
size,
|
|
134
|
+
color,
|
|
135
|
+
classPrefix,
|
|
136
|
+
rotate
|
|
137
|
+
} = toRefs(props);
|
|
138
|
+
const ns2 = useNamespace("icon");
|
|
139
|
+
const iconSize = computed(() => {
|
|
140
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
141
|
+
});
|
|
142
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
143
|
+
const imgIconDom = () => {
|
|
144
|
+
return createVNode("img", mergeProps({
|
|
145
|
+
"src": name.value,
|
|
146
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
147
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
148
|
+
"style": {
|
|
149
|
+
width: iconSize.value || "",
|
|
150
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
|
|
151
|
+
verticalAlign: "middle"
|
|
152
|
+
}
|
|
153
|
+
}, ctx.attrs), null);
|
|
154
|
+
};
|
|
155
|
+
const svgIconDom = () => {
|
|
156
|
+
return createVNode(IconComponent, mergeProps({
|
|
157
|
+
"name": name.value,
|
|
158
|
+
"color": color.value,
|
|
159
|
+
"size": iconSize.value,
|
|
160
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
161
|
+
"style": {
|
|
162
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
163
|
+
}
|
|
164
|
+
}, ctx.attrs), null);
|
|
165
|
+
};
|
|
166
|
+
const fontIconDom = () => {
|
|
167
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
168
|
+
return createVNode("i", mergeProps({
|
|
169
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
170
|
+
"style": {
|
|
171
|
+
fontSize: iconSize.value,
|
|
172
|
+
color: color.value,
|
|
173
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
174
|
+
}
|
|
175
|
+
}, ctx.attrs), null);
|
|
176
|
+
};
|
|
177
|
+
const iconDom = () => {
|
|
178
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
iconDom
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
var Icon = defineComponent({
|
|
185
|
+
name: "DIcon",
|
|
186
|
+
props: iconProps,
|
|
187
|
+
emits: ["click"],
|
|
188
|
+
setup(props, ctx) {
|
|
189
|
+
const {
|
|
190
|
+
disabled,
|
|
191
|
+
operable
|
|
192
|
+
} = toRefs(props);
|
|
193
|
+
const {
|
|
194
|
+
iconDom
|
|
195
|
+
} = useIconDom(props, ctx);
|
|
196
|
+
const ns2 = useNamespace("icon");
|
|
197
|
+
const wrapClassed = computed(() => ({
|
|
198
|
+
[ns2.e("container")]: true,
|
|
199
|
+
[ns2.m("disabled")]: disabled.value,
|
|
200
|
+
[ns2.m("operable")]: operable.value
|
|
201
|
+
}));
|
|
202
|
+
const onClick = (e) => {
|
|
203
|
+
if (disabled.value) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
ctx.emit("click", e);
|
|
207
|
+
};
|
|
208
|
+
return () => {
|
|
209
|
+
var _a, _b, _c, _d;
|
|
210
|
+
return createVNode("div", {
|
|
211
|
+
"class": wrapClassed.value,
|
|
212
|
+
"onClick": onClick
|
|
213
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
var iconGroup = "";
|
|
218
|
+
defineComponent({
|
|
219
|
+
name: "DIconGroup",
|
|
220
|
+
setup(_, ctx) {
|
|
221
|
+
const ns2 = useNamespace("icon-group");
|
|
222
|
+
return () => {
|
|
223
|
+
var _a, _b;
|
|
224
|
+
return createVNode("div", {
|
|
225
|
+
"class": ns2.b()
|
|
226
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
var Close = defineComponent({
|
|
231
|
+
emits: ["click"],
|
|
232
|
+
setup(props, {
|
|
233
|
+
emit
|
|
234
|
+
}) {
|
|
235
|
+
const ns2 = useNamespace("notification");
|
|
236
|
+
return () => createVNode("div", {
|
|
237
|
+
"class": ns2.e("icon-close"),
|
|
238
|
+
"onClick": (e) => emit("click", e)
|
|
239
|
+
}, [createVNode(Icon, {
|
|
240
|
+
"name": "close",
|
|
241
|
+
"size": "14px"
|
|
242
|
+
}, null)]);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
const ns = useNamespace("notification");
|
|
246
|
+
const XLINK = {
|
|
247
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
248
|
+
};
|
|
249
|
+
const XLINK_HREF = {
|
|
250
|
+
"xlink:href": "#path-s"
|
|
251
|
+
};
|
|
252
|
+
function SuccessIcon() {
|
|
253
|
+
return createVNode("svg", mergeProps({
|
|
254
|
+
"width": "16px",
|
|
255
|
+
"height": "16px",
|
|
256
|
+
"viewBox": "0 0 16 16",
|
|
257
|
+
"version": "1.1",
|
|
258
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
259
|
+
}, XLINK), [createVNode("defs", null, [createVNode("polygon", {
|
|
260
|
+
"id": "path-s",
|
|
261
|
+
"points": "6.53553391 9.77817459 12.1923882 4.12132034 13.6066017 5.53553391 6.53553391 12.6066017 3 9.07106781 4.41421356 7.65685425 6.53553391 9.77817459"
|
|
262
|
+
}, null)]), createVNode("g", {
|
|
263
|
+
"id": "correct",
|
|
264
|
+
"stroke": "none",
|
|
265
|
+
"stroke-width": "1",
|
|
266
|
+
"fill": "none",
|
|
267
|
+
"fill-rule": "evenodd"
|
|
268
|
+
}, [createVNode("mask", {
|
|
269
|
+
"id": "mask-2",
|
|
270
|
+
"fill": "white"
|
|
271
|
+
}, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
|
|
272
|
+
"id": "Mask",
|
|
273
|
+
"class": ns.e("image-success-path")
|
|
274
|
+
}, XLINK_HREF), null)])]);
|
|
275
|
+
}
|
|
276
|
+
function WarningIcon() {
|
|
277
|
+
return createVNode("svg", mergeProps({
|
|
278
|
+
"width": "16px",
|
|
279
|
+
"height": "16px",
|
|
280
|
+
"viewBox": "0 0 16 16",
|
|
281
|
+
"version": "1.1",
|
|
282
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
283
|
+
}, XLINK), [createVNode("g", {
|
|
284
|
+
"stroke": "none",
|
|
285
|
+
"stroke-width": "1",
|
|
286
|
+
"fill": "none",
|
|
287
|
+
"fill-rule": "evenodd"
|
|
288
|
+
}, [createVNode("path", {
|
|
289
|
+
"class": ns.e("warning-outer"),
|
|
290
|
+
"d": "M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506, 15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049, 0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071, 0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z"
|
|
291
|
+
}, null), createVNode("path", {
|
|
292
|
+
"class": ns.e("warning-inner"),
|
|
293
|
+
"stroke-width": "0.3",
|
|
294
|
+
"fill-rule": "nonzero",
|
|
295
|
+
"d": "M8.87894737,13 L7.08947368,13 L7.08947368,11.2105263 L8.87894737,11.2105263 L8.87894737,13 Z M8.62102372,9.86842105 L7.32800539,9.86842105 L7,4.5 L8.96842105,4.5 L8.62102372,9.86842105 Z"
|
|
296
|
+
}, null)])]);
|
|
297
|
+
}
|
|
298
|
+
function InfoIcon() {
|
|
299
|
+
return createVNode("svg", mergeProps({
|
|
300
|
+
"width": "16px",
|
|
301
|
+
"height": "16px",
|
|
302
|
+
"viewBox": "0 0 16 16",
|
|
303
|
+
"version": "1.1",
|
|
304
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
305
|
+
}, XLINK), [createVNode("g", {
|
|
306
|
+
"id": "info",
|
|
307
|
+
"stroke": "none",
|
|
308
|
+
"stroke-width": "1",
|
|
309
|
+
"fill": "none",
|
|
310
|
+
"fill-rule": "evenodd"
|
|
311
|
+
}, [createVNode("path", {
|
|
312
|
+
"class": ns.e("image-info-path"),
|
|
313
|
+
"d": "M7,13 L7,6 L9,6 L9,13 L7,13 Z M7,5 L7,3 L9,3 L9,5 L7,5 Z",
|
|
314
|
+
"id": "info"
|
|
315
|
+
}, null)])]);
|
|
316
|
+
}
|
|
317
|
+
function ErrorIcon() {
|
|
318
|
+
return createVNode("svg", mergeProps({
|
|
319
|
+
"width": "16px",
|
|
320
|
+
"height": "16px",
|
|
321
|
+
"viewBox": "0 0 16 16",
|
|
322
|
+
"version": "1.1",
|
|
323
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
324
|
+
}, XLINK), [createVNode("defs", null, [createVNode("polygon", {
|
|
325
|
+
"id": "path-e",
|
|
326
|
+
"points": "8.07106781 6.65685425 10.8994949 3.82842712 12.3137085 5.24264069 9.48528137 8.07106781 12.3137085 10.8994949 10.8994949 12.3137085 8.07106781 9.48528137 5.24264069 12.3137085 3.82842712 10.8994949 6.65685425 8.07106781 3.82842712 5.24264069 5.24264069 3.82842712"
|
|
327
|
+
}, null)]), createVNode("g", {
|
|
328
|
+
"id": "error",
|
|
329
|
+
"stroke": "none",
|
|
330
|
+
"stroke-width": "1",
|
|
331
|
+
"fill": "none",
|
|
332
|
+
"fill-rule": "evenodd"
|
|
333
|
+
}, [createVNode("mask", {
|
|
334
|
+
"id": "mask-2",
|
|
335
|
+
"fill": "white"
|
|
336
|
+
}, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
|
|
337
|
+
"id": "Mask",
|
|
338
|
+
"class": ns.e("image-error-path")
|
|
339
|
+
}, XLINK_HREF), null)])]);
|
|
340
|
+
}
|
|
341
|
+
var TypeIcon = defineComponent({
|
|
342
|
+
props: {
|
|
343
|
+
type: {
|
|
344
|
+
type: String,
|
|
345
|
+
default: "normal"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
setup(props) {
|
|
349
|
+
const {
|
|
350
|
+
type
|
|
351
|
+
} = toRefs(props);
|
|
352
|
+
const ns2 = useNamespace("notification");
|
|
353
|
+
const classes = computed(() => ({
|
|
354
|
+
[ns2.e("image")]: true,
|
|
355
|
+
[ns2.em("image", type.value)]: true
|
|
356
|
+
}));
|
|
357
|
+
return () => createVNode("span", {
|
|
358
|
+
"class": classes.value
|
|
359
|
+
}, [type.value && type.value !== "normal" && (type.value === "success" && createVNode(SuccessIcon, null, null) || type.value === "info" && createVNode(InfoIcon, null, null) || type.value === "warning" && createVNode(WarningIcon, null, null) || type.value === "error" && createVNode(ErrorIcon, null, null))]);
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
function useNotification(props) {
|
|
363
|
+
const classes = computed(() => ({
|
|
364
|
+
"devui-notification-item-container": true,
|
|
365
|
+
[`devui-notification-message-${props.type}`]: true
|
|
366
|
+
}));
|
|
367
|
+
return { classes };
|
|
368
|
+
}
|
|
369
|
+
function useEvent(props, emit) {
|
|
370
|
+
let timer = null;
|
|
371
|
+
let timestamp;
|
|
372
|
+
const close2 = () => {
|
|
373
|
+
var _a;
|
|
374
|
+
timer && clearTimeout(timer);
|
|
375
|
+
timer = null;
|
|
376
|
+
(_a = props.onClose) == null ? void 0 : _a.call(props);
|
|
377
|
+
emit("update:modelValue", false);
|
|
378
|
+
};
|
|
379
|
+
const interrupt = () => {
|
|
380
|
+
if (timer) {
|
|
381
|
+
clearTimeout(timer);
|
|
382
|
+
timer = null;
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
const removeReset = () => {
|
|
386
|
+
if (!props.modelValue) {
|
|
387
|
+
const remainTime = props.duration - (Date.now() - timestamp);
|
|
388
|
+
timer = setTimeout(close2, remainTime);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
const handleDestroy = () => {
|
|
392
|
+
emit("destroy");
|
|
393
|
+
};
|
|
394
|
+
watch(() => props.modelValue, (val) => {
|
|
395
|
+
if (val) {
|
|
396
|
+
timestamp = Date.now();
|
|
397
|
+
if (props.duration) {
|
|
398
|
+
timer = setTimeout(close2, props.duration);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
return { interrupt, removeReset, close: close2, handleDestroy };
|
|
403
|
+
}
|
|
404
|
+
var notification = "";
|
|
405
|
+
var Notification = defineComponent({
|
|
406
|
+
name: "DNotification",
|
|
407
|
+
props: notificationProps,
|
|
408
|
+
emits: ["update:modelValue", "destroy"],
|
|
409
|
+
setup(props, {
|
|
410
|
+
emit,
|
|
411
|
+
slots
|
|
412
|
+
}) {
|
|
413
|
+
const {
|
|
414
|
+
modelValue,
|
|
415
|
+
title,
|
|
416
|
+
type
|
|
417
|
+
} = toRefs(props);
|
|
418
|
+
const {
|
|
419
|
+
classes
|
|
420
|
+
} = useNotification(props);
|
|
421
|
+
const {
|
|
422
|
+
interrupt,
|
|
423
|
+
removeReset,
|
|
424
|
+
close: close2,
|
|
425
|
+
handleDestroy
|
|
426
|
+
} = useEvent(props, emit);
|
|
427
|
+
const ns2 = useNamespace("notification");
|
|
428
|
+
return () => createVNode(Transition, {
|
|
429
|
+
"name": "notification-fade",
|
|
430
|
+
"onAfterLeave": handleDestroy
|
|
431
|
+
}, {
|
|
432
|
+
default: () => {
|
|
433
|
+
var _a;
|
|
434
|
+
return [modelValue.value && createVNode("div", {
|
|
435
|
+
"class": ns2.b()
|
|
436
|
+
}, [createVNode("div", {
|
|
437
|
+
"class": classes.value,
|
|
438
|
+
"onMouseenter": interrupt,
|
|
439
|
+
"onMouseleave": removeReset
|
|
440
|
+
}, [createVNode("div", {
|
|
441
|
+
"class": ns2.e("item")
|
|
442
|
+
}, [createVNode(Close, {
|
|
443
|
+
"onClick": close2
|
|
444
|
+
}, null), title.value && createVNode(TypeIcon, {
|
|
445
|
+
"type": type.value
|
|
446
|
+
}, null), createVNode("div", {
|
|
447
|
+
"class": ns2.e("message")
|
|
448
|
+
}, [createVNode("span", {
|
|
449
|
+
"class": ns2.e("title")
|
|
450
|
+
}, [title.value]), createVNode("span", {
|
|
451
|
+
"class": ns2.e("content")
|
|
452
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)])])])])])];
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
function _isSlot(s) {
|
|
458
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
459
|
+
}
|
|
460
|
+
const defaultOptions = {
|
|
461
|
+
modelValue: false,
|
|
462
|
+
duration: 3e3,
|
|
463
|
+
type: "normal"
|
|
464
|
+
};
|
|
465
|
+
function initInstance(props, content) {
|
|
466
|
+
const container = document.createElement("div");
|
|
467
|
+
container.classList.add("notification__warpper");
|
|
468
|
+
const lastChild = document.body.lastElementChild;
|
|
469
|
+
let offset_Top = 50;
|
|
470
|
+
if (lastChild == null ? void 0 : lastChild.classList.contains("notification__warpper")) {
|
|
471
|
+
const notification2 = lastChild.lastElementChild;
|
|
472
|
+
const rects = notification2.getBoundingClientRect();
|
|
473
|
+
const height = rects.height;
|
|
474
|
+
const top = rects.top;
|
|
475
|
+
offset_Top = height + top;
|
|
476
|
+
}
|
|
477
|
+
const app = createApp({
|
|
478
|
+
setup() {
|
|
479
|
+
onUnmounted(() => {
|
|
480
|
+
document.body.removeChild(container);
|
|
481
|
+
});
|
|
482
|
+
return () => createVNode(Notification, mergeProps(props, {
|
|
483
|
+
"onDestroy": app.unmount,
|
|
484
|
+
"style": [`top: ${offset_Top}px`]
|
|
485
|
+
}), _isSlot(content) ? content : {
|
|
486
|
+
default: () => [content]
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
document.body.appendChild(container);
|
|
491
|
+
app.mount(container);
|
|
492
|
+
return app;
|
|
493
|
+
}
|
|
494
|
+
function close(props, originOnClose) {
|
|
495
|
+
props.modelValue = false;
|
|
496
|
+
originOnClose == null ? void 0 : originOnClose();
|
|
497
|
+
}
|
|
498
|
+
class NotificationService {
|
|
499
|
+
static open(options) {
|
|
500
|
+
const originOnClose = options.onClose || null;
|
|
501
|
+
const content = options.content;
|
|
502
|
+
let timer;
|
|
503
|
+
delete options.content;
|
|
504
|
+
const props = reactive({
|
|
505
|
+
...defaultOptions,
|
|
506
|
+
...options,
|
|
507
|
+
onClose: () => {
|
|
508
|
+
close(props, originOnClose);
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
initInstance(props, content);
|
|
512
|
+
props.modelValue = true;
|
|
513
|
+
clearTimeout(timer);
|
|
514
|
+
if (options.duration && props.onClose) {
|
|
515
|
+
timer = setTimeout(props.onClose, options.duration);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
class IUploadOptions {
|
|
520
|
+
}
|
|
521
|
+
class IFileOptions {
|
|
522
|
+
}
|
|
523
|
+
var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
|
|
524
|
+
UploadStatus2[UploadStatus2["preLoad"] = 0] = "preLoad";
|
|
525
|
+
UploadStatus2[UploadStatus2["uploading"] = 1] = "uploading";
|
|
526
|
+
UploadStatus2[UploadStatus2["uploaded"] = 2] = "uploaded";
|
|
527
|
+
UploadStatus2[UploadStatus2["failed"] = 3] = "failed";
|
|
528
|
+
return UploadStatus2;
|
|
529
|
+
})(UploadStatus || {});
|
|
530
|
+
const uploadProps = {
|
|
531
|
+
accept: {
|
|
532
|
+
type: String
|
|
533
|
+
},
|
|
534
|
+
webkitdirectory: {
|
|
535
|
+
type: Boolean,
|
|
536
|
+
default: false
|
|
537
|
+
},
|
|
538
|
+
uploadOptions: {
|
|
539
|
+
type: Object
|
|
540
|
+
},
|
|
541
|
+
multiple: {
|
|
542
|
+
type: Boolean,
|
|
543
|
+
default: false
|
|
544
|
+
},
|
|
545
|
+
autoUpload: {
|
|
546
|
+
type: Boolean,
|
|
547
|
+
default: true
|
|
548
|
+
},
|
|
549
|
+
placeholder: {
|
|
550
|
+
type: String,
|
|
551
|
+
default: ""
|
|
552
|
+
},
|
|
553
|
+
modelValue: {
|
|
554
|
+
type: Array,
|
|
555
|
+
default: () => []
|
|
556
|
+
},
|
|
557
|
+
droppable: {
|
|
558
|
+
type: Boolean,
|
|
559
|
+
default: false
|
|
560
|
+
},
|
|
561
|
+
beforeUpload: {
|
|
562
|
+
type: Function
|
|
563
|
+
},
|
|
564
|
+
dynamicUploadOptionsFn: {
|
|
565
|
+
type: Function
|
|
566
|
+
},
|
|
567
|
+
disabled: {
|
|
568
|
+
type: Boolean,
|
|
569
|
+
default: false
|
|
570
|
+
},
|
|
571
|
+
onChange: {
|
|
572
|
+
type: Function
|
|
573
|
+
},
|
|
574
|
+
fileDrop: {
|
|
575
|
+
type: Function,
|
|
576
|
+
default: void 0
|
|
577
|
+
},
|
|
578
|
+
fileOver: {
|
|
579
|
+
type: Function,
|
|
580
|
+
default: void 0
|
|
581
|
+
},
|
|
582
|
+
fileSelect: {
|
|
583
|
+
type: Function,
|
|
584
|
+
default: void 0
|
|
585
|
+
},
|
|
586
|
+
deleteUploadedFile: {
|
|
587
|
+
type: Function,
|
|
588
|
+
default: void 0
|
|
589
|
+
},
|
|
590
|
+
onError: {
|
|
591
|
+
type: Function,
|
|
592
|
+
default: void 0
|
|
593
|
+
},
|
|
594
|
+
onSuccess: {
|
|
595
|
+
type: Function,
|
|
596
|
+
default: void 0
|
|
597
|
+
},
|
|
598
|
+
onExceed: {
|
|
599
|
+
type: Function,
|
|
600
|
+
default: void 0
|
|
601
|
+
},
|
|
602
|
+
onProgress: {
|
|
603
|
+
type: Function,
|
|
604
|
+
default: void 0
|
|
605
|
+
},
|
|
606
|
+
onPreview: {
|
|
607
|
+
type: Function,
|
|
608
|
+
default: void 0
|
|
609
|
+
},
|
|
610
|
+
oneTimeUpload: {
|
|
611
|
+
type: Boolean,
|
|
612
|
+
default: false
|
|
613
|
+
},
|
|
614
|
+
limit: {
|
|
615
|
+
type: Number,
|
|
616
|
+
default: 0
|
|
617
|
+
},
|
|
618
|
+
httpRequest: {
|
|
619
|
+
type: Function,
|
|
620
|
+
default: void 0
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
const useSelectFiles = (t) => {
|
|
624
|
+
const BEYOND_MAXIMAL_FILE_SIZE_MSG = ref("");
|
|
625
|
+
const simulateClickEvent = (input) => {
|
|
626
|
+
const evt = document.createEvent("MouseEvents");
|
|
627
|
+
evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
628
|
+
input.dispatchEvent(evt);
|
|
629
|
+
};
|
|
630
|
+
const selectFiles = ({ multiple, accept, webkitdirectory }) => {
|
|
631
|
+
return new Promise((resolve) => {
|
|
632
|
+
const tempNode = document.getElementById("d-upload-temp");
|
|
633
|
+
if (tempNode) {
|
|
634
|
+
document.body.removeChild(tempNode);
|
|
635
|
+
}
|
|
636
|
+
const input = document.createElement("input");
|
|
637
|
+
input.style.position = "fixed";
|
|
638
|
+
input.style.left = "-2000px";
|
|
639
|
+
input.style.top = "-2000px";
|
|
640
|
+
input.setAttribute("id", "d-upload-temp");
|
|
641
|
+
input.setAttribute("type", "file");
|
|
642
|
+
if (multiple) {
|
|
643
|
+
input.setAttribute("multiple", "");
|
|
644
|
+
}
|
|
645
|
+
if (accept) {
|
|
646
|
+
input.setAttribute("accept", accept);
|
|
647
|
+
}
|
|
648
|
+
if (webkitdirectory) {
|
|
649
|
+
input.setAttribute("webkitdirectory", "");
|
|
650
|
+
}
|
|
651
|
+
input.addEventListener("change", (event) => {
|
|
652
|
+
resolve(Array.prototype.slice.call(event.target.files));
|
|
653
|
+
});
|
|
654
|
+
document.body.appendChild(input);
|
|
655
|
+
simulateClickEvent(input);
|
|
656
|
+
});
|
|
657
|
+
};
|
|
658
|
+
const isAllowedFileType = (accept, file) => {
|
|
659
|
+
if (accept) {
|
|
660
|
+
const acceptArr = accept.split(",");
|
|
661
|
+
const baseMimeType = file.type.replace(/\/.*$/, "");
|
|
662
|
+
return acceptArr.some((type) => {
|
|
663
|
+
const validType = type.trim();
|
|
664
|
+
if (validType.startsWith(".")) {
|
|
665
|
+
return file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.toLowerCase().length - validType.toLowerCase().length) > -1;
|
|
666
|
+
} else if (/\/\*$/.test(validType)) {
|
|
667
|
+
return baseMimeType === validType.replace(/\/.*$/, "");
|
|
668
|
+
}
|
|
669
|
+
return file.type === validType;
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
return true;
|
|
673
|
+
};
|
|
674
|
+
const beyondMaximalSize = (fileSize, maximumSize) => {
|
|
675
|
+
if (maximumSize) {
|
|
676
|
+
return fileSize > 1024 * 1024 * maximumSize;
|
|
677
|
+
}
|
|
678
|
+
return false;
|
|
679
|
+
};
|
|
680
|
+
const _validateFiles = (file, accept, uploadOptions) => {
|
|
681
|
+
if (!isAllowedFileType(accept, file)) {
|
|
682
|
+
return {
|
|
683
|
+
checkError: true,
|
|
684
|
+
errorMsg: t("getNotAllowedFileTypeMsg")(file.name, accept)
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
|
|
688
|
+
return {
|
|
689
|
+
checkError: true,
|
|
690
|
+
errorMsg: t("getBeyondMaximalFileSizeMsg")(file.name, uploadOptions.maximumSize || 0)
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
return { checkError: false, errorMsg: void 0 };
|
|
694
|
+
};
|
|
695
|
+
const triggerSelectFiles = (fileOptions) => {
|
|
696
|
+
const { multiple, accept, webkitdirectory } = fileOptions;
|
|
697
|
+
return selectFiles({ multiple, accept, webkitdirectory });
|
|
698
|
+
};
|
|
699
|
+
const triggerDropFiles = (files) => {
|
|
700
|
+
return Promise.resolve(files);
|
|
701
|
+
};
|
|
702
|
+
const checkAllFilesSize = (fileSize, maximumSize) => {
|
|
703
|
+
if (beyondMaximalSize(fileSize, maximumSize)) {
|
|
704
|
+
BEYOND_MAXIMAL_FILE_SIZE_MSG.value = t("getAllFilesBeyondMaximalFileSizeMsg")(maximumSize);
|
|
705
|
+
return { checkError: true, errorMsg: BEYOND_MAXIMAL_FILE_SIZE_MSG.value };
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
return {
|
|
709
|
+
triggerSelectFiles,
|
|
710
|
+
_validateFiles,
|
|
711
|
+
triggerDropFiles,
|
|
712
|
+
checkAllFilesSize
|
|
713
|
+
};
|
|
714
|
+
};
|
|
715
|
+
class FileUploader {
|
|
716
|
+
constructor(file, uploadOptions) {
|
|
717
|
+
this.file = file;
|
|
718
|
+
this.uploadOptions = uploadOptions;
|
|
719
|
+
this.percentage = 0;
|
|
720
|
+
this.file = file;
|
|
721
|
+
this.uploadOptions = uploadOptions;
|
|
722
|
+
this.status = UploadStatus.preLoad;
|
|
723
|
+
}
|
|
724
|
+
send(uploadFiles) {
|
|
725
|
+
return new Promise((resolve, reject) => {
|
|
726
|
+
const { uri, method, headers, authToken, authTokenHeader, additionalParameter, fileFieldName, withCredentials, responseType } = this.uploadOptions || {};
|
|
727
|
+
const authTokenHeader_ = authTokenHeader || "Authorization";
|
|
728
|
+
const fileFieldName_ = fileFieldName || "file";
|
|
729
|
+
this.xhr = new XMLHttpRequest();
|
|
730
|
+
this.xhr.open(method || "POST", uri || "");
|
|
731
|
+
if (withCredentials) {
|
|
732
|
+
this.xhr.withCredentials = withCredentials;
|
|
733
|
+
}
|
|
734
|
+
if (responseType) {
|
|
735
|
+
this.xhr.responseType = responseType;
|
|
736
|
+
}
|
|
737
|
+
if (authToken) {
|
|
738
|
+
this.xhr.setRequestHeader(authTokenHeader_, authToken);
|
|
739
|
+
}
|
|
740
|
+
if (headers) {
|
|
741
|
+
Object.keys(headers).forEach((key) => {
|
|
742
|
+
var _a;
|
|
743
|
+
(_a = this.xhr) == null ? void 0 : _a.setRequestHeader(key, headers[key]);
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
this.xhr.upload.onprogress = (e) => {
|
|
747
|
+
this.percentage = Math.round(e.loaded * 100 / e.total);
|
|
748
|
+
};
|
|
749
|
+
const formData = uploadFiles && uploadFiles.length ? this.oneTimeUploadFiles(fileFieldName_, additionalParameter, uploadFiles) : this.parallelUploadFiles(fileFieldName_, additionalParameter);
|
|
750
|
+
this.xhr.send(formData);
|
|
751
|
+
this.status = UploadStatus.uploading;
|
|
752
|
+
this.xhr.onabort = () => {
|
|
753
|
+
this.status = UploadStatus.preLoad;
|
|
754
|
+
this.xhr = null;
|
|
755
|
+
};
|
|
756
|
+
this.xhr.onerror = () => {
|
|
757
|
+
var _a, _b;
|
|
758
|
+
this.response = (_a = this.xhr) == null ? void 0 : _a.response;
|
|
759
|
+
this.status = UploadStatus.failed;
|
|
760
|
+
reject({ file: this.file, response: (_b = this.xhr) == null ? void 0 : _b.response });
|
|
761
|
+
};
|
|
762
|
+
this.xhr.onload = () => {
|
|
763
|
+
var _a, _b, _c;
|
|
764
|
+
if (((_a = this.xhr) == null ? void 0 : _a.readyState) === 4 && this.xhr.status >= 200 && this.xhr.status < 300) {
|
|
765
|
+
this.response = this.xhr.response;
|
|
766
|
+
this.status = UploadStatus.uploaded;
|
|
767
|
+
resolve({ file: this.file, response: this.xhr.response });
|
|
768
|
+
} else {
|
|
769
|
+
this.response = (_b = this.xhr) == null ? void 0 : _b.response;
|
|
770
|
+
this.status = UploadStatus.failed;
|
|
771
|
+
reject({ file: this.file, response: (_c = this.xhr) == null ? void 0 : _c.response });
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
parallelUploadFiles(fileFieldName_, additionalParameter) {
|
|
777
|
+
const formData = new FormData();
|
|
778
|
+
formData.append(fileFieldName_, this.file, this.file.name);
|
|
779
|
+
if (additionalParameter) {
|
|
780
|
+
Object.keys(additionalParameter).forEach((key) => {
|
|
781
|
+
formData.append(key, additionalParameter[key]);
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
return formData;
|
|
785
|
+
}
|
|
786
|
+
oneTimeUploadFiles(fileFieldName_, additionalParameter, uploadFiles) {
|
|
787
|
+
const formData = new FormData();
|
|
788
|
+
uploadFiles.forEach((element) => {
|
|
789
|
+
formData.append(fileFieldName_, element.file, element.file.name);
|
|
790
|
+
if (additionalParameter) {
|
|
791
|
+
Object.keys(additionalParameter).forEach((key) => {
|
|
792
|
+
formData.append(key, additionalParameter[key]);
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
return formData;
|
|
797
|
+
}
|
|
798
|
+
cancel() {
|
|
799
|
+
if (this.xhr) {
|
|
800
|
+
this.xhr.abort();
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
const useUpload = () => {
|
|
805
|
+
const fileUploaders = ref([]);
|
|
806
|
+
const filesWithSameName = ref([]);
|
|
807
|
+
const checkFileSame = (fileName) => {
|
|
808
|
+
let checkRel = true;
|
|
809
|
+
for (let i = 0; i < fileUploaders.value.length; i++) {
|
|
810
|
+
if (fileName === fileUploaders.value[i].file.name) {
|
|
811
|
+
checkRel = false;
|
|
812
|
+
if (filesWithSameName.value.indexOf(fileName) === -1) {
|
|
813
|
+
filesWithSameName.value.push(fileName);
|
|
814
|
+
}
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
return checkRel;
|
|
819
|
+
};
|
|
820
|
+
const addFile = (file, options) => {
|
|
821
|
+
if (options && options.checkSameName) {
|
|
822
|
+
if (checkFileSame(file.name)) {
|
|
823
|
+
fileUploaders.value.push(new FileUploader(file, options));
|
|
824
|
+
}
|
|
825
|
+
} else {
|
|
826
|
+
fileUploaders.value.push(new FileUploader(file, options));
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
const getFiles = () => {
|
|
830
|
+
return fileUploaders.value.map((fileUploader) => {
|
|
831
|
+
return fileUploader.file;
|
|
832
|
+
});
|
|
833
|
+
};
|
|
834
|
+
const getFullFiles = () => {
|
|
835
|
+
return fileUploaders.value.map((fileUploader) => {
|
|
836
|
+
return fileUploader;
|
|
837
|
+
});
|
|
838
|
+
};
|
|
839
|
+
const dealOneTimeUploadFiles = async (uploads) => {
|
|
840
|
+
if (!uploads || !uploads.length) {
|
|
841
|
+
return Promise.reject("no files");
|
|
842
|
+
}
|
|
843
|
+
let finalUploads = [];
|
|
844
|
+
await uploads[0].send(uploads).finally(() => finalUploads = uploads.map((file) => {
|
|
845
|
+
file.status = uploads[0].status;
|
|
846
|
+
file.percentage = uploads[0].percentage;
|
|
847
|
+
return { file: file.file, response: uploads[0].response };
|
|
848
|
+
}));
|
|
849
|
+
return finalUploads;
|
|
850
|
+
};
|
|
851
|
+
const upload2 = async (oneFile) => {
|
|
852
|
+
let uploads = [];
|
|
853
|
+
if (oneFile) {
|
|
854
|
+
oneFile.percentage = 0;
|
|
855
|
+
const uploadedFile = await oneFile.send();
|
|
856
|
+
uploads.push(uploadedFile);
|
|
857
|
+
} else {
|
|
858
|
+
const preFiles = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad);
|
|
859
|
+
const failedFiles = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.failed);
|
|
860
|
+
const uploadFiles = preFiles.length > 0 ? preFiles : failedFiles;
|
|
861
|
+
uploads = await Promise.all(uploadFiles.map(async (fileUploader) => {
|
|
862
|
+
fileUploader.percentage = 0;
|
|
863
|
+
const uploadedFile = await fileUploader.send();
|
|
864
|
+
return uploadedFile;
|
|
865
|
+
}));
|
|
866
|
+
}
|
|
867
|
+
if (uploads.length > 0) {
|
|
868
|
+
return Promise.resolve(uploads);
|
|
869
|
+
}
|
|
870
|
+
return Promise.reject("no files");
|
|
871
|
+
};
|
|
872
|
+
const _oneTimeUpload = () => {
|
|
873
|
+
const uploads = fileUploaders.value.filter((fileUploader) => fileUploader.status !== UploadStatus.uploaded);
|
|
874
|
+
return dealOneTimeUploadFiles(uploads);
|
|
875
|
+
};
|
|
876
|
+
const deleteFile = (file) => {
|
|
877
|
+
const deleteUploadFile = fileUploaders.value.find((fileUploader) => fileUploader.file === file);
|
|
878
|
+
deleteUploadFile == null ? void 0 : deleteUploadFile.cancel();
|
|
879
|
+
fileUploaders.value = fileUploaders.value.filter((fileUploader) => {
|
|
880
|
+
return file !== fileUploader.file;
|
|
881
|
+
});
|
|
882
|
+
};
|
|
883
|
+
const removeFiles = () => {
|
|
884
|
+
fileUploaders.value = [];
|
|
885
|
+
filesWithSameName.value = [];
|
|
886
|
+
};
|
|
887
|
+
const getSameNameFiles = () => {
|
|
888
|
+
return filesWithSameName.value.join();
|
|
889
|
+
};
|
|
890
|
+
const resetSameNameFiles = () => {
|
|
891
|
+
filesWithSameName.value = [];
|
|
892
|
+
};
|
|
893
|
+
return {
|
|
894
|
+
fileUploaders,
|
|
895
|
+
getFiles,
|
|
896
|
+
addFile,
|
|
897
|
+
getFullFiles,
|
|
898
|
+
deleteFile,
|
|
899
|
+
upload: upload2,
|
|
900
|
+
removeFiles,
|
|
901
|
+
getSameNameFiles,
|
|
902
|
+
resetSameNameFiles,
|
|
903
|
+
_oneTimeUpload
|
|
904
|
+
};
|
|
905
|
+
};
|
|
906
|
+
var upload = "";
|
|
907
|
+
function deepAssign(...objects) {
|
|
908
|
+
const isObject = (obj) => obj && typeof obj === "object";
|
|
909
|
+
return objects.reduce((prev, from) => {
|
|
910
|
+
Object.keys(from).forEach((key) => {
|
|
911
|
+
const pVal = prev[key];
|
|
912
|
+
const oVal = from[key];
|
|
913
|
+
if (Array.isArray(pVal) && Array.isArray(oVal)) {
|
|
914
|
+
prev[key] = Array.from(/* @__PURE__ */ new Set([...oVal, ...pVal]));
|
|
915
|
+
} else if (isObject(pVal) && isObject(oVal)) {
|
|
916
|
+
prev[key] = deepAssign(pVal, oVal);
|
|
917
|
+
} else {
|
|
918
|
+
prev[key] = oVal;
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
return prev;
|
|
922
|
+
}, {});
|
|
923
|
+
}
|
|
924
|
+
var zhCN = {
|
|
925
|
+
pagination: {
|
|
926
|
+
totalItemText: "\u6240\u6709\u6761\u76EE",
|
|
927
|
+
goToText: "\u8DF3\u81F3"
|
|
928
|
+
},
|
|
929
|
+
accordion: {
|
|
930
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
931
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
932
|
+
},
|
|
933
|
+
autoCompleteDropdown: {
|
|
934
|
+
latestInput: "\u6700\u8FD1\u8F93\u5165"
|
|
935
|
+
},
|
|
936
|
+
cascaderList: {
|
|
937
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
938
|
+
},
|
|
939
|
+
colorPicker: {
|
|
940
|
+
foundationPanel: "\u57FA\u7840\u9762\u677F",
|
|
941
|
+
advancedPanel: "\u9AD8\u7EA7\u9762\u677F"
|
|
942
|
+
},
|
|
943
|
+
datePickerPro: {
|
|
944
|
+
ok: "\u786E\u5B9A",
|
|
945
|
+
placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
|
|
946
|
+
month1: "1\u6708",
|
|
947
|
+
month2: "2\u6708",
|
|
948
|
+
month3: "3\u6708",
|
|
949
|
+
month4: "4\u6708",
|
|
950
|
+
month5: "5\u6708",
|
|
951
|
+
month6: "6\u6708",
|
|
952
|
+
month7: "7\u6708",
|
|
953
|
+
month8: "8\u6708",
|
|
954
|
+
month9: "9\u6708",
|
|
955
|
+
month10: "10\u6708",
|
|
956
|
+
month11: "11\u6708",
|
|
957
|
+
month12: "12\u6708",
|
|
958
|
+
year: "\u5E74",
|
|
959
|
+
startPlaceholder: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
|
|
960
|
+
endPlaceholder: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
|
|
961
|
+
getWeekDays() {
|
|
962
|
+
return ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
963
|
+
},
|
|
964
|
+
getTimeArr() {
|
|
965
|
+
return ["\u65F6", "\u5206", "\u79D2"];
|
|
966
|
+
},
|
|
967
|
+
getYearMonthStr(year, month) {
|
|
968
|
+
return `${year}\u5E74${month}\u6708`;
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
editableSelect: {
|
|
972
|
+
noRelatedRecords: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
973
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
974
|
+
},
|
|
975
|
+
input: {
|
|
976
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
977
|
+
},
|
|
978
|
+
splitterBar: {
|
|
979
|
+
collapse: "\u6536\u8D77",
|
|
980
|
+
expand: "\u5C55\u5F00"
|
|
981
|
+
},
|
|
982
|
+
stepsGuide: {
|
|
983
|
+
previous: "\u4E0A\u4E00\u6B65",
|
|
984
|
+
continue: "\u6211\u77E5\u9053\u5566\uFF0C\u7EE7\u7EED",
|
|
985
|
+
ok: "\u6211\u77E5\u9053\u5566"
|
|
986
|
+
},
|
|
987
|
+
table: {
|
|
988
|
+
selectAll: "\u5168\u9009",
|
|
989
|
+
ok: "\u786E\u5B9A"
|
|
990
|
+
},
|
|
991
|
+
timePopup: {
|
|
992
|
+
ok: "\u786E\u5B9A"
|
|
993
|
+
},
|
|
994
|
+
transfer: {
|
|
995
|
+
unit: "\u9879",
|
|
996
|
+
panelUnit: "\u9879",
|
|
997
|
+
headerUnit: "\u9879",
|
|
998
|
+
noData: "\u6682\u65E0\u6570\u636E",
|
|
999
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"
|
|
1000
|
+
},
|
|
1001
|
+
tree: {
|
|
1002
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
1003
|
+
newNode: "\u65B0\u8282\u70B9",
|
|
1004
|
+
selectPlaceholder: "\u8BF7\u9009\u62E9"
|
|
1005
|
+
},
|
|
1006
|
+
upload: {
|
|
1007
|
+
placeholder: "\u9009\u62E9\u6587\u4EF6",
|
|
1008
|
+
getExistSameNameFilesMsg(sameNames) {
|
|
1009
|
+
return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
1010
|
+
},
|
|
1011
|
+
getAllFilesBeyondMaximalFileSizeMsg(maximalSize) {
|
|
1012
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
1013
|
+
},
|
|
1014
|
+
getBeyondMaximalFileSizeMsg(filename, maximalSize) {
|
|
1015
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
1016
|
+
},
|
|
1017
|
+
getNotAllowedFileTypeMsg(filename, scope) {
|
|
1018
|
+
return `\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B: "${scope}", \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u4E0D\u5728\u5141\u8BB8\u8303\u56F4\u5185\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1021
|
+
search: {
|
|
1022
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
1023
|
+
},
|
|
1024
|
+
select: {
|
|
1025
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
1026
|
+
noDataText: "\u65E0\u6570\u636E",
|
|
1027
|
+
noMatchText: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
1028
|
+
loadingText: "\u52A0\u8F7D\u4E2D..."
|
|
1029
|
+
},
|
|
1030
|
+
tagInput: {
|
|
1031
|
+
maxTagsText: "\u5DF2\u8FBE\u5230\u6700\u5927\u4E2A\u6570\uFF1A"
|
|
1032
|
+
},
|
|
1033
|
+
timeSelect: {
|
|
1034
|
+
placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4"
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
const lang = ref("zh-CN");
|
|
1038
|
+
let langMessages = reactive({
|
|
1039
|
+
[lang.value]: zhCN
|
|
1040
|
+
});
|
|
1041
|
+
const Locale = {
|
|
1042
|
+
messages() {
|
|
1043
|
+
return langMessages[lang.value];
|
|
1044
|
+
},
|
|
1045
|
+
lang() {
|
|
1046
|
+
return lang.value;
|
|
1047
|
+
},
|
|
1048
|
+
use(newLang, newMessages) {
|
|
1049
|
+
lang.value = newLang;
|
|
1050
|
+
this.add({ [newLang]: newMessages });
|
|
1051
|
+
},
|
|
1052
|
+
add(newMessages = {}) {
|
|
1053
|
+
langMessages = deepAssign(langMessages, newMessages);
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
|
|
1057
|
+
function get(object, path) {
|
|
1058
|
+
const keys = path.split(".");
|
|
1059
|
+
let result = object;
|
|
1060
|
+
keys.forEach((key) => {
|
|
1061
|
+
var _a;
|
|
1062
|
+
result = (_a = result[key]) != null ? _a : "";
|
|
1063
|
+
});
|
|
1064
|
+
return result;
|
|
1065
|
+
}
|
|
1066
|
+
function createI18nTranslate(name, app, newPrefix) {
|
|
1067
|
+
const prefix = newPrefix || camelize(name) + ".";
|
|
1068
|
+
return (path) => {
|
|
1069
|
+
var _a;
|
|
1070
|
+
const messages = ((_a = app == null ? void 0 : app.appContext.config.globalProperties.langMessages) == null ? void 0 : _a.value) || Locale.messages();
|
|
1071
|
+
const message = get(messages, prefix + path) || get(messages, path);
|
|
1072
|
+
return message;
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
var Upload = defineComponent({
|
|
1076
|
+
name: "DUpload",
|
|
1077
|
+
props: uploadProps,
|
|
1078
|
+
emits: ["fileDrop", "fileOver", "fileSelect", "deleteUploadedFile", "update:modelValue"],
|
|
1079
|
+
setup(props, ctx) {
|
|
1080
|
+
const app = getCurrentInstance();
|
|
1081
|
+
const t = createI18nTranslate("DUpload", app);
|
|
1082
|
+
const {
|
|
1083
|
+
uploadOptions,
|
|
1084
|
+
placeholder,
|
|
1085
|
+
autoUpload,
|
|
1086
|
+
disabled,
|
|
1087
|
+
beforeUpload,
|
|
1088
|
+
droppable,
|
|
1089
|
+
oneTimeUpload,
|
|
1090
|
+
modelValue,
|
|
1091
|
+
multiple,
|
|
1092
|
+
accept,
|
|
1093
|
+
webkitdirectory,
|
|
1094
|
+
limit,
|
|
1095
|
+
httpRequest
|
|
1096
|
+
} = toRefs(props);
|
|
1097
|
+
const ns2 = useNamespace("upload");
|
|
1098
|
+
const inputGroupNs = useNamespace("input-group");
|
|
1099
|
+
const formControlNs = useNamespace("form-control");
|
|
1100
|
+
const inputGroupAddOnNs = useNamespace("input-group-addon");
|
|
1101
|
+
const {
|
|
1102
|
+
triggerSelectFiles,
|
|
1103
|
+
_validateFiles,
|
|
1104
|
+
triggerDropFiles,
|
|
1105
|
+
checkAllFilesSize
|
|
1106
|
+
} = useSelectFiles(t);
|
|
1107
|
+
const {
|
|
1108
|
+
fileUploaders,
|
|
1109
|
+
addFile,
|
|
1110
|
+
getFullFiles,
|
|
1111
|
+
deleteFile,
|
|
1112
|
+
upload: upload2,
|
|
1113
|
+
resetSameNameFiles,
|
|
1114
|
+
removeFiles,
|
|
1115
|
+
_oneTimeUpload,
|
|
1116
|
+
getSameNameFiles
|
|
1117
|
+
} = useUpload();
|
|
1118
|
+
const isDropOver = ref(false);
|
|
1119
|
+
const selectedFiles = ref([]);
|
|
1120
|
+
const alertMsg = (errorMsg) => {
|
|
1121
|
+
NotificationService.open({
|
|
1122
|
+
type: "warning",
|
|
1123
|
+
content: errorMsg
|
|
1124
|
+
});
|
|
1125
|
+
};
|
|
1126
|
+
const checkValid = () => {
|
|
1127
|
+
var _a;
|
|
1128
|
+
let totalFileSize = 0;
|
|
1129
|
+
fileUploaders.value.forEach((fileUploader) => {
|
|
1130
|
+
totalFileSize += fileUploader.file.size;
|
|
1131
|
+
const checkResult = _validateFiles(fileUploader.file, (accept == null ? void 0 : accept.value) || "", fileUploader.uploadOptions);
|
|
1132
|
+
if (checkResult && checkResult.checkError) {
|
|
1133
|
+
deleteFile(fileUploader.file);
|
|
1134
|
+
alertMsg(checkResult.errorMsg);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
if (oneTimeUpload.value) {
|
|
1139
|
+
const checkResult = checkAllFilesSize(totalFileSize, ((_a = uploadOptions == null ? void 0 : uploadOptions.value) == null ? void 0 : _a.maximumSize) || 0);
|
|
1140
|
+
if (checkResult && checkResult.checkError) {
|
|
1141
|
+
removeFiles();
|
|
1142
|
+
alertMsg(checkResult.errorMsg);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
const onFileOver = (event) => {
|
|
1147
|
+
isDropOver.value = event;
|
|
1148
|
+
ctx.emit("fileOver", event);
|
|
1149
|
+
};
|
|
1150
|
+
const deleteUploadedFile = (file) => {
|
|
1151
|
+
const newUploadedFiles = modelValue.value.filter((uploadedFile) => {
|
|
1152
|
+
return uploadedFile.name !== file.name;
|
|
1153
|
+
});
|
|
1154
|
+
ctx.emit("deleteUploadedFile", file);
|
|
1155
|
+
ctx.emit("update:modelValue", newUploadedFiles);
|
|
1156
|
+
};
|
|
1157
|
+
const onDeleteFile = (event, file, status) => {
|
|
1158
|
+
event == null ? void 0 : event.stopPropagation();
|
|
1159
|
+
if (status === UploadStatus.uploaded) {
|
|
1160
|
+
deleteUploadedFile(file);
|
|
1161
|
+
}
|
|
1162
|
+
deleteFile(file);
|
|
1163
|
+
};
|
|
1164
|
+
const canUpload = () => {
|
|
1165
|
+
let uploadResult = Promise.resolve(true);
|
|
1166
|
+
if (beforeUpload == null ? void 0 : beforeUpload.value) {
|
|
1167
|
+
const result = beforeUpload == null ? void 0 : beforeUpload.value(getFullFiles());
|
|
1168
|
+
if (typeof result !== "undefined") {
|
|
1169
|
+
if (typeof result === "boolean") {
|
|
1170
|
+
uploadResult = Promise.resolve(result);
|
|
1171
|
+
} else {
|
|
1172
|
+
uploadResult = result;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
return uploadResult;
|
|
1177
|
+
};
|
|
1178
|
+
const fileUpload = (event, fileUploader) => {
|
|
1179
|
+
if (event) {
|
|
1180
|
+
event.stopPropagation();
|
|
1181
|
+
}
|
|
1182
|
+
canUpload().then((_canUpload) => {
|
|
1183
|
+
if (!_canUpload) {
|
|
1184
|
+
removeFiles();
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
if (typeof (httpRequest == null ? void 0 : httpRequest.value) === "function") {
|
|
1188
|
+
const files = fileUploaders.value.map((tempFileUploader) => tempFileUploader.file);
|
|
1189
|
+
httpRequest.value(files);
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
const uploadObservable = oneTimeUpload.value ? _oneTimeUpload() : upload2(fileUploader);
|
|
1193
|
+
props.onProgress && props.onProgress(selectedFiles.value, modelValue.value);
|
|
1194
|
+
uploadObservable == null ? void 0 : uploadObservable.then((results) => {
|
|
1195
|
+
props.onSuccess && props.onSuccess(results);
|
|
1196
|
+
const newFiles = results.map((result) => result.file);
|
|
1197
|
+
const newUploadedFiles = [...newFiles, ...modelValue.value];
|
|
1198
|
+
ctx.emit("update:modelValue", newUploadedFiles);
|
|
1199
|
+
props.onChange && props.onChange(newFiles, newUploadedFiles);
|
|
1200
|
+
}).catch((error) => {
|
|
1201
|
+
props.onError && props.onError(error);
|
|
1202
|
+
props.onChange && props.onChange([error.file], modelValue.value);
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
};
|
|
1206
|
+
const _dealFiles = (promise) => {
|
|
1207
|
+
resetSameNameFiles();
|
|
1208
|
+
promise.then((files) => {
|
|
1209
|
+
if (limit.value && modelValue.value.length + files.length > limit.value) {
|
|
1210
|
+
props.onExceed && props.onExceed(files, modelValue.value);
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
props.onChange && props.onChange(files, modelValue.value);
|
|
1214
|
+
files.forEach((file) => {
|
|
1215
|
+
if (!multiple.value) {
|
|
1216
|
+
removeFiles();
|
|
1217
|
+
}
|
|
1218
|
+
addFile(file, uploadOptions == null ? void 0 : uploadOptions.value);
|
|
1219
|
+
});
|
|
1220
|
+
checkValid();
|
|
1221
|
+
const sameNameFiles = getSameNameFiles();
|
|
1222
|
+
if ((uploadOptions == null ? void 0 : uploadOptions.value) && uploadOptions.value.checkSameName && sameNameFiles.length) {
|
|
1223
|
+
alertMsg(t("getExistSameNameFilesMsg")(sameNameFiles));
|
|
1224
|
+
}
|
|
1225
|
+
selectedFiles.value = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
|
|
1226
|
+
ctx.emit("fileSelect", selectedFiles.value);
|
|
1227
|
+
if (autoUpload.value) {
|
|
1228
|
+
fileUpload();
|
|
1229
|
+
}
|
|
1230
|
+
}).catch((error) => {
|
|
1231
|
+
alertMsg(error.message);
|
|
1232
|
+
});
|
|
1233
|
+
};
|
|
1234
|
+
const handleClick = () => {
|
|
1235
|
+
if (disabled.value) {
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
_dealFiles(triggerSelectFiles({
|
|
1239
|
+
accept: accept == null ? void 0 : accept.value,
|
|
1240
|
+
multiple: multiple.value,
|
|
1241
|
+
webkitdirectory: webkitdirectory.value
|
|
1242
|
+
}));
|
|
1243
|
+
};
|
|
1244
|
+
const onFileDrop = (files) => {
|
|
1245
|
+
isDropOver.value = false;
|
|
1246
|
+
_dealFiles(triggerDropFiles(files));
|
|
1247
|
+
ctx.emit("fileDrop", files);
|
|
1248
|
+
};
|
|
1249
|
+
const submit = (event, fileUploader) => {
|
|
1250
|
+
fileUpload(event, fileUploader);
|
|
1251
|
+
};
|
|
1252
|
+
const clearFiles = (event) => {
|
|
1253
|
+
fileUploaders.value.forEach((fileUploader) => {
|
|
1254
|
+
onDeleteFile(event, fileUploader.file, fileUploader.status);
|
|
1255
|
+
});
|
|
1256
|
+
};
|
|
1257
|
+
const clickSelectedFile = (event, file) => {
|
|
1258
|
+
event == null ? void 0 : event.stopPropagation();
|
|
1259
|
+
props.onPreview && props.onPreview(file);
|
|
1260
|
+
};
|
|
1261
|
+
ctx.expose({
|
|
1262
|
+
submit,
|
|
1263
|
+
clearFiles
|
|
1264
|
+
});
|
|
1265
|
+
return () => {
|
|
1266
|
+
var _a, _b, _c, _d;
|
|
1267
|
+
return createVNode("div", null, [withDirectives(createVNode("div", {
|
|
1268
|
+
"class": ns2.b(),
|
|
1269
|
+
"style": `border: ${isDropOver.value ? "1px solid #15bf15" : "0"}`
|
|
1270
|
+
}, [((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
|
|
1271
|
+
"onClick": handleClick
|
|
1272
|
+
}, [ctx.slots.default()]) : createVNode("div", {
|
|
1273
|
+
"class": [inputGroupNs.b(), disabled.value ? "disabled" : ""],
|
|
1274
|
+
"onClick": handleClick
|
|
1275
|
+
}, [fileUploaders.value.length === 0 && createVNode("div", {
|
|
1276
|
+
"class": [formControlNs.b(), ns2.e("placeholder")]
|
|
1277
|
+
}, [placeholder.value || t("placeholder")]), fileUploaders.value.length > 0 && createVNode("ul", {
|
|
1278
|
+
"class": [formControlNs.b(), ns2.e("files-list")]
|
|
1279
|
+
}, [fileUploaders.value.map((fileUploader, index2) => createVNode("li", {
|
|
1280
|
+
"key": index2,
|
|
1281
|
+
"class": [ns2.e("file-item"), ns2.e("file-tag")],
|
|
1282
|
+
"style": "display: inline-block;",
|
|
1283
|
+
"title": fileUploader.file.name,
|
|
1284
|
+
"onClick": (event) => clickSelectedFile(event, fileUploader.file)
|
|
1285
|
+
}, [createVNode("span", {
|
|
1286
|
+
"class": [ns2.e("filename"), fileUploader.status === UploadStatus.failed ? ns2.m("failed-color") : ""]
|
|
1287
|
+
}, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
|
|
1288
|
+
"name": "close",
|
|
1289
|
+
"class": [(fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.failed ? ns2.e("delete-file-button") : "", (fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.uploading || (fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.uploaded ? ns2.e("delete") : ""],
|
|
1290
|
+
"onClick": (event) => onDeleteFile(event, fileUploader.file, fileUploader.status)
|
|
1291
|
+
}, null), fileUploader.status === UploadStatus.uploading && createVNode("div", {
|
|
1292
|
+
"class": ["icon", ns2.e("progress")]
|
|
1293
|
+
}, [createVNode(resolveComponent("d-progress"), {
|
|
1294
|
+
"isCircle": true,
|
|
1295
|
+
"percentage": fileUploader.percentage,
|
|
1296
|
+
"barbgcolor": "#50D4AB",
|
|
1297
|
+
"strokeWidth": 8,
|
|
1298
|
+
"showContent": false
|
|
1299
|
+
}, null)]), fileUploader.status === UploadStatus.failed && createVNode(resolveComponent("d-icon"), {
|
|
1300
|
+
"name": "running",
|
|
1301
|
+
"onClick": fileUpload
|
|
1302
|
+
}, null), fileUploader.status === UploadStatus.uploaded && createVNode(resolveComponent("d-icon"), {
|
|
1303
|
+
"name": "right",
|
|
1304
|
+
"color": "#50d4ab"
|
|
1305
|
+
}, null)]))]), createVNode("span", {
|
|
1306
|
+
"class": inputGroupAddOnNs.b()
|
|
1307
|
+
}, [createVNode(resolveComponent("d-icon"), {
|
|
1308
|
+
"name": "more-operate",
|
|
1309
|
+
"color": "#252b3a"
|
|
1310
|
+
}, null)])])]), [[resolveDirective("file-drop"), {
|
|
1311
|
+
droppable,
|
|
1312
|
+
isSingle: !multiple,
|
|
1313
|
+
onFileDrop,
|
|
1314
|
+
onFileOver
|
|
1315
|
+
}]]), createVNode("div", null, [(_d = (_c = ctx.slots)["uploaded-files"]) == null ? void 0 : _d.call(_c, {
|
|
1316
|
+
uploadedFiles: modelValue.value,
|
|
1317
|
+
deleteFile: deleteUploadedFile
|
|
1318
|
+
})])]);
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
const getTransfer = (event) => {
|
|
1323
|
+
var _a;
|
|
1324
|
+
return event.dataTransfer ? event.dataTransfer : (_a = event.originalEvent) == null ? void 0 : _a.dataTransfer;
|
|
1325
|
+
};
|
|
1326
|
+
const haveFiles = (types) => {
|
|
1327
|
+
if (!types) {
|
|
1328
|
+
return false;
|
|
1329
|
+
}
|
|
1330
|
+
if (types.indexOf) {
|
|
1331
|
+
return types.indexOf("Files") !== -1;
|
|
1332
|
+
} else if (types.contains) {
|
|
1333
|
+
return types.contains("Files");
|
|
1334
|
+
} else {
|
|
1335
|
+
return false;
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
const preventAndStop = (event) => {
|
|
1339
|
+
event.preventDefault();
|
|
1340
|
+
event.stopPropagation();
|
|
1341
|
+
};
|
|
1342
|
+
const onDragOver = (el, binding) => {
|
|
1343
|
+
const { onFileOver } = binding.value;
|
|
1344
|
+
el.addEventListener("dragover", (event) => {
|
|
1345
|
+
const transfer = getTransfer(event);
|
|
1346
|
+
if (!haveFiles(transfer.types)) {
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
preventAndStop(event);
|
|
1350
|
+
onFileOver && onFileOver(true);
|
|
1351
|
+
});
|
|
1352
|
+
};
|
|
1353
|
+
const onDragLeave = (el, binding) => {
|
|
1354
|
+
const { onFileOver } = binding.value;
|
|
1355
|
+
el.addEventListener("dragleave", (event) => {
|
|
1356
|
+
if (event.currentTarget === el) {
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
preventAndStop(event);
|
|
1360
|
+
onFileOver && onFileOver(true);
|
|
1361
|
+
});
|
|
1362
|
+
};
|
|
1363
|
+
const onDrop = (el, binding) => {
|
|
1364
|
+
const { onFileDrop, isSingle } = binding.value;
|
|
1365
|
+
el.addEventListener("drop", (event) => {
|
|
1366
|
+
const transfer = getTransfer(event);
|
|
1367
|
+
if (!transfer) {
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
preventAndStop(event);
|
|
1371
|
+
if (isSingle) {
|
|
1372
|
+
onFileDrop && onFileDrop([transfer.files[0]]);
|
|
1373
|
+
} else {
|
|
1374
|
+
onFileDrop && onFileDrop(Array.from(transfer.files));
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
};
|
|
1378
|
+
const fileDropDirective = {
|
|
1379
|
+
mounted: (el, binding) => {
|
|
1380
|
+
const { droppable } = binding.value;
|
|
1381
|
+
if (!droppable) {
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1384
|
+
onDragOver(el, binding);
|
|
1385
|
+
onDragLeave(el, binding);
|
|
1386
|
+
onDrop(el, binding);
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
var index = {
|
|
1390
|
+
title: "Upload \u4E0A\u4F20",
|
|
1391
|
+
category: "\u6570\u636E\u5F55\u5165",
|
|
1392
|
+
status: "100%",
|
|
1393
|
+
install(app) {
|
|
1394
|
+
app.directive("file-drop", fileDropDirective);
|
|
1395
|
+
app.component(Upload.name, Upload);
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
export { IFileOptions, IUploadOptions, Upload, UploadStatus, index as default, uploadProps };
|