vant 3.4.0 → 3.4.1
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/es/action-bar/ActionBar.js +24 -20
- package/es/action-bar/index.js +8 -4
- package/es/action-bar/style/index.js +2 -2
- package/es/action-bar/style/less.js +2 -2
- package/es/action-bar-button/ActionBarButton.js +26 -28
- package/es/action-bar-button/index.js +8 -4
- package/es/action-bar-button/style/index.js +7 -7
- package/es/action-bar-button/style/less.js +7 -7
- package/es/action-bar-icon/ActionBarIcon.js +23 -29
- package/es/action-bar-icon/index.js +8 -4
- package/es/action-bar-icon/style/index.js +5 -5
- package/es/action-bar-icon/style/less.js +5 -5
- package/es/action-sheet/ActionSheet.js +47 -61
- package/es/action-sheet/index.js +8 -4
- package/es/action-sheet/style/index.js +7 -7
- package/es/action-sheet/style/less.js +7 -7
- package/es/address-edit/AddressEdit.js +186 -219
- package/es/address-edit/AddressEditDetail.js +31 -43
- package/es/address-edit/index.js +8 -4
- package/es/address-edit/style/index.js +13 -13
- package/es/address-edit/style/less.js +13 -13
- package/es/address-edit/types.js +0 -1
- package/es/address-list/AddressList.js +38 -49
- package/es/address-list/AddressListItem.js +39 -49
- package/es/address-list/index.js +8 -4
- package/es/address-list/style/index.js +11 -11
- package/es/address-list/style/less.js +11 -11
- package/es/area/Area.js +99 -161
- package/es/area/index.js +8 -4
- package/es/area/style/index.js +3 -3
- package/es/area/style/less.js +3 -3
- package/es/area/types.js +0 -1
- package/es/badge/Badge.js +33 -47
- package/es/badge/index.js +8 -4
- package/es/badge/style/index.js +2 -2
- package/es/badge/style/less.js +2 -2
- package/es/button/Button.js +43 -63
- package/es/button/index.js +8 -4
- package/es/button/style/index.js +5 -5
- package/es/button/style/less.js +5 -5
- package/es/button/types.js +0 -1
- package/es/calendar/Calendar.js +123 -221
- package/es/calendar/CalendarDay.js +54 -70
- package/es/calendar/CalendarHeader.js +30 -35
- package/es/calendar/CalendarMonth.js +97 -140
- package/es/calendar/index.js +8 -4
- package/es/calendar/style/index.js +10 -10
- package/es/calendar/style/less.js +10 -10
- package/es/calendar/types.js +0 -1
- package/es/calendar/utils.js +40 -30
- package/es/card/Card.js +53 -72
- package/es/card/index.js +8 -4
- package/es/card/style/index.js +6 -6
- package/es/card/style/less.js +6 -6
- package/es/cascader/Cascader.js +84 -118
- package/es/cascader/index.js +8 -4
- package/es/cascader/style/index.js +9 -9
- package/es/cascader/style/less.js +9 -9
- package/es/cascader/types.js +0 -1
- package/es/cell/Cell.js +42 -59
- package/es/cell/index.js +8 -4
- package/es/cell/style/index.js +4 -4
- package/es/cell/style/less.js +4 -4
- package/es/cell-group/CellGroup.js +25 -26
- package/es/cell-group/index.js +8 -4
- package/es/cell-group/style/index.js +2 -2
- package/es/cell-group/style/less.js +2 -2
- package/es/checkbox/Checkbox.js +35 -53
- package/es/checkbox/Checker.js +37 -45
- package/es/checkbox/index.js +8 -4
- package/es/checkbox/style/index.js +5 -5
- package/es/checkbox/style/less.js +5 -5
- package/es/checkbox/types.js +0 -1
- package/es/checkbox-group/CheckboxGroup.js +32 -41
- package/es/checkbox-group/index.js +8 -4
- package/es/checkbox-group/style/index.js +2 -2
- package/es/checkbox-group/style/less.js +2 -2
- package/es/checkbox-group/types.js +0 -1
- package/es/circle/Circle.js +60 -76
- package/es/circle/index.js +8 -4
- package/es/circle/style/index.js +2 -2
- package/es/circle/style/less.js +2 -2
- package/es/col/Col.js +27 -26
- package/es/col/index.js +8 -4
- package/es/col/style/index.js +3 -3
- package/es/col/style/less.js +3 -3
- package/es/collapse/Collapse.js +39 -46
- package/es/collapse/index.js +8 -4
- package/es/collapse/style/index.js +1 -1
- package/es/collapse/style/less.js +1 -1
- package/es/collapse-item/CollapseItem.js +57 -81
- package/es/collapse-item/index.js +8 -4
- package/es/collapse-item/style/index.js +5 -5
- package/es/collapse-item/style/less.js +5 -5
- package/es/collapse-item/types.js +0 -1
- package/es/composables/on-popup-reopen.js +10 -8
- package/es/composables/use-expose.js +8 -7
- package/es/composables/use-height.js +8 -5
- package/es/composables/use-id.js +11 -12
- package/es/composables/use-lazy-render.js +10 -9
- package/es/composables/use-lock-scroll.js +29 -43
- package/es/composables/use-placeholder.js +10 -7
- package/es/composables/use-refs.js +10 -10
- package/es/composables/use-route.js +19 -17
- package/es/composables/use-tab-status.js +7 -4
- package/es/composables/use-touch.js +25 -35
- package/es/composables/use-visibility-change.js +12 -18
- package/es/config-provider/ConfigProvider.js +23 -21
- package/es/config-provider/index.js +8 -4
- package/es/config-provider/style/index.js +1 -1
- package/es/config-provider/style/less.js +1 -1
- package/es/contact-card/ContactCard.js +24 -28
- package/es/contact-card/index.js +8 -4
- package/es/contact-card/style/index.js +5 -5
- package/es/contact-card/style/less.js +5 -5
- package/es/contact-edit/ContactEdit.js +48 -56
- package/es/contact-edit/index.js +8 -4
- package/es/contact-edit/style/index.js +9 -9
- package/es/contact-edit/style/less.js +9 -9
- package/es/contact-list/ContactList.js +41 -51
- package/es/contact-list/index.js +8 -4
- package/es/contact-list/style/index.js +11 -11
- package/es/contact-list/style/less.js +11 -11
- package/es/count-down/CountDown.js +23 -28
- package/es/count-down/index.js +8 -4
- package/es/count-down/style/index.js +2 -2
- package/es/count-down/style/less.js +2 -2
- package/es/count-down/types.js +0 -1
- package/es/count-down/utils.js +24 -35
- package/es/coupon/Coupon.js +35 -38
- package/es/coupon/index.js +8 -4
- package/es/coupon/style/index.js +6 -6
- package/es/coupon/style/less.js +6 -6
- package/es/coupon/utils.js +11 -6
- package/es/coupon-cell/CouponCell.js +23 -32
- package/es/coupon-cell/index.js +8 -4
- package/es/coupon-cell/style/index.js +5 -5
- package/es/coupon-cell/style/less.js +5 -5
- package/es/coupon-list/CouponList.js +101 -112
- package/es/coupon-list/index.js +8 -4
- package/es/coupon-list/style/index.js +16 -16
- package/es/coupon-list/style/less.js +16 -16
- package/es/datetime-picker/DatePicker.js +112 -157
- package/es/datetime-picker/DatetimePicker.js +25 -26
- package/es/datetime-picker/TimePicker.js +51 -69
- package/es/datetime-picker/index.js +8 -4
- package/es/datetime-picker/style/index.js +3 -3
- package/es/datetime-picker/style/less.js +3 -3
- package/es/datetime-picker/types.js +0 -1
- package/es/datetime-picker/utils.js +30 -20
- package/es/dialog/Dialog.js +58 -83
- package/es/dialog/function-call.js +25 -37
- package/es/dialog/index.js +6 -3
- package/es/dialog/style/index.js +10 -10
- package/es/dialog/style/less.js +10 -10
- package/es/dialog/types.js +0 -1
- package/es/divider/Divider.js +24 -21
- package/es/divider/index.js +8 -4
- package/es/divider/style/index.js +2 -2
- package/es/divider/style/less.js +2 -2
- package/es/dropdown-item/DropdownItem.js +62 -94
- package/es/dropdown-item/index.js +8 -4
- package/es/dropdown-item/style/index.js +8 -8
- package/es/dropdown-item/style/less.js +8 -8
- package/es/dropdown-item/types.js +0 -1
- package/es/dropdown-menu/DropdownMenu.js +55 -61
- package/es/dropdown-menu/index.js +8 -4
- package/es/dropdown-menu/style/index.js +2 -2
- package/es/dropdown-menu/style/less.js +2 -2
- package/es/dropdown-menu/types.js +0 -1
- package/es/empty/Empty.js +25 -34
- package/es/empty/Network.js +24 -23
- package/es/empty/index.js +8 -4
- package/es/empty/style/index.js +2 -2
- package/es/empty/style/less.js +2 -2
- package/es/field/Field.js +154 -243
- package/es/field/index.js +8 -4
- package/es/field/style/index.js +5 -5
- package/es/field/style/less.js +5 -5
- package/es/field/types.js +0 -1
- package/es/field/utils.js +50 -69
- package/es/form/Form.js +55 -74
- package/es/form/index.js +8 -4
- package/es/form/style/index.js +1 -1
- package/es/form/style/less.js +1 -1
- package/es/form/types.js +0 -1
- package/es/grid/Grid.js +28 -24
- package/es/grid/index.js +8 -4
- package/es/grid/style/index.js +2 -2
- package/es/grid/style/less.js +2 -2
- package/es/grid-item/GridItem.js +40 -57
- package/es/grid-item/index.js +8 -4
- package/es/grid-item/style/index.js +5 -5
- package/es/grid-item/style/less.js +5 -5
- package/es/icon/Icon.js +29 -28
- package/es/icon/index.js +8 -4
- package/es/icon/style/index.js +3 -3
- package/es/icon/style/less.js +3 -3
- package/es/image/Image.js +59 -78
- package/es/image/index.js +8 -4
- package/es/image/style/index.js +4 -4
- package/es/image/style/less.js +4 -4
- package/es/image-preview/ImagePreview.js +51 -69
- package/es/image-preview/ImagePreviewItem.js +72 -105
- package/es/image-preview/function-call.js +23 -36
- package/es/image-preview/index.js +6 -3
- package/es/image-preview/style/index.js +10 -10
- package/es/image-preview/style/less.js +10 -10
- package/es/image-preview/types.js +0 -1
- package/es/index-anchor/IndexAnchor.js +31 -42
- package/es/index-anchor/index.js +8 -4
- package/es/index-anchor/style/index.js +3 -3
- package/es/index-anchor/style/less.js +3 -3
- package/es/index-bar/IndexBar.js +73 -98
- package/es/index-bar/index.js +8 -4
- package/es/index-bar/style/index.js +2 -2
- package/es/index-bar/style/less.js +2 -2
- package/es/index-bar/types.js +0 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +267 -180
- package/es/lazyload/index.js +6 -3
- package/es/lazyload/style/index.js +1 -1
- package/es/lazyload/style/less.js +1 -1
- package/es/lazyload/vue-lazyload/index.js +17 -32
- package/es/lazyload/vue-lazyload/lazy-component.js +11 -16
- package/es/lazyload/vue-lazyload/lazy-container.js +28 -56
- package/es/lazyload/vue-lazyload/lazy-image.js +21 -46
- package/es/lazyload/vue-lazyload/lazy.js +113 -264
- package/es/lazyload/vue-lazyload/listener.js +50 -130
- package/es/lazyload/vue-lazyload/util.js +67 -87
- package/es/list/List.js +52 -74
- package/es/list/index.js +8 -4
- package/es/list/style/index.js +3 -3
- package/es/list/style/less.js +3 -3
- package/es/list/types.js +0 -1
- package/es/loading/Loading.js +25 -30
- package/es/loading/index.js +8 -4
- package/es/loading/style/index.js +2 -2
- package/es/loading/style/less.js +2 -2
- package/es/locale/index.js +14 -19
- package/es/locale/lang/de-DE-formal.js +49 -46
- package/es/locale/lang/de-DE.js +49 -46
- package/es/locale/lang/en-US.js +49 -46
- package/es/locale/lang/es-ES.js +49 -46
- package/es/locale/lang/fr-FR.js +49 -46
- package/es/locale/lang/ja-JP.js +50 -47
- package/es/locale/lang/nb-NO.js +49 -46
- package/es/locale/lang/pt-BR.js +49 -46
- package/es/locale/lang/ro-RO.js +49 -46
- package/es/locale/lang/ru-RU.js +49 -46
- package/es/locale/lang/th-TH.js +50 -47
- package/es/locale/lang/tr-TR.js +49 -46
- package/es/locale/lang/zh-CN.js +50 -47
- package/es/locale/lang/zh-HK.js +50 -47
- package/es/locale/lang/zh-TW.js +50 -47
- package/es/locale/style/index.js +1 -1
- package/es/locale/style/less.js +1 -1
- package/es/nav-bar/NavBar.js +35 -47
- package/es/nav-bar/index.js +8 -4
- package/es/nav-bar/style/index.js +4 -4
- package/es/nav-bar/style/less.js +4 -4
- package/es/notice-bar/NoticeBar.js +62 -85
- package/es/notice-bar/index.js +8 -4
- package/es/notice-bar/style/index.js +4 -4
- package/es/notice-bar/style/less.js +4 -4
- package/es/notice-bar/types.js +0 -1
- package/es/notify/Notify.js +19 -21
- package/es/notify/function-call.js +23 -37
- package/es/notify/index.js +6 -3
- package/es/notify/style/index.js +6 -6
- package/es/notify/style/less.js +6 -6
- package/es/notify/types.js +0 -1
- package/es/number-keyboard/NumberKeyboard.js +81 -114
- package/es/number-keyboard/NumberKeyboardKey.js +32 -48
- package/es/number-keyboard/index.js +8 -4
- package/es/number-keyboard/style/index.js +3 -3
- package/es/number-keyboard/style/less.js +3 -3
- package/es/overlay/Overlay.js +21 -24
- package/es/overlay/index.js +8 -4
- package/es/overlay/style/index.js +2 -2
- package/es/overlay/style/less.js +2 -2
- package/es/pagination/Pagination.js +62 -84
- package/es/pagination/index.js +8 -4
- package/es/pagination/style/index.js +2 -2
- package/es/pagination/style/less.js +2 -2
- package/es/password-input/PasswordInput.js +30 -37
- package/es/password-input/index.js +8 -4
- package/es/password-input/style/index.js +2 -2
- package/es/password-input/style/less.js +2 -2
- package/es/picker/Picker.js +126 -196
- package/es/picker/PickerColumn.d.ts +3 -2
- package/es/picker/PickerColumn.js +86 -133
- package/es/picker/index.js +8 -4
- package/es/picker/style/index.js +3 -3
- package/es/picker/style/less.js +3 -3
- package/es/picker/types.d.ts +13 -0
- package/es/picker/types.js +0 -1
- package/es/popover/Popover.js +71 -87
- package/es/popover/index.css +1 -1
- package/es/popover/index.js +8 -4
- package/es/popover/index.less +8 -4
- package/es/popover/style/index.js +6 -6
- package/es/popover/style/less.js +6 -6
- package/es/popover/types.js +0 -1
- package/es/popup/Popup.js +67 -88
- package/es/popup/index.js +8 -4
- package/es/popup/shared.js +7 -15
- package/es/popup/style/index.js +5 -5
- package/es/popup/style/less.js +5 -5
- package/es/popup/types.js +0 -1
- package/es/progress/Progress.js +23 -25
- package/es/progress/index.js +8 -4
- package/es/progress/style/index.js +2 -2
- package/es/progress/style/less.js +2 -2
- package/es/progress/types.js +0 -1
- package/es/pull-refresh/PullRefresh.js +66 -96
- package/es/pull-refresh/index.js +8 -4
- package/es/pull-refresh/style/index.js +3 -3
- package/es/pull-refresh/style/less.js +3 -3
- package/es/radio/Radio.js +23 -29
- package/es/radio/index.js +8 -4
- package/es/radio/style/index.js +6 -6
- package/es/radio/style/less.js +6 -6
- package/es/radio-group/RadioGroup.js +27 -25
- package/es/radio-group/index.js +8 -4
- package/es/radio-group/style/index.js +2 -2
- package/es/radio-group/style/less.js +2 -2
- package/es/rate/Rate.js +53 -77
- package/es/rate/index.js +8 -4
- package/es/rate/style/index.js +4 -4
- package/es/rate/style/less.js +4 -4
- package/es/row/Row.js +41 -40
- package/es/row/index.js +8 -4
- package/es/row/style/index.js +2 -2
- package/es/row/style/less.js +2 -2
- package/es/search/Search.js +67 -89
- package/es/search/index.js +8 -4
- package/es/search/style/index.js +6 -6
- package/es/search/style/less.js +6 -6
- package/es/search/types.js +0 -1
- package/es/share-sheet/ShareSheet.js +46 -65
- package/es/share-sheet/index.js +8 -4
- package/es/share-sheet/style/index.js +6 -6
- package/es/share-sheet/style/less.js +6 -6
- package/es/sidebar/Sidebar.js +29 -28
- package/es/sidebar/index.js +8 -4
- package/es/sidebar/style/index.js +2 -2
- package/es/sidebar/style/less.js +2 -2
- package/es/sidebar-item/SidebarItem.js +28 -36
- package/es/sidebar-item/index.js +8 -4
- package/es/sidebar-item/style/index.js +4 -4
- package/es/sidebar-item/style/less.js +4 -4
- package/es/skeleton/Skeleton.js +26 -34
- package/es/skeleton/index.js +8 -4
- package/es/skeleton/style/index.js +2 -2
- package/es/skeleton/style/less.js +2 -2
- package/es/slider/Slider.js +99 -158
- package/es/slider/index.js +8 -4
- package/es/slider/style/index.js +2 -2
- package/es/slider/style/less.js +2 -2
- package/es/step/Step.js +47 -68
- package/es/step/index.js +8 -4
- package/es/step/style/index.js +5 -5
- package/es/step/style/less.js +5 -5
- package/es/stepper/Stepper.js +82 -123
- package/es/stepper/index.js +8 -4
- package/es/stepper/style/index.js +2 -2
- package/es/stepper/style/less.js +2 -2
- package/es/steps/Steps.js +29 -27
- package/es/steps/index.js +8 -4
- package/es/steps/style/index.js +2 -2
- package/es/steps/style/less.js +2 -2
- package/es/sticky/Sticky.js +58 -73
- package/es/sticky/index.js +8 -4
- package/es/sticky/style/index.js +2 -2
- package/es/sticky/style/less.js +2 -2
- package/es/submit-bar/SubmitBar.js +48 -53
- package/es/submit-bar/index.js +8 -4
- package/es/submit-bar/style/index.js +6 -6
- package/es/submit-bar/style/less.js +6 -6
- package/es/swipe/Swipe.js +117 -184
- package/es/swipe/index.js +8 -4
- package/es/swipe/style/index.js +2 -2
- package/es/swipe/style/less.js +2 -2
- package/es/swipe/types.js +0 -1
- package/es/swipe-cell/SwipeCell.js +60 -89
- package/es/swipe-cell/index.js +8 -4
- package/es/swipe-cell/style/index.js +2 -2
- package/es/swipe-cell/style/less.js +2 -2
- package/es/swipe-cell/types.js +0 -1
- package/es/swipe-item/SwipeItem.js +40 -51
- package/es/swipe-item/index.js +8 -4
- package/es/swipe-item/style/index.js +3 -3
- package/es/swipe-item/style/less.js +3 -3
- package/es/switch/Switch.js +28 -32
- package/es/switch/index.js +8 -4
- package/es/switch/style/index.js +3 -3
- package/es/switch/style/less.js +3 -3
- package/es/tab/Tab.js +44 -56
- package/es/tab/index.js +8 -4
- package/es/tab/style/index.js +7 -7
- package/es/tab/style/less.js +7 -7
- package/es/tabbar/Tabbar.js +32 -40
- package/es/tabbar/index.js +8 -4
- package/es/tabbar/style/index.js +2 -2
- package/es/tabbar/style/less.js +2 -2
- package/es/tabbar-item/TabbarItem.js +49 -63
- package/es/tabbar-item/index.js +8 -4
- package/es/tabbar-item/style/index.js +5 -5
- package/es/tabbar-item/style/less.js +5 -5
- package/es/tabs/Tabs.js +137 -197
- package/es/tabs/TabsContent.js +24 -30
- package/es/tabs/TabsTitle.js +28 -37
- package/es/tabs/index.js +8 -4
- package/es/tabs/style/index.js +5 -5
- package/es/tabs/style/less.js +5 -5
- package/es/tabs/types.js +0 -1
- package/es/tabs/utils.js +16 -20
- package/es/tag/Tag.js +27 -34
- package/es/tag/index.js +8 -4
- package/es/tag/style/index.js +4 -4
- package/es/tag/style/less.js +4 -4
- package/es/toast/Toast.js +41 -56
- package/es/toast/function-call.js +55 -85
- package/es/toast/index.js +6 -3
- package/es/toast/lock-click.js +8 -7
- package/es/toast/style/index.js +7 -7
- package/es/toast/style/less.js +7 -7
- package/es/toast/types.js +0 -1
- package/es/tree-select/TreeSelect.js +37 -52
- package/es/tree-select/index.js +8 -4
- package/es/tree-select/style/index.js +6 -6
- package/es/tree-select/style/less.js +6 -6
- package/es/uploader/Uploader.js +87 -134
- package/es/uploader/UploaderPreviewItem.js +47 -60
- package/es/uploader/index.js +8 -4
- package/es/uploader/style/index.js +11 -11
- package/es/uploader/style/less.js +11 -11
- package/es/uploader/types.js +0 -1
- package/es/uploader/utils.js +35 -39
- package/es/utils/basic.js +20 -15
- package/es/utils/constant.js +20 -9
- package/es/utils/create.js +32 -43
- package/es/utils/deep-assign.js +9 -13
- package/es/utils/deep-clone.js +9 -9
- package/es/utils/dom.js +36 -38
- package/es/utils/format.js +56 -82
- package/es/utils/index.js +9 -9
- package/es/utils/interceptor.js +13 -14
- package/es/utils/mount-component.js +18 -26
- package/es/utils/props.js +19 -13
- package/es/utils/validate.js +20 -11
- package/es/utils/with-install.js +9 -10
- package/lib/action-bar/ActionBar.js +49 -33
- package/lib/action-bar/index.js +31 -15
- package/lib/action-bar/style/index.js +2 -5
- package/lib/action-bar/style/less.js +2 -5
- package/lib/action-bar-button/ActionBarButton.js +52 -45
- package/lib/action-bar-button/index.js +31 -15
- package/lib/action-bar-button/style/index.js +7 -15
- package/lib/action-bar-button/style/less.js +7 -15
- package/lib/action-bar-icon/ActionBarIcon.js +51 -48
- package/lib/action-bar-icon/index.js +31 -15
- package/lib/action-bar-icon/style/index.js +5 -11
- package/lib/action-bar-icon/style/less.js +5 -11
- package/lib/action-sheet/ActionSheet.js +86 -90
- package/lib/action-sheet/index.js +31 -15
- package/lib/action-sheet/style/index.js +7 -15
- package/lib/action-sheet/style/less.js +7 -15
- package/lib/address-edit/AddressEdit.js +223 -253
- package/lib/address-edit/AddressEditDetail.js +57 -56
- package/lib/address-edit/index.js +31 -15
- package/lib/address-edit/style/index.js +13 -27
- package/lib/address-edit/style/less.js +13 -27
- package/lib/address-edit/types.js +3 -3
- package/lib/address-list/AddressList.js +67 -67
- package/lib/address-list/AddressListItem.js +66 -66
- package/lib/address-list/index.js +31 -15
- package/lib/address-list/style/index.js +11 -23
- package/lib/address-list/style/less.js +11 -23
- package/lib/area/Area.js +130 -181
- package/lib/area/index.js +31 -15
- package/lib/area/style/index.js +3 -7
- package/lib/area/style/less.js +3 -7
- package/lib/area/types.js +3 -3
- package/lib/badge/Badge.js +62 -62
- package/lib/badge/index.js +31 -15
- package/lib/badge/style/index.js +2 -5
- package/lib/badge/style/less.js +2 -5
- package/lib/button/Button.js +75 -83
- package/lib/button/index.js +31 -15
- package/lib/button/style/index.js +5 -11
- package/lib/button/style/less.js +5 -11
- package/lib/button/types.js +3 -3
- package/lib/calendar/Calendar.js +183 -277
- package/lib/calendar/CalendarDay.js +84 -87
- package/lib/calendar/CalendarHeader.js +57 -49
- package/lib/calendar/CalendarMonth.js +130 -166
- package/lib/calendar/index.js +31 -15
- package/lib/calendar/style/index.js +10 -21
- package/lib/calendar/style/less.js +10 -21
- package/lib/calendar/types.js +3 -3
- package/lib/calendar/utils.js +59 -63
- package/lib/card/Card.js +91 -92
- package/lib/card/index.js +31 -15
- package/lib/card/style/index.js +6 -13
- package/lib/card/style/less.js +6 -13
- package/lib/cascader/Cascader.js +122 -144
- package/lib/cascader/index.js +31 -15
- package/lib/cascader/style/index.js +9 -19
- package/lib/cascader/style/less.js +9 -19
- package/lib/cascader/types.js +3 -3
- package/lib/cell/Cell.js +81 -87
- package/lib/cell/index.js +31 -15
- package/lib/cell/style/index.js +4 -9
- package/lib/cell/style/less.js +4 -9
- package/lib/cell-group/CellGroup.js +50 -37
- package/lib/cell-group/index.js +31 -15
- package/lib/cell-group/style/index.js +2 -5
- package/lib/cell-group/style/less.js +2 -5
- package/lib/checkbox/Checkbox.js +62 -73
- package/lib/checkbox/Checker.js +71 -67
- package/lib/checkbox/index.js +31 -15
- package/lib/checkbox/style/index.js +5 -11
- package/lib/checkbox/style/less.js +5 -11
- package/lib/checkbox/types.js +3 -3
- package/lib/checkbox-group/CheckboxGroup.js +61 -58
- package/lib/checkbox-group/index.js +31 -15
- package/lib/checkbox-group/style/index.js +2 -5
- package/lib/checkbox-group/style/less.js +2 -5
- package/lib/checkbox-group/types.js +3 -3
- package/lib/circle/Circle.js +100 -103
- package/lib/circle/index.js +31 -15
- package/lib/circle/style/index.js +2 -5
- package/lib/circle/style/less.js +2 -5
- package/lib/col/Col.js +54 -41
- package/lib/col/index.js +31 -15
- package/lib/col/style/index.js +3 -7
- package/lib/col/style/less.js +3 -7
- package/lib/collapse/Collapse.js +64 -58
- package/lib/collapse/index.js +31 -15
- package/lib/collapse/style/index.js +1 -3
- package/lib/collapse/style/less.js +1 -3
- package/lib/collapse-item/CollapseItem.js +88 -104
- package/lib/collapse-item/index.js +31 -15
- package/lib/collapse-item/style/index.js +5 -11
- package/lib/collapse-item/style/less.js +5 -11
- package/lib/collapse-item/types.js +3 -3
- package/lib/composables/on-popup-reopen.js +32 -16
- package/lib/composables/use-expose.js +31 -14
- package/lib/composables/use-height.js +32 -15
- package/lib/composables/use-id.js +33 -18
- package/lib/composables/use-lazy-render.js +32 -14
- package/lib/composables/use-lock-scroll.js +55 -56
- package/lib/composables/use-placeholder.js +33 -14
- package/lib/composables/use-refs.js +33 -16
- package/lib/composables/use-route.js +39 -27
- package/lib/composables/use-tab-status.js +30 -14
- package/lib/composables/use-touch.js +47 -39
- package/lib/composables/use-visibility-change.js +38 -29
- package/lib/config-provider/ConfigProvider.js +48 -32
- package/lib/config-provider/index.js +31 -15
- package/lib/config-provider/style/index.js +1 -3
- package/lib/config-provider/style/less.js +1 -3
- package/lib/contact-card/ContactCard.js +48 -39
- package/lib/contact-card/index.js +31 -15
- package/lib/contact-card/style/index.js +5 -11
- package/lib/contact-card/style/less.js +5 -11
- package/lib/contact-edit/ContactEdit.js +79 -78
- package/lib/contact-edit/index.js +31 -15
- package/lib/contact-edit/style/index.js +9 -19
- package/lib/contact-edit/style/less.js +9 -19
- package/lib/contact-list/ContactList.js +70 -72
- package/lib/contact-list/index.js +31 -15
- package/lib/contact-list/style/index.js +11 -23
- package/lib/contact-list/style/less.js +11 -23
- package/lib/count-down/CountDown.js +52 -46
- package/lib/count-down/index.js +31 -15
- package/lib/count-down/style/index.js +2 -5
- package/lib/count-down/style/less.js +2 -5
- package/lib/count-down/types.js +3 -3
- package/lib/count-down/utils.js +46 -40
- package/lib/coupon/Coupon.js +69 -60
- package/lib/coupon/index.js +31 -15
- package/lib/coupon/style/index.js +6 -13
- package/lib/coupon/style/less.js +6 -13
- package/lib/coupon/utils.js +33 -18
- package/lib/coupon-cell/CouponCell.js +53 -47
- package/lib/coupon-cell/index.js +31 -15
- package/lib/coupon-cell/style/index.js +5 -11
- package/lib/coupon-cell/style/less.js +5 -11
- package/lib/coupon-list/CouponList.js +149 -153
- package/lib/coupon-list/index.js +31 -15
- package/lib/coupon-list/style/index.js +16 -33
- package/lib/coupon-list/style/less.js +16 -33
- package/lib/datetime-picker/DatePicker.js +152 -185
- package/lib/datetime-picker/DatetimePicker.js +49 -41
- package/lib/datetime-picker/TimePicker.js +92 -99
- package/lib/datetime-picker/index.js +31 -15
- package/lib/datetime-picker/style/index.js +3 -7
- package/lib/datetime-picker/style/less.js +3 -7
- package/lib/datetime-picker/types.js +3 -3
- package/lib/datetime-picker/utils.js +50 -37
- package/lib/dialog/Dialog.js +99 -114
- package/lib/dialog/function-call.js +59 -57
- package/lib/dialog/index.js +29 -10
- package/lib/dialog/style/index.js +10 -21
- package/lib/dialog/style/less.js +10 -21
- package/lib/dialog/types.js +3 -3
- package/lib/divider/Divider.js +48 -31
- package/lib/divider/index.js +31 -15
- package/lib/divider/style/index.js +2 -5
- package/lib/divider/style/less.js +2 -5
- package/lib/dropdown-item/DropdownItem.js +96 -119
- package/lib/dropdown-item/index.js +31 -15
- package/lib/dropdown-item/style/index.js +8 -17
- package/lib/dropdown-item/style/less.js +8 -17
- package/lib/dropdown-item/types.js +3 -3
- package/lib/dropdown-menu/DropdownMenu.js +91 -85
- package/lib/dropdown-menu/index.js +31 -15
- package/lib/dropdown-menu/style/index.js +2 -5
- package/lib/dropdown-menu/style/less.js +2 -5
- package/lib/dropdown-menu/types.js +3 -3
- package/lib/empty/Empty.js +56 -52
- package/lib/empty/Network.js +62 -45
- package/lib/empty/index.js +31 -15
- package/lib/empty/style/index.js +2 -5
- package/lib/empty/style/less.js +2 -5
- package/lib/field/Field.js +220 -302
- package/lib/field/index.js +31 -15
- package/lib/field/style/index.js +5 -11
- package/lib/field/style/less.js +5 -11
- package/lib/field/types.js +3 -3
- package/lib/field/utils.js +64 -87
- package/lib/form/Form.js +84 -90
- package/lib/form/index.js +31 -15
- package/lib/form/style/index.js +1 -3
- package/lib/form/style/less.js +1 -3
- package/lib/form/types.js +3 -3
- package/lib/grid/Grid.js +57 -42
- package/lib/grid/index.js +31 -15
- package/lib/grid/style/index.js +2 -5
- package/lib/grid/style/less.js +2 -5
- package/lib/grid-item/GridItem.js +70 -78
- package/lib/grid-item/index.js +31 -15
- package/lib/grid-item/style/index.js +5 -11
- package/lib/grid-item/style/less.js +5 -11
- package/lib/icon/Icon.js +56 -43
- package/lib/icon/index.js +31 -15
- package/lib/icon/style/index.js +3 -7
- package/lib/icon/style/less.js +3 -7
- package/lib/image/Image.js +101 -107
- package/lib/image/index.js +31 -15
- package/lib/image/style/index.js +4 -9
- package/lib/image/style/less.js +4 -9
- package/lib/image-preview/ImagePreview.js +95 -106
- package/lib/image-preview/ImagePreviewItem.js +109 -131
- package/lib/image-preview/function-call.js +54 -54
- package/lib/image-preview/index.js +29 -10
- package/lib/image-preview/style/index.js +10 -21
- package/lib/image-preview/style/less.js +10 -21
- package/lib/image-preview/types.js +3 -3
- package/lib/index-anchor/IndexAnchor.js +63 -64
- package/lib/index-anchor/index.js +31 -15
- package/lib/index-anchor/style/index.js +3 -7
- package/lib/index-anchor/style/less.js +3 -7
- package/lib/index-bar/IndexBar.js +108 -122
- package/lib/index-bar/index.js +31 -15
- package/lib/index-bar/style/index.js +2 -5
- package/lib/index-bar/style/less.js +2 -5
- package/lib/index-bar/types.js +3 -3
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +288 -791
- package/lib/lazyload/index.js +29 -10
- package/lib/lazyload/style/index.js +1 -3
- package/lib/lazyload/style/less.js +1 -3
- package/lib/lazyload/vue-lazyload/index.js +39 -43
- package/lib/lazyload/vue-lazyload/lazy-component.js +35 -26
- package/lib/lazyload/vue-lazyload/lazy-container.js +50 -63
- package/lib/lazyload/vue-lazyload/lazy-image.js +43 -55
- package/lib/lazyload/vue-lazyload/lazy.js +149 -301
- package/lib/lazyload/vue-lazyload/listener.js +73 -140
- package/lib/lazyload/vue-lazyload/util.js +82 -109
- package/lib/list/List.js +88 -97
- package/lib/list/index.js +31 -15
- package/lib/list/style/index.js +3 -7
- package/lib/list/style/less.js +3 -7
- package/lib/list/types.js +3 -3
- package/lib/loading/Loading.js +56 -45
- package/lib/loading/index.js +31 -15
- package/lib/loading/style/index.js +2 -5
- package/lib/loading/style/less.js +2 -5
- package/lib/locale/index.js +38 -32
- package/lib/locale/lang/de-DE-formal.js +55 -50
- package/lib/locale/lang/de-DE.js +55 -50
- package/lib/locale/lang/en-US.js +55 -50
- package/lib/locale/lang/es-ES.js +55 -50
- package/lib/locale/lang/fr-FR.js +55 -50
- package/lib/locale/lang/ja-JP.js +56 -51
- package/lib/locale/lang/nb-NO.js +55 -50
- package/lib/locale/lang/pt-BR.js +55 -50
- package/lib/locale/lang/ro-RO.js +55 -50
- package/lib/locale/lang/ru-RU.js +55 -50
- package/lib/locale/lang/th-TH.js +56 -51
- package/lib/locale/lang/tr-TR.js +55 -50
- package/lib/locale/lang/zh-CN.js +56 -51
- package/lib/locale/lang/zh-HK.js +56 -51
- package/lib/locale/lang/zh-TW.js +56 -51
- package/lib/locale/style/index.js +1 -3
- package/lib/locale/style/less.js +1 -3
- package/lib/nav-bar/NavBar.js +69 -69
- package/lib/nav-bar/index.js +31 -15
- package/lib/nav-bar/style/index.js +4 -9
- package/lib/nav-bar/style/less.js +4 -9
- package/lib/notice-bar/NoticeBar.js +99 -111
- package/lib/notice-bar/index.js +31 -15
- package/lib/notice-bar/style/index.js +4 -9
- package/lib/notice-bar/style/less.js +4 -9
- package/lib/notice-bar/types.js +3 -3
- package/lib/notify/Notify.js +45 -35
- package/lib/notify/function-call.js +55 -55
- package/lib/notify/index.js +29 -10
- package/lib/notify/style/index.js +6 -13
- package/lib/notify/style/less.js +6 -13
- package/lib/notify/types.js +3 -3
- package/lib/number-keyboard/NumberKeyboard.js +126 -148
- package/lib/number-keyboard/NumberKeyboardKey.js +62 -63
- package/lib/number-keyboard/index.js +31 -15
- package/lib/number-keyboard/style/index.js +3 -7
- package/lib/number-keyboard/style/less.js +3 -7
- package/lib/overlay/Overlay.js +52 -42
- package/lib/overlay/index.js +31 -15
- package/lib/overlay/style/index.js +2 -5
- package/lib/overlay/style/less.js +2 -5
- package/lib/pagination/Pagination.js +102 -110
- package/lib/pagination/index.js +31 -15
- package/lib/pagination/style/index.js +2 -5
- package/lib/pagination/style/less.js +2 -5
- package/lib/password-input/PasswordInput.js +65 -58
- package/lib/password-input/index.js +31 -15
- package/lib/password-input/style/index.js +2 -5
- package/lib/password-input/style/less.js +2 -5
- package/lib/picker/Picker.js +167 -231
- package/lib/picker/PickerColumn.d.ts +3 -2
- package/lib/picker/PickerColumn.js +128 -164
- package/lib/picker/index.js +31 -15
- package/lib/picker/style/index.js +3 -7
- package/lib/picker/style/less.js +3 -7
- package/lib/picker/types.d.ts +13 -0
- package/lib/picker/types.js +3 -3
- package/lib/popover/Popover.js +111 -116
- package/lib/popover/index.css +1 -1
- package/lib/popover/index.js +31 -15
- package/lib/popover/index.less +8 -4
- package/lib/popover/style/index.js +6 -13
- package/lib/popover/style/less.js +6 -13
- package/lib/popover/types.js +3 -3
- package/lib/popup/Popup.js +103 -117
- package/lib/popup/index.js +31 -15
- package/lib/popup/shared.js +37 -30
- package/lib/popup/style/index.js +5 -11
- package/lib/popup/style/less.js +5 -11
- package/lib/popup/types.js +3 -3
- package/lib/progress/Progress.js +53 -41
- package/lib/progress/index.js +31 -15
- package/lib/progress/style/index.js +2 -5
- package/lib/progress/style/less.js +2 -5
- package/lib/progress/types.js +3 -3
- package/lib/pull-refresh/PullRefresh.js +99 -118
- package/lib/pull-refresh/index.js +31 -15
- package/lib/pull-refresh/style/index.js +3 -7
- package/lib/pull-refresh/style/less.js +3 -7
- package/lib/radio/Radio.js +48 -47
- package/lib/radio/index.js +31 -15
- package/lib/radio/style/index.js +6 -13
- package/lib/radio/style/less.js +6 -13
- package/lib/radio-group/RadioGroup.js +54 -40
- package/lib/radio-group/index.js +31 -15
- package/lib/radio-group/style/index.js +2 -5
- package/lib/radio-group/style/less.js +2 -5
- package/lib/rate/Rate.js +88 -102
- package/lib/rate/index.js +31 -15
- package/lib/rate/style/index.js +4 -9
- package/lib/rate/style/less.js +4 -9
- package/lib/row/Row.js +68 -55
- package/lib/row/index.js +31 -15
- package/lib/row/style/index.js +2 -5
- package/lib/row/style/less.js +2 -5
- package/lib/search/Search.js +95 -106
- package/lib/search/index.js +31 -15
- package/lib/search/style/index.js +6 -13
- package/lib/search/style/less.js +6 -13
- package/lib/search/types.js +3 -3
- package/lib/share-sheet/ShareSheet.js +81 -88
- package/lib/share-sheet/index.js +31 -15
- package/lib/share-sheet/style/index.js +6 -13
- package/lib/share-sheet/style/less.js +6 -13
- package/lib/sidebar/Sidebar.js +54 -41
- package/lib/sidebar/index.js +31 -15
- package/lib/sidebar/style/index.js +2 -5
- package/lib/sidebar/style/less.js +2 -5
- package/lib/sidebar-item/SidebarItem.js +55 -53
- package/lib/sidebar-item/index.js +31 -15
- package/lib/sidebar-item/style/index.js +4 -9
- package/lib/sidebar-item/style/less.js +4 -9
- package/lib/skeleton/Skeleton.js +61 -55
- package/lib/skeleton/index.js +31 -15
- package/lib/skeleton/style/index.js +2 -5
- package/lib/skeleton/style/less.js +2 -5
- package/lib/slider/Slider.js +138 -185
- package/lib/slider/index.js +31 -15
- package/lib/slider/style/index.js +2 -5
- package/lib/slider/style/less.js +2 -5
- package/lib/step/Step.js +79 -89
- package/lib/step/index.js +31 -15
- package/lib/step/style/index.js +5 -11
- package/lib/step/style/less.js +5 -11
- package/lib/stepper/Stepper.js +134 -162
- package/lib/stepper/index.js +31 -15
- package/lib/stepper/style/index.js +2 -5
- package/lib/stepper/style/less.js +2 -5
- package/lib/steps/Steps.js +54 -40
- package/lib/steps/index.js +31 -15
- package/lib/steps/style/index.js +2 -5
- package/lib/steps/style/less.js +2 -5
- package/lib/sticky/Sticky.js +86 -89
- package/lib/sticky/index.js +31 -15
- package/lib/sticky/style/index.js +2 -5
- package/lib/sticky/style/less.js +2 -5
- package/lib/submit-bar/SubmitBar.js +80 -73
- package/lib/submit-bar/index.js +31 -15
- package/lib/submit-bar/style/index.js +6 -13
- package/lib/submit-bar/style/less.js +6 -13
- package/lib/swipe/Swipe.js +172 -229
- package/lib/swipe/index.js +31 -15
- package/lib/swipe/style/index.js +2 -5
- package/lib/swipe/style/less.js +2 -5
- package/lib/swipe/types.js +3 -3
- package/lib/swipe-cell/SwipeCell.js +92 -109
- package/lib/swipe-cell/index.js +31 -15
- package/lib/swipe-cell/style/index.js +2 -5
- package/lib/swipe-cell/style/less.js +2 -5
- package/lib/swipe-cell/types.js +3 -3
- package/lib/swipe-item/SwipeItem.js +67 -67
- package/lib/swipe-item/index.js +31 -15
- package/lib/swipe-item/style/index.js +3 -7
- package/lib/swipe-item/style/less.js +3 -7
- package/lib/switch/Switch.js +60 -52
- package/lib/switch/index.js +31 -15
- package/lib/switch/style/index.js +3 -7
- package/lib/switch/style/less.js +3 -7
- package/lib/tab/Tab.js +79 -84
- package/lib/tab/index.js +31 -15
- package/lib/tab/style/index.js +7 -15
- package/lib/tab/style/less.js +7 -15
- package/lib/tabbar/Tabbar.js +64 -61
- package/lib/tabbar/index.js +31 -15
- package/lib/tabbar/style/index.js +2 -5
- package/lib/tabbar/style/less.js +2 -5
- package/lib/tabbar-item/TabbarItem.js +78 -83
- package/lib/tabbar-item/index.js +31 -15
- package/lib/tabbar-item/style/index.js +5 -11
- package/lib/tabbar-item/style/less.js +5 -11
- package/lib/tabs/Tabs.js +194 -252
- package/lib/tabs/TabsContent.js +54 -47
- package/lib/tabs/TabsTitle.js +55 -51
- package/lib/tabs/index.js +31 -15
- package/lib/tabs/style/index.js +5 -11
- package/lib/tabs/style/less.js +5 -11
- package/lib/tabs/types.js +3 -3
- package/lib/tabs/utils.js +41 -31
- package/lib/tag/Tag.js +53 -46
- package/lib/tag/index.js +31 -15
- package/lib/tag/style/index.js +4 -9
- package/lib/tag/style/less.js +4 -9
- package/lib/toast/Toast.js +78 -82
- package/lib/toast/function-call.js +90 -105
- package/lib/toast/index.js +29 -10
- package/lib/toast/lock-click.js +14 -11
- package/lib/toast/style/index.js +7 -15
- package/lib/toast/style/less.js +7 -15
- package/lib/toast/types.js +3 -3
- package/lib/tree-select/TreeSelect.js +70 -74
- package/lib/tree-select/index.js +31 -15
- package/lib/tree-select/style/index.js +6 -13
- package/lib/tree-select/style/less.js +6 -13
- package/lib/uploader/Uploader.js +133 -173
- package/lib/uploader/UploaderPreviewItem.js +86 -87
- package/lib/uploader/index.js +31 -15
- package/lib/uploader/style/index.js +11 -23
- package/lib/uploader/style/less.js +11 -23
- package/lib/uploader/types.js +3 -3
- package/lib/uploader/utils.js +55 -62
- package/lib/utils/basic.js +25 -27
- package/lib/utils/constant.js +27 -22
- package/lib/utils/create.js +53 -56
- package/lib/utils/deep-assign.js +33 -20
- package/lib/utils/deep-clone.js +33 -16
- package/lib/utils/dom.js +52 -60
- package/lib/utils/format.js +79 -113
- package/lib/utils/index.js +28 -75
- package/lib/utils/interceptor.js +38 -23
- package/lib/utils/mount-component.js +39 -34
- package/lib/utils/props.js +25 -35
- package/lib/utils/validate.js +42 -39
- package/lib/utils/with-install.js +31 -14
- package/lib/vant.cjs.js +5635 -5743
- package/lib/vant.cjs.min.js +1 -1
- package/lib/vant.es.js +5635 -5743
- package/lib/vant.es.min.js +5635 -5743
- package/lib/vant.js +5518 -5626
- package/lib/vant.min.js +1 -1
- package/package.json +3 -4
- package/vetur/attributes.json +163 -163
- package/vetur/tags.json +52 -52
- package/vetur/web-types.json +595 -595
package/es/uploader/utils.js
CHANGED
@@ -1,75 +1,71 @@
|
|
1
|
-
import { createNamespace, isFunction } from
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if (resultType === 'file') {
|
1
|
+
import { createNamespace, isFunction } from "../utils";
|
2
|
+
const [name, bem, t] = createNamespace("uploader");
|
3
|
+
const toArray = (item) => Array.isArray(item) ? item : [item];
|
4
|
+
function readFileContent(file, resultType) {
|
5
|
+
return new Promise((resolve) => {
|
6
|
+
if (resultType === "file") {
|
8
7
|
resolve();
|
9
8
|
return;
|
10
9
|
}
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
reader.onload = event => {
|
10
|
+
const reader = new FileReader();
|
11
|
+
reader.onload = (event) => {
|
15
12
|
resolve(event.target.result);
|
16
13
|
};
|
17
|
-
|
18
|
-
if (resultType === 'dataUrl') {
|
14
|
+
if (resultType === "dataUrl") {
|
19
15
|
reader.readAsDataURL(file);
|
20
|
-
} else if (resultType ===
|
16
|
+
} else if (resultType === "text") {
|
21
17
|
reader.readAsText(file);
|
22
18
|
}
|
23
19
|
});
|
24
20
|
}
|
25
|
-
|
26
|
-
return toArray(items).some(item => {
|
21
|
+
function isOversize(items, maxSize) {
|
22
|
+
return toArray(items).some((item) => {
|
27
23
|
if (item.file) {
|
28
24
|
if (isFunction(maxSize)) {
|
29
25
|
return maxSize(item.file);
|
30
26
|
}
|
31
|
-
|
32
27
|
return item.file.size > maxSize;
|
33
28
|
}
|
34
|
-
|
35
29
|
return false;
|
36
30
|
});
|
37
31
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
items.forEach(item => {
|
32
|
+
function filterFiles(items, maxSize) {
|
33
|
+
const valid = [];
|
34
|
+
const invalid = [];
|
35
|
+
items.forEach((item) => {
|
42
36
|
if (isOversize(item, maxSize)) {
|
43
37
|
invalid.push(item);
|
44
38
|
} else {
|
45
39
|
valid.push(item);
|
46
40
|
}
|
47
41
|
});
|
48
|
-
return {
|
49
|
-
valid,
|
50
|
-
invalid
|
51
|
-
};
|
42
|
+
return { valid, invalid };
|
52
43
|
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
// some special urls cannot be recognized
|
57
|
-
// user can add `isImage` flag to mark it as an image url
|
44
|
+
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
45
|
+
const isImageUrl = (url) => IMAGE_REGEXP.test(url);
|
46
|
+
function isImageFile(item) {
|
58
47
|
if (item.isImage) {
|
59
48
|
return true;
|
60
49
|
}
|
61
|
-
|
62
50
|
if (item.file && item.file.type) {
|
63
|
-
return item.file.type.indexOf(
|
51
|
+
return item.file.type.indexOf("image") === 0;
|
64
52
|
}
|
65
|
-
|
66
53
|
if (item.url) {
|
67
54
|
return isImageUrl(item.url);
|
68
55
|
}
|
69
|
-
|
70
|
-
|
71
|
-
return item.content.indexOf('data:image') === 0;
|
56
|
+
if (typeof item.content === "string") {
|
57
|
+
return item.content.indexOf("data:image") === 0;
|
72
58
|
}
|
73
|
-
|
74
59
|
return false;
|
75
|
-
}
|
60
|
+
}
|
61
|
+
export {
|
62
|
+
bem,
|
63
|
+
filterFiles,
|
64
|
+
isImageFile,
|
65
|
+
isImageUrl,
|
66
|
+
isOversize,
|
67
|
+
name,
|
68
|
+
readFileContent,
|
69
|
+
t,
|
70
|
+
toArray
|
71
|
+
};
|
package/es/utils/basic.js
CHANGED
@@ -1,23 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
keys.forEach(key => {
|
9
|
-
var
|
10
|
-
|
11
|
-
result = (_result$key = result[key]) != null ? _result$key : '';
|
1
|
+
function noop() {
|
2
|
+
}
|
3
|
+
const extend = Object.assign;
|
4
|
+
const inBrowser = typeof window !== "undefined";
|
5
|
+
function get(object, path) {
|
6
|
+
const keys = path.split(".");
|
7
|
+
let result = object;
|
8
|
+
keys.forEach((key) => {
|
9
|
+
var _a;
|
10
|
+
result = (_a = result[key]) != null ? _a : "";
|
12
11
|
});
|
13
12
|
return result;
|
14
13
|
}
|
15
|
-
|
14
|
+
function pick(obj, keys, ignoreUndefined) {
|
16
15
|
return keys.reduce((ret, key) => {
|
17
|
-
if (!ignoreUndefined || obj[key] !==
|
16
|
+
if (!ignoreUndefined || obj[key] !== void 0) {
|
18
17
|
ret[key] = obj[key];
|
19
18
|
}
|
20
|
-
|
21
19
|
return ret;
|
22
20
|
}, {});
|
23
|
-
}
|
21
|
+
}
|
22
|
+
export {
|
23
|
+
extend,
|
24
|
+
get,
|
25
|
+
inBrowser,
|
26
|
+
noop,
|
27
|
+
pick
|
28
|
+
};
|
package/es/utils/constant.js
CHANGED
@@ -1,9 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
const BORDER = "van-hairline";
|
2
|
+
const BORDER_TOP = `${BORDER}--top`;
|
3
|
+
const BORDER_LEFT = `${BORDER}--left`;
|
4
|
+
const BORDER_BOTTOM = `${BORDER}--bottom`;
|
5
|
+
const BORDER_SURROUND = `${BORDER}--surround`;
|
6
|
+
const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
|
7
|
+
const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
|
8
|
+
const HAPTICS_FEEDBACK = "van-haptics-feedback";
|
9
|
+
const FORM_KEY = Symbol("van-form");
|
10
|
+
export {
|
11
|
+
BORDER,
|
12
|
+
BORDER_BOTTOM,
|
13
|
+
BORDER_LEFT,
|
14
|
+
BORDER_SURROUND,
|
15
|
+
BORDER_TOP,
|
16
|
+
BORDER_TOP_BOTTOM,
|
17
|
+
BORDER_UNSET_TOP_BOTTOM,
|
18
|
+
FORM_KEY,
|
19
|
+
HAPTICS_FEEDBACK
|
20
|
+
};
|
package/es/utils/create.js
CHANGED
@@ -1,58 +1,47 @@
|
|
1
|
-
import { get } from
|
2
|
-
import { camelize } from
|
3
|
-
import { isFunction } from
|
4
|
-
import locale from
|
5
|
-
|
6
|
-
|
7
|
-
return
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
12
|
-
args[_key - 1] = arguments[_key];
|
13
|
-
}
|
14
|
-
|
1
|
+
import { get } from "./basic";
|
2
|
+
import { camelize } from "./format";
|
3
|
+
import { isFunction } from "./validate";
|
4
|
+
import locale from "../locale";
|
5
|
+
function createTranslate(name) {
|
6
|
+
const prefix = camelize(name) + ".";
|
7
|
+
return (path, ...args) => {
|
8
|
+
const messages = locale.messages();
|
9
|
+
const message = get(messages, prefix + path) || get(messages, path);
|
15
10
|
return isFunction(message) ? message(...args) : message;
|
16
11
|
};
|
17
12
|
}
|
18
|
-
|
19
13
|
function genBem(name, mods) {
|
20
14
|
if (!mods) {
|
21
|
-
return
|
15
|
+
return "";
|
22
16
|
}
|
23
|
-
|
24
|
-
|
25
|
-
return " " + name + "--" + mods;
|
17
|
+
if (typeof mods === "string") {
|
18
|
+
return ` ${name}--${mods}`;
|
26
19
|
}
|
27
|
-
|
28
20
|
if (Array.isArray(mods)) {
|
29
|
-
return mods.reduce((ret, item) => ret + genBem(name, item),
|
21
|
+
return mods.reduce((ret, item) => ret + genBem(name, item), "");
|
30
22
|
}
|
31
|
-
|
32
|
-
return Object.keys(mods).reduce((ret, key) => ret + (mods[key] ? genBem(name, key) : ''), '');
|
23
|
+
return Object.keys(mods).reduce((ret, key) => ret + (mods[key] ? genBem(name, key) : ""), "");
|
33
24
|
}
|
34
|
-
|
35
|
-
* bem helper
|
36
|
-
* b() // 'button'
|
37
|
-
* b('text') // 'button__text'
|
38
|
-
* b({ disabled }) // 'button button--disabled'
|
39
|
-
* b('text', { disabled }) // 'button__text button__text--disabled'
|
40
|
-
* b(['disabled', 'primary']) // 'button button--disabled button--primary'
|
41
|
-
*/
|
42
|
-
|
43
|
-
|
44
|
-
export function createBEM(name) {
|
25
|
+
function createBEM(name) {
|
45
26
|
return (el, mods) => {
|
46
|
-
if (el && typeof el !==
|
27
|
+
if (el && typeof el !== "string") {
|
47
28
|
mods = el;
|
48
|
-
el =
|
29
|
+
el = "";
|
49
30
|
}
|
50
|
-
|
51
|
-
|
52
|
-
return "" + el + genBem(el, mods);
|
31
|
+
el = el ? `${name}__${el}` : name;
|
32
|
+
return `${el}${genBem(el, mods)}`;
|
53
33
|
};
|
54
34
|
}
|
55
|
-
|
56
|
-
|
57
|
-
return [
|
58
|
-
|
35
|
+
function createNamespace(name) {
|
36
|
+
const prefixedName = `van-${name}`;
|
37
|
+
return [
|
38
|
+
prefixedName,
|
39
|
+
createBEM(prefixedName),
|
40
|
+
createTranslate(prefixedName)
|
41
|
+
];
|
42
|
+
}
|
43
|
+
export {
|
44
|
+
createBEM,
|
45
|
+
createNamespace,
|
46
|
+
createTranslate
|
47
|
+
};
|
package/es/utils/deep-assign.js
CHANGED
@@ -1,26 +1,22 @@
|
|
1
|
-
import { isDef, isObject } from
|
2
|
-
|
3
|
-
hasOwnProperty
|
4
|
-
} = Object.prototype;
|
5
|
-
|
1
|
+
import { isDef, isObject } from "./validate";
|
2
|
+
const { hasOwnProperty } = Object.prototype;
|
6
3
|
function assignKey(to, from, key) {
|
7
|
-
|
8
|
-
|
4
|
+
const val = from[key];
|
9
5
|
if (!isDef(val)) {
|
10
6
|
return;
|
11
7
|
}
|
12
|
-
|
13
8
|
if (!hasOwnProperty.call(to, key) || !isObject(val)) {
|
14
9
|
to[key] = val;
|
15
10
|
} else {
|
16
|
-
// eslint-disable-next-line no-use-before-define
|
17
11
|
to[key] = deepAssign(Object(to[key]), val);
|
18
12
|
}
|
19
13
|
}
|
20
|
-
|
21
|
-
|
22
|
-
Object.keys(from).forEach(key => {
|
14
|
+
function deepAssign(to, from) {
|
15
|
+
Object.keys(from).forEach((key) => {
|
23
16
|
assignKey(to, from, key);
|
24
17
|
});
|
25
18
|
return to;
|
26
|
-
}
|
19
|
+
}
|
20
|
+
export {
|
21
|
+
deepAssign
|
22
|
+
};
|
package/es/utils/deep-clone.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
import { isDef, isObject } from
|
2
|
-
|
1
|
+
import { isDef, isObject } from "./validate";
|
2
|
+
function deepClone(obj) {
|
3
3
|
if (!isDef(obj)) {
|
4
4
|
return obj;
|
5
5
|
}
|
6
|
-
|
7
6
|
if (Array.isArray(obj)) {
|
8
|
-
return obj.map(item => deepClone(item));
|
7
|
+
return obj.map((item) => deepClone(item));
|
9
8
|
}
|
10
|
-
|
11
9
|
if (isObject(obj)) {
|
12
|
-
|
13
|
-
Object.keys(obj).forEach(key => {
|
10
|
+
const to = {};
|
11
|
+
Object.keys(obj).forEach((key) => {
|
14
12
|
to[key] = deepClone(obj[key]);
|
15
13
|
});
|
16
14
|
return to;
|
17
15
|
}
|
18
|
-
|
19
16
|
return obj;
|
20
|
-
}
|
17
|
+
}
|
18
|
+
export {
|
19
|
+
deepClone
|
20
|
+
};
|
package/es/utils/dom.js
CHANGED
@@ -1,69 +1,67 @@
|
|
1
|
-
import { useRect, useWindowSize } from
|
2
|
-
import { unref } from
|
3
|
-
import { isIOS as checkIsIOS } from
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
import { useRect, useWindowSize } from "@vant/use";
|
2
|
+
import { unref } from "vue";
|
3
|
+
import { isIOS as checkIsIOS } from "./validate";
|
4
|
+
function getScrollTop(el) {
|
5
|
+
const top = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
|
7
6
|
return Math.max(top, 0);
|
8
7
|
}
|
9
|
-
|
10
|
-
if (
|
8
|
+
function setScrollTop(el, value) {
|
9
|
+
if ("scrollTop" in el) {
|
11
10
|
el.scrollTop = value;
|
12
11
|
} else {
|
13
12
|
el.scrollTo(el.scrollX, value);
|
14
13
|
}
|
15
14
|
}
|
16
|
-
|
15
|
+
function getRootScrollTop() {
|
17
16
|
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
18
17
|
}
|
19
|
-
|
18
|
+
function setRootScrollTop(value) {
|
20
19
|
setScrollTop(window, value);
|
21
20
|
setScrollTop(document.body, value);
|
22
|
-
}
|
23
|
-
|
24
|
-
export function getElementTop(el, scroller) {
|
21
|
+
}
|
22
|
+
function getElementTop(el, scroller) {
|
25
23
|
if (el === window) {
|
26
24
|
return 0;
|
27
25
|
}
|
28
|
-
|
29
|
-
var scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
|
26
|
+
const scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
|
30
27
|
return useRect(el).top + scrollTop;
|
31
28
|
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
export function resetScroll() {
|
29
|
+
const isIOS = checkIsIOS();
|
30
|
+
function resetScroll() {
|
36
31
|
if (isIOS) {
|
37
32
|
setRootScrollTop(getRootScrollTop());
|
38
33
|
}
|
39
34
|
}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
if (typeof event.cancelable !== 'boolean' || event.cancelable) {
|
35
|
+
const stopPropagation = (event) => event.stopPropagation();
|
36
|
+
function preventDefault(event, isStopPropagation) {
|
37
|
+
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
44
38
|
event.preventDefault();
|
45
39
|
}
|
46
|
-
|
47
40
|
if (isStopPropagation) {
|
48
41
|
stopPropagation(event);
|
49
42
|
}
|
50
43
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
44
|
+
function isHidden(elementRef) {
|
45
|
+
const el = unref(elementRef);
|
54
46
|
if (!el) {
|
55
47
|
return false;
|
56
48
|
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
// 1. The element or its parent element has the display property set to none.
|
61
|
-
// 2. The element has the position property set to fixed
|
62
|
-
|
63
|
-
var parentHidden = el.offsetParent === null && style.position !== 'fixed';
|
49
|
+
const style = window.getComputedStyle(el);
|
50
|
+
const hidden = style.display === "none";
|
51
|
+
const parentHidden = el.offsetParent === null && style.position !== "fixed";
|
64
52
|
return hidden || parentHidden;
|
65
53
|
}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
54
|
+
const { width: windowWidth, height: windowHeight } = useWindowSize();
|
55
|
+
export {
|
56
|
+
getElementTop,
|
57
|
+
getRootScrollTop,
|
58
|
+
getScrollTop,
|
59
|
+
isHidden,
|
60
|
+
preventDefault,
|
61
|
+
resetScroll,
|
62
|
+
setRootScrollTop,
|
63
|
+
setScrollTop,
|
64
|
+
stopPropagation,
|
65
|
+
windowHeight,
|
66
|
+
windowWidth
|
67
|
+
};
|
package/es/utils/format.js
CHANGED
@@ -1,140 +1,114 @@
|
|
1
|
-
import { inBrowser } from
|
2
|
-
import { windowWidth, windowHeight } from
|
3
|
-
import { isDef, isNumeric } from
|
4
|
-
|
1
|
+
import { inBrowser } from "./basic";
|
2
|
+
import { windowWidth, windowHeight } from "./dom";
|
3
|
+
import { isDef, isNumeric } from "./validate";
|
4
|
+
function addUnit(value) {
|
5
5
|
if (isDef(value)) {
|
6
|
-
return isNumeric(value) ? value
|
6
|
+
return isNumeric(value) ? `${value}px` : String(value);
|
7
7
|
}
|
8
|
-
|
9
|
-
return undefined;
|
8
|
+
return void 0;
|
10
9
|
}
|
11
|
-
|
10
|
+
function getSizeStyle(originSize) {
|
12
11
|
if (isDef(originSize)) {
|
13
|
-
|
12
|
+
const size = addUnit(originSize);
|
14
13
|
return {
|
15
14
|
width: size,
|
16
15
|
height: size
|
17
16
|
};
|
18
17
|
}
|
19
18
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
if (zIndex !== undefined) {
|
19
|
+
function getZIndexStyle(zIndex) {
|
20
|
+
const style = {};
|
21
|
+
if (zIndex !== void 0) {
|
24
22
|
style.zIndex = +zIndex;
|
25
23
|
}
|
26
|
-
|
27
24
|
return style;
|
28
|
-
}
|
29
|
-
|
30
|
-
var rootFontSize;
|
31
|
-
|
25
|
+
}
|
26
|
+
let rootFontSize;
|
32
27
|
function getRootFontSize() {
|
33
28
|
if (!rootFontSize) {
|
34
|
-
|
35
|
-
|
29
|
+
const doc = document.documentElement;
|
30
|
+
const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
|
36
31
|
rootFontSize = parseFloat(fontSize);
|
37
32
|
}
|
38
|
-
|
39
33
|
return rootFontSize;
|
40
34
|
}
|
41
|
-
|
42
35
|
function convertRem(value) {
|
43
|
-
value = value.replace(/rem/g,
|
36
|
+
value = value.replace(/rem/g, "");
|
44
37
|
return +value * getRootFontSize();
|
45
38
|
}
|
46
|
-
|
47
39
|
function convertVw(value) {
|
48
|
-
value = value.replace(/vw/g,
|
40
|
+
value = value.replace(/vw/g, "");
|
49
41
|
return +value * windowWidth.value / 100;
|
50
42
|
}
|
51
|
-
|
52
43
|
function convertVh(value) {
|
53
|
-
value = value.replace(/vh/g,
|
44
|
+
value = value.replace(/vh/g, "");
|
54
45
|
return +value * windowHeight.value / 100;
|
55
46
|
}
|
56
|
-
|
57
|
-
|
58
|
-
if (typeof value === 'number') {
|
47
|
+
function unitToPx(value) {
|
48
|
+
if (typeof value === "number") {
|
59
49
|
return value;
|
60
50
|
}
|
61
|
-
|
62
51
|
if (inBrowser) {
|
63
|
-
if (value.includes(
|
52
|
+
if (value.includes("rem")) {
|
64
53
|
return convertRem(value);
|
65
54
|
}
|
66
|
-
|
67
|
-
if (value.includes('vw')) {
|
55
|
+
if (value.includes("vw")) {
|
68
56
|
return convertVw(value);
|
69
57
|
}
|
70
|
-
|
71
|
-
if (value.includes('vh')) {
|
58
|
+
if (value.includes("vh")) {
|
72
59
|
return convertVh(value);
|
73
60
|
}
|
74
61
|
}
|
75
|
-
|
76
62
|
return parseFloat(value);
|
77
63
|
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
targetLength = 2;
|
84
|
-
}
|
85
|
-
|
86
|
-
var str = num + '';
|
87
|
-
|
64
|
+
const camelizeRE = /-(\w)/g;
|
65
|
+
const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
|
66
|
+
const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
|
67
|
+
function padZero(num, targetLength = 2) {
|
68
|
+
let str = num + "";
|
88
69
|
while (str.length < targetLength) {
|
89
|
-
str =
|
70
|
+
str = "0" + str;
|
90
71
|
}
|
91
|
-
|
92
72
|
return str;
|
93
73
|
}
|
94
|
-
|
95
|
-
|
96
|
-
export var clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
97
|
-
|
74
|
+
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
98
75
|
function trimExtraChar(value, char, regExp) {
|
99
|
-
|
100
|
-
|
76
|
+
const index = value.indexOf(char);
|
101
77
|
if (index === -1) {
|
102
78
|
return value;
|
103
79
|
}
|
104
|
-
|
105
|
-
if (char === '-' && index !== 0) {
|
80
|
+
if (char === "-" && index !== 0) {
|
106
81
|
return value.slice(0, index);
|
107
82
|
}
|
108
|
-
|
109
|
-
return value.slice(0, index + 1) + value.slice(index).replace(regExp, '');
|
83
|
+
return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
|
110
84
|
}
|
111
|
-
|
112
|
-
export function formatNumber(value, allowDot, allowMinus) {
|
113
|
-
if (allowDot === void 0) {
|
114
|
-
allowDot = true;
|
115
|
-
}
|
116
|
-
|
117
|
-
if (allowMinus === void 0) {
|
118
|
-
allowMinus = true;
|
119
|
-
}
|
120
|
-
|
85
|
+
function formatNumber(value, allowDot = true, allowMinus = true) {
|
121
86
|
if (allowDot) {
|
122
|
-
value = trimExtraChar(value,
|
87
|
+
value = trimExtraChar(value, ".", /\./g);
|
123
88
|
} else {
|
124
|
-
value = value.split(
|
89
|
+
value = value.split(".")[0];
|
125
90
|
}
|
126
|
-
|
127
91
|
if (allowMinus) {
|
128
|
-
value = trimExtraChar(value,
|
92
|
+
value = trimExtraChar(value, "-", /-/g);
|
129
93
|
} else {
|
130
|
-
value = value.replace(/-/,
|
94
|
+
value = value.replace(/-/, "");
|
131
95
|
}
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
export function addNumber(num1, num2) {
|
138
|
-
var cardinal = Math.pow(10, 10);
|
96
|
+
const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
|
97
|
+
return value.replace(regExp, "");
|
98
|
+
}
|
99
|
+
function addNumber(num1, num2) {
|
100
|
+
const cardinal = 10 ** 10;
|
139
101
|
return Math.round((num1 + num2) * cardinal) / cardinal;
|
140
|
-
}
|
102
|
+
}
|
103
|
+
export {
|
104
|
+
addNumber,
|
105
|
+
addUnit,
|
106
|
+
camelize,
|
107
|
+
clamp,
|
108
|
+
formatNumber,
|
109
|
+
getSizeStyle,
|
110
|
+
getZIndexStyle,
|
111
|
+
kebabCase,
|
112
|
+
padZero,
|
113
|
+
unitToPx
|
114
|
+
};
|
package/es/utils/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
4
|
-
export * from
|
5
|
-
export * from
|
6
|
-
export * from
|
7
|
-
export * from
|
8
|
-
export * from
|
9
|
-
export * from
|
1
|
+
export * from "./basic";
|
2
|
+
export * from "./props";
|
3
|
+
export * from "./dom";
|
4
|
+
export * from "./create";
|
5
|
+
export * from "./format";
|
6
|
+
export * from "./constant";
|
7
|
+
export * from "./validate";
|
8
|
+
export * from "./interceptor";
|
9
|
+
export * from "./with-install";
|