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 @@
|
|
|
1
|
+
.van-swipe{position:relative;overflow:hidden;cursor:grab;-webkit-user-select:none;user-select:none}.van-swipe__track{display:-webkit-box;display:-webkit-flex;display:flex;height:100%}.van-swipe__track--vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column}.van-swipe__indicators{position:absolute;bottom:12px;left:50%;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.van-swipe__indicators--vertical{top:50%;bottom:auto;left:12px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.van-swipe__indicators--vertical .van-swipe__indicator:not(:last-child){margin-bottom:6px}.van-swipe__indicator{width:6px;height:6px;background-color:#ebedf0;border-radius:100%;opacity:.3;-webkit-transition:opacity .2s,background-color .2s;transition:opacity .2s,background-color .2s}.van-swipe__indicator:not(:last-child){margin-right:6px}.van-swipe__indicator--active{background-color:#1989fa;opacity:1}
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
// Utils
|
|
2
|
+
import { createNamespace } from '../utils';
|
|
3
|
+
import { isHidden } from '../utils/dom/style';
|
|
4
|
+
import { preventDefault } from '../utils/dom/event';
|
|
5
|
+
import { doubleRaf } from '../utils/dom/raf';
|
|
6
|
+
import { range } from '../utils/format/number'; // Mixins
|
|
7
|
+
|
|
8
|
+
import { TouchMixin } from '../mixins/touch';
|
|
9
|
+
import { ParentMixin } from '../mixins/relation';
|
|
10
|
+
import { BindEventMixin } from '../mixins/bind-event';
|
|
11
|
+
|
|
12
|
+
var _createNamespace = createNamespace('swipe'),
|
|
13
|
+
createComponent = _createNamespace[0],
|
|
14
|
+
bem = _createNamespace[1];
|
|
15
|
+
|
|
16
|
+
export default createComponent({
|
|
17
|
+
mixins: [TouchMixin, ParentMixin('vanSwipe'), BindEventMixin(function (bind, isBind) {
|
|
18
|
+
bind(window, 'resize', this.resize, true);
|
|
19
|
+
bind(window, 'orientationchange', this.resize, true);
|
|
20
|
+
bind(window, 'visibilitychange', this.onVisibilityChange);
|
|
21
|
+
|
|
22
|
+
if (isBind) {
|
|
23
|
+
this.initialize();
|
|
24
|
+
} else {
|
|
25
|
+
this.clear();
|
|
26
|
+
}
|
|
27
|
+
})],
|
|
28
|
+
props: {
|
|
29
|
+
width: [Number, String],
|
|
30
|
+
height: [Number, String],
|
|
31
|
+
autoplay: [Number, String],
|
|
32
|
+
vertical: Boolean,
|
|
33
|
+
lazyRender: Boolean,
|
|
34
|
+
indicatorColor: String,
|
|
35
|
+
loop: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: true
|
|
38
|
+
},
|
|
39
|
+
duration: {
|
|
40
|
+
type: [Number, String],
|
|
41
|
+
default: 500
|
|
42
|
+
},
|
|
43
|
+
touchable: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true
|
|
46
|
+
},
|
|
47
|
+
initialSwipe: {
|
|
48
|
+
type: [Number, String],
|
|
49
|
+
default: 0
|
|
50
|
+
},
|
|
51
|
+
showIndicators: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
},
|
|
55
|
+
stopPropagation: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
data: function data() {
|
|
61
|
+
return {
|
|
62
|
+
rect: null,
|
|
63
|
+
offset: 0,
|
|
64
|
+
active: 0,
|
|
65
|
+
deltaX: 0,
|
|
66
|
+
deltaY: 0,
|
|
67
|
+
swiping: false,
|
|
68
|
+
computedWidth: 0,
|
|
69
|
+
computedHeight: 0
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
watch: {
|
|
73
|
+
children: function children() {
|
|
74
|
+
this.initialize();
|
|
75
|
+
},
|
|
76
|
+
initialSwipe: function initialSwipe() {
|
|
77
|
+
this.initialize();
|
|
78
|
+
},
|
|
79
|
+
autoplay: function autoplay(_autoplay) {
|
|
80
|
+
if (_autoplay > 0) {
|
|
81
|
+
this.autoPlay();
|
|
82
|
+
} else {
|
|
83
|
+
this.clear();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
computed: {
|
|
88
|
+
count: function count() {
|
|
89
|
+
return this.children.length;
|
|
90
|
+
},
|
|
91
|
+
maxCount: function maxCount() {
|
|
92
|
+
return Math.ceil(Math.abs(this.minOffset) / this.size);
|
|
93
|
+
},
|
|
94
|
+
delta: function delta() {
|
|
95
|
+
return this.vertical ? this.deltaY : this.deltaX;
|
|
96
|
+
},
|
|
97
|
+
size: function size() {
|
|
98
|
+
return this[this.vertical ? 'computedHeight' : 'computedWidth'];
|
|
99
|
+
},
|
|
100
|
+
trackSize: function trackSize() {
|
|
101
|
+
return this.count * this.size;
|
|
102
|
+
},
|
|
103
|
+
activeIndicator: function activeIndicator() {
|
|
104
|
+
return (this.active + this.count) % this.count;
|
|
105
|
+
},
|
|
106
|
+
isCorrectDirection: function isCorrectDirection() {
|
|
107
|
+
var expect = this.vertical ? 'vertical' : 'horizontal';
|
|
108
|
+
return this.direction === expect;
|
|
109
|
+
},
|
|
110
|
+
trackStyle: function trackStyle() {
|
|
111
|
+
var style = {
|
|
112
|
+
transitionDuration: (this.swiping ? 0 : this.duration) + "ms",
|
|
113
|
+
transform: "translate" + (this.vertical ? 'Y' : 'X') + "(" + this.offset + "px)"
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
if (this.size) {
|
|
117
|
+
var mainAxis = this.vertical ? 'height' : 'width';
|
|
118
|
+
var crossAxis = this.vertical ? 'width' : 'height';
|
|
119
|
+
style[mainAxis] = this.trackSize + "px";
|
|
120
|
+
style[crossAxis] = this[crossAxis] ? this[crossAxis] + "px" : '';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return style;
|
|
124
|
+
},
|
|
125
|
+
indicatorStyle: function indicatorStyle() {
|
|
126
|
+
return {
|
|
127
|
+
backgroundColor: this.indicatorColor
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
minOffset: function minOffset() {
|
|
131
|
+
return (this.vertical ? this.rect.height : this.rect.width) - this.size * this.count;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
mounted: function mounted() {
|
|
135
|
+
this.bindTouchEvent(this.$refs.track);
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
// initialize swipe position
|
|
139
|
+
initialize: function initialize(active) {
|
|
140
|
+
if (active === void 0) {
|
|
141
|
+
active = +this.initialSwipe;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!this.$el || isHidden(this.$el)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
clearTimeout(this.timer);
|
|
149
|
+
var rect = this.$el.getBoundingClientRect();
|
|
150
|
+
this.rect = rect;
|
|
151
|
+
this.swiping = true;
|
|
152
|
+
this.active = active;
|
|
153
|
+
this.computedWidth = +this.width || rect.width;
|
|
154
|
+
this.computedHeight = +this.height || rect.height;
|
|
155
|
+
this.offset = this.getTargetOffset(active);
|
|
156
|
+
this.children.forEach(function (swipe) {
|
|
157
|
+
swipe.offset = 0;
|
|
158
|
+
});
|
|
159
|
+
this.autoPlay();
|
|
160
|
+
},
|
|
161
|
+
// @exposed-api
|
|
162
|
+
resize: function resize() {
|
|
163
|
+
this.initialize(this.activeIndicator);
|
|
164
|
+
},
|
|
165
|
+
onVisibilityChange: function onVisibilityChange() {
|
|
166
|
+
if (document.hidden) {
|
|
167
|
+
this.clear();
|
|
168
|
+
} else {
|
|
169
|
+
this.autoPlay();
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
onTouchStart: function onTouchStart(event) {
|
|
173
|
+
if (!this.touchable) return;
|
|
174
|
+
this.clear();
|
|
175
|
+
this.touchStartTime = Date.now();
|
|
176
|
+
this.touchStart(event);
|
|
177
|
+
this.correctPosition();
|
|
178
|
+
},
|
|
179
|
+
onTouchMove: function onTouchMove(event) {
|
|
180
|
+
if (!this.touchable || !this.swiping) return;
|
|
181
|
+
this.touchMove(event);
|
|
182
|
+
|
|
183
|
+
if (this.isCorrectDirection) {
|
|
184
|
+
preventDefault(event, this.stopPropagation);
|
|
185
|
+
this.move({
|
|
186
|
+
offset: this.delta
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
onTouchEnd: function onTouchEnd() {
|
|
191
|
+
if (!this.touchable || !this.swiping) return;
|
|
192
|
+
var size = this.size,
|
|
193
|
+
delta = this.delta;
|
|
194
|
+
var duration = Date.now() - this.touchStartTime;
|
|
195
|
+
var speed = delta / duration;
|
|
196
|
+
var shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta) > size / 2;
|
|
197
|
+
|
|
198
|
+
if (shouldSwipe && this.isCorrectDirection) {
|
|
199
|
+
var offset = this.vertical ? this.offsetY : this.offsetX;
|
|
200
|
+
var pace = 0;
|
|
201
|
+
|
|
202
|
+
if (this.loop) {
|
|
203
|
+
pace = offset > 0 ? delta > 0 ? -1 : 1 : 0;
|
|
204
|
+
} else {
|
|
205
|
+
pace = -Math[delta > 0 ? 'ceil' : 'floor'](delta / size);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
this.move({
|
|
209
|
+
pace: pace,
|
|
210
|
+
emitChange: true
|
|
211
|
+
});
|
|
212
|
+
} else if (delta) {
|
|
213
|
+
this.move({
|
|
214
|
+
pace: 0
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
this.swiping = false;
|
|
219
|
+
this.autoPlay();
|
|
220
|
+
},
|
|
221
|
+
getTargetActive: function getTargetActive(pace) {
|
|
222
|
+
var active = this.active,
|
|
223
|
+
count = this.count,
|
|
224
|
+
maxCount = this.maxCount;
|
|
225
|
+
|
|
226
|
+
if (pace) {
|
|
227
|
+
if (this.loop) {
|
|
228
|
+
return range(active + pace, -1, count);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return range(active + pace, 0, maxCount);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return active;
|
|
235
|
+
},
|
|
236
|
+
getTargetOffset: function getTargetOffset(targetActive, offset) {
|
|
237
|
+
if (offset === void 0) {
|
|
238
|
+
offset = 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
var currentPosition = targetActive * this.size;
|
|
242
|
+
|
|
243
|
+
if (!this.loop) {
|
|
244
|
+
currentPosition = Math.min(currentPosition, -this.minOffset);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
var targetOffset = offset - currentPosition;
|
|
248
|
+
|
|
249
|
+
if (!this.loop) {
|
|
250
|
+
targetOffset = range(targetOffset, this.minOffset, 0);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return targetOffset;
|
|
254
|
+
},
|
|
255
|
+
move: function move(_ref) {
|
|
256
|
+
var _ref$pace = _ref.pace,
|
|
257
|
+
pace = _ref$pace === void 0 ? 0 : _ref$pace,
|
|
258
|
+
_ref$offset = _ref.offset,
|
|
259
|
+
offset = _ref$offset === void 0 ? 0 : _ref$offset,
|
|
260
|
+
emitChange = _ref.emitChange;
|
|
261
|
+
var loop = this.loop,
|
|
262
|
+
count = this.count,
|
|
263
|
+
active = this.active,
|
|
264
|
+
children = this.children,
|
|
265
|
+
trackSize = this.trackSize,
|
|
266
|
+
minOffset = this.minOffset;
|
|
267
|
+
|
|
268
|
+
if (count <= 1) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
var targetActive = this.getTargetActive(pace);
|
|
273
|
+
var targetOffset = this.getTargetOffset(targetActive, offset); // auto move first and last swipe in loop mode
|
|
274
|
+
|
|
275
|
+
if (loop) {
|
|
276
|
+
if (children[0] && targetOffset !== minOffset) {
|
|
277
|
+
var outRightBound = targetOffset < minOffset;
|
|
278
|
+
children[0].offset = outRightBound ? trackSize : 0;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (children[count - 1] && targetOffset !== 0) {
|
|
282
|
+
var outLeftBound = targetOffset > 0;
|
|
283
|
+
children[count - 1].offset = outLeftBound ? -trackSize : 0;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
this.active = targetActive;
|
|
288
|
+
this.offset = targetOffset;
|
|
289
|
+
|
|
290
|
+
if (emitChange && targetActive !== active) {
|
|
291
|
+
this.$emit('change', this.activeIndicator);
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
// @exposed-api
|
|
295
|
+
prev: function prev() {
|
|
296
|
+
var _this = this;
|
|
297
|
+
|
|
298
|
+
this.correctPosition();
|
|
299
|
+
this.resetTouchStatus();
|
|
300
|
+
doubleRaf(function () {
|
|
301
|
+
_this.swiping = false;
|
|
302
|
+
|
|
303
|
+
_this.move({
|
|
304
|
+
pace: -1,
|
|
305
|
+
emitChange: true
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
// @exposed-api
|
|
310
|
+
next: function next() {
|
|
311
|
+
var _this2 = this;
|
|
312
|
+
|
|
313
|
+
this.correctPosition();
|
|
314
|
+
this.resetTouchStatus();
|
|
315
|
+
doubleRaf(function () {
|
|
316
|
+
_this2.swiping = false;
|
|
317
|
+
|
|
318
|
+
_this2.move({
|
|
319
|
+
pace: 1,
|
|
320
|
+
emitChange: true
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
},
|
|
324
|
+
// @exposed-api
|
|
325
|
+
swipeTo: function swipeTo(index, options) {
|
|
326
|
+
var _this3 = this;
|
|
327
|
+
|
|
328
|
+
if (options === void 0) {
|
|
329
|
+
options = {};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
this.correctPosition();
|
|
333
|
+
this.resetTouchStatus();
|
|
334
|
+
doubleRaf(function () {
|
|
335
|
+
var targetIndex;
|
|
336
|
+
|
|
337
|
+
if (_this3.loop && index === _this3.count) {
|
|
338
|
+
targetIndex = _this3.active === 0 ? 0 : index;
|
|
339
|
+
} else {
|
|
340
|
+
targetIndex = index % _this3.count;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (options.immediate) {
|
|
344
|
+
doubleRaf(function () {
|
|
345
|
+
_this3.swiping = false;
|
|
346
|
+
});
|
|
347
|
+
} else {
|
|
348
|
+
_this3.swiping = false;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
_this3.move({
|
|
352
|
+
pace: targetIndex - _this3.active,
|
|
353
|
+
emitChange: true
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
},
|
|
357
|
+
correctPosition: function correctPosition() {
|
|
358
|
+
this.swiping = true;
|
|
359
|
+
|
|
360
|
+
if (this.active <= -1) {
|
|
361
|
+
this.move({
|
|
362
|
+
pace: this.count
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
if (this.active >= this.count) {
|
|
367
|
+
this.move({
|
|
368
|
+
pace: -this.count
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
clear: function clear() {
|
|
373
|
+
clearTimeout(this.timer);
|
|
374
|
+
},
|
|
375
|
+
autoPlay: function autoPlay() {
|
|
376
|
+
var _this4 = this;
|
|
377
|
+
|
|
378
|
+
var autoplay = this.autoplay;
|
|
379
|
+
|
|
380
|
+
if (autoplay > 0 && this.count > 1) {
|
|
381
|
+
this.clear();
|
|
382
|
+
this.timer = setTimeout(function () {
|
|
383
|
+
_this4.next();
|
|
384
|
+
|
|
385
|
+
_this4.autoPlay();
|
|
386
|
+
}, autoplay);
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
genIndicator: function genIndicator() {
|
|
390
|
+
var _this5 = this;
|
|
391
|
+
|
|
392
|
+
var h = this.$createElement;
|
|
393
|
+
var count = this.count,
|
|
394
|
+
activeIndicator = this.activeIndicator;
|
|
395
|
+
var slot = this.slots('indicator');
|
|
396
|
+
|
|
397
|
+
if (slot) {
|
|
398
|
+
return slot;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (this.showIndicators && count > 1) {
|
|
402
|
+
return h("div", {
|
|
403
|
+
"class": bem('indicators', {
|
|
404
|
+
vertical: this.vertical
|
|
405
|
+
})
|
|
406
|
+
}, [Array.apply(void 0, Array(count)).map(function (empty, index) {
|
|
407
|
+
return h("i", {
|
|
408
|
+
"class": bem('indicator', {
|
|
409
|
+
active: index === activeIndicator
|
|
410
|
+
}),
|
|
411
|
+
"style": index === activeIndicator ? _this5.indicatorStyle : null
|
|
412
|
+
});
|
|
413
|
+
})]);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
render: function render() {
|
|
418
|
+
var h = arguments[0];
|
|
419
|
+
return h("div", {
|
|
420
|
+
"class": bem()
|
|
421
|
+
}, [h("div", {
|
|
422
|
+
"ref": "track",
|
|
423
|
+
"style": this.trackStyle,
|
|
424
|
+
"class": bem('track', {
|
|
425
|
+
vertical: this.vertical
|
|
426
|
+
})
|
|
427
|
+
}, [this.slots()]), this.genIndicator()]);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
|
|
3
|
+
.van-swipe {
|
|
4
|
+
position: relative;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
cursor: grab;
|
|
7
|
+
user-select: none;
|
|
8
|
+
|
|
9
|
+
&__track {
|
|
10
|
+
display: flex;
|
|
11
|
+
height: 100%;
|
|
12
|
+
|
|
13
|
+
&--vertical {
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__indicators {
|
|
19
|
+
position: absolute;
|
|
20
|
+
bottom: @swipe-indicator-margin;
|
|
21
|
+
left: 50%;
|
|
22
|
+
display: flex;
|
|
23
|
+
transform: translateX(-50%);
|
|
24
|
+
|
|
25
|
+
&--vertical {
|
|
26
|
+
top: 50%;
|
|
27
|
+
bottom: auto;
|
|
28
|
+
left: @swipe-indicator-margin;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
transform: translateY(-50%);
|
|
31
|
+
|
|
32
|
+
.van-swipe__indicator:not(:last-child) {
|
|
33
|
+
margin-bottom: @swipe-indicator-size;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__indicator {
|
|
39
|
+
width: @swipe-indicator-size;
|
|
40
|
+
height: @swipe-indicator-size;
|
|
41
|
+
background-color: @swipe-indicator-inactive-background-color;
|
|
42
|
+
border-radius: 100%;
|
|
43
|
+
opacity: @swipe-indicator-inactive-opacity;
|
|
44
|
+
transition: opacity @animation-duration-fast,
|
|
45
|
+
background-color @animation-duration-fast;
|
|
46
|
+
|
|
47
|
+
&:not(:last-child) {
|
|
48
|
+
margin-right: @swipe-indicator-size;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--active {
|
|
52
|
+
background-color: @swipe-indicator-active-background-color;
|
|
53
|
+
opacity: @swipe-indicator-active-opacity;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.van-swipe-item{position:relative;-webkit-flex-shrink:0;flex-shrink:0;width:100%;height:100%}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createNamespace } from '../utils';
|
|
3
|
+
import { ChildrenMixin } from '../mixins/relation';
|
|
4
|
+
|
|
5
|
+
var _createNamespace = createNamespace('swipe-item'),
|
|
6
|
+
createComponent = _createNamespace[0],
|
|
7
|
+
bem = _createNamespace[1];
|
|
8
|
+
|
|
9
|
+
export default createComponent({
|
|
10
|
+
mixins: [ChildrenMixin('vanSwipe')],
|
|
11
|
+
data: function data() {
|
|
12
|
+
return {
|
|
13
|
+
offset: 0,
|
|
14
|
+
inited: false,
|
|
15
|
+
mounted: false
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
mounted: function mounted() {
|
|
19
|
+
var _this = this;
|
|
20
|
+
|
|
21
|
+
this.$nextTick(function () {
|
|
22
|
+
_this.mounted = true;
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
style: function style() {
|
|
27
|
+
var style = {};
|
|
28
|
+
var _this$parent = this.parent,
|
|
29
|
+
size = _this$parent.size,
|
|
30
|
+
vertical = _this$parent.vertical;
|
|
31
|
+
|
|
32
|
+
if (size) {
|
|
33
|
+
style[vertical ? 'height' : 'width'] = size + "px";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (this.offset) {
|
|
37
|
+
style.transform = "translate" + (vertical ? 'Y' : 'X') + "(" + this.offset + "px)";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return style;
|
|
41
|
+
},
|
|
42
|
+
shouldRender: function shouldRender() {
|
|
43
|
+
var index = this.index,
|
|
44
|
+
inited = this.inited,
|
|
45
|
+
parent = this.parent,
|
|
46
|
+
mounted = this.mounted;
|
|
47
|
+
|
|
48
|
+
if (!parent.lazyRender || inited) {
|
|
49
|
+
return true;
|
|
50
|
+
} // wait for all item to mount, so we can get the exact count
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if (!mounted) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var active = parent.activeIndicator;
|
|
58
|
+
var maxActive = parent.count - 1;
|
|
59
|
+
var prevActive = active === 0 && parent.loop ? maxActive : active - 1;
|
|
60
|
+
var nextActive = active === maxActive && parent.loop ? 0 : active + 1;
|
|
61
|
+
var shouldRender = index === active || index === prevActive || index === nextActive;
|
|
62
|
+
|
|
63
|
+
if (shouldRender) {
|
|
64
|
+
this.inited = true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return shouldRender;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
render: function render() {
|
|
71
|
+
var h = arguments[0];
|
|
72
|
+
return h("div", {
|
|
73
|
+
"class": bem(),
|
|
74
|
+
"style": this.style,
|
|
75
|
+
"on": _extends({}, this.$listeners)
|
|
76
|
+
}, [this.shouldRender && this.slots()]);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.van-switch{position:relative;display:inline-block;box-sizing:content-box;width:2em;height:1em;font-size:30px;background-color:#fff;border:1px solid rgba(0,0,0,.1);border-radius:1em;cursor:pointer;-webkit-transition:background-color .3s;transition:background-color .3s}.van-switch__node{position:absolute;top:0;left:0;width:1em;height:1em;background-color:#fff;border-radius:100%;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05);-webkit-transition:-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:transform .3s cubic-bezier(.3,1.05,.4,1.05),-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05)}.van-switch__loading{top:25%;left:25%;width:50%;height:50%;line-height:1}.van-switch--on{background-color:#3b99fc}.van-switch--on .van-switch__node{-webkit-transform:translateX(1em);transform:translateX(1em)}.van-switch--on .van-switch__loading{color:#1989fa}.van-switch--disabled{cursor:not-allowed;opacity:.5}.van-switch--loading{cursor:default}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Utils
|
|
2
|
+
import { createNamespace, addUnit } from '../utils';
|
|
3
|
+
import { switchProps } from './shared'; // Mixins
|
|
4
|
+
|
|
5
|
+
import { FieldMixin } from '../mixins/field'; // Components
|
|
6
|
+
|
|
7
|
+
import Loading from '../loading';
|
|
8
|
+
|
|
9
|
+
var _createNamespace = createNamespace('switch'),
|
|
10
|
+
createComponent = _createNamespace[0],
|
|
11
|
+
bem = _createNamespace[1];
|
|
12
|
+
|
|
13
|
+
export default createComponent({
|
|
14
|
+
mixins: [FieldMixin],
|
|
15
|
+
props: switchProps,
|
|
16
|
+
computed: {
|
|
17
|
+
checked: function checked() {
|
|
18
|
+
return this.value === this.activeValue;
|
|
19
|
+
},
|
|
20
|
+
style: function style() {
|
|
21
|
+
return {
|
|
22
|
+
fontSize: addUnit(this.size),
|
|
23
|
+
backgroundColor: this.checked ? this.activeColor : this.inactiveColor
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
onClick: function onClick(event) {
|
|
29
|
+
this.$emit('click', event);
|
|
30
|
+
|
|
31
|
+
if (!this.disabled && !this.loading) {
|
|
32
|
+
var newValue = this.checked ? this.inactiveValue : this.activeValue;
|
|
33
|
+
this.$emit('input', newValue);
|
|
34
|
+
this.$emit('change', newValue);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
genLoading: function genLoading() {
|
|
38
|
+
var h = this.$createElement;
|
|
39
|
+
|
|
40
|
+
if (this.loading) {
|
|
41
|
+
var color = this.checked ? this.activeColor : this.inactiveColor;
|
|
42
|
+
return h(Loading, {
|
|
43
|
+
"class": bem('loading'),
|
|
44
|
+
"attrs": {
|
|
45
|
+
"color": color
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
render: function render() {
|
|
52
|
+
var h = arguments[0];
|
|
53
|
+
var checked = this.checked,
|
|
54
|
+
loading = this.loading,
|
|
55
|
+
disabled = this.disabled;
|
|
56
|
+
return h("div", {
|
|
57
|
+
"class": bem({
|
|
58
|
+
on: checked,
|
|
59
|
+
loading: loading,
|
|
60
|
+
disabled: disabled
|
|
61
|
+
}),
|
|
62
|
+
"attrs": {
|
|
63
|
+
"role": "switch",
|
|
64
|
+
"aria-checked": String(checked)
|
|
65
|
+
},
|
|
66
|
+
"style": this.style,
|
|
67
|
+
"on": {
|
|
68
|
+
"click": this.onClick
|
|
69
|
+
}
|
|
70
|
+
}, [h("div", {
|
|
71
|
+
"class": bem('node')
|
|
72
|
+
}, [this.genLoading()])]);
|
|
73
|
+
}
|
|
74
|
+
});
|