mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-08-06 21:39:45 +08:00
build: compile 1.10.8
This commit is contained in:
parent
c6bff2718a
commit
345027906d
3
dist/dialog/dialog.d.ts
vendored
3
dist/dialog/dialog.d.ts
vendored
@ -14,6 +14,9 @@ interface DialogOptions {
|
|||||||
overlay?: boolean;
|
overlay?: boolean;
|
||||||
selector?: string;
|
selector?: string;
|
||||||
ariaLabel?: string;
|
ariaLabel?: string;
|
||||||
|
/**
|
||||||
|
* @deprecated use custom-class instead
|
||||||
|
*/
|
||||||
className?: string;
|
className?: string;
|
||||||
customStyle?: string;
|
customStyle?: string;
|
||||||
transition?: string;
|
transition?: string;
|
||||||
|
2
dist/dialog/index.wxml
vendored
2
dist/dialog/index.wxml
vendored
@ -5,7 +5,7 @@
|
|||||||
z-index="{{ zIndex }}"
|
z-index="{{ zIndex }}"
|
||||||
overlay="{{ overlay }}"
|
overlay="{{ overlay }}"
|
||||||
transition="{{ transition }}"
|
transition="{{ transition }}"
|
||||||
custom-class="van-dialog van-dialog--{{ theme }} {{ className }}"
|
custom-class="van-dialog van-dialog--{{ theme }}{{ className }} custom-class"
|
||||||
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
|
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
|
||||||
overlay-style="{{ overlayStyle }}"
|
overlay-style="{{ overlayStyle }}"
|
||||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||||
|
24
dist/slider/index.js
vendored
24
dist/slider/index.js
vendored
@ -1,7 +1,12 @@
|
|||||||
import { VantComponent } from '../common/component';
|
import { VantComponent } from '../common/component';
|
||||||
import { touch } from '../mixins/touch';
|
import { touch } from '../mixins/touch';
|
||||||
import { canIUseModel } from '../common/version';
|
import { canIUseModel } from '../common/version';
|
||||||
import { getRect, addUnit } from '../common/utils';
|
import { getRect, addUnit, nextTick } from '../common/utils';
|
||||||
|
const DRAG_STATUS = {
|
||||||
|
START: 'start',
|
||||||
|
MOVING: 'moving',
|
||||||
|
END: 'end',
|
||||||
|
};
|
||||||
VantComponent({
|
VantComponent({
|
||||||
mixins: [touch],
|
mixins: [touch],
|
||||||
props: {
|
props: {
|
||||||
@ -54,16 +59,16 @@ VantComponent({
|
|||||||
else {
|
else {
|
||||||
this.startValue = this.format(this.newValue);
|
this.startValue = this.format(this.newValue);
|
||||||
}
|
}
|
||||||
this.dragStatus = 'start';
|
this.dragStatus = DRAG_STATUS.START;
|
||||||
},
|
},
|
||||||
onTouchMove(event) {
|
onTouchMove(event) {
|
||||||
if (this.data.disabled)
|
if (this.data.disabled)
|
||||||
return;
|
return;
|
||||||
if (this.dragStatus === 'start') {
|
if (this.dragStatus === DRAG_STATUS.START) {
|
||||||
this.$emit('drag-start');
|
this.$emit('drag-start');
|
||||||
}
|
}
|
||||||
this.touchMove(event);
|
this.touchMove(event);
|
||||||
this.dragStatus = 'draging';
|
this.dragStatus = DRAG_STATUS.MOVING;
|
||||||
getRect(this, '.van-slider').then((rect) => {
|
getRect(this, '.van-slider').then((rect) => {
|
||||||
const { vertical } = this.data;
|
const { vertical } = this.data;
|
||||||
const delta = vertical ? this.deltaY : this.deltaX;
|
const delta = vertical ? this.deltaY : this.deltaX;
|
||||||
@ -82,9 +87,12 @@ VantComponent({
|
|||||||
onTouchEnd() {
|
onTouchEnd() {
|
||||||
if (this.data.disabled)
|
if (this.data.disabled)
|
||||||
return;
|
return;
|
||||||
if (this.dragStatus === 'draging') {
|
if (this.dragStatus === DRAG_STATUS.MOVING) {
|
||||||
this.updateValue(this.newValue, true);
|
this.dragStatus = DRAG_STATUS.END;
|
||||||
this.$emit('drag-end');
|
nextTick(() => {
|
||||||
|
this.updateValue(this.newValue, true);
|
||||||
|
this.$emit('drag-end');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClick(event) {
|
onClick(event) {
|
||||||
@ -166,7 +174,7 @@ VantComponent({
|
|||||||
getOffsetWidth(current, min) {
|
getOffsetWidth(current, min) {
|
||||||
const scope = this.getScope();
|
const scope = this.getScope();
|
||||||
// 避免最小值小于最小step时出现负数情况
|
// 避免最小值小于最小step时出现负数情况
|
||||||
return `${Math.max((current - min) * 100 / scope, 0)}%`;
|
return `${Math.max(((current - min) * 100) / scope, 0)}%`;
|
||||||
},
|
},
|
||||||
// 计算选中条的长度百分比
|
// 计算选中条的长度百分比
|
||||||
calcMainAxis() {
|
calcMainAxis() {
|
||||||
|
1
dist/stepper/index.js
vendored
1
dist/stepper/index.js
vendored
@ -96,7 +96,6 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
onBlur(event) {
|
onBlur(event) {
|
||||||
const value = this.format(event.detail.value);
|
const value = this.format(event.detail.value);
|
||||||
this.emitChange(value);
|
|
||||||
this.$emit('blur', Object.assign(Object.assign({}, event.detail), { value }));
|
this.$emit('blur', Object.assign(Object.assign({}, event.detail), { value }));
|
||||||
},
|
},
|
||||||
// filter illegal characters
|
// filter illegal characters
|
||||||
|
8
dist/tabs/index.js
vendored
8
dist/tabs/index.js
vendored
@ -83,6 +83,7 @@ VantComponent({
|
|||||||
skipTransition: true,
|
skipTransition: true,
|
||||||
scrollWithAnimation: false,
|
scrollWithAnimation: false,
|
||||||
lineOffsetLeft: 0,
|
lineOffsetLeft: 0,
|
||||||
|
inited: false,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
@ -191,12 +192,13 @@ VantComponent({
|
|||||||
.reduce((prev, curr) => prev + curr.width, 0);
|
.reduce((prev, curr) => prev + curr.width, 0);
|
||||||
lineOffsetLeft +=
|
lineOffsetLeft +=
|
||||||
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
|
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
|
||||||
this.setData({ lineOffsetLeft });
|
this.setData({ lineOffsetLeft, inited: true });
|
||||||
this.swiping = true;
|
this.swiping = true;
|
||||||
if (skipTransition) {
|
if (skipTransition) {
|
||||||
nextTick(() => {
|
// waiting transition end
|
||||||
|
setTimeout(() => {
|
||||||
this.setData({ skipTransition: false });
|
this.setData({ skipTransition: false });
|
||||||
});
|
}, this.data.duration);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
2
dist/tabs/index.wxml
vendored
2
dist/tabs/index.wxml
vendored
@ -20,7 +20,7 @@
|
|||||||
style="{{ color ? 'border-color: ' + color : '' }}"
|
style="{{ color ? 'border-color: ' + color : '' }}"
|
||||||
>
|
>
|
||||||
<view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}">
|
<view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}">
|
||||||
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth }) }}" />
|
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth, inited }) }}" />
|
||||||
<view
|
<view
|
||||||
wx:for="{{ tabs }}"
|
wx:for="{{ tabs }}"
|
||||||
wx:key="index"
|
wx:key="index"
|
||||||
|
1
dist/tabs/index.wxs
vendored
1
dist/tabs/index.wxs
vendored
@ -60,6 +60,7 @@ function trackStyle(data) {
|
|||||||
function lineStyle(data) {
|
function lineStyle(data) {
|
||||||
return style({
|
return style({
|
||||||
width: utils.addUnit(data.lineWidth),
|
width: utils.addUnit(data.lineWidth),
|
||||||
|
opacity: data.inited ? 1 : 0,
|
||||||
transform: 'translateX(' + data.lineOffsetLeft + 'px)',
|
transform: 'translateX(' + data.lineOffsetLeft + 'px)',
|
||||||
'-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)',
|
'-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)',
|
||||||
'background-color': data.color,
|
'background-color': data.color,
|
||||||
|
2
dist/tabs/index.wxss
vendored
2
dist/tabs/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{display:inline-block;position:relative!important;top:-1px!important;transform:translateX(0)!important}
|
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;opacity:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{display:inline-block;position:relative!important;top:-1px!important;transform:translateX(0)!important}
|
6
dist/uploader/index.js
vendored
6
dist/uploader/index.js
vendored
@ -1,9 +1,9 @@
|
|||||||
import { VantComponent } from '../common/component';
|
import { VantComponent } from '../common/component';
|
||||||
import { isImageFile, chooseFile, isVideoFile } from './utils';
|
import { isImageFile, chooseFile, isVideoFile } from './utils';
|
||||||
import { chooseImageProps, chooseVideoProps } from './shared';
|
import { chooseImageProps, chooseVideoProps, chooseMediaProps } from './shared';
|
||||||
import { isBoolean, isPromise } from '../common/validator';
|
import { isBoolean, isPromise } from '../common/validator';
|
||||||
VantComponent({
|
VantComponent({
|
||||||
props: Object.assign(Object.assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
|
props: Object.assign(Object.assign(Object.assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
|
||||||
type: null,
|
type: null,
|
||||||
value: 80,
|
value: 80,
|
||||||
}, name: {
|
}, name: {
|
||||||
@ -40,7 +40,7 @@ VantComponent({
|
|||||||
}, uploadIcon: {
|
}, uploadIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
value: 'photograph',
|
value: 'photograph',
|
||||||
} }, chooseImageProps), chooseVideoProps),
|
} }, chooseImageProps), chooseVideoProps), chooseMediaProps),
|
||||||
data: {
|
data: {
|
||||||
lists: [],
|
lists: [],
|
||||||
isInCount: true,
|
isInCount: true,
|
||||||
|
18
dist/uploader/shared.d.ts
vendored
18
dist/uploader/shared.d.ts
vendored
@ -26,3 +26,21 @@ export declare const chooseVideoProps: {
|
|||||||
value: string;
|
value: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
export declare const chooseMediaProps: {
|
||||||
|
capture: {
|
||||||
|
type: ArrayConstructor;
|
||||||
|
value: string[];
|
||||||
|
};
|
||||||
|
mediaType: {
|
||||||
|
type: ArrayConstructor;
|
||||||
|
value: string[];
|
||||||
|
};
|
||||||
|
maxDuration: {
|
||||||
|
type: NumberConstructor;
|
||||||
|
value: number;
|
||||||
|
};
|
||||||
|
camera: {
|
||||||
|
type: StringConstructor;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
19
dist/uploader/shared.js
vendored
19
dist/uploader/shared.js
vendored
@ -28,3 +28,22 @@ export const chooseVideoProps = {
|
|||||||
value: 'back',
|
value: 'back',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
// props for choose media
|
||||||
|
export const chooseMediaProps = {
|
||||||
|
capture: {
|
||||||
|
type: Array,
|
||||||
|
value: ['album', 'camera'],
|
||||||
|
},
|
||||||
|
mediaType: {
|
||||||
|
type: Array,
|
||||||
|
value: ['image', 'video'],
|
||||||
|
},
|
||||||
|
maxDuration: {
|
||||||
|
type: Number,
|
||||||
|
value: 60,
|
||||||
|
},
|
||||||
|
camera: {
|
||||||
|
type: String,
|
||||||
|
value: 'back',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
3
dist/uploader/utils.d.ts
vendored
3
dist/uploader/utils.d.ts
vendored
@ -10,7 +10,7 @@ export interface File {
|
|||||||
}
|
}
|
||||||
export declare function isImageFile(item: File): boolean;
|
export declare function isImageFile(item: File): boolean;
|
||||||
export declare function isVideoFile(item: File): boolean;
|
export declare function isVideoFile(item: File): boolean;
|
||||||
export declare function chooseFile({ accept, multiple, capture, compressed, maxDuration, sizeType, camera, maxCount, }: {
|
export declare function chooseFile({ accept, multiple, capture, compressed, maxDuration, sizeType, camera, maxCount, mediaType, }: {
|
||||||
accept: any;
|
accept: any;
|
||||||
multiple: any;
|
multiple: any;
|
||||||
capture: any;
|
capture: any;
|
||||||
@ -19,4 +19,5 @@ export declare function chooseFile({ accept, multiple, capture, compressed, maxD
|
|||||||
sizeType: any;
|
sizeType: any;
|
||||||
camera: any;
|
camera: any;
|
||||||
maxCount: any;
|
maxCount: any;
|
||||||
|
mediaType: any;
|
||||||
}): Promise<File | File[]>;
|
}): Promise<File | File[]>;
|
||||||
|
3
dist/uploader/utils.js
vendored
3
dist/uploader/utils.js
vendored
@ -38,7 +38,7 @@ function formatMedia(res) {
|
|||||||
function formatFile(res) {
|
function formatFile(res) {
|
||||||
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['path'])), { url: item.path })));
|
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['path'])), { url: item.path })));
|
||||||
}
|
}
|
||||||
export function chooseFile({ accept, multiple, capture, compressed, maxDuration, sizeType, camera, maxCount, }) {
|
export function chooseFile({ accept, multiple, capture, compressed, maxDuration, sizeType, camera, maxCount, mediaType, }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
switch (accept) {
|
switch (accept) {
|
||||||
case 'image':
|
case 'image':
|
||||||
@ -53,6 +53,7 @@ export function chooseFile({ accept, multiple, capture, compressed, maxDuration,
|
|||||||
case 'media':
|
case 'media':
|
||||||
wx.chooseMedia({
|
wx.chooseMedia({
|
||||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||||
|
mediaType,
|
||||||
sourceType: capture,
|
sourceType: capture,
|
||||||
maxDuration,
|
maxDuration,
|
||||||
sizeType,
|
sizeType,
|
||||||
|
3
lib/dialog/dialog.d.ts
vendored
3
lib/dialog/dialog.d.ts
vendored
@ -14,6 +14,9 @@ interface DialogOptions {
|
|||||||
overlay?: boolean;
|
overlay?: boolean;
|
||||||
selector?: string;
|
selector?: string;
|
||||||
ariaLabel?: string;
|
ariaLabel?: string;
|
||||||
|
/**
|
||||||
|
* @deprecated use custom-class instead
|
||||||
|
*/
|
||||||
className?: string;
|
className?: string;
|
||||||
customStyle?: string;
|
customStyle?: string;
|
||||||
transition?: string;
|
transition?: string;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
z-index="{{ zIndex }}"
|
z-index="{{ zIndex }}"
|
||||||
overlay="{{ overlay }}"
|
overlay="{{ overlay }}"
|
||||||
transition="{{ transition }}"
|
transition="{{ transition }}"
|
||||||
custom-class="van-dialog van-dialog--{{ theme }} {{ className }}"
|
custom-class="van-dialog van-dialog--{{ theme }}{{ className }} custom-class"
|
||||||
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
|
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
|
||||||
overlay-style="{{ overlayStyle }}"
|
overlay-style="{{ overlayStyle }}"
|
||||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||||
|
@ -4,6 +4,11 @@ var component_1 = require("../common/component");
|
|||||||
var touch_1 = require("../mixins/touch");
|
var touch_1 = require("../mixins/touch");
|
||||||
var version_1 = require("../common/version");
|
var version_1 = require("../common/version");
|
||||||
var utils_1 = require("../common/utils");
|
var utils_1 = require("../common/utils");
|
||||||
|
var DRAG_STATUS = {
|
||||||
|
START: 'start',
|
||||||
|
MOVING: 'moving',
|
||||||
|
END: 'end',
|
||||||
|
};
|
||||||
(0, component_1.VantComponent)({
|
(0, component_1.VantComponent)({
|
||||||
mixins: [touch_1.touch],
|
mixins: [touch_1.touch],
|
||||||
props: {
|
props: {
|
||||||
@ -57,17 +62,17 @@ var utils_1 = require("../common/utils");
|
|||||||
else {
|
else {
|
||||||
this.startValue = this.format(this.newValue);
|
this.startValue = this.format(this.newValue);
|
||||||
}
|
}
|
||||||
this.dragStatus = 'start';
|
this.dragStatus = DRAG_STATUS.START;
|
||||||
},
|
},
|
||||||
onTouchMove: function (event) {
|
onTouchMove: function (event) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
if (this.data.disabled)
|
if (this.data.disabled)
|
||||||
return;
|
return;
|
||||||
if (this.dragStatus === 'start') {
|
if (this.dragStatus === DRAG_STATUS.START) {
|
||||||
this.$emit('drag-start');
|
this.$emit('drag-start');
|
||||||
}
|
}
|
||||||
this.touchMove(event);
|
this.touchMove(event);
|
||||||
this.dragStatus = 'draging';
|
this.dragStatus = DRAG_STATUS.MOVING;
|
||||||
(0, utils_1.getRect)(this, '.van-slider').then(function (rect) {
|
(0, utils_1.getRect)(this, '.van-slider').then(function (rect) {
|
||||||
var vertical = _this.data.vertical;
|
var vertical = _this.data.vertical;
|
||||||
var delta = vertical ? _this.deltaY : _this.deltaX;
|
var delta = vertical ? _this.deltaY : _this.deltaX;
|
||||||
@ -84,11 +89,15 @@ var utils_1 = require("../common/utils");
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onTouchEnd: function () {
|
onTouchEnd: function () {
|
||||||
|
var _this = this;
|
||||||
if (this.data.disabled)
|
if (this.data.disabled)
|
||||||
return;
|
return;
|
||||||
if (this.dragStatus === 'draging') {
|
if (this.dragStatus === DRAG_STATUS.MOVING) {
|
||||||
this.updateValue(this.newValue, true);
|
this.dragStatus = DRAG_STATUS.END;
|
||||||
this.$emit('drag-end');
|
(0, utils_1.nextTick)(function () {
|
||||||
|
_this.updateValue(_this.newValue, true);
|
||||||
|
_this.$emit('drag-end');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClick: function (event) {
|
onClick: function (event) {
|
||||||
@ -164,7 +173,7 @@ var utils_1 = require("../common/utils");
|
|||||||
getOffsetWidth: function (current, min) {
|
getOffsetWidth: function (current, min) {
|
||||||
var scope = this.getScope();
|
var scope = this.getScope();
|
||||||
// 避免最小值小于最小step时出现负数情况
|
// 避免最小值小于最小step时出现负数情况
|
||||||
return "".concat(Math.max((current - min) * 100 / scope, 0), "%");
|
return "".concat(Math.max(((current - min) * 100) / scope, 0), "%");
|
||||||
},
|
},
|
||||||
// 计算选中条的长度百分比
|
// 计算选中条的长度百分比
|
||||||
calcMainAxis: function () {
|
calcMainAxis: function () {
|
||||||
|
@ -109,7 +109,6 @@ function equal(value1, value2) {
|
|||||||
},
|
},
|
||||||
onBlur: function (event) {
|
onBlur: function (event) {
|
||||||
var value = this.format(event.detail.value);
|
var value = this.format(event.detail.value);
|
||||||
this.emitChange(value);
|
|
||||||
this.$emit('blur', __assign(__assign({}, event.detail), { value: value }));
|
this.$emit('blur', __assign(__assign({}, event.detail), { value: value }));
|
||||||
},
|
},
|
||||||
// filter illegal characters
|
// filter illegal characters
|
||||||
|
@ -88,6 +88,7 @@ var relation_1 = require("../common/relation");
|
|||||||
skipTransition: true,
|
skipTransition: true,
|
||||||
scrollWithAnimation: false,
|
scrollWithAnimation: false,
|
||||||
lineOffsetLeft: 0,
|
lineOffsetLeft: 0,
|
||||||
|
inited: false,
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
@ -201,12 +202,13 @@ var relation_1 = require("../common/relation");
|
|||||||
.reduce(function (prev, curr) { return prev + curr.width; }, 0);
|
.reduce(function (prev, curr) { return prev + curr.width; }, 0);
|
||||||
lineOffsetLeft +=
|
lineOffsetLeft +=
|
||||||
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
|
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
|
||||||
_this.setData({ lineOffsetLeft: lineOffsetLeft });
|
_this.setData({ lineOffsetLeft: lineOffsetLeft, inited: true });
|
||||||
_this.swiping = true;
|
_this.swiping = true;
|
||||||
if (skipTransition) {
|
if (skipTransition) {
|
||||||
(0, utils_1.nextTick)(function () {
|
// waiting transition end
|
||||||
|
setTimeout(function () {
|
||||||
_this.setData({ skipTransition: false });
|
_this.setData({ skipTransition: false });
|
||||||
});
|
}, _this.data.duration);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
style="{{ color ? 'border-color: ' + color : '' }}"
|
style="{{ color ? 'border-color: ' + color : '' }}"
|
||||||
>
|
>
|
||||||
<view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}">
|
<view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}">
|
||||||
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth }) }}" />
|
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth, inited }) }}" />
|
||||||
<view
|
<view
|
||||||
wx:for="{{ tabs }}"
|
wx:for="{{ tabs }}"
|
||||||
wx:key="index"
|
wx:key="index"
|
||||||
|
@ -60,6 +60,7 @@ function trackStyle(data) {
|
|||||||
function lineStyle(data) {
|
function lineStyle(data) {
|
||||||
return style({
|
return style({
|
||||||
width: utils.addUnit(data.lineWidth),
|
width: utils.addUnit(data.lineWidth),
|
||||||
|
opacity: data.inited ? 1 : 0,
|
||||||
transform: 'translateX(' + data.lineOffsetLeft + 'px)',
|
transform: 'translateX(' + data.lineOffsetLeft + 'px)',
|
||||||
'-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)',
|
'-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)',
|
||||||
'background-color': data.color,
|
'background-color': data.color,
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{display:inline-block;position:relative!important;top:-1px!important;transform:translateX(0)!important}
|
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;opacity:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{display:inline-block;position:relative!important;top:-1px!important;transform:translateX(0)!important}
|
@ -16,7 +16,7 @@ var utils_1 = require("./utils");
|
|||||||
var shared_1 = require("./shared");
|
var shared_1 = require("./shared");
|
||||||
var validator_1 = require("../common/validator");
|
var validator_1 = require("../common/validator");
|
||||||
(0, component_1.VantComponent)({
|
(0, component_1.VantComponent)({
|
||||||
props: __assign(__assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
|
props: __assign(__assign(__assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
|
||||||
type: null,
|
type: null,
|
||||||
value: 80,
|
value: 80,
|
||||||
}, name: {
|
}, name: {
|
||||||
@ -53,7 +53,7 @@ var validator_1 = require("../common/validator");
|
|||||||
}, uploadIcon: {
|
}, uploadIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
value: 'photograph',
|
value: 'photograph',
|
||||||
} }, shared_1.chooseImageProps), shared_1.chooseVideoProps),
|
} }, shared_1.chooseImageProps), shared_1.chooseVideoProps), shared_1.chooseMediaProps),
|
||||||
data: {
|
data: {
|
||||||
lists: [],
|
lists: [],
|
||||||
isInCount: true,
|
isInCount: true,
|
||||||
|
18
lib/uploader/shared.d.ts
vendored
18
lib/uploader/shared.d.ts
vendored
@ -26,3 +26,21 @@ export declare const chooseVideoProps: {
|
|||||||
value: string;
|
value: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
export declare const chooseMediaProps: {
|
||||||
|
capture: {
|
||||||
|
type: ArrayConstructor;
|
||||||
|
value: string[];
|
||||||
|
};
|
||||||
|
mediaType: {
|
||||||
|
type: ArrayConstructor;
|
||||||
|
value: string[];
|
||||||
|
};
|
||||||
|
maxDuration: {
|
||||||
|
type: NumberConstructor;
|
||||||
|
value: number;
|
||||||
|
};
|
||||||
|
camera: {
|
||||||
|
type: StringConstructor;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.chooseVideoProps = exports.chooseImageProps = void 0;
|
exports.chooseMediaProps = exports.chooseVideoProps = exports.chooseImageProps = void 0;
|
||||||
// props for choose image
|
// props for choose image
|
||||||
exports.chooseImageProps = {
|
exports.chooseImageProps = {
|
||||||
sizeType: {
|
sizeType: {
|
||||||
@ -31,3 +31,22 @@ exports.chooseVideoProps = {
|
|||||||
value: 'back',
|
value: 'back',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
// props for choose media
|
||||||
|
exports.chooseMediaProps = {
|
||||||
|
capture: {
|
||||||
|
type: Array,
|
||||||
|
value: ['album', 'camera'],
|
||||||
|
},
|
||||||
|
mediaType: {
|
||||||
|
type: Array,
|
||||||
|
value: ['image', 'video'],
|
||||||
|
},
|
||||||
|
maxDuration: {
|
||||||
|
type: Number,
|
||||||
|
value: 60,
|
||||||
|
},
|
||||||
|
camera: {
|
||||||
|
type: String,
|
||||||
|
value: 'back',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
3
lib/uploader/utils.d.ts
vendored
3
lib/uploader/utils.d.ts
vendored
@ -10,7 +10,7 @@ export interface File {
|
|||||||
}
|
}
|
||||||
export declare function isImageFile(item: File): boolean;
|
export declare function isImageFile(item: File): boolean;
|
||||||
export declare function isVideoFile(item: File): boolean;
|
export declare function isVideoFile(item: File): boolean;
|
||||||
export declare function chooseFile({ accept, multiple, capture, compressed, maxDuration, sizeType, camera, maxCount, }: {
|
export declare function chooseFile({ accept, multiple, capture, compressed, maxDuration, sizeType, camera, maxCount, mediaType, }: {
|
||||||
accept: any;
|
accept: any;
|
||||||
multiple: any;
|
multiple: any;
|
||||||
capture: any;
|
capture: any;
|
||||||
@ -19,4 +19,5 @@ export declare function chooseFile({ accept, multiple, capture, compressed, maxD
|
|||||||
sizeType: any;
|
sizeType: any;
|
||||||
camera: any;
|
camera: any;
|
||||||
maxCount: any;
|
maxCount: any;
|
||||||
|
mediaType: any;
|
||||||
}): Promise<File | File[]>;
|
}): Promise<File | File[]>;
|
||||||
|
@ -55,7 +55,7 @@ function formatFile(res) {
|
|||||||
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { url: item.path })); });
|
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { url: item.path })); });
|
||||||
}
|
}
|
||||||
function chooseFile(_a) {
|
function chooseFile(_a) {
|
||||||
var accept = _a.accept, multiple = _a.multiple, capture = _a.capture, compressed = _a.compressed, maxDuration = _a.maxDuration, sizeType = _a.sizeType, camera = _a.camera, maxCount = _a.maxCount;
|
var accept = _a.accept, multiple = _a.multiple, capture = _a.capture, compressed = _a.compressed, maxDuration = _a.maxDuration, sizeType = _a.sizeType, camera = _a.camera, maxCount = _a.maxCount, mediaType = _a.mediaType;
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
switch (accept) {
|
switch (accept) {
|
||||||
case 'image':
|
case 'image':
|
||||||
@ -70,6 +70,7 @@ function chooseFile(_a) {
|
|||||||
case 'media':
|
case 'media':
|
||||||
wx.chooseMedia({
|
wx.chooseMedia({
|
||||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||||
|
mediaType: mediaType,
|
||||||
sourceType: capture,
|
sourceType: capture,
|
||||||
maxDuration: maxDuration,
|
maxDuration: maxDuration,
|
||||||
sizeType: sizeType,
|
sizeType: sizeType,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user