From 31e85aeb6f7a51b422a56024bff76d25028ced34 Mon Sep 17 00:00:00 2001 From: zhongnan Date: Mon, 3 Aug 2020 20:35:29 +0800 Subject: [PATCH] build: compile 1.4.2 --- dist/calendar/index.json | 3 ++- dist/tabs/index.js | 28 +++++++++++++++++++++++----- dist/tag/index.wxml | 2 +- dist/tag/index.wxss | 2 +- dist/toast/index.wxss | 2 +- lib/calendar/index.json | 3 ++- lib/tabs/index.js | 40 +++++++++++++++++++++++++++++----------- lib/tag/index.wxml | 2 +- lib/tag/index.wxss | 2 +- lib/toast/index.wxss | 2 +- 10 files changed, 62 insertions(+), 24 deletions(-) diff --git a/dist/calendar/index.json b/dist/calendar/index.json index 61dec086..397d5aea 100644 --- a/dist/calendar/index.json +++ b/dist/calendar/index.json @@ -4,6 +4,7 @@ "header": "./components/header/index", "month": "./components/month/index", "van-button": "../button/index", - "van-popup": "../popup/index" + "van-popup": "../popup/index", + "van-toast": "../toast/index" } } diff --git a/dist/tabs/index.js b/dist/tabs/index.js index 6b73af7c..bb6c9e10 100644 --- a/dist/tabs/index.js +++ b/dist/tabs/index.js @@ -269,16 +269,34 @@ VantComponent({ // watch swipe touch end onTouchEnd() { if (!this.data.swipeable) return; - const { tabs, currentIndex } = this.data; const { direction, deltaX, offsetX } = this; const minSwipeDistance = 50; if (direction === 'horizontal' && offsetX >= minSwipeDistance) { - if (deltaX > 0 && currentIndex !== 0) { - this.setCurrentIndex(currentIndex - 1); - } else if (deltaX < 0 && currentIndex !== tabs.length - 1) { - this.setCurrentIndex(currentIndex + 1); + const index = this.getAvaiableTab(deltaX); + if (index !== -1) { + this.setCurrentIndex(index); } } }, + getAvaiableTab(direction) { + const { tabs, currentIndex } = this.data; + const step = direction > 0 ? -1 : 1; + for ( + let i = step; + currentIndex + i < tabs.length && currentIndex + i >= 0; + i += step + ) { + const index = currentIndex + i; + if ( + index >= 0 && + index < tabs.length && + tabs[index] && + !tabs[index].disabled + ) { + return index; + } + } + return -1; + }, }, }); diff --git a/dist/tag/index.wxml b/dist/tag/index.wxml index 8c786865..16ab7508 100644 --- a/dist/tag/index.wxml +++ b/dist/tag/index.wxml @@ -1,7 +1,7 @@ diff --git a/dist/tag/index.wxss b/dist/tag/index.wxss index 0615a993..46df0da0 100644 --- a/dist/tag/index.wxss +++ b/dist/tag/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-tag{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;line-height:normal;padding:.2em .5em;padding:var(--tag-padding,.2em .5em);color:#fff;color:var(--tag-text-color,#fff);font-size:10px;font-size:var(--tag-font-size,10px);border-radius:.2em;border-radius:var(--tag-border-radius,.2em)}.van-tag:after{border-color:currentColor;border-radius:.2em * 2;border-radius:var(--tag-border-radius,.2em) * 2}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--mark{padding-right:.7em}.van-tag--mark,.van-tag--mark:after{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--round,.van-tag--round:after{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag--medium{font-size:12px;font-size:var(--tag-medium-font-size,12px)}.van-tag--large{font-size:14px;font-size:var(--tag-large-font-size,14px)}.van-tag__close{margin-left:2px} \ No newline at end of file +@import '../common/index.wxss';.van-tag{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;padding:0 4px;padding:var(--tag-padding,0 4px);color:#fff;color:var(--tag-text-color,#fff);font-size:12px;font-size:var(--tag-font-size,12px);line-height:16px;line-height:var(--tag-line-height,16px);border-radius:2px;border-radius:var(--tag-border-radius,2px)}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--plain:before{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:inherit;content:"";pointer-events:none}.van-tag--medium{padding:2px 6px;padding:var(--tag-medium-padding,2px 6px)}.van-tag--large{padding:4px 8px;padding:var(--tag-large-padding,4px 8px);font-size:14px;font-size:var(--tag-large-font-size,14px);border-radius:4px;border-radius:var(--tag-large-border-radius,4px)}.van-tag--mark{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--mark:after{display:block;width:2px;content:""}.van-tag--round{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag__close{min-width:1em;margin-left:2px} \ No newline at end of file diff --git a/dist/toast/index.wxss b/dist/toast/index.wxss index 2a98d2e2..85dc7a8f 100644 --- a/dist/toast/index.wxss +++ b/dist/toast/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(50,50,51,.88);background-color:var(--toast-background-color,rgba(50,50,51,.88));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:90px;width:var(--toast-default-width,90px);min-height:90px;min-height:var(--toast-default-min-height,90px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:48px;font-size:var(--toast-icon-size,48px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)} \ No newline at end of file +@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(0,0,0,.7);background-color:var(--toast-background-color,rgba(0,0,0,.7));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:88px;width:var(--toast-default-width,88px);min-height:88px;min-height:var(--toast-default-min-height,88px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:36px;font-size:var(--toast-icon-size,36px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)} \ No newline at end of file diff --git a/lib/calendar/index.json b/lib/calendar/index.json index 61dec086..397d5aea 100644 --- a/lib/calendar/index.json +++ b/lib/calendar/index.json @@ -4,6 +4,7 @@ "header": "./components/header/index", "month": "./components/month/index", "van-button": "../button/index", - "van-popup": "../popup/index" + "van-popup": "../popup/index", + "van-toast": "../toast/index" } } diff --git a/lib/tabs/index.js b/lib/tabs/index.js index a2855c1b..86d7486f 100644 --- a/lib/tabs/index.js +++ b/lib/tabs/index.js @@ -309,21 +309,39 @@ component_1.VantComponent({ // watch swipe touch end onTouchEnd: function () { if (!this.data.swipeable) return; - var _a = this.data, - tabs = _a.tabs, - currentIndex = _a.currentIndex; - var _b = this, - direction = _b.direction, - deltaX = _b.deltaX, - offsetX = _b.offsetX; + var _a = this, + direction = _a.direction, + deltaX = _a.deltaX, + offsetX = _a.offsetX; var minSwipeDistance = 50; if (direction === 'horizontal' && offsetX >= minSwipeDistance) { - if (deltaX > 0 && currentIndex !== 0) { - this.setCurrentIndex(currentIndex - 1); - } else if (deltaX < 0 && currentIndex !== tabs.length - 1) { - this.setCurrentIndex(currentIndex + 1); + var index = this.getAvaiableTab(deltaX); + if (index !== -1) { + this.setCurrentIndex(index); } } }, + getAvaiableTab: function (direction) { + var _a = this.data, + tabs = _a.tabs, + currentIndex = _a.currentIndex; + var step = direction > 0 ? -1 : 1; + for ( + var i = step; + currentIndex + i < tabs.length && currentIndex + i >= 0; + i += step + ) { + var index = currentIndex + i; + if ( + index >= 0 && + index < tabs.length && + tabs[index] && + !tabs[index].disabled + ) { + return index; + } + } + return -1; + }, }, }); diff --git a/lib/tag/index.wxml b/lib/tag/index.wxml index 8c786865..16ab7508 100644 --- a/lib/tag/index.wxml +++ b/lib/tag/index.wxml @@ -1,7 +1,7 @@ diff --git a/lib/tag/index.wxss b/lib/tag/index.wxss index 0615a993..46df0da0 100644 --- a/lib/tag/index.wxss +++ b/lib/tag/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-tag{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;line-height:normal;padding:.2em .5em;padding:var(--tag-padding,.2em .5em);color:#fff;color:var(--tag-text-color,#fff);font-size:10px;font-size:var(--tag-font-size,10px);border-radius:.2em;border-radius:var(--tag-border-radius,.2em)}.van-tag:after{border-color:currentColor;border-radius:.2em * 2;border-radius:var(--tag-border-radius,.2em) * 2}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--mark{padding-right:.7em}.van-tag--mark,.van-tag--mark:after{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--round,.van-tag--round:after{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag--medium{font-size:12px;font-size:var(--tag-medium-font-size,12px)}.van-tag--large{font-size:14px;font-size:var(--tag-large-font-size,14px)}.van-tag__close{margin-left:2px} \ No newline at end of file +@import '../common/index.wxss';.van-tag{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;padding:0 4px;padding:var(--tag-padding,0 4px);color:#fff;color:var(--tag-text-color,#fff);font-size:12px;font-size:var(--tag-font-size,12px);line-height:16px;line-height:var(--tag-line-height,16px);border-radius:2px;border-radius:var(--tag-border-radius,2px)}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--plain:before{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:inherit;content:"";pointer-events:none}.van-tag--medium{padding:2px 6px;padding:var(--tag-medium-padding,2px 6px)}.van-tag--large{padding:4px 8px;padding:var(--tag-large-padding,4px 8px);font-size:14px;font-size:var(--tag-large-font-size,14px);border-radius:4px;border-radius:var(--tag-large-border-radius,4px)}.van-tag--mark{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--mark:after{display:block;width:2px;content:""}.van-tag--round{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag__close{min-width:1em;margin-left:2px} \ No newline at end of file diff --git a/lib/toast/index.wxss b/lib/toast/index.wxss index 2a98d2e2..85dc7a8f 100644 --- a/lib/toast/index.wxss +++ b/lib/toast/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(50,50,51,.88);background-color:var(--toast-background-color,rgba(50,50,51,.88));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:90px;width:var(--toast-default-width,90px);min-height:90px;min-height:var(--toast-default-min-height,90px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:48px;font-size:var(--toast-icon-size,48px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)} \ No newline at end of file +@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(0,0,0,.7);background-color:var(--toast-background-color,rgba(0,0,0,.7));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:88px;width:var(--toast-default-width,88px);min-height:88px;min-height:var(--toast-default-min-height,88px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:36px;font-size:var(--toast-icon-size,36px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)} \ No newline at end of file