tlvant 0.0.22 → 0.0.24
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-sheet/index.css +1 -0
- package/es/action-sheet/index.js +177 -0
- package/es/action-sheet/index.less +112 -0
- package/es/action-sheet/style/index.js +7 -0
- package/es/action-sheet/style/less.js +7 -0
- package/es/area/index.js +321 -0
- package/es/area/style/index.js +3 -0
- package/es/area/style/less.js +3 -0
- package/es/button/index.css +1 -0
- package/es/button/index.js +171 -0
- package/es/button/index.less +238 -0
- package/es/button/style/index.js +5 -0
- package/es/button/style/less.js +5 -0
- package/es/calendar/components/Header.js +55 -0
- package/es/calendar/components/Month.js +326 -0
- package/es/calendar/index.css +1 -0
- package/es/calendar/index.js +539 -0
- package/es/calendar/index.less +210 -0
- package/es/calendar/style/index.js +9 -0
- package/es/calendar/style/less.js +9 -0
- package/es/calendar/utils.js +66 -0
- package/es/cell/index.css +1 -0
- package/es/cell/index.js +121 -0
- package/es/cell/index.less +103 -0
- package/es/cell/shared.js +24 -0
- package/es/cell/style/index.js +4 -0
- package/es/cell/style/less.js +4 -0
- package/es/cell-group/index.css +1 -0
- package/es/cell-group/index.js +34 -0
- package/es/cell-group/index.less +12 -0
- package/es/cell-group/style/index.js +2 -0
- package/es/cell-group/style/less.js +2 -0
- package/es/checkbox/index.css +1 -0
- package/es/checkbox/index.js +80 -0
- package/es/checkbox/index.less +85 -0
- package/es/checkbox/style/index.js +4 -0
- package/es/checkbox/style/less.js +4 -0
- package/es/checkbox-group/index.css +1 -0
- package/es/checkbox-group/index.js +64 -0
- package/es/checkbox-group/index.less +8 -0
- package/es/checkbox-group/style/index.js +2 -0
- package/es/checkbox-group/style/less.js +2 -0
- package/es/collapse/index.js +39 -0
- package/es/collapse/style/index.js +1 -0
- package/es/collapse/style/less.js +1 -0
- package/es/collapse-item/index.css +1 -0
- package/es/collapse-item/index.js +198 -0
- package/es/collapse-item/index.less +67 -0
- package/es/collapse-item/style/index.js +5 -0
- package/es/collapse-item/style/less.js +5 -0
- package/es/contact-card/index.css +1 -0
- package/es/contact-card/index.js +59 -0
- package/es/contact-card/index.less +42 -0
- package/es/contact-card/style/index.js +5 -0
- package/es/contact-card/style/less.js +5 -0
- package/es/contact-edit/index.css +1 -0
- package/es/contact-edit/index.js +193 -0
- package/es/contact-edit/index.less +30 -0
- package/es/contact-edit/style/index.js +14 -0
- package/es/contact-edit/style/less.js +14 -0
- package/es/contact-list/index.css +1 -0
- package/es/contact-list/index.js +119 -0
- package/es/contact-list/index.less +54 -0
- package/es/contact-list/style/index.js +10 -0
- package/es/contact-list/style/less.js +10 -0
- package/es/datetime-picker/DatePicker.js +246 -0
- package/es/datetime-picker/TimePicker.js +104 -0
- package/es/datetime-picker/index.js +29 -0
- package/es/datetime-picker/shared.js +110 -0
- package/es/datetime-picker/style/index.js +3 -0
- package/es/datetime-picker/style/less.js +3 -0
- package/es/datetime-picker/utils.js +29 -0
- package/es/demo-button/index-sfc.css +1 -0
- package/es/demo-button/index-sfc.less +9 -0
- package/es/demo-button/index.js +27 -0
- package/es/demo-button/style/index.js +1 -0
- package/es/demo-button/style/less.js +1 -0
- package/es/dialog/Dialog.js +246 -0
- package/es/dialog/index.css +1 -0
- package/es/dialog/index.js +104 -0
- package/es/dialog/index.less +153 -0
- package/es/dialog/style/index.js +10 -0
- package/es/dialog/style/less.js +10 -0
- package/es/dropdown-item/index.css +1 -0
- package/es/dropdown-item/index.js +210 -0
- package/es/dropdown-item/index.less +39 -0
- package/es/dropdown-item/style/index.js +7 -0
- package/es/dropdown-item/style/less.js +7 -0
- package/es/dropdown-menu/index.css +1 -0
- package/es/dropdown-menu/index.js +132 -0
- package/es/dropdown-menu/index.less +77 -0
- package/es/dropdown-menu/style/index.js +2 -0
- package/es/dropdown-menu/style/less.js +2 -0
- package/es/empty/Network.js +193 -0
- package/es/empty/index.css +1 -0
- package/es/empty/index.js +81 -0
- package/es/empty/index.less +32 -0
- package/es/empty/style/index.js +2 -0
- package/es/empty/style/less.js +2 -0
- package/es/field/index.css +1 -0
- package/es/field/index.js +623 -0
- package/es/field/index.less +172 -0
- package/es/field/style/index.js +5 -0
- package/es/field/style/less.js +5 -0
- package/es/form/index.js +200 -0
- package/es/form/style/index.js +1 -0
- package/es/form/style/less.js +1 -0
- package/es/goods-action/index.css +1 -0
- package/es/goods-action/index.js +24 -0
- package/es/goods-action/index.less +19 -0
- package/es/goods-action/style/index.js +2 -0
- package/es/goods-action/style/less.js +2 -0
- package/es/goods-action-button/index.css +1 -0
- package/es/goods-action-button/index.js +57 -0
- package/es/goods-action-button/index.less +34 -0
- package/es/goods-action-button/style/index.js +6 -0
- package/es/goods-action-button/style/less.js +6 -0
- package/es/icon/index.css +1 -0
- package/es/icon/index.js +74 -0
- package/es/icon/index.less +11 -0
- package/es/icon/local.css +1 -0
- package/es/icon/local.less +1 -0
- package/es/icon/style/index.js +3 -0
- package/es/icon/style/less.js +3 -0
- package/es/image/index.css +1 -0
- package/es/image/index.js +189 -0
- package/es/image/index.less +47 -0
- package/es/image/style/index.js +4 -0
- package/es/image/style/less.js +4 -0
- package/es/image-preview/ImagePreview.js +234 -0
- package/es/image-preview/ImagePreviewItem.js +242 -0
- package/es/image-preview/index.css +1 -0
- package/es/image-preview/index.js +86 -0
- package/es/image-preview/index.less +103 -0
- package/es/image-preview/shared.js +7 -0
- package/es/image-preview/style/index.js +10 -0
- package/es/image-preview/style/less.js +10 -0
- package/es/index-anchor/index.css +1 -0
- package/es/index-anchor/index.js +83 -0
- package/es/index-anchor/index.less +21 -0
- package/es/index-anchor/style/index.js +2 -0
- package/es/index-anchor/style/less.js +2 -0
- package/es/index-bar/index.css +1 -0
- package/es/index-bar/index.js +222 -0
- package/es/index-bar/index.less +27 -0
- package/es/index-bar/style/index.js +2 -0
- package/es/index-bar/style/less.js +2 -0
- package/es/index.js +80 -0
- package/es/info/index.css +1 -0
- package/es/info/index.js +30 -0
- package/es/info/index.less +29 -0
- package/es/info/style/index.js +2 -0
- package/es/info/style/less.js +2 -0
- package/es/lazyload/index.js +2 -0
- package/es/lazyload/style/index.js +1 -0
- package/es/lazyload/style/less.js +1 -0
- package/es/list/index.css +1 -0
- package/es/list/index.js +178 -0
- package/es/list/index.less +21 -0
- package/es/list/style/index.js +3 -0
- package/es/list/style/less.js +3 -0
- package/es/loading/index.css +1 -0
- package/es/loading/index.js +86 -0
- package/es/loading/index.less +103 -0
- package/es/loading/style/index.js +2 -0
- package/es/loading/style/less.js +2 -0
- package/es/locale/index.js +27 -0
- package/es/locale/lang/de-DE-formal.js +90 -0
- package/es/locale/lang/de-DE.js +90 -0
- package/es/locale/lang/en-US.js +90 -0
- package/es/locale/lang/es-ES.js +90 -0
- package/es/locale/lang/ja-JP.js +91 -0
- package/es/locale/lang/nb-NO.js +90 -0
- package/es/locale/lang/ro-RO.js +90 -0
- package/es/locale/lang/tr-TR.js +90 -0
- package/es/locale/lang/zh-CN.js +91 -0
- package/es/locale/lang/zh-HK.js +91 -0
- package/es/locale/lang/zh-TW.js +91 -0
- package/es/locale/style/index.js +1 -0
- package/es/locale/style/less.js +1 -0
- package/es/mixins/bind-event.js +29 -0
- package/es/mixins/checkbox.js +139 -0
- package/es/mixins/click-outside.js +33 -0
- package/es/mixins/close-on-popstate.js +38 -0
- package/es/mixins/field.js +24 -0
- package/es/mixins/popup/context.js +10 -0
- package/es/mixins/popup/index.js +208 -0
- package/es/mixins/popup/overlay.js +76 -0
- package/es/mixins/popup/type.js +0 -0
- package/es/mixins/portal.js +48 -0
- package/es/mixins/relation.js +76 -0
- package/es/mixins/slots.js +23 -0
- package/es/mixins/touch.js +58 -0
- package/es/nav-bar/index.css +1 -0
- package/es/nav-bar/index.js +124 -0
- package/es/nav-bar/index.less +77 -0
- package/es/nav-bar/style/index.js +4 -0
- package/es/nav-bar/style/less.js +4 -0
- package/es/number-keyboard/CollapseIcon.js +16 -0
- package/es/number-keyboard/DeleteIcon.js +16 -0
- package/es/number-keyboard/Key.js +121 -0
- package/es/number-keyboard/index.css +1 -0
- package/es/number-keyboard/index.js +409 -0
- package/es/number-keyboard/index.less +191 -0
- package/es/number-keyboard/style/index.js +3 -0
- package/es/number-keyboard/style/less.js +3 -0
- package/es/overlay/index.css +1 -0
- package/es/overlay/index.js +53 -0
- package/es/overlay/index.less +11 -0
- package/es/overlay/style/index.js +2 -0
- package/es/overlay/style/less.js +2 -0
- package/es/password-input/index.css +1 -0
- package/es/password-input/index.js +84 -0
- package/es/password-input/index.less +83 -0
- package/es/password-input/style/index.js +2 -0
- package/es/password-input/style/less.js +2 -0
- package/es/picker/PickerColumn.js +300 -0
- package/es/picker/index.css +1 -0
- package/es/picker/index.js +383 -0
- package/es/picker/index.less +118 -0
- package/es/picker/shared.js +22 -0
- package/es/picker/style/index.js +3 -0
- package/es/picker/style/less.js +3 -0
- package/es/popover/index.css +1 -0
- package/es/popover/index.js +211 -0
- package/es/popover/index.less +270 -0
- package/es/popover/style/index.js +6 -0
- package/es/popover/style/less.js +6 -0
- package/es/popup/index.css +1 -0
- package/es/popup/index.js +111 -0
- package/es/popup/index.less +140 -0
- package/es/popup/style/index.js +5 -0
- package/es/popup/style/less.js +5 -0
- package/es/pull-refresh/index.css +1 -0
- package/es/pull-refresh/index.js +213 -0
- package/es/pull-refresh/index.less +25 -0
- package/es/pull-refresh/style/index.js +3 -0
- package/es/pull-refresh/style/less.js +3 -0
- package/es/radio/index.css +1 -0
- package/es/radio/index.js +32 -0
- package/es/radio/index.less +86 -0
- package/es/radio/style/index.js +4 -0
- package/es/radio/style/less.js +4 -0
- package/es/radio-group/index.css +1 -0
- package/es/radio-group/index.js +32 -0
- package/es/radio-group/index.less +8 -0
- package/es/radio-group/style/index.js +2 -0
- package/es/radio-group/style/less.js +2 -0
- package/es/rate/index.css +1 -0
- package/es/rate/index.js +227 -0
- package/es/rate/index.less +46 -0
- package/es/rate/style/index.js +4 -0
- package/es/rate/style/less.js +4 -0
- package/es/search/index.css +1 -0
- package/es/search/index.js +114 -0
- package/es/search/index.less +68 -0
- package/es/search/style/index.js +6 -0
- package/es/search/style/less.js +6 -0
- package/es/slider/index.css +1 -0
- package/es/slider/index.js +289 -0
- package/es/slider/index.less +94 -0
- package/es/slider/style/index.js +2 -0
- package/es/slider/style/less.js +2 -0
- package/es/step/index.css +1 -0
- package/es/step/index.js +115 -0
- package/es/step/index.less +151 -0
- package/es/step/style/index.js +4 -0
- package/es/step/style/less.js +4 -0
- package/es/stepper/index.css +1 -0
- package/es/stepper/index.js +355 -0
- package/es/stepper/index.less +129 -0
- package/es/stepper/style/index.js +2 -0
- package/es/stepper/style/less.js +2 -0
- package/es/steps/index.css +1 -0
- package/es/steps/index.js +35 -0
- package/es/steps/index.less +21 -0
- package/es/steps/style/index.js +2 -0
- package/es/steps/style/less.js +2 -0
- package/es/sticky/index.css +1 -0
- package/es/sticky/index.js +146 -0
- package/es/sticky/index.less +11 -0
- package/es/sticky/style/index.js +2 -0
- package/es/sticky/style/less.js +2 -0
- package/es/style/animation.css +1 -0
- package/es/style/animation.less +139 -0
- package/es/style/base.css +1 -0
- package/es/style/base.less +10 -0
- package/es/style/clearfix.css +1 -0
- package/es/style/clearfix.less +5 -0
- package/es/style/ellipsis.css +1 -0
- package/es/style/ellipsis.less +13 -0
- package/es/style/hairline.css +1 -0
- package/es/style/hairline.less +47 -0
- package/es/style/iconfont.css +1 -0
- package/es/style/iconfont.less +910 -0
- package/es/style/mixins/clearfix.css +0 -0
- package/es/style/mixins/clearfix.less +7 -0
- package/es/style/mixins/ellipsis.css +0 -0
- package/es/style/mixins/ellipsis.less +15 -0
- package/es/style/mixins/hairline.css +0 -0
- package/es/style/mixins/hairline.less +39 -0
- package/es/style/normalize.css +1 -0
- package/es/style/normalize.less +38 -0
- package/es/style/reset.css +1 -0
- package/es/style/reset.less +171 -0
- package/es/style/var.css +0 -0
- package/es/style/var.less +983 -0
- package/es/swipe/index.css +1 -0
- package/es/swipe/index.js +429 -0
- package/es/swipe/index.less +56 -0
- package/es/swipe/style/index.js +2 -0
- package/es/swipe/style/less.js +2 -0
- package/es/swipe-item/index.css +1 -0
- package/es/swipe-item/index.js +78 -0
- package/es/swipe-item/index.less +8 -0
- package/es/swipe-item/style/index.js +2 -0
- package/es/swipe-item/style/less.js +2 -0
- package/es/switch/index.css +1 -0
- package/es/switch/index.js +74 -0
- package/es/switch/index.less +57 -0
- package/es/switch/shared.js +19 -0
- package/es/switch/style/index.js +3 -0
- package/es/switch/style/less.js +3 -0
- package/es/tab/index.css +1 -0
- package/es/tab/index.js +102 -0
- package/es/tab/index.less +24 -0
- package/es/tab/style/index.js +2 -0
- package/es/tab/style/less.js +2 -0
- package/es/tabs/Content.js +78 -0
- package/es/tabs/Title.js +92 -0
- package/es/tabs/index.css +1 -0
- package/es/tabs/index.js +419 -0
- package/es/tabs/index.less +153 -0
- package/es/tabs/style/index.js +4 -0
- package/es/tabs/style/less.js +4 -0
- package/es/tabs/utils.js +43 -0
- package/es/tag/index.css +1 -0
- package/es/tag/index.js +74 -0
- package/es/tag/index.less +97 -0
- package/es/tag/style/index.js +4 -0
- package/es/tag/style/less.js +4 -0
- package/es/toast/Toast.js +155 -0
- package/es/toast/index.css +1 -0
- package/es/toast/index.js +189 -0
- package/es/toast/index.less +76 -0
- package/es/toast/lock-click.js +16 -0
- package/es/toast/style/index.js +7 -0
- package/es/toast/style/less.js +7 -0
- package/es/types/address-edit.d.js +11 -0
- package/es/types/area.d.js +11 -0
- package/es/types/calendar.d.js +11 -0
- package/es/types/checkbox-group.d.js +11 -0
- package/es/types/checkbox.d.js +11 -0
- package/es/types/collapse-item.d.js +11 -0
- package/es/types/component.d.js +11 -0
- package/es/types/count-down.d.js +11 -0
- package/es/types/datetime-picker.d.js +11 -0
- package/es/types/dialog.d.js +1 -0
- package/es/types/dropdown-item.d.js +11 -0
- package/es/types/field.d.js +11 -0
- package/es/types/form.d.js +11 -0
- package/es/types/image-preview.d.js +12 -0
- package/es/types/index-bar.d.js +11 -0
- package/es/types/index.d.js +590 -0
- package/es/types/jsx.d.js +0 -0
- package/es/types/lazyload.d.js +1 -0
- package/es/types/list.d.js +11 -0
- package/es/types/locale.d.js +1 -0
- package/es/types/mixins/popup.d.js +1 -0
- package/es/types/notify.d.js +2 -0
- package/es/types/picker.d.js +11 -0
- package/es/types/progress.d.js +11 -0
- package/es/types/sku.d.js +11 -0
- package/es/types/swipe-cell.d.js +11 -0
- package/es/types/swipe.d.js +11 -0
- package/es/types/tabs.d.js +11 -0
- package/es/types/toast.d.js +2 -0
- package/es/types/uploader.d.js +11 -0
- package/es/uploader/index.css +1 -0
- package/es/uploader/index.js +451 -0
- package/es/uploader/index.less +159 -0
- package/es/uploader/style/index.js +11 -0
- package/es/uploader/style/less.js +11 -0
- package/es/uploader/utils.js +57 -0
- package/es/utils/constant.js +10 -0
- package/es/utils/create/bem.js +39 -0
- package/es/utils/create/component.js +57 -0
- package/es/utils/create/i18n.js +16 -0
- package/es/utils/create/index.js +7 -0
- package/es/utils/deep-assign.js +24 -0
- package/es/utils/deep-clone.js +14 -0
- package/es/utils/dom/event.js +48 -0
- package/es/utils/dom/node.js +7 -0
- package/es/utils/dom/raf.js +36 -0
- package/es/utils/dom/reset-scroll.js +14 -0
- package/es/utils/dom/scroll.js +69 -0
- package/es/utils/dom/style.js +9 -0
- package/es/utils/format/number.js +47 -0
- package/es/utils/format/string.js +19 -0
- package/es/utils/format/unit.js +59 -0
- package/es/utils/functional.js +56 -0
- package/es/utils/index.js +29 -0
- package/es/utils/interceptor.js +22 -0
- package/es/utils/router.js +36 -0
- package/es/utils/types.js +0 -0
- package/es/utils/validate/date.js +4 -0
- package/es/utils/validate/email.js +5 -0
- package/es/utils/validate/mobile.js +4 -0
- package/es/utils/validate/number.js +11 -0
- package/es/utils/validate/system.js +9 -0
- package/es/utils/vnodes.js +36 -0
- package/lib/action-sheet/index.css +1 -0
- package/lib/action-sheet/index.js +194 -0
- package/lib/action-sheet/index.less +112 -0
- package/lib/action-sheet/style/index.js +7 -0
- package/lib/action-sheet/style/less.js +7 -0
- package/lib/area/index.js +331 -0
- package/lib/area/style/index.js +3 -0
- package/lib/area/style/less.js +3 -0
- package/lib/button/index.css +1 -0
- package/lib/button/index.js +188 -0
- package/lib/button/index.less +238 -0
- package/lib/button/style/index.js +5 -0
- package/lib/button/style/less.js +5 -0
- package/lib/calendar/components/Header.js +63 -0
- package/lib/calendar/components/Month.js +336 -0
- package/lib/calendar/index.css +1 -0
- package/lib/calendar/index.js +557 -0
- package/lib/calendar/index.less +210 -0
- package/lib/calendar/style/index.js +9 -0
- package/lib/calendar/style/less.js +9 -0
- package/lib/calendar/utils.js +91 -0
- package/lib/cell/index.css +1 -0
- package/lib/cell/index.js +137 -0
- package/lib/cell/index.less +103 -0
- package/lib/cell/shared.js +29 -0
- package/lib/cell/style/index.js +4 -0
- package/lib/cell/style/less.js +4 -0
- package/lib/cell-group/index.css +1 -0
- package/lib/cell-group/index.js +47 -0
- package/lib/cell-group/index.less +12 -0
- package/lib/cell-group/style/index.js +2 -0
- package/lib/cell-group/style/less.js +2 -0
- package/lib/checkbox/index.css +1 -0
- package/lib/checkbox/index.js +88 -0
- package/lib/checkbox/index.less +85 -0
- package/lib/checkbox/style/index.js +4 -0
- package/lib/checkbox/style/less.js +4 -0
- package/lib/checkbox-group/index.css +1 -0
- package/lib/checkbox-group/index.js +73 -0
- package/lib/checkbox-group/index.less +8 -0
- package/lib/checkbox-group/style/index.js +2 -0
- package/lib/checkbox-group/style/less.js +2 -0
- package/lib/collapse/index.js +48 -0
- package/lib/collapse/style/index.js +1 -0
- package/lib/collapse/style/less.js +1 -0
- package/lib/collapse-item/index.css +1 -0
- package/lib/collapse-item/index.js +213 -0
- package/lib/collapse-item/index.less +67 -0
- package/lib/collapse-item/style/index.js +5 -0
- package/lib/collapse-item/style/less.js +5 -0
- package/lib/contact-card/index.css +1 -0
- package/lib/contact-card/index.js +72 -0
- package/lib/contact-card/index.less +42 -0
- package/lib/contact-card/style/index.js +5 -0
- package/lib/contact-card/style/less.js +5 -0
- package/lib/contact-edit/index.css +1 -0
- package/lib/contact-edit/index.js +210 -0
- package/lib/contact-edit/index.less +30 -0
- package/lib/contact-edit/style/index.js +14 -0
- package/lib/contact-edit/style/less.js +14 -0
- package/lib/contact-list/index.css +1 -0
- package/lib/contact-list/index.js +138 -0
- package/lib/contact-list/index.less +54 -0
- package/lib/contact-list/style/index.js +10 -0
- package/lib/contact-list/style/less.js +10 -0
- package/lib/datetime-picker/DatePicker.js +261 -0
- package/lib/datetime-picker/TimePicker.js +117 -0
- package/lib/datetime-picker/index.js +41 -0
- package/lib/datetime-picker/shared.js +124 -0
- package/lib/datetime-picker/style/index.js +3 -0
- package/lib/datetime-picker/style/less.js +3 -0
- package/lib/datetime-picker/utils.js +39 -0
- package/lib/demo-button/index-sfc.css +1 -0
- package/lib/demo-button/index-sfc.less +9 -0
- package/lib/demo-button/index.js +33 -0
- package/lib/demo-button/style/index.js +1 -0
- package/lib/demo-button/style/less.js +1 -0
- package/lib/dialog/Dialog.js +261 -0
- package/lib/dialog/index.css +1 -0
- package/lib/dialog/index.js +116 -0
- package/lib/dialog/index.less +153 -0
- package/lib/dialog/style/index.js +10 -0
- package/lib/dialog/style/less.js +10 -0
- package/lib/dropdown-item/index.css +1 -0
- package/lib/dropdown-item/index.js +225 -0
- package/lib/dropdown-item/index.less +39 -0
- package/lib/dropdown-item/style/index.js +7 -0
- package/lib/dropdown-item/style/less.js +7 -0
- package/lib/dropdown-menu/index.css +1 -0
- package/lib/dropdown-menu/index.js +142 -0
- package/lib/dropdown-menu/index.less +77 -0
- package/lib/dropdown-menu/style/index.js +2 -0
- package/lib/dropdown-menu/style/less.js +2 -0
- package/lib/empty/Network.js +198 -0
- package/lib/empty/index.css +1 -0
- package/lib/empty/index.js +92 -0
- package/lib/empty/index.less +32 -0
- package/lib/empty/style/index.js +2 -0
- package/lib/empty/style/less.js +2 -0
- package/lib/field/index.css +1 -0
- package/lib/field/index.js +639 -0
- package/lib/field/index.less +172 -0
- package/lib/field/style/index.js +5 -0
- package/lib/field/style/less.js +5 -0
- package/lib/form/index.js +208 -0
- package/lib/form/style/index.js +1 -0
- package/lib/form/style/less.js +1 -0
- package/lib/goods-action/index.css +1 -0
- package/lib/goods-action/index.js +32 -0
- package/lib/goods-action/index.less +19 -0
- package/lib/goods-action/style/index.js +2 -0
- package/lib/goods-action/style/less.js +2 -0
- package/lib/goods-action-button/index.css +1 -0
- package/lib/goods-action-button/index.js +70 -0
- package/lib/goods-action-button/index.less +34 -0
- package/lib/goods-action-button/style/index.js +6 -0
- package/lib/goods-action-button/style/less.js +6 -0
- package/lib/icon/index.css +1 -0
- package/lib/icon/index.js +87 -0
- package/lib/icon/index.less +11 -0
- package/lib/icon/local.css +1 -0
- package/lib/icon/local.less +1 -0
- package/lib/icon/style/index.js +3 -0
- package/lib/icon/style/less.js +3 -0
- package/lib/image/index.css +1 -0
- package/lib/image/index.js +199 -0
- package/lib/image/index.less +47 -0
- package/lib/image/style/index.js +4 -0
- package/lib/image/style/less.js +4 -0
- package/lib/image-preview/ImagePreview.js +250 -0
- package/lib/image-preview/ImagePreviewItem.js +256 -0
- package/lib/image-preview/index.css +1 -0
- package/lib/image-preview/index.js +96 -0
- package/lib/image-preview/index.less +103 -0
- package/lib/image-preview/shared.js +13 -0
- package/lib/image-preview/style/index.js +10 -0
- package/lib/image-preview/style/less.js +10 -0
- package/lib/index-anchor/index.css +1 -0
- package/lib/index-anchor/index.js +93 -0
- package/lib/index-anchor/index.less +21 -0
- package/lib/index-anchor/style/index.js +2 -0
- package/lib/index-anchor/style/less.js +2 -0
- package/lib/index-bar/index.css +1 -0
- package/lib/index-bar/index.js +235 -0
- package/lib/index-bar/index.less +27 -0
- package/lib/index-bar/style/index.js +2 -0
- package/lib/index-bar/style/less.js +2 -0
- package/lib/index.css +1 -0
- package/lib/index.js +262 -0
- package/lib/index.less +52 -0
- package/lib/info/index.css +1 -0
- package/lib/info/index.js +42 -0
- package/lib/info/index.less +29 -0
- package/lib/info/style/index.js +2 -0
- package/lib/info/style/less.js +2 -0
- package/lib/lazyload/index.js +11 -0
- package/lib/lazyload/style/index.js +1 -0
- package/lib/lazyload/style/less.js +1 -0
- package/lib/list/index.css +1 -0
- package/lib/list/index.js +191 -0
- package/lib/list/index.less +21 -0
- package/lib/list/style/index.js +3 -0
- package/lib/list/style/less.js +3 -0
- package/lib/loading/index.css +1 -0
- package/lib/loading/index.js +98 -0
- package/lib/loading/index.less +103 -0
- package/lib/loading/style/index.js +2 -0
- package/lib/loading/style/less.js +2 -0
- package/lib/locale/index.js +38 -0
- package/lib/locale/lang/de-DE-formal.js +95 -0
- package/lib/locale/lang/de-DE.js +95 -0
- package/lib/locale/lang/en-US.js +95 -0
- package/lib/locale/lang/es-ES.js +95 -0
- package/lib/locale/lang/ja-JP.js +96 -0
- package/lib/locale/lang/nb-NO.js +95 -0
- package/lib/locale/lang/ro-RO.js +95 -0
- package/lib/locale/lang/tr-TR.js +95 -0
- package/lib/locale/lang/zh-CN.js +96 -0
- package/lib/locale/lang/zh-HK.js +96 -0
- package/lib/locale/lang/zh-TW.js +96 -0
- package/lib/locale/style/index.js +1 -0
- package/lib/locale/style/less.js +1 -0
- package/lib/mixins/bind-event.js +36 -0
- package/lib/mixins/checkbox.js +152 -0
- package/lib/mixins/click-outside.js +41 -0
- package/lib/mixins/close-on-popstate.js +46 -0
- package/lib/mixins/field.js +29 -0
- package/lib/mixins/popup/context.js +15 -0
- package/lib/mixins/popup/index.js +224 -0
- package/lib/mixins/popup/overlay.js +95 -0
- package/lib/mixins/popup/type.js +1 -0
- package/lib/mixins/portal.js +53 -0
- package/lib/mixins/relation.js +84 -0
- package/lib/mixins/slots.js +29 -0
- package/lib/mixins/touch.js +65 -0
- package/lib/nav-bar/index.css +1 -0
- package/lib/nav-bar/index.js +135 -0
- package/lib/nav-bar/index.less +77 -0
- package/lib/nav-bar/style/index.js +4 -0
- package/lib/nav-bar/style/less.js +4 -0
- package/lib/number-keyboard/CollapseIcon.js +21 -0
- package/lib/number-keyboard/DeleteIcon.js +21 -0
- package/lib/number-keyboard/Key.js +134 -0
- package/lib/number-keyboard/index.css +1 -0
- package/lib/number-keyboard/index.js +423 -0
- package/lib/number-keyboard/index.less +191 -0
- package/lib/number-keyboard/style/index.js +3 -0
- package/lib/number-keyboard/style/less.js +3 -0
- package/lib/overlay/index.css +1 -0
- package/lib/overlay/index.js +67 -0
- package/lib/overlay/index.less +11 -0
- package/lib/overlay/style/index.js +2 -0
- package/lib/overlay/style/less.js +2 -0
- package/lib/password-input/index.css +1 -0
- package/lib/password-input/index.js +97 -0
- package/lib/password-input/index.less +83 -0
- package/lib/password-input/style/index.js +2 -0
- package/lib/password-input/style/less.js +2 -0
- package/lib/picker/PickerColumn.js +314 -0
- package/lib/picker/index.css +1 -0
- package/lib/picker/index.js +399 -0
- package/lib/picker/index.less +118 -0
- package/lib/picker/shared.js +28 -0
- package/lib/picker/style/index.js +3 -0
- package/lib/picker/style/less.js +3 -0
- package/lib/popover/index.css +1 -0
- package/lib/popover/index.js +226 -0
- package/lib/popover/index.less +270 -0
- package/lib/popover/style/index.js +6 -0
- package/lib/popover/style/less.js +6 -0
- package/lib/popup/index.css +1 -0
- package/lib/popup/index.js +122 -0
- package/lib/popup/index.less +140 -0
- package/lib/popup/style/index.js +5 -0
- package/lib/popup/style/less.js +5 -0
- package/lib/pull-refresh/index.css +1 -0
- package/lib/pull-refresh/index.js +227 -0
- package/lib/pull-refresh/index.less +25 -0
- package/lib/pull-refresh/style/index.js +3 -0
- package/lib/pull-refresh/style/less.js +3 -0
- package/lib/radio/index.css +1 -0
- package/lib/radio/index.js +40 -0
- package/lib/radio/index.less +86 -0
- package/lib/radio/style/index.js +4 -0
- package/lib/radio/style/less.js +4 -0
- package/lib/radio-group/index.css +1 -0
- package/lib/radio-group/index.js +41 -0
- package/lib/radio-group/index.less +8 -0
- package/lib/radio-group/style/index.js +2 -0
- package/lib/radio-group/style/less.js +2 -0
- package/lib/rate/index.css +1 -0
- package/lib/rate/index.js +240 -0
- package/lib/rate/index.less +46 -0
- package/lib/rate/style/index.js +4 -0
- package/lib/rate/style/less.js +4 -0
- package/lib/search/index.css +1 -0
- package/lib/search/index.js +128 -0
- package/lib/search/index.less +68 -0
- package/lib/search/style/index.js +6 -0
- package/lib/search/style/less.js +6 -0
- package/lib/slider/index.css +1 -0
- package/lib/slider/index.js +300 -0
- package/lib/slider/index.less +94 -0
- package/lib/slider/style/index.js +2 -0
- package/lib/slider/style/less.js +2 -0
- package/lib/step/index.css +1 -0
- package/lib/step/index.js +127 -0
- package/lib/step/index.less +151 -0
- package/lib/step/style/index.js +4 -0
- package/lib/step/style/less.js +4 -0
- package/lib/stepper/index.css +1 -0
- package/lib/stepper/index.js +369 -0
- package/lib/stepper/index.less +129 -0
- package/lib/stepper/style/index.js +2 -0
- package/lib/stepper/style/less.js +2 -0
- package/lib/steps/index.css +1 -0
- package/lib/steps/index.js +43 -0
- package/lib/steps/index.less +21 -0
- package/lib/steps/style/index.js +2 -0
- package/lib/steps/style/less.js +2 -0
- package/lib/sticky/index.css +1 -0
- package/lib/sticky/index.js +157 -0
- package/lib/sticky/index.less +11 -0
- package/lib/sticky/style/index.js +2 -0
- package/lib/sticky/style/less.js +2 -0
- package/lib/style/animation.css +1 -0
- package/lib/style/animation.less +139 -0
- package/lib/style/base.css +1 -0
- package/lib/style/base.less +10 -0
- package/lib/style/clearfix.css +1 -0
- package/lib/style/clearfix.less +5 -0
- package/lib/style/ellipsis.css +1 -0
- package/lib/style/ellipsis.less +13 -0
- package/lib/style/hairline.css +1 -0
- package/lib/style/hairline.less +47 -0
- package/lib/style/iconfont.css +1 -0
- package/lib/style/iconfont.less +910 -0
- package/lib/style/mixins/clearfix.css +0 -0
- package/lib/style/mixins/clearfix.less +7 -0
- package/lib/style/mixins/ellipsis.css +0 -0
- package/lib/style/mixins/ellipsis.less +15 -0
- package/lib/style/mixins/hairline.css +0 -0
- package/lib/style/mixins/hairline.less +39 -0
- package/lib/style/normalize.css +1 -0
- package/lib/style/normalize.less +38 -0
- package/lib/style/reset.css +1 -0
- package/lib/style/reset.less +171 -0
- package/lib/style/var.css +0 -0
- package/lib/style/var.less +983 -0
- package/lib/swipe/index.css +1 -0
- package/lib/swipe/index.js +443 -0
- package/lib/swipe/index.less +56 -0
- package/lib/swipe/style/index.js +2 -0
- package/lib/swipe/style/less.js +2 -0
- package/lib/swipe-item/index.css +1 -0
- package/lib/swipe-item/index.js +89 -0
- package/lib/swipe-item/index.less +8 -0
- package/lib/swipe-item/style/index.js +2 -0
- package/lib/swipe-item/style/less.js +2 -0
- package/lib/switch/index.css +1 -0
- package/lib/switch/index.js +86 -0
- package/lib/switch/index.less +57 -0
- package/lib/switch/shared.js +25 -0
- package/lib/switch/style/index.js +3 -0
- package/lib/switch/style/less.js +3 -0
- package/lib/tab/index.css +1 -0
- package/lib/tab/index.js +114 -0
- package/lib/tab/index.less +24 -0
- package/lib/tab/style/index.js +2 -0
- package/lib/tab/style/less.js +2 -0
- package/lib/tabs/Content.js +90 -0
- package/lib/tabs/Title.js +102 -0
- package/lib/tabs/index.css +1 -0
- package/lib/tabs/index.js +441 -0
- package/lib/tabs/index.less +153 -0
- package/lib/tabs/style/index.js +4 -0
- package/lib/tabs/style/less.js +4 -0
- package/lib/tabs/utils.js +53 -0
- package/lib/tag/index.css +1 -0
- package/lib/tag/index.js +87 -0
- package/lib/tag/index.less +97 -0
- package/lib/tag/style/index.js +4 -0
- package/lib/tag/style/less.js +4 -0
- package/lib/tlvant.js +16647 -0
- package/lib/tlvant.min.js +7 -0
- package/lib/toast/Toast.js +168 -0
- package/lib/toast/index.css +1 -0
- package/lib/toast/index.js +200 -0
- package/lib/toast/index.less +76 -0
- package/lib/toast/lock-click.js +21 -0
- package/lib/toast/style/index.js +7 -0
- package/lib/toast/style/less.js +7 -0
- package/lib/types/address-edit.d.js +22 -0
- package/lib/types/area.d.js +22 -0
- package/lib/types/calendar.d.js +22 -0
- package/lib/types/checkbox-group.d.js +22 -0
- package/lib/types/checkbox.d.js +22 -0
- package/lib/types/collapse-item.d.js +22 -0
- package/lib/types/component.d.js +22 -0
- package/lib/types/count-down.d.js +22 -0
- package/lib/types/datetime-picker.d.js +22 -0
- package/lib/types/dialog.d.js +6 -0
- package/lib/types/dropdown-item.d.js +22 -0
- package/lib/types/field.d.js +22 -0
- package/lib/types/form.d.js +22 -0
- package/lib/types/image-preview.d.js +24 -0
- package/lib/types/index-bar.d.js +22 -0
- package/lib/types/index.d.js +862 -0
- package/lib/types/jsx.d.js +1 -0
- package/lib/types/lazyload.d.js +6 -0
- package/lib/types/list.d.js +22 -0
- package/lib/types/locale.d.js +6 -0
- package/lib/types/mixins/popup.d.js +8 -0
- package/lib/types/notify.d.js +11 -0
- package/lib/types/picker.d.js +22 -0
- package/lib/types/progress.d.js +22 -0
- package/lib/types/sku.d.js +22 -0
- package/lib/types/swipe-cell.d.js +22 -0
- package/lib/types/swipe.d.js +22 -0
- package/lib/types/tabs.d.js +22 -0
- package/lib/types/toast.d.js +11 -0
- package/lib/types/uploader.d.js +22 -0
- package/lib/uploader/index.css +1 -0
- package/lib/uploader/index.js +467 -0
- package/lib/uploader/index.less +159 -0
- package/lib/uploader/style/index.js +11 -0
- package/lib/uploader/style/less.js +11 -0
- package/lib/uploader/utils.js +71 -0
- package/lib/utils/constant.js +22 -0
- package/lib/utils/create/bem.js +44 -0
- package/lib/utils/create/component.js +70 -0
- package/lib/utils/create/i18n.js +27 -0
- package/lib/utils/create/index.js +15 -0
- package/lib/utils/deep-assign.js +30 -0
- package/lib/utils/deep-clone.js +20 -0
- package/lib/utils/dom/event.js +62 -0
- package/lib/utils/dom/node.js +12 -0
- package/lib/utils/dom/raf.js +47 -0
- package/lib/utils/dom/reset-scroll.js +21 -0
- package/lib/utils/dom/scroll.js +89 -0
- package/lib/utils/dom/style.js +14 -0
- package/lib/utils/format/number.js +53 -0
- package/lib/utils/format/string.js +26 -0
- package/lib/utils/format/unit.js +68 -0
- package/lib/utils/functional.js +68 -0
- package/lib/utils/index.js +56 -0
- package/lib/utils/interceptor.js +28 -0
- package/lib/utils/router.js +46 -0
- package/lib/utils/types.js +1 -0
- package/lib/utils/validate/date.js +10 -0
- package/lib/utils/validate/email.js +10 -0
- package/lib/utils/validate/mobile.js +9 -0
- package/lib/utils/validate/number.js +18 -0
- package/lib/utils/validate/system.js +17 -0
- package/lib/utils/vnodes.js +41 -0
- package/package.json +2 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
|
|
3
|
+
.van-image {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
|
|
7
|
+
&--round {
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border-radius: 50%;
|
|
10
|
+
|
|
11
|
+
img {
|
|
12
|
+
border-radius: inherit;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__img,
|
|
17
|
+
&__error,
|
|
18
|
+
&__loading {
|
|
19
|
+
display: block;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__error,
|
|
25
|
+
&__loading {
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 0;
|
|
28
|
+
left: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
color: @image-placeholder-text-color;
|
|
34
|
+
font-size: @image-placeholder-font-size;
|
|
35
|
+
background-color: @image-placeholder-background-color;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__loading-icon {
|
|
39
|
+
color: @image-loading-icon-color;
|
|
40
|
+
font-size: @image-loading-icon-size;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__error-icon {
|
|
44
|
+
color: @image-error-icon-color;
|
|
45
|
+
font-size: @image-error-icon-size;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// Utils
|
|
2
|
+
import { bem, createComponent } from './shared'; // Mixins
|
|
3
|
+
|
|
4
|
+
import { PopupMixin } from '../mixins/popup';
|
|
5
|
+
import { TouchMixin } from '../mixins/touch';
|
|
6
|
+
import { BindEventMixin } from '../mixins/bind-event'; // Components
|
|
7
|
+
|
|
8
|
+
import Icon from '../icon';
|
|
9
|
+
import Swipe from '../swipe';
|
|
10
|
+
import ImagePreviewItem from './ImagePreviewItem';
|
|
11
|
+
export default createComponent({
|
|
12
|
+
mixins: [TouchMixin, PopupMixin({
|
|
13
|
+
skipToggleEvent: true
|
|
14
|
+
}), BindEventMixin(function (bind) {
|
|
15
|
+
bind(window, 'resize', this.resize, true);
|
|
16
|
+
bind(window, 'orientationchange', this.resize, true);
|
|
17
|
+
})],
|
|
18
|
+
props: {
|
|
19
|
+
className: null,
|
|
20
|
+
closeable: Boolean,
|
|
21
|
+
asyncClose: Boolean,
|
|
22
|
+
showIndicators: Boolean,
|
|
23
|
+
images: {
|
|
24
|
+
type: Array,
|
|
25
|
+
default: function _default() {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
loop: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true
|
|
32
|
+
},
|
|
33
|
+
overlay: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true
|
|
36
|
+
},
|
|
37
|
+
minZoom: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: 1 / 3
|
|
40
|
+
},
|
|
41
|
+
maxZoom: {
|
|
42
|
+
type: [Number, String],
|
|
43
|
+
default: 3
|
|
44
|
+
},
|
|
45
|
+
showIndex: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true
|
|
48
|
+
},
|
|
49
|
+
swipeDuration: {
|
|
50
|
+
type: [Number, String],
|
|
51
|
+
default: 300
|
|
52
|
+
},
|
|
53
|
+
startPosition: {
|
|
54
|
+
type: [Number, String],
|
|
55
|
+
default: 0
|
|
56
|
+
},
|
|
57
|
+
overlayClass: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: bem('overlay')
|
|
60
|
+
},
|
|
61
|
+
closeIcon: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: 'clear'
|
|
64
|
+
},
|
|
65
|
+
closeOnPopstate: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: true
|
|
68
|
+
},
|
|
69
|
+
closeIconPosition: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: 'top-right'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
data: function data() {
|
|
75
|
+
return {
|
|
76
|
+
active: 0,
|
|
77
|
+
rootWidth: 0,
|
|
78
|
+
rootHeight: 0,
|
|
79
|
+
doubleClickTimer: null
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
mounted: function mounted() {
|
|
83
|
+
this.resize();
|
|
84
|
+
},
|
|
85
|
+
watch: {
|
|
86
|
+
startPosition: 'setActive',
|
|
87
|
+
value: function value(val) {
|
|
88
|
+
var _this = this;
|
|
89
|
+
|
|
90
|
+
if (val) {
|
|
91
|
+
this.setActive(+this.startPosition);
|
|
92
|
+
this.$nextTick(function () {
|
|
93
|
+
_this.resize();
|
|
94
|
+
|
|
95
|
+
_this.$refs.swipe.swipeTo(+_this.startPosition, {
|
|
96
|
+
immediate: true
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
this.$emit('close', {
|
|
101
|
+
index: this.active,
|
|
102
|
+
url: this.images[this.active]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
methods: {
|
|
108
|
+
resize: function resize() {
|
|
109
|
+
if (this.$el && this.$el.getBoundingClientRect) {
|
|
110
|
+
var rect = this.$el.getBoundingClientRect();
|
|
111
|
+
this.rootWidth = rect.width;
|
|
112
|
+
this.rootHeight = rect.height;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
emitClose: function emitClose() {
|
|
116
|
+
if (!this.asyncClose) {
|
|
117
|
+
this.$emit('input', false);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
emitScale: function emitScale(args) {
|
|
121
|
+
this.$emit('scale', args);
|
|
122
|
+
},
|
|
123
|
+
setActive: function setActive(active) {
|
|
124
|
+
if (active !== this.active) {
|
|
125
|
+
this.active = active;
|
|
126
|
+
this.$emit('change', active);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
genIndex: function genIndex() {
|
|
130
|
+
var h = this.$createElement;
|
|
131
|
+
|
|
132
|
+
if (this.showIndex) {
|
|
133
|
+
return h("div", {
|
|
134
|
+
"class": bem('index')
|
|
135
|
+
}, [this.slots('index', {
|
|
136
|
+
index: this.active
|
|
137
|
+
}) || this.active + 1 + " / " + this.images.length]);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
genCover: function genCover() {
|
|
141
|
+
var h = this.$createElement;
|
|
142
|
+
var cover = this.slots('cover');
|
|
143
|
+
|
|
144
|
+
if (cover) {
|
|
145
|
+
return h("div", {
|
|
146
|
+
"class": bem('cover')
|
|
147
|
+
}, [cover]);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
genImages: function genImages() {
|
|
151
|
+
var _this2 = this;
|
|
152
|
+
|
|
153
|
+
var h = this.$createElement;
|
|
154
|
+
return h(Swipe, {
|
|
155
|
+
"ref": "swipe",
|
|
156
|
+
"attrs": {
|
|
157
|
+
"lazyRender": true,
|
|
158
|
+
"loop": this.loop,
|
|
159
|
+
"duration": this.swipeDuration,
|
|
160
|
+
"initialSwipe": this.startPosition,
|
|
161
|
+
"showIndicators": this.showIndicators,
|
|
162
|
+
"indicatorColor": "white"
|
|
163
|
+
},
|
|
164
|
+
"class": bem('swipe'),
|
|
165
|
+
"on": {
|
|
166
|
+
"change": this.setActive
|
|
167
|
+
}
|
|
168
|
+
}, [this.images.map(function (image) {
|
|
169
|
+
return h(ImagePreviewItem, {
|
|
170
|
+
"attrs": {
|
|
171
|
+
"src": image,
|
|
172
|
+
"show": _this2.value,
|
|
173
|
+
"active": _this2.active,
|
|
174
|
+
"maxZoom": _this2.maxZoom,
|
|
175
|
+
"minZoom": _this2.minZoom,
|
|
176
|
+
"rootWidth": _this2.rootWidth,
|
|
177
|
+
"rootHeight": _this2.rootHeight
|
|
178
|
+
},
|
|
179
|
+
"on": {
|
|
180
|
+
"scale": _this2.emitScale,
|
|
181
|
+
"close": _this2.emitClose
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
})]);
|
|
185
|
+
},
|
|
186
|
+
genClose: function genClose() {
|
|
187
|
+
var h = this.$createElement;
|
|
188
|
+
|
|
189
|
+
if (this.closeable) {
|
|
190
|
+
return h(Icon, {
|
|
191
|
+
"attrs": {
|
|
192
|
+
"role": "button",
|
|
193
|
+
"name": this.closeIcon
|
|
194
|
+
},
|
|
195
|
+
"class": bem('close-icon', this.closeIconPosition),
|
|
196
|
+
"on": {
|
|
197
|
+
"click": this.emitClose
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
onClosed: function onClosed() {
|
|
203
|
+
this.$emit('closed');
|
|
204
|
+
},
|
|
205
|
+
// @exposed-api
|
|
206
|
+
swipeTo: function swipeTo(index, options) {
|
|
207
|
+
if (this.$refs.swipe) {
|
|
208
|
+
this.$refs.swipe.swipeTo(index, options);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
render: function render() {
|
|
213
|
+
var h = arguments[0];
|
|
214
|
+
|
|
215
|
+
if (!this.shouldRender) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return h("transition", {
|
|
220
|
+
"attrs": {
|
|
221
|
+
"name": "van-fade"
|
|
222
|
+
},
|
|
223
|
+
"on": {
|
|
224
|
+
"afterLeave": this.onClosed
|
|
225
|
+
}
|
|
226
|
+
}, [h("div", {
|
|
227
|
+
"directives": [{
|
|
228
|
+
name: "show",
|
|
229
|
+
value: this.value
|
|
230
|
+
}],
|
|
231
|
+
"class": [bem(), this.className]
|
|
232
|
+
}, [this.genClose(), this.genImages(), this.genIndex(), this.genCover()])]);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// Utils
|
|
2
|
+
import { bem } from './shared';
|
|
3
|
+
import { range } from '../utils/format/number';
|
|
4
|
+
import { preventDefault } from '../utils/dom/event'; // Mixins
|
|
5
|
+
|
|
6
|
+
import { TouchMixin } from '../mixins/touch'; // Component
|
|
7
|
+
|
|
8
|
+
import Image from '../image';
|
|
9
|
+
import Loading from '../loading';
|
|
10
|
+
import SwipeItem from '../swipe-item';
|
|
11
|
+
|
|
12
|
+
function getDistance(touches) {
|
|
13
|
+
return Math.sqrt(Math.pow(touches[0].clientX - touches[1].clientX, 2) + Math.pow(touches[0].clientY - touches[1].clientY, 2));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
mixins: [TouchMixin],
|
|
18
|
+
props: {
|
|
19
|
+
src: String,
|
|
20
|
+
show: Boolean,
|
|
21
|
+
active: Number,
|
|
22
|
+
minZoom: [Number, String],
|
|
23
|
+
maxZoom: [Number, String],
|
|
24
|
+
rootWidth: Number,
|
|
25
|
+
rootHeight: Number
|
|
26
|
+
},
|
|
27
|
+
data: function data() {
|
|
28
|
+
return {
|
|
29
|
+
scale: 1,
|
|
30
|
+
moveX: 0,
|
|
31
|
+
moveY: 0,
|
|
32
|
+
moving: false,
|
|
33
|
+
zooming: false,
|
|
34
|
+
imageRatio: 0,
|
|
35
|
+
displayWidth: 0,
|
|
36
|
+
displayHeight: 0
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
computed: {
|
|
40
|
+
vertical: function vertical() {
|
|
41
|
+
var rootWidth = this.rootWidth,
|
|
42
|
+
rootHeight = this.rootHeight;
|
|
43
|
+
var rootRatio = rootHeight / rootWidth;
|
|
44
|
+
return this.imageRatio > rootRatio;
|
|
45
|
+
},
|
|
46
|
+
imageStyle: function imageStyle() {
|
|
47
|
+
var scale = this.scale;
|
|
48
|
+
var style = {
|
|
49
|
+
transitionDuration: this.zooming || this.moving ? '0s' : '.3s'
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (scale !== 1) {
|
|
53
|
+
var offsetX = this.moveX / scale;
|
|
54
|
+
var offsetY = this.moveY / scale;
|
|
55
|
+
style.transform = "scale(" + scale + ", " + scale + ") translate(" + offsetX + "px, " + offsetY + "px)";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return style;
|
|
59
|
+
},
|
|
60
|
+
maxMoveX: function maxMoveX() {
|
|
61
|
+
if (this.imageRatio) {
|
|
62
|
+
var displayWidth = this.vertical ? this.rootHeight / this.imageRatio : this.rootWidth;
|
|
63
|
+
return Math.max(0, (this.scale * displayWidth - this.rootWidth) / 2);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return 0;
|
|
67
|
+
},
|
|
68
|
+
maxMoveY: function maxMoveY() {
|
|
69
|
+
if (this.imageRatio) {
|
|
70
|
+
var displayHeight = this.vertical ? this.rootHeight : this.rootWidth * this.imageRatio;
|
|
71
|
+
return Math.max(0, (this.scale * displayHeight - this.rootHeight) / 2);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
watch: {
|
|
78
|
+
active: 'resetScale',
|
|
79
|
+
show: function show(val) {
|
|
80
|
+
if (!val) {
|
|
81
|
+
this.resetScale();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
mounted: function mounted() {
|
|
86
|
+
this.bindTouchEvent(this.$el);
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
resetScale: function resetScale() {
|
|
90
|
+
this.setScale(1);
|
|
91
|
+
this.moveX = 0;
|
|
92
|
+
this.moveY = 0;
|
|
93
|
+
},
|
|
94
|
+
setScale: function setScale(scale) {
|
|
95
|
+
scale = range(scale, +this.minZoom, +this.maxZoom);
|
|
96
|
+
|
|
97
|
+
if (scale !== this.scale) {
|
|
98
|
+
this.scale = scale;
|
|
99
|
+
this.$emit('scale', {
|
|
100
|
+
scale: this.scale,
|
|
101
|
+
index: this.active
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
toggleScale: function toggleScale() {
|
|
106
|
+
var scale = this.scale > 1 ? 1 : 2;
|
|
107
|
+
this.setScale(scale);
|
|
108
|
+
this.moveX = 0;
|
|
109
|
+
this.moveY = 0;
|
|
110
|
+
},
|
|
111
|
+
onTouchStart: function onTouchStart(event) {
|
|
112
|
+
var touches = event.touches;
|
|
113
|
+
var _this$offsetX = this.offsetX,
|
|
114
|
+
offsetX = _this$offsetX === void 0 ? 0 : _this$offsetX;
|
|
115
|
+
this.touchStart(event);
|
|
116
|
+
this.touchStartTime = new Date();
|
|
117
|
+
this.startMoveX = this.moveX;
|
|
118
|
+
this.startMoveY = this.moveY;
|
|
119
|
+
this.moving = touches.length === 1 && this.scale !== 1;
|
|
120
|
+
this.zooming = touches.length === 2 && !offsetX;
|
|
121
|
+
|
|
122
|
+
if (this.zooming) {
|
|
123
|
+
this.startScale = this.scale;
|
|
124
|
+
this.startDistance = getDistance(event.touches);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
onTouchMove: function onTouchMove(event) {
|
|
128
|
+
var touches = event.touches;
|
|
129
|
+
this.touchMove(event);
|
|
130
|
+
|
|
131
|
+
if (this.moving || this.zooming) {
|
|
132
|
+
preventDefault(event, true);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (this.moving) {
|
|
136
|
+
var moveX = this.deltaX + this.startMoveX;
|
|
137
|
+
var moveY = this.deltaY + this.startMoveY;
|
|
138
|
+
this.moveX = range(moveX, -this.maxMoveX, this.maxMoveX);
|
|
139
|
+
this.moveY = range(moveY, -this.maxMoveY, this.maxMoveY);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (this.zooming && touches.length === 2) {
|
|
143
|
+
var distance = getDistance(touches);
|
|
144
|
+
var scale = this.startScale * distance / this.startDistance;
|
|
145
|
+
this.setScale(scale);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
onTouchEnd: function onTouchEnd(event) {
|
|
149
|
+
var stopPropagation = false;
|
|
150
|
+
/* istanbul ignore else */
|
|
151
|
+
|
|
152
|
+
if (this.moving || this.zooming) {
|
|
153
|
+
stopPropagation = true;
|
|
154
|
+
|
|
155
|
+
if (this.moving && this.startMoveX === this.moveX && this.startMoveY === this.moveY) {
|
|
156
|
+
stopPropagation = false;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (!event.touches.length) {
|
|
160
|
+
if (this.zooming) {
|
|
161
|
+
this.moveX = range(this.moveX, -this.maxMoveX, this.maxMoveX);
|
|
162
|
+
this.moveY = range(this.moveY, -this.maxMoveY, this.maxMoveY);
|
|
163
|
+
this.zooming = false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
this.moving = false;
|
|
167
|
+
this.startMoveX = 0;
|
|
168
|
+
this.startMoveY = 0;
|
|
169
|
+
this.startScale = 1;
|
|
170
|
+
|
|
171
|
+
if (this.scale < 1) {
|
|
172
|
+
this.resetScale();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
} // eliminate tap delay on safari
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
preventDefault(event, stopPropagation);
|
|
179
|
+
this.checkTap();
|
|
180
|
+
this.resetTouchStatus();
|
|
181
|
+
},
|
|
182
|
+
checkTap: function checkTap() {
|
|
183
|
+
var _this = this;
|
|
184
|
+
|
|
185
|
+
var _this$offsetX2 = this.offsetX,
|
|
186
|
+
offsetX = _this$offsetX2 === void 0 ? 0 : _this$offsetX2,
|
|
187
|
+
_this$offsetY = this.offsetY,
|
|
188
|
+
offsetY = _this$offsetY === void 0 ? 0 : _this$offsetY;
|
|
189
|
+
var deltaTime = new Date() - this.touchStartTime;
|
|
190
|
+
var TAP_TIME = 250;
|
|
191
|
+
var TAP_OFFSET = 10;
|
|
192
|
+
|
|
193
|
+
if (offsetX < TAP_OFFSET && offsetY < TAP_OFFSET && deltaTime < TAP_TIME) {
|
|
194
|
+
if (this.doubleTapTimer) {
|
|
195
|
+
clearTimeout(this.doubleTapTimer);
|
|
196
|
+
this.doubleTapTimer = null;
|
|
197
|
+
this.toggleScale();
|
|
198
|
+
} else {
|
|
199
|
+
this.doubleTapTimer = setTimeout(function () {
|
|
200
|
+
_this.$emit('close');
|
|
201
|
+
|
|
202
|
+
_this.doubleTapTimer = null;
|
|
203
|
+
}, TAP_TIME);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
onLoad: function onLoad(event) {
|
|
208
|
+
var _event$target = event.target,
|
|
209
|
+
naturalWidth = _event$target.naturalWidth,
|
|
210
|
+
naturalHeight = _event$target.naturalHeight;
|
|
211
|
+
this.imageRatio = naturalHeight / naturalWidth;
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
render: function render() {
|
|
215
|
+
var h = arguments[0];
|
|
216
|
+
var imageSlots = {
|
|
217
|
+
loading: function loading() {
|
|
218
|
+
return h(Loading, {
|
|
219
|
+
"attrs": {
|
|
220
|
+
"type": "spinner"
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
return h(SwipeItem, {
|
|
226
|
+
"class": bem('swipe-item')
|
|
227
|
+
}, [h(Image, {
|
|
228
|
+
"attrs": {
|
|
229
|
+
"src": this.src,
|
|
230
|
+
"fit": "contain"
|
|
231
|
+
},
|
|
232
|
+
"class": bem('image', {
|
|
233
|
+
vertical: this.vertical
|
|
234
|
+
}),
|
|
235
|
+
"style": this.imageStyle,
|
|
236
|
+
"scopedSlots": imageSlots,
|
|
237
|
+
"on": {
|
|
238
|
+
"load": this.onLoad
|
|
239
|
+
}
|
|
240
|
+
})]);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.van-image-preview{position:fixed;top:0;left:0;width:100%;height:100%}.van-image-preview__swipe{height:100%}.van-image-preview__swipe-item{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;overflow:hidden}.van-image-preview__cover{position:absolute;top:0;left:0}.van-image-preview__image{width:100%;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-image-preview__image--vertical{width:auto;height:100%}.van-image-preview__image img{-webkit-user-drag:none}.van-image-preview__image .van-image__error{top:30%;height:40%}.van-image-preview__image .van-image__error-icon{font-size:36px}.van-image-preview__image .van-image__loading{background-color:transparent}.van-image-preview__index{position:absolute;top:16px;left:50%;color:#fff;font-size:14px;line-height:20px;text-shadow:0 1px 1px #323233;-webkit-transform:translate(-50%,0);transform:translate(-50%,0)}.van-image-preview__overlay{background-color:rgba(0,0,0,.9)}.van-image-preview__close-icon{position:absolute;z-index:1;color:#c8c9cc;font-size:22px;cursor:pointer}.van-image-preview__close-icon:active{color:#969799}.van-image-preview__close-icon--top-left{top:16px;left:16px}.van-image-preview__close-icon--top-right{top:16px;right:16px}.van-image-preview__close-icon--bottom-left{bottom:16px;left:16px}.van-image-preview__close-icon--bottom-right{right:16px;bottom:16px}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import Vue from 'vue';
|
|
3
|
+
import VueImagePreview from './ImagePreview';
|
|
4
|
+
import { isServer } from '../utils';
|
|
5
|
+
var instance;
|
|
6
|
+
var defaultConfig = {
|
|
7
|
+
loop: true,
|
|
8
|
+
value: true,
|
|
9
|
+
images: [],
|
|
10
|
+
maxZoom: 3,
|
|
11
|
+
minZoom: 1 / 3,
|
|
12
|
+
onClose: null,
|
|
13
|
+
onChange: null,
|
|
14
|
+
className: '',
|
|
15
|
+
showIndex: true,
|
|
16
|
+
closeable: false,
|
|
17
|
+
closeIcon: 'clear',
|
|
18
|
+
asyncClose: false,
|
|
19
|
+
getContainer: 'body',
|
|
20
|
+
startPosition: 0,
|
|
21
|
+
swipeDuration: 300,
|
|
22
|
+
showIndicators: false,
|
|
23
|
+
closeOnPopstate: true,
|
|
24
|
+
closeIconPosition: 'top-right'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var initInstance = function initInstance() {
|
|
28
|
+
instance = new (Vue.extend(VueImagePreview))({
|
|
29
|
+
el: document.createElement('div')
|
|
30
|
+
});
|
|
31
|
+
document.body.appendChild(instance.$el);
|
|
32
|
+
instance.$on('change', function (index) {
|
|
33
|
+
if (instance.onChange) {
|
|
34
|
+
instance.onChange(index);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
instance.$on('scale', function (data) {
|
|
38
|
+
if (instance.onScale) {
|
|
39
|
+
instance.onScale(data);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var ImagePreview = function ImagePreview(images, startPosition) {
|
|
45
|
+
if (startPosition === void 0) {
|
|
46
|
+
startPosition = 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* istanbul ignore if */
|
|
50
|
+
if (isServer) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!instance) {
|
|
55
|
+
initInstance();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var options = Array.isArray(images) ? {
|
|
59
|
+
images: images,
|
|
60
|
+
startPosition: startPosition
|
|
61
|
+
} : images;
|
|
62
|
+
|
|
63
|
+
_extends(instance, defaultConfig, options);
|
|
64
|
+
|
|
65
|
+
instance.$once('input', function (show) {
|
|
66
|
+
instance.value = show;
|
|
67
|
+
});
|
|
68
|
+
instance.$once('closed', function () {
|
|
69
|
+
instance.images = [];
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (options.onClose) {
|
|
73
|
+
instance.$off('close');
|
|
74
|
+
instance.$once('close', options.onClose);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return instance;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
ImagePreview.Component = VueImagePreview;
|
|
81
|
+
|
|
82
|
+
ImagePreview.install = function () {
|
|
83
|
+
Vue.use(VueImagePreview);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default ImagePreview;
|