mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
[build] 0.5.11
This commit is contained in:
parent
6ca34c3158
commit
bbde603217
31
dist/area/index.js
vendored
31
dist/area/index.js
vendored
@ -1,29 +1,14 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: {
|
||||
title: String,
|
||||
value: String,
|
||||
loading: Boolean,
|
||||
cancelButtonText: String,
|
||||
confirmButtonText: String,
|
||||
itemHeight: {
|
||||
type: Number,
|
||||
value: 44
|
||||
},
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5
|
||||
},
|
||||
columnsNum: {
|
||||
type: [String, Number],
|
||||
value: 3
|
||||
},
|
||||
areaList: {
|
||||
props: Object.assign({}, pickerProps, { value: String, areaList: {
|
||||
type: Object,
|
||||
value: {}
|
||||
}
|
||||
},
|
||||
}, columnsNum: {
|
||||
type: [String, Number],
|
||||
value: 3
|
||||
} }),
|
||||
data: {
|
||||
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
displayColumns: [{ values: [] }, { values: [] }, { values: [] }]
|
||||
@ -40,6 +25,9 @@ VantComponent({
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.setValues();
|
||||
},
|
||||
methods: {
|
||||
getPicker() {
|
||||
if (this.picker == null) {
|
||||
@ -120,7 +108,6 @@ VantComponent({
|
||||
stack.push(picker.setColumnValues(0, province, false));
|
||||
stack.push(picker.setColumnValues(1, city, false));
|
||||
if (city.length && code.slice(2, 4) === '00') {
|
||||
;
|
||||
[{ code }] = city;
|
||||
}
|
||||
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
|
||||
|
34
dist/badge-group/index.js
vendored
34
dist/badge-group/index.js
vendored
@ -1,49 +1,43 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { isNumber } from '../common/utils';
|
||||
VantComponent({
|
||||
relation: {
|
||||
name: 'badge',
|
||||
type: 'descendant',
|
||||
linked(target) {
|
||||
this.badges.push(target);
|
||||
this.setActive();
|
||||
this.setActive(this.data.active);
|
||||
},
|
||||
unlinked(target) {
|
||||
this.badges = this.badges.filter(item => item !== target);
|
||||
this.setActive();
|
||||
this.setActive(this.data.active);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
active: {
|
||||
type: Number,
|
||||
value: 0
|
||||
value: 0,
|
||||
observer: 'setActive'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
active: 'setActive'
|
||||
},
|
||||
beforeCreate() {
|
||||
this.badges = [];
|
||||
this.currentActive = -1;
|
||||
},
|
||||
methods: {
|
||||
setActive(badge) {
|
||||
let { active } = this.data;
|
||||
const { badges } = this;
|
||||
if (badge && !isNumber(badge)) {
|
||||
active = badges.indexOf(badge);
|
||||
setActive(active) {
|
||||
const { badges, currentActive } = this;
|
||||
if (!badges.length) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (active === this.currentActive) {
|
||||
return;
|
||||
}
|
||||
if (this.currentActive !== -1 && badges[this.currentActive]) {
|
||||
this.$emit('change', active);
|
||||
badges[this.currentActive].setActive(false);
|
||||
this.currentActive = active;
|
||||
const stack = [];
|
||||
if (currentActive !== active && badges[currentActive]) {
|
||||
stack.push(badges[currentActive].setActive(false));
|
||||
}
|
||||
if (badges[active]) {
|
||||
badges[active].setActive(true);
|
||||
this.currentActive = active;
|
||||
stack.push(badges[active].setActive(true));
|
||||
}
|
||||
return Promise.all(stack);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
18
dist/badge/index.js
vendored
18
dist/badge/index.js
vendored
@ -2,7 +2,10 @@ import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
relation: {
|
||||
type: 'ancestor',
|
||||
name: 'badge-group'
|
||||
name: 'badge-group',
|
||||
linked(target) {
|
||||
this.parent = target;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
info: null,
|
||||
@ -10,13 +13,18 @@ VantComponent({
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
const group = this.getRelationNodes('../badge-group/index')[0];
|
||||
if (group) {
|
||||
group.setActive(this);
|
||||
const { parent } = this;
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
const index = parent.badges.indexOf(this);
|
||||
parent.setActive(index).then(() => {
|
||||
this.$emit('click', index);
|
||||
parent.$emit('change', index);
|
||||
});
|
||||
},
|
||||
setActive(active) {
|
||||
this.set({ active });
|
||||
return this.set({ active });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
1
dist/cell/index.js
vendored
1
dist/cell/index.js
vendored
@ -22,6 +22,7 @@ VantComponent({
|
||||
titleWidth: String,
|
||||
customStyle: String,
|
||||
arrowDirection: String,
|
||||
useLabelSlot: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
|
10
dist/cell/index.wxml
vendored
10
dist/cell/index.wxml
vendored
@ -19,11 +19,13 @@
|
||||
style="{{ titleWidth ? 'max-width:' + titleWidth + ';min-width:' + titleWidth : '' }}"
|
||||
class="van-cell__title title-class"
|
||||
>
|
||||
<block wx:if="{{ title }}">
|
||||
{{ title }}
|
||||
<view wx:if="{{ label }}" class="van-cell__label label-class">{{ label }}</view>
|
||||
</block>
|
||||
<block wx:if="{{ title }}">{{ title }}</block>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class">
|
||||
<slot wx:if="{{ useLabelSlot }}" name="label" />
|
||||
<block wx:elif="{{ label }}">{{ label }}</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="van-cell__value value-class">
|
||||
|
1
dist/collapse-item/index.js
vendored
1
dist/collapse-item/index.js
vendored
@ -16,6 +16,7 @@ VantComponent({
|
||||
icon: String,
|
||||
label: String,
|
||||
disabled: Boolean,
|
||||
clickable: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
|
3
dist/collapse-item/index.wxml
vendored
3
dist/collapse-item/index.wxml
vendored
@ -5,9 +5,10 @@
|
||||
title="{{ title }}"
|
||||
title-class="title-class"
|
||||
icon="{{ icon }}"
|
||||
is-link="{{ isLink }}"
|
||||
value="{{ value }}"
|
||||
label="{{ label }}"
|
||||
is-link="{{ isLink }}"
|
||||
clickable="{{ clickable }}"
|
||||
border="{{ border && expanded }}"
|
||||
class="{{ utils.bem('collapse-item__title', { disabled, expanded }) }}"
|
||||
right-icon-class="van-cell__right-icon"
|
||||
|
3
dist/collapse/index.js
vendored
3
dist/collapse/index.js
vendored
@ -5,6 +5,9 @@ VantComponent({
|
||||
type: 'descendant',
|
||||
linked(child) {
|
||||
this.children.push(child);
|
||||
},
|
||||
unlinked(child) {
|
||||
this.children = this.children.filter((item) => item !== child);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
79
dist/datetime-picker/index.js
vendored
79
dist/datetime-picker/index.js
vendored
@ -1,5 +1,6 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { isDef } from '../common/utils';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
const currentYear = new Date().getFullYear();
|
||||
function isValidDate(date) {
|
||||
return isDef(date) && !isNaN(new Date(date).getTime());
|
||||
@ -29,60 +30,37 @@ function getTrueValue(formattedValue) {
|
||||
function getMonthEndDay(year, month) {
|
||||
return 32 - new Date(year, month - 1, 32).getDate();
|
||||
}
|
||||
const defaultFormatter = (_, value) => value;
|
||||
VantComponent({
|
||||
props: {
|
||||
value: null,
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
itemHeight: {
|
||||
type: Number,
|
||||
value: 44
|
||||
},
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5
|
||||
},
|
||||
confirmButtonText: {
|
||||
type: String,
|
||||
value: '确认'
|
||||
},
|
||||
cancelButtonText: {
|
||||
type: String,
|
||||
value: '取消'
|
||||
},
|
||||
type: {
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: Object.assign({}, pickerProps, { formatter: {
|
||||
type: Function,
|
||||
value: defaultFormatter
|
||||
}, value: null, type: {
|
||||
type: String,
|
||||
value: 'datetime'
|
||||
},
|
||||
showToolbar: {
|
||||
}, showToolbar: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
minDate: {
|
||||
}, minDate: {
|
||||
type: Number,
|
||||
value: new Date(currentYear - 10, 0, 1).getTime()
|
||||
},
|
||||
maxDate: {
|
||||
}, maxDate: {
|
||||
type: Number,
|
||||
value: new Date(currentYear + 10, 11, 31).getTime()
|
||||
},
|
||||
minHour: {
|
||||
}, minHour: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
maxHour: {
|
||||
}, maxHour: {
|
||||
type: Number,
|
||||
value: 23
|
||||
},
|
||||
minMinute: {
|
||||
}, minMinute: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
maxMinute: {
|
||||
}, maxMinute: {
|
||||
type: Number,
|
||||
value: 59
|
||||
}
|
||||
},
|
||||
} }),
|
||||
data: {
|
||||
innerValue: Date.now(),
|
||||
columns: []
|
||||
@ -107,18 +85,19 @@ VantComponent({
|
||||
methods: {
|
||||
getPicker() {
|
||||
if (this.picker == null) {
|
||||
const picker = this.picker = this.selectComponent('.van-datetime-picker');
|
||||
const picker = (this.picker = this.selectComponent('.van-datetime-picker'));
|
||||
const { setColumnValues } = picker;
|
||||
picker.setColumnValues = (...args) => setColumnValues.apply(picker, [...args, false]);
|
||||
}
|
||||
return this.picker;
|
||||
},
|
||||
updateColumns() {
|
||||
const { formatter = defaultFormatter } = this.data;
|
||||
const results = this.getRanges().map(({ type, range }, index) => {
|
||||
const values = times(range[1] - range[0] + 1, index => {
|
||||
let value = range[0] + index;
|
||||
value = type === 'year' ? `${value}` : padZero(value);
|
||||
return value;
|
||||
return formatter(type, value);
|
||||
});
|
||||
return { values };
|
||||
});
|
||||
@ -265,20 +244,26 @@ VantComponent({
|
||||
},
|
||||
updateColumnValue(value) {
|
||||
let values = [];
|
||||
const { data } = this;
|
||||
const { type, formatter = defaultFormatter } = this.data;
|
||||
const picker = this.getPicker();
|
||||
if (data.type === 'time') {
|
||||
if (type === 'time') {
|
||||
const pair = value.split(':');
|
||||
values = [pair[0], pair[1]];
|
||||
values = [
|
||||
formatter('hour', pair[0]),
|
||||
formatter('minute', pair[1])
|
||||
];
|
||||
}
|
||||
else {
|
||||
const date = new Date(value);
|
||||
values = [`${date.getFullYear()}`, padZero(date.getMonth() + 1)];
|
||||
if (data.type === 'date') {
|
||||
values.push(padZero(date.getDate()));
|
||||
values = [
|
||||
formatter('year', `${date.getFullYear()}`),
|
||||
formatter('month', padZero(date.getMonth() + 1))
|
||||
];
|
||||
if (type === 'date') {
|
||||
values.push(formatter('day', padZero(date.getDate())));
|
||||
}
|
||||
if (data.type === 'datetime') {
|
||||
values.push(padZero(date.getDate()), padZero(date.getHours()), padZero(date.getMinutes()));
|
||||
if (type === 'datetime') {
|
||||
values.push(formatter('day', padZero(date.getDate())), formatter('hour', padZero(date.getHours())), formatter('minute', padZero(date.getMinutes())));
|
||||
}
|
||||
}
|
||||
return this.set({ innerValue: value })
|
||||
|
3
dist/datetime-picker/index.wxml
vendored
3
dist/datetime-picker/index.wxml
vendored
@ -1,5 +1,8 @@
|
||||
<van-picker
|
||||
class="van-datetime-picker"
|
||||
active-class="active-class"
|
||||
toolbar-class="toolbar-class"
|
||||
column-class="column-class"
|
||||
title="{{ title }}"
|
||||
columns="{{ columns }}"
|
||||
item-height="{{ itemHeight }}"
|
||||
|
5
dist/field/index.js
vendored
5
dist/field/index.js
vendored
@ -1,7 +1,7 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
field: true,
|
||||
classes: ['input-class'],
|
||||
classes: ['input-class', 'right-icon-class'],
|
||||
props: {
|
||||
size: String,
|
||||
icon: String,
|
||||
@ -12,6 +12,7 @@ VantComponent({
|
||||
center: Boolean,
|
||||
isLink: Boolean,
|
||||
leftIcon: String,
|
||||
rightIcon: String,
|
||||
disabled: Boolean,
|
||||
autosize: Boolean,
|
||||
readonly: Boolean,
|
||||
@ -26,8 +27,6 @@ VantComponent({
|
||||
errorMessage: String,
|
||||
placeholder: String,
|
||||
customStyle: String,
|
||||
useIconSlot: Boolean,
|
||||
useButtonSlot: Boolean,
|
||||
showConfirmBar: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
|
30
dist/field/index.wxml
vendored
30
dist/field/index.wxml
vendored
@ -24,9 +24,6 @@
|
||||
disabled="{{ disabled || readonly }}"
|
||||
maxlength="{{ maxlength }}"
|
||||
auto-height="{{ autosize }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
placeholder-style="{{ placeholderStyle }}"
|
||||
placeholder-class="{{ error ? 'van-field__input--error' : 'van-field__placeholder' }}"
|
||||
cursor-spacing="{{ cursorSpacing }}"
|
||||
adjust-position="{{ adjustPosition }}"
|
||||
show-confirm-bar="{{ showConfirmBar }}"
|
||||
@ -34,7 +31,11 @@
|
||||
bind:blur="onBlur"
|
||||
bind:focus="onFocus"
|
||||
bind:confirm="onConfirm"
|
||||
/>
|
||||
>
|
||||
<view wx:if="{{ value == null || value.length === 0 }}" style="{{ placeholderStyle }}" class="{{ utils.bem('field__placeholder', { error }) }}">
|
||||
{{ placeholder }}
|
||||
</view>
|
||||
</textarea>
|
||||
<input
|
||||
wx:else
|
||||
class="input-class {{ utils.bem('field__input', [inputAlign, { disabled, error }]) }}"
|
||||
@ -45,7 +46,7 @@
|
||||
maxlength="{{ maxlength }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
placeholder-style="{{ placeholderStyle }}"
|
||||
placeholder-class="{{ error ? 'van-field__input--error' : 'van-field__placeholder' }}"
|
||||
placeholder-class="{{ error ? 'van-field__placeholder--error' : 'van-field__placeholder' }}"
|
||||
confirm-type="{{ confirmType }}"
|
||||
confirm-hold="{{ confirmHold }}"
|
||||
cursor-spacing="{{ cursorSpacing }}"
|
||||
@ -59,20 +60,21 @@
|
||||
wx:if="{{ showClear }}"
|
||||
size="16px"
|
||||
name="clear"
|
||||
class="van-field__clear-root"
|
||||
custom-class="van-field__clear"
|
||||
bind:touchstart="onClear"
|
||||
class="van-field__clear-root van-field__icon-root"
|
||||
bindtouchstart="onClear"
|
||||
/>
|
||||
<view class="van-field__icon-container" wx:if="{{ icon || useIconSlot }}" bind:tap="onClickIcon">
|
||||
<view class="van-field__icon-container" bind:tap="onClickIcon">
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
wx:if="{{ rightIcon || icon }}"
|
||||
size="16px"
|
||||
name="{{ icon }}"
|
||||
custom-class="van-field__icon {{ iconClass }}"
|
||||
name="{{ rightIcon || icon }}"
|
||||
class="van-field__icon-root {{ iconClass }}"
|
||||
custom-class="right-icon-class"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
<slot name="right-icon" />
|
||||
<slot name="icon" />
|
||||
</view>
|
||||
<view wx:if="{{ useButtonSlot }}" class="van-field__button">
|
||||
<view class="van-field__button">
|
||||
<slot name="button" />
|
||||
</view>
|
||||
</view>
|
||||
|
2
dist/field/index.wxss
vendored
2
dist/field/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{display:block;width:100%;height:24px;min-height:24px;padding:0;margin:0;line-height:inherit;color:#333;text-align:left;background-color:initial;border:0;box-sizing:border-box;resize:none}.van-field__input--disabled{color:#999;background-color:initial;opacity:1}.van-field__input--center{text-align:center}.van-field__input--right{text-align:right}.van-field__input--error{color:#f44}.van-field__placeholder{color:#999}.van-field__clear-root{display:-webkit-flex;display:flex;height:24px;-webkit-align-items:center;align-items:center}.van-field__button,.van-field__clear,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear,.van-field__icon-container{padding:0 10px;margin-right:-10px;line-height:inherit;vertical-align:middle}.van-field__clear{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon{display:block!important}.van-field__button{padding-left:10px}.van-field__error-message{font-size:12px;color:#f44;text-align:left}.van-field__error--center{text-align:center}.van-field__error--right{text-align:right}
|
||||
@import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{position:relative;display:block;width:100%;height:24px;min-height:24px;padding:0;margin:0;line-height:inherit;color:#333;text-align:left;background-color:initial;border:0;box-sizing:border-box;resize:none}.van-field__input--disabled{color:#999;background-color:initial;opacity:1}.van-field__input--center{text-align:center}.van-field__input--right{text-align:right}.van-field__placeholder{position:absolute;top:0;left:0;color:#999;pointer-events:none}.van-field__placeholder--error{color:#f44}.van-field__icon-root{display:-webkit-flex;display:flex;min-height:24px;-webkit-align-items:center;align-items:center}.van-field__clear-root,.van-field__icon-container{padding:0 10px;margin-right:-10px;line-height:inherit;vertical-align:middle}.van-field__button,.van-field__clear-root,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear-root{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:10px}.van-field__button:empty{display:none}.van-field__error-message{font-size:12px;color:#f44;text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}
|
2
dist/icon/index.wxss
vendored
2
dist/icon/index.wxss
vendored
File diff suppressed because one or more lines are too long
4
dist/notify/index.js
vendored
4
dist/notify/index.js
vendored
@ -16,6 +16,10 @@ VantComponent({
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 3000
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 110
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
2
dist/notify/index.wxml
vendored
2
dist/notify/index.wxml
vendored
@ -2,7 +2,7 @@
|
||||
name="slide-down"
|
||||
show="{{ show }}"
|
||||
custom-class="van-notify"
|
||||
custom-style="background-color:{{ backgroundColor }}; color: {{ color }};"
|
||||
custom-style="background-color:{{ backgroundColor }}; color: {{ color }}; z-index: {{ zIndex }};"
|
||||
>
|
||||
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-top" style="padding-top: {{ statusBarHeight }}px"></view>
|
||||
{{ text }}
|
||||
|
2
dist/notify/index.wxss
vendored
2
dist/notify/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-notify{position:fixed;top:0;z-index:110;width:100%;padding:6px 15px;font-size:14px;line-height:20px;text-align:center;word-break:break-all;box-sizing:border-box}.van-notify__safe-top{height:44px}
|
||||
@import '../common/index.wxss';.van-notify{position:fixed;top:0;width:100%;padding:6px 15px;font-size:14px;line-height:20px;text-align:center;word-break:break-all;box-sizing:border-box}.van-notify__safe-top{height:44px}
|
5
dist/notify/notify.d.ts
vendored
5
dist/notify/notify.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
declare type NotifyOptions = {
|
||||
interface NotifyOptions {
|
||||
text: string;
|
||||
color?: string;
|
||||
backgroundColor?: string;
|
||||
@ -6,6 +6,7 @@ declare type NotifyOptions = {
|
||||
selector?: string;
|
||||
context?: any;
|
||||
safeAreaInsetTop?: boolean;
|
||||
};
|
||||
zIndex?: number;
|
||||
}
|
||||
export default function Notify(options: NotifyOptions | string): void;
|
||||
export {};
|
||||
|
2
dist/picker-column/index.wxss
vendored
2
dist/picker-column/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-picker-column{overflow:hidden;font-size:16px;text-align:center}.van-picker-column__item{padding:0 5px;color:#999}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
|
||||
@import '../common/index.wxss';.van-picker-column{overflow:hidden;font-size:16px;color:#999;text-align:center}.van-picker-column__item{padding:0 5px}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
|
29
dist/picker/index.js
vendored
29
dist/picker/index.js
vendored
@ -1,39 +1,24 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
function isSimple(columns) {
|
||||
return columns.length && !columns[0].values;
|
||||
}
|
||||
import { pickerProps } from './shared';
|
||||
VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: {
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
showToolbar: Boolean,
|
||||
confirmButtonText: String,
|
||||
cancelButtonText: String,
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5
|
||||
},
|
||||
valueKey: {
|
||||
props: Object.assign({}, pickerProps, { valueKey: {
|
||||
type: String,
|
||||
value: 'text'
|
||||
},
|
||||
itemHeight: {
|
||||
}, defaultIndex: {
|
||||
type: Number,
|
||||
value: 44
|
||||
},
|
||||
columns: {
|
||||
value: 0
|
||||
}, columns: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer(columns = []) {
|
||||
this.simple = isSimple(columns);
|
||||
this.simple = columns.length && !columns[0].values;
|
||||
this.children = this.selectAllComponents('.van-picker__column');
|
||||
if (Array.isArray(this.children) && this.children.length) {
|
||||
this.setColumns().catch(() => { });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
} }),
|
||||
beforeCreate() {
|
||||
this.children = [];
|
||||
},
|
||||
|
6
dist/picker/index.wxml
vendored
6
dist/picker/index.wxml
vendored
@ -10,7 +10,7 @@
|
||||
data-type="cancel"
|
||||
bindtap="emit"
|
||||
>
|
||||
{{ cancelButtonText || '取消' }}
|
||||
{{ cancelButtonText }}
|
||||
</view>
|
||||
<view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{ title }}</view>
|
||||
<view
|
||||
@ -20,7 +20,7 @@
|
||||
data-type="confirm"
|
||||
bindtap="emit"
|
||||
>
|
||||
{{ confirmButtonText || '确认' }}
|
||||
{{ confirmButtonText }}
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{ loading }}" class="van-picker__loading">
|
||||
@ -39,7 +39,7 @@
|
||||
custom-class="column-class"
|
||||
value-key="{{ valueKey }}"
|
||||
initial-options="{{ isSimple(columns) ? item : item.values }}"
|
||||
default-index="{{ item.defaultIndex }}"
|
||||
default-index="{{ item.defaultIndex || defaultIndex }}"
|
||||
item-height="{{ itemHeight }}"
|
||||
visible-item-count="{{ visibleItemCount }}"
|
||||
active-class="active-class"
|
||||
|
21
dist/picker/shared.d.ts
vendored
Normal file
21
dist/picker/shared.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
export declare const pickerProps: {
|
||||
title: StringConstructor;
|
||||
loading: BooleanConstructor;
|
||||
showToolbar: BooleanConstructor;
|
||||
cancelButtonText: {
|
||||
type: StringConstructor;
|
||||
value: string;
|
||||
};
|
||||
confirmButtonText: {
|
||||
type: StringConstructor;
|
||||
value: string;
|
||||
};
|
||||
visibleItemCount: {
|
||||
type: NumberConstructor;
|
||||
value: number;
|
||||
};
|
||||
itemHeight: {
|
||||
type: NumberConstructor;
|
||||
value: number;
|
||||
};
|
||||
};
|
21
dist/picker/shared.js
vendored
Normal file
21
dist/picker/shared.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
export const pickerProps = {
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
showToolbar: Boolean,
|
||||
cancelButtonText: {
|
||||
type: String,
|
||||
value: '取消'
|
||||
},
|
||||
confirmButtonText: {
|
||||
type: String,
|
||||
value: '确认'
|
||||
},
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5
|
||||
},
|
||||
itemHeight: {
|
||||
type: Number,
|
||||
value: 44
|
||||
}
|
||||
};
|
5
dist/slider/index.js
vendored
5
dist/slider/index.js
vendored
@ -49,13 +49,14 @@ VantComponent({
|
||||
this.touchMove(event);
|
||||
this.getRect('.van-slider').then((rect) => {
|
||||
const diff = this.deltaX / rect.width * 100;
|
||||
this.updateValue(this.startValue + diff, false, true);
|
||||
this.newValue = this.startValue + diff;
|
||||
this.updateValue(this.newValue, false, true);
|
||||
});
|
||||
},
|
||||
onTouchEnd() {
|
||||
if (this.data.disabled)
|
||||
return;
|
||||
this.updateValue(this.data.value, true);
|
||||
this.updateValue(this.newValue, true);
|
||||
},
|
||||
onClick(event) {
|
||||
if (this.data.disabled)
|
||||
|
6
dist/submit-bar/index.js
vendored
6
dist/submit-bar/index.js
vendored
@ -22,6 +22,10 @@ VantComponent({
|
||||
buttonType: {
|
||||
type: String,
|
||||
value: 'danger'
|
||||
},
|
||||
decimalLength: {
|
||||
type: Number,
|
||||
value: 2
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -29,7 +33,7 @@ VantComponent({
|
||||
return typeof this.data.price === 'number';
|
||||
},
|
||||
priceStr() {
|
||||
return (this.data.price / 100).toFixed(2);
|
||||
return (this.data.price / 100).toFixed(this.data.decimalLength);
|
||||
},
|
||||
tipStr() {
|
||||
const { tip } = this.data;
|
||||
|
5
dist/toast/index.js
vendored
5
dist/toast/index.js
vendored
@ -23,11 +23,6 @@ VantComponent({
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clear() {
|
||||
this.set({
|
||||
show: false
|
||||
});
|
||||
},
|
||||
// for prevent touchmove
|
||||
noop() { }
|
||||
}
|
||||
|
2
dist/toast/index.wxml
vendored
2
dist/toast/index.wxml
vendored
@ -27,5 +27,7 @@
|
||||
<van-icon wx:else class="van-toast__icon" name="{{ type }}" />
|
||||
<text wx:if="{{ message }}" class="van-toast__text">{{ message }}</text>
|
||||
</block>
|
||||
|
||||
<slot />
|
||||
</view>
|
||||
</van-transition>
|
||||
|
22
dist/toast/toast.d.ts
vendored
22
dist/toast/toast.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
declare type ToastMessage = string | number;
|
||||
export declare type ToastOptions = {
|
||||
interface ToastOptions {
|
||||
show?: boolean;
|
||||
type?: string;
|
||||
mask?: boolean;
|
||||
@ -11,15 +11,15 @@ export declare type ToastOptions = {
|
||||
forbidClick?: boolean;
|
||||
loadingType?: string;
|
||||
message?: ToastMessage;
|
||||
};
|
||||
export interface Toast {
|
||||
(message: ToastOptions | ToastMessage, options?: ToastOptions): Weapp.Component;
|
||||
loading?(options?: ToastOptions | ToastMessage): Weapp.Component;
|
||||
success?(options?: ToastOptions | ToastMessage): Weapp.Component;
|
||||
fail?(options?: ToastOptions | ToastMessage): Weapp.Component;
|
||||
clear?(): void;
|
||||
setDefaultOptions?(options: ToastOptions): void;
|
||||
resetDefaultOptions?(): void;
|
||||
onClose?: () => void;
|
||||
}
|
||||
declare function Toast(toastOptions: ToastOptions | ToastMessage): Weapp.Component;
|
||||
declare namespace Toast {
|
||||
var loading: (options: string | number | ToastOptions) => Weapp.Component;
|
||||
var success: (options: string | number | ToastOptions) => Weapp.Component;
|
||||
var fail: (options: string | number | ToastOptions) => Weapp.Component;
|
||||
var clear: () => void;
|
||||
var setDefaultOptions: (options: ToastOptions) => void;
|
||||
var resetDefaultOptions: () => void;
|
||||
}
|
||||
declare const Toast: Toast;
|
||||
export default Toast;
|
||||
|
22
dist/toast/toast.js
vendored
22
dist/toast/toast.js
vendored
@ -20,8 +20,8 @@ function getContext() {
|
||||
const pages = getCurrentPages();
|
||||
return pages[pages.length - 1];
|
||||
}
|
||||
const Toast = (options = {}) => {
|
||||
options = Object.assign({}, currentOptions, parseOptions(options));
|
||||
function Toast(toastOptions) {
|
||||
const options = Object.assign({}, currentOptions, parseOptions(toastOptions));
|
||||
const context = options.context || getContext();
|
||||
const toast = context.selectComponent(options.selector);
|
||||
if (!toast) {
|
||||
@ -30,6 +30,12 @@ const Toast = (options = {}) => {
|
||||
}
|
||||
delete options.context;
|
||||
delete options.selector;
|
||||
toast.clear = () => {
|
||||
toast.set({ show: false });
|
||||
if (options.onClose) {
|
||||
options.onClose();
|
||||
}
|
||||
};
|
||||
queue.push(toast);
|
||||
toast.set(options);
|
||||
clearTimeout(toast.timer);
|
||||
@ -40,18 +46,18 @@ const Toast = (options = {}) => {
|
||||
}, options.duration);
|
||||
}
|
||||
return toast;
|
||||
};
|
||||
const createMethod = type => options => Toast(Object.assign({ type }, parseOptions(options)));
|
||||
['loading', 'success', 'fail'].forEach(method => {
|
||||
Toast[method] = createMethod(method);
|
||||
});
|
||||
}
|
||||
const createMethod = type => (options) => Toast(Object.assign({ type }, parseOptions(options)));
|
||||
Toast.loading = createMethod('loading');
|
||||
Toast.success = createMethod('success');
|
||||
Toast.fail = createMethod('fail');
|
||||
Toast.clear = () => {
|
||||
queue.forEach(toast => {
|
||||
toast.clear();
|
||||
});
|
||||
queue = [];
|
||||
};
|
||||
Toast.setDefaultOptions = options => {
|
||||
Toast.setDefaultOptions = (options) => {
|
||||
Object.assign(currentOptions, options);
|
||||
};
|
||||
Toast.resetDefaultOptions = () => {
|
||||
|
@ -1,31 +1,27 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
var shared_1 = require("../picker/shared");
|
||||
component_1.VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: {
|
||||
title: String,
|
||||
value: String,
|
||||
loading: Boolean,
|
||||
cancelButtonText: String,
|
||||
confirmButtonText: String,
|
||||
itemHeight: {
|
||||
type: Number,
|
||||
value: 44
|
||||
},
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5
|
||||
},
|
||||
columnsNum: {
|
||||
type: [String, Number],
|
||||
value: 3
|
||||
},
|
||||
areaList: {
|
||||
props: __assign({}, shared_1.pickerProps, { value: String, areaList: {
|
||||
type: Object,
|
||||
value: {}
|
||||
}
|
||||
},
|
||||
}, columnsNum: {
|
||||
type: [String, Number],
|
||||
value: 3
|
||||
} }),
|
||||
data: {
|
||||
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
displayColumns: [{ values: [] }, { values: [] }, { values: [] }]
|
||||
@ -42,6 +38,9 @@ component_1.VantComponent({
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.setValues();
|
||||
},
|
||||
methods: {
|
||||
getPicker: function () {
|
||||
if (this.picker == null) {
|
||||
@ -124,7 +123,6 @@ component_1.VantComponent({
|
||||
stack.push(picker.setColumnValues(0, province, false));
|
||||
stack.push(picker.setColumnValues(1, city, false));
|
||||
if (city.length && code.slice(2, 4) === '00') {
|
||||
;
|
||||
code = city[0].code;
|
||||
}
|
||||
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
|
||||
|
@ -1,51 +1,45 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
var utils_1 = require("../common/utils");
|
||||
component_1.VantComponent({
|
||||
relation: {
|
||||
name: 'badge',
|
||||
type: 'descendant',
|
||||
linked: function (target) {
|
||||
this.badges.push(target);
|
||||
this.setActive();
|
||||
this.setActive(this.data.active);
|
||||
},
|
||||
unlinked: function (target) {
|
||||
this.badges = this.badges.filter(function (item) { return item !== target; });
|
||||
this.setActive();
|
||||
this.setActive(this.data.active);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
active: {
|
||||
type: Number,
|
||||
value: 0
|
||||
value: 0,
|
||||
observer: 'setActive'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
active: 'setActive'
|
||||
},
|
||||
beforeCreate: function () {
|
||||
this.badges = [];
|
||||
this.currentActive = -1;
|
||||
},
|
||||
methods: {
|
||||
setActive: function (badge) {
|
||||
var active = this.data.active;
|
||||
var badges = this.badges;
|
||||
if (badge && !utils_1.isNumber(badge)) {
|
||||
active = badges.indexOf(badge);
|
||||
setActive: function (active) {
|
||||
var _a = this, badges = _a.badges, currentActive = _a.currentActive;
|
||||
if (!badges.length) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (active === this.currentActive) {
|
||||
return;
|
||||
}
|
||||
if (this.currentActive !== -1 && badges[this.currentActive]) {
|
||||
this.$emit('change', active);
|
||||
badges[this.currentActive].setActive(false);
|
||||
this.currentActive = active;
|
||||
var stack = [];
|
||||
if (currentActive !== active && badges[currentActive]) {
|
||||
stack.push(badges[currentActive].setActive(false));
|
||||
}
|
||||
if (badges[active]) {
|
||||
badges[active].setActive(true);
|
||||
this.currentActive = active;
|
||||
stack.push(badges[active].setActive(true));
|
||||
}
|
||||
return Promise.all(stack);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,10 @@ var component_1 = require("../common/component");
|
||||
component_1.VantComponent({
|
||||
relation: {
|
||||
type: 'ancestor',
|
||||
name: 'badge-group'
|
||||
name: 'badge-group',
|
||||
linked: function (target) {
|
||||
this.parent = target;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
info: null,
|
||||
@ -12,13 +15,19 @@ component_1.VantComponent({
|
||||
},
|
||||
methods: {
|
||||
onClick: function () {
|
||||
var group = this.getRelationNodes('../badge-group/index')[0];
|
||||
if (group) {
|
||||
group.setActive(this);
|
||||
var _this = this;
|
||||
var parent = this.parent;
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
var index = parent.badges.indexOf(this);
|
||||
parent.setActive(index).then(function () {
|
||||
_this.$emit('click', index);
|
||||
parent.$emit('change', index);
|
||||
});
|
||||
},
|
||||
setActive: function (active) {
|
||||
this.set({ active: active });
|
||||
return this.set({ active: active });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -24,6 +24,7 @@ component_1.VantComponent({
|
||||
titleWidth: String,
|
||||
customStyle: String,
|
||||
arrowDirection: String,
|
||||
useLabelSlot: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
|
@ -19,11 +19,13 @@
|
||||
style="{{ titleWidth ? 'max-width:' + titleWidth + ';min-width:' + titleWidth : '' }}"
|
||||
class="van-cell__title title-class"
|
||||
>
|
||||
<block wx:if="{{ title }}">
|
||||
{{ title }}
|
||||
<view wx:if="{{ label }}" class="van-cell__label label-class">{{ label }}</view>
|
||||
</block>
|
||||
<block wx:if="{{ title }}">{{ title }}</block>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class">
|
||||
<slot wx:if="{{ useLabelSlot }}" name="label" />
|
||||
<block wx:elif="{{ label }}">{{ label }}</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="van-cell__value value-class">
|
||||
|
@ -18,6 +18,7 @@ component_1.VantComponent({
|
||||
icon: String,
|
||||
label: String,
|
||||
disabled: Boolean,
|
||||
clickable: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
|
@ -5,9 +5,10 @@
|
||||
title="{{ title }}"
|
||||
title-class="title-class"
|
||||
icon="{{ icon }}"
|
||||
is-link="{{ isLink }}"
|
||||
value="{{ value }}"
|
||||
label="{{ label }}"
|
||||
is-link="{{ isLink }}"
|
||||
clickable="{{ clickable }}"
|
||||
border="{{ border && expanded }}"
|
||||
class="{{ utils.bem('collapse-item__title', { disabled, expanded }) }}"
|
||||
right-icon-class="van-cell__right-icon"
|
||||
|
@ -7,6 +7,9 @@ component_1.VantComponent({
|
||||
type: 'descendant',
|
||||
linked: function (child) {
|
||||
this.children.push(child);
|
||||
},
|
||||
unlinked: function (child) {
|
||||
this.children = this.children.filter(function (item) { return item !== child; });
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -1,7 +1,19 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
var utils_1 = require("../common/utils");
|
||||
var shared_1 = require("../picker/shared");
|
||||
var currentYear = new Date().getFullYear();
|
||||
function isValidDate(date) {
|
||||
return utils_1.isDef(date) && !isNaN(new Date(date).getTime());
|
||||
@ -31,60 +43,37 @@ function getTrueValue(formattedValue) {
|
||||
function getMonthEndDay(year, month) {
|
||||
return 32 - new Date(year, month - 1, 32).getDate();
|
||||
}
|
||||
var defaultFormatter = function (_, value) { return value; };
|
||||
component_1.VantComponent({
|
||||
props: {
|
||||
value: null,
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
itemHeight: {
|
||||
type: Number,
|
||||
value: 44
|
||||
},
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5
|
||||
},
|
||||
confirmButtonText: {
|
||||
type: String,
|
||||
value: '确认'
|
||||
},
|
||||
cancelButtonText: {
|
||||
type: String,
|
||||
value: '取消'
|
||||
},
|
||||
type: {
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: __assign({}, shared_1.pickerProps, { formatter: {
|
||||
type: Function,
|
||||
value: defaultFormatter
|
||||
}, value: null, type: {
|
||||
type: String,
|
||||
value: 'datetime'
|
||||
},
|
||||
showToolbar: {
|
||||
}, showToolbar: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
minDate: {
|
||||
}, minDate: {
|
||||
type: Number,
|
||||
value: new Date(currentYear - 10, 0, 1).getTime()
|
||||
},
|
||||
maxDate: {
|
||||
}, maxDate: {
|
||||
type: Number,
|
||||
value: new Date(currentYear + 10, 11, 31).getTime()
|
||||
},
|
||||
minHour: {
|
||||
}, minHour: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
maxHour: {
|
||||
}, maxHour: {
|
||||
type: Number,
|
||||
value: 23
|
||||
},
|
||||
minMinute: {
|
||||
}, minMinute: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
maxMinute: {
|
||||
}, maxMinute: {
|
||||
type: Number,
|
||||
value: 59
|
||||
}
|
||||
},
|
||||
} }),
|
||||
data: {
|
||||
innerValue: Date.now(),
|
||||
columns: []
|
||||
@ -110,7 +99,7 @@ component_1.VantComponent({
|
||||
methods: {
|
||||
getPicker: function () {
|
||||
if (this.picker == null) {
|
||||
var picker_1 = this.picker = this.selectComponent('.van-datetime-picker');
|
||||
var picker_1 = (this.picker = this.selectComponent('.van-datetime-picker'));
|
||||
var setColumnValues_1 = picker_1.setColumnValues;
|
||||
picker_1.setColumnValues = function () {
|
||||
var args = [];
|
||||
@ -123,12 +112,13 @@ component_1.VantComponent({
|
||||
return this.picker;
|
||||
},
|
||||
updateColumns: function () {
|
||||
var _a = this.data.formatter, formatter = _a === void 0 ? defaultFormatter : _a;
|
||||
var results = this.getRanges().map(function (_a, index) {
|
||||
var type = _a.type, range = _a.range;
|
||||
var values = times(range[1] - range[0] + 1, function (index) {
|
||||
var value = range[0] + index;
|
||||
value = type === 'year' ? "" + value : padZero(value);
|
||||
return value;
|
||||
return formatter(type, value);
|
||||
});
|
||||
return { values: values };
|
||||
});
|
||||
@ -278,20 +268,26 @@ component_1.VantComponent({
|
||||
updateColumnValue: function (value) {
|
||||
var _this = this;
|
||||
var values = [];
|
||||
var data = this.data;
|
||||
var _a = this.data, type = _a.type, _b = _a.formatter, formatter = _b === void 0 ? defaultFormatter : _b;
|
||||
var picker = this.getPicker();
|
||||
if (data.type === 'time') {
|
||||
if (type === 'time') {
|
||||
var pair = value.split(':');
|
||||
values = [pair[0], pair[1]];
|
||||
values = [
|
||||
formatter('hour', pair[0]),
|
||||
formatter('minute', pair[1])
|
||||
];
|
||||
}
|
||||
else {
|
||||
var date = new Date(value);
|
||||
values = ["" + date.getFullYear(), padZero(date.getMonth() + 1)];
|
||||
if (data.type === 'date') {
|
||||
values.push(padZero(date.getDate()));
|
||||
values = [
|
||||
formatter('year', "" + date.getFullYear()),
|
||||
formatter('month', padZero(date.getMonth() + 1))
|
||||
];
|
||||
if (type === 'date') {
|
||||
values.push(formatter('day', padZero(date.getDate())));
|
||||
}
|
||||
if (data.type === 'datetime') {
|
||||
values.push(padZero(date.getDate()), padZero(date.getHours()), padZero(date.getMinutes()));
|
||||
if (type === 'datetime') {
|
||||
values.push(formatter('day', padZero(date.getDate())), formatter('hour', padZero(date.getHours())), formatter('minute', padZero(date.getMinutes())));
|
||||
}
|
||||
}
|
||||
return this.set({ innerValue: value })
|
||||
|
@ -1,5 +1,8 @@
|
||||
<van-picker
|
||||
class="van-datetime-picker"
|
||||
active-class="active-class"
|
||||
toolbar-class="toolbar-class"
|
||||
column-class="column-class"
|
||||
title="{{ title }}"
|
||||
columns="{{ columns }}"
|
||||
item-height="{{ itemHeight }}"
|
||||
|
@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
component_1.VantComponent({
|
||||
field: true,
|
||||
classes: ['input-class'],
|
||||
classes: ['input-class', 'right-icon-class'],
|
||||
props: {
|
||||
size: String,
|
||||
icon: String,
|
||||
@ -14,6 +14,7 @@ component_1.VantComponent({
|
||||
center: Boolean,
|
||||
isLink: Boolean,
|
||||
leftIcon: String,
|
||||
rightIcon: String,
|
||||
disabled: Boolean,
|
||||
autosize: Boolean,
|
||||
readonly: Boolean,
|
||||
@ -28,8 +29,6 @@ component_1.VantComponent({
|
||||
errorMessage: String,
|
||||
placeholder: String,
|
||||
customStyle: String,
|
||||
useIconSlot: Boolean,
|
||||
useButtonSlot: Boolean,
|
||||
showConfirmBar: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
|
@ -24,9 +24,6 @@
|
||||
disabled="{{ disabled || readonly }}"
|
||||
maxlength="{{ maxlength }}"
|
||||
auto-height="{{ autosize }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
placeholder-style="{{ placeholderStyle }}"
|
||||
placeholder-class="{{ error ? 'van-field__input--error' : 'van-field__placeholder' }}"
|
||||
cursor-spacing="{{ cursorSpacing }}"
|
||||
adjust-position="{{ adjustPosition }}"
|
||||
show-confirm-bar="{{ showConfirmBar }}"
|
||||
@ -34,7 +31,11 @@
|
||||
bind:blur="onBlur"
|
||||
bind:focus="onFocus"
|
||||
bind:confirm="onConfirm"
|
||||
/>
|
||||
>
|
||||
<view wx:if="{{ value == null || value.length === 0 }}" style="{{ placeholderStyle }}" class="{{ utils.bem('field__placeholder', { error }) }}">
|
||||
{{ placeholder }}
|
||||
</view>
|
||||
</textarea>
|
||||
<input
|
||||
wx:else
|
||||
class="input-class {{ utils.bem('field__input', [inputAlign, { disabled, error }]) }}"
|
||||
@ -45,7 +46,7 @@
|
||||
maxlength="{{ maxlength }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
placeholder-style="{{ placeholderStyle }}"
|
||||
placeholder-class="{{ error ? 'van-field__input--error' : 'van-field__placeholder' }}"
|
||||
placeholder-class="{{ error ? 'van-field__placeholder--error' : 'van-field__placeholder' }}"
|
||||
confirm-type="{{ confirmType }}"
|
||||
confirm-hold="{{ confirmHold }}"
|
||||
cursor-spacing="{{ cursorSpacing }}"
|
||||
@ -59,20 +60,21 @@
|
||||
wx:if="{{ showClear }}"
|
||||
size="16px"
|
||||
name="clear"
|
||||
class="van-field__clear-root"
|
||||
custom-class="van-field__clear"
|
||||
bind:touchstart="onClear"
|
||||
class="van-field__clear-root van-field__icon-root"
|
||||
bindtouchstart="onClear"
|
||||
/>
|
||||
<view class="van-field__icon-container" wx:if="{{ icon || useIconSlot }}" bind:tap="onClickIcon">
|
||||
<view class="van-field__icon-container" bind:tap="onClickIcon">
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
wx:if="{{ rightIcon || icon }}"
|
||||
size="16px"
|
||||
name="{{ icon }}"
|
||||
custom-class="van-field__icon {{ iconClass }}"
|
||||
name="{{ rightIcon || icon }}"
|
||||
class="van-field__icon-root {{ iconClass }}"
|
||||
custom-class="right-icon-class"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
<slot name="right-icon" />
|
||||
<slot name="icon" />
|
||||
</view>
|
||||
<view wx:if="{{ useButtonSlot }}" class="van-field__button">
|
||||
<view class="van-field__button">
|
||||
<slot name="button" />
|
||||
</view>
|
||||
</view>
|
||||
|
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{display:block;width:100%;height:24px;min-height:24px;padding:0;margin:0;line-height:inherit;color:#333;text-align:left;background-color:initial;border:0;box-sizing:border-box;resize:none}.van-field__input--disabled{color:#999;background-color:initial;opacity:1}.van-field__input--center{text-align:center}.van-field__input--right{text-align:right}.van-field__input--error{color:#f44}.van-field__placeholder{color:#999}.van-field__clear-root{display:-webkit-flex;display:flex;height:24px;-webkit-align-items:center;align-items:center}.van-field__button,.van-field__clear,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear,.van-field__icon-container{padding:0 10px;margin-right:-10px;line-height:inherit;vertical-align:middle}.van-field__clear{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon{display:block!important}.van-field__button{padding-left:10px}.van-field__error-message{font-size:12px;color:#f44;text-align:left}.van-field__error--center{text-align:center}.van-field__error--right{text-align:right}
|
||||
@import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{position:relative;display:block;width:100%;height:24px;min-height:24px;padding:0;margin:0;line-height:inherit;color:#333;text-align:left;background-color:initial;border:0;box-sizing:border-box;resize:none}.van-field__input--disabled{color:#999;background-color:initial;opacity:1}.van-field__input--center{text-align:center}.van-field__input--right{text-align:right}.van-field__placeholder{position:absolute;top:0;left:0;color:#999;pointer-events:none}.van-field__placeholder--error{color:#f44}.van-field__icon-root{display:-webkit-flex;display:flex;min-height:24px;-webkit-align-items:center;align-items:center}.van-field__clear-root,.van-field__icon-container{padding:0 10px;margin-right:-10px;line-height:inherit;vertical-align:middle}.van-field__button,.van-field__clear-root,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear-root{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:10px}.van-field__button:empty{display:none}.van-field__error-message{font-size:12px;color:#f44;text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}
|
File diff suppressed because one or more lines are too long
@ -18,6 +18,10 @@ component_1.VantComponent({
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 3000
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 110
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -2,7 +2,7 @@
|
||||
name="slide-down"
|
||||
show="{{ show }}"
|
||||
custom-class="van-notify"
|
||||
custom-style="background-color:{{ backgroundColor }}; color: {{ color }};"
|
||||
custom-style="background-color:{{ backgroundColor }}; color: {{ color }}; z-index: {{ zIndex }};"
|
||||
>
|
||||
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-top" style="padding-top: {{ statusBarHeight }}px"></view>
|
||||
{{ text }}
|
||||
|
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-notify{position:fixed;top:0;z-index:110;width:100%;padding:6px 15px;font-size:14px;line-height:20px;text-align:center;word-break:break-all;box-sizing:border-box}.van-notify__safe-top{height:44px}
|
||||
@import '../common/index.wxss';.van-notify{position:fixed;top:0;width:100%;padding:6px 15px;font-size:14px;line-height:20px;text-align:center;word-break:break-all;box-sizing:border-box}.van-notify__safe-top{height:44px}
|
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-picker-column{overflow:hidden;font-size:16px;text-align:center}.van-picker-column__item{padding:0 5px;color:#999}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
|
||||
@import '../common/index.wxss';.van-picker-column{overflow:hidden;font-size:16px;color:#999;text-align:center}.van-picker-column__item{padding:0 5px}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
|
@ -1,42 +1,38 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
function isSimple(columns) {
|
||||
return columns.length && !columns[0].values;
|
||||
}
|
||||
var shared_1 = require("./shared");
|
||||
component_1.VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: {
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
showToolbar: Boolean,
|
||||
confirmButtonText: String,
|
||||
cancelButtonText: String,
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5
|
||||
},
|
||||
valueKey: {
|
||||
props: __assign({}, shared_1.pickerProps, { valueKey: {
|
||||
type: String,
|
||||
value: 'text'
|
||||
},
|
||||
itemHeight: {
|
||||
}, defaultIndex: {
|
||||
type: Number,
|
||||
value: 44
|
||||
},
|
||||
columns: {
|
||||
value: 0
|
||||
}, columns: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: function (columns) {
|
||||
if (columns === void 0) { columns = []; }
|
||||
this.simple = isSimple(columns);
|
||||
this.simple = columns.length && !columns[0].values;
|
||||
this.children = this.selectAllComponents('.van-picker__column');
|
||||
if (Array.isArray(this.children) && this.children.length) {
|
||||
this.setColumns().catch(function () { });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
} }),
|
||||
beforeCreate: function () {
|
||||
this.children = [];
|
||||
},
|
||||
|
@ -10,7 +10,7 @@
|
||||
data-type="cancel"
|
||||
bindtap="emit"
|
||||
>
|
||||
{{ cancelButtonText || '取消' }}
|
||||
{{ cancelButtonText }}
|
||||
</view>
|
||||
<view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{ title }}</view>
|
||||
<view
|
||||
@ -20,7 +20,7 @@
|
||||
data-type="confirm"
|
||||
bindtap="emit"
|
||||
>
|
||||
{{ confirmButtonText || '确认' }}
|
||||
{{ confirmButtonText }}
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{ loading }}" class="van-picker__loading">
|
||||
@ -39,7 +39,7 @@
|
||||
custom-class="column-class"
|
||||
value-key="{{ valueKey }}"
|
||||
initial-options="{{ isSimple(columns) ? item : item.values }}"
|
||||
default-index="{{ item.defaultIndex }}"
|
||||
default-index="{{ item.defaultIndex || defaultIndex }}"
|
||||
item-height="{{ itemHeight }}"
|
||||
visible-item-count="{{ visibleItemCount }}"
|
||||
active-class="active-class"
|
||||
|
23
lib/picker/shared.js
Normal file
23
lib/picker/shared.js
Normal file
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pickerProps = {
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
showToolbar: Boolean,
|
||||
cancelButtonText: {
|
||||
type: String,
|
||||
value: '取消'
|
||||
},
|
||||
confirmButtonText: {
|
||||
type: String,
|
||||
value: '确认'
|
||||
},
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5
|
||||
},
|
||||
itemHeight: {
|
||||
type: Number,
|
||||
value: 44
|
||||
}
|
||||
};
|
@ -52,13 +52,14 @@ component_1.VantComponent({
|
||||
this.touchMove(event);
|
||||
this.getRect('.van-slider').then(function (rect) {
|
||||
var diff = _this.deltaX / rect.width * 100;
|
||||
_this.updateValue(_this.startValue + diff, false, true);
|
||||
_this.newValue = _this.startValue + diff;
|
||||
_this.updateValue(_this.newValue, false, true);
|
||||
});
|
||||
},
|
||||
onTouchEnd: function () {
|
||||
if (this.data.disabled)
|
||||
return;
|
||||
this.updateValue(this.data.value, true);
|
||||
this.updateValue(this.newValue, true);
|
||||
},
|
||||
onClick: function (event) {
|
||||
var _this = this;
|
||||
|
@ -24,6 +24,10 @@ component_1.VantComponent({
|
||||
buttonType: {
|
||||
type: String,
|
||||
value: 'danger'
|
||||
},
|
||||
decimalLength: {
|
||||
type: Number,
|
||||
value: 2
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -31,7 +35,7 @@ component_1.VantComponent({
|
||||
return typeof this.data.price === 'number';
|
||||
},
|
||||
priceStr: function () {
|
||||
return (this.data.price / 100).toFixed(2);
|
||||
return (this.data.price / 100).toFixed(this.data.decimalLength);
|
||||
},
|
||||
tipStr: function () {
|
||||
var tip = this.data.tip;
|
||||
|
@ -25,11 +25,6 @@ component_1.VantComponent({
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clear: function () {
|
||||
this.set({
|
||||
show: false
|
||||
});
|
||||
},
|
||||
// for prevent touchmove
|
||||
noop: function () { }
|
||||
}
|
||||
|
@ -27,5 +27,7 @@
|
||||
<van-icon wx:else class="van-toast__icon" name="{{ type }}" />
|
||||
<text wx:if="{{ message }}" class="van-toast__text">{{ message }}</text>
|
||||
</block>
|
||||
|
||||
<slot />
|
||||
</view>
|
||||
</van-transition>
|
||||
|
@ -33,9 +33,8 @@ function getContext() {
|
||||
var pages = getCurrentPages();
|
||||
return pages[pages.length - 1];
|
||||
}
|
||||
var Toast = function (options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
options = __assign({}, currentOptions, parseOptions(options));
|
||||
function Toast(toastOptions) {
|
||||
var options = __assign({}, currentOptions, parseOptions(toastOptions));
|
||||
var context = options.context || getContext();
|
||||
var toast = context.selectComponent(options.selector);
|
||||
if (!toast) {
|
||||
@ -44,6 +43,12 @@ var Toast = function (options) {
|
||||
}
|
||||
delete options.context;
|
||||
delete options.selector;
|
||||
toast.clear = function () {
|
||||
toast.set({ show: false });
|
||||
if (options.onClose) {
|
||||
options.onClose();
|
||||
}
|
||||
};
|
||||
queue.push(toast);
|
||||
toast.set(options);
|
||||
clearTimeout(toast.timer);
|
||||
@ -54,11 +59,13 @@ var Toast = function (options) {
|
||||
}, options.duration);
|
||||
}
|
||||
return toast;
|
||||
};
|
||||
var createMethod = function (type) { return function (options) { return Toast(__assign({ type: type }, parseOptions(options))); }; };
|
||||
['loading', 'success', 'fail'].forEach(function (method) {
|
||||
Toast[method] = createMethod(method);
|
||||
});
|
||||
}
|
||||
var createMethod = function (type) { return function (options) {
|
||||
return Toast(__assign({ type: type }, parseOptions(options)));
|
||||
}; };
|
||||
Toast.loading = createMethod('loading');
|
||||
Toast.success = createMethod('success');
|
||||
Toast.fail = createMethod('fail');
|
||||
Toast.clear = function () {
|
||||
queue.forEach(function (toast) {
|
||||
toast.clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user