患者1.2
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -22,6 +22,7 @@
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
|
||||
@@ -54,12 +54,12 @@
|
||||
type="danger"
|
||||
color="{{ color }}"
|
||||
custom-class="van-calendar__confirm"
|
||||
disabled="{{ computed.getButtonDisabled(type, currentDate) }}"
|
||||
disabled="{{ computed.getButtonDisabled(type, currentDate, minRange) }}"
|
||||
nativeType="text"
|
||||
bind:click="onConfirm"
|
||||
>
|
||||
{{
|
||||
computed.getButtonDisabled(type, currentDate)
|
||||
computed.getButtonDisabled(type, currentDate, minRange)
|
||||
? confirmDisabledText
|
||||
: confirmText
|
||||
}}
|
||||
|
||||
@@ -56,6 +56,7 @@ var getTime = function (date) {
|
||||
},
|
||||
defaultDate: {
|
||||
type: null,
|
||||
value: (0, utils_1.getToday)().getTime(),
|
||||
observer: function (val) {
|
||||
this.setData({ currentDate: val });
|
||||
this.scrollIntoView();
|
||||
@@ -119,6 +120,10 @@ var getTime = function (date) {
|
||||
type: null,
|
||||
value: null,
|
||||
},
|
||||
minRange: {
|
||||
type: Number,
|
||||
value: 1,
|
||||
},
|
||||
firstDayOfWeek: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
@@ -181,13 +186,16 @@ var getTime = function (date) {
|
||||
var _this = this;
|
||||
if (defaultDate === void 0) { defaultDate = null; }
|
||||
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, allowSameDay = _a.allowSameDay;
|
||||
if (!defaultDate)
|
||||
return [];
|
||||
var now = (0, utils_1.getToday)().getTime();
|
||||
if (type === 'range') {
|
||||
if (!Array.isArray(defaultDate)) {
|
||||
defaultDate = [];
|
||||
}
|
||||
var _b = defaultDate || [], startDay = _b[0], endDay = _b[1];
|
||||
var start = this.limitDateRange(startDay || now, minDate, (0, utils_1.getPrevDay)(new Date(maxDate)).getTime());
|
||||
var startDate = getTime(startDay || now);
|
||||
var start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : (0, utils_1.getPrevDay)(new Date(maxDate)).getTime());
|
||||
var date = getTime(endDay || now);
|
||||
var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime());
|
||||
return [start, end];
|
||||
@@ -207,6 +215,8 @@ var getTime = function (date) {
|
||||
var _this = this;
|
||||
(0, utils_2.requestAnimationFrame)(function () {
|
||||
var _a = _this.data, currentDate = _a.currentDate, type = _a.type, show = _a.show, poppable = _a.poppable, minDate = _a.minDate, maxDate = _a.maxDate;
|
||||
if (!currentDate)
|
||||
return;
|
||||
// @ts-ignore
|
||||
var targetDate = type === 'single' ? currentDate : currentDate[0];
|
||||
var displayed = show || !poppable;
|
||||
@@ -263,7 +273,7 @@ var getTime = function (date) {
|
||||
this.select([date, null]);
|
||||
}
|
||||
else if (allowSameDay) {
|
||||
this.select([date, date]);
|
||||
this.select([date, date], true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
position="{{ position }}"
|
||||
closeable="{{ showTitle || showSubtitle }}"
|
||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
|
||||
bind:enter="onOpen"
|
||||
bind:close="onClose"
|
||||
bind:after-enter="onOpened"
|
||||
|
||||
@@ -15,7 +15,7 @@ function getMonths(minDate, maxDate) {
|
||||
return months;
|
||||
}
|
||||
|
||||
function getButtonDisabled(type, currentDate) {
|
||||
function getButtonDisabled(type, currentDate, minRange) {
|
||||
if (currentDate == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ function getButtonDisabled(type, currentDate) {
|
||||
}
|
||||
|
||||
if (type === 'multiple') {
|
||||
return !currentDate.length;
|
||||
return currentDate.length < minRange;
|
||||
}
|
||||
|
||||
return !currentDate;
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
|
||||
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,90%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
|
||||
@@ -26,7 +26,6 @@ var defaultFieldNames = {
|
||||
title: String,
|
||||
value: {
|
||||
type: String,
|
||||
observer: 'updateValue',
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
@@ -39,7 +38,6 @@ var defaultFieldNames = {
|
||||
options: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: 'updateOptions',
|
||||
},
|
||||
swipeable: {
|
||||
type: Boolean,
|
||||
@@ -69,15 +67,20 @@ var defaultFieldNames = {
|
||||
textKey: FieldName.TEXT,
|
||||
valueKey: FieldName.VALUE,
|
||||
childrenKey: FieldName.CHILDREN,
|
||||
innerValue: '',
|
||||
},
|
||||
watch: {
|
||||
options: function () {
|
||||
this.updateTabs();
|
||||
},
|
||||
value: function (newVal) {
|
||||
this.updateValue(newVal);
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
this.updateTabs();
|
||||
},
|
||||
methods: {
|
||||
updateOptions: function (val, oldVal) {
|
||||
var isAsync = !!(val.length && oldVal.length);
|
||||
this.updateTabs(isAsync);
|
||||
},
|
||||
updateValue: function (val) {
|
||||
var _this = this;
|
||||
if (val !== undefined) {
|
||||
@@ -86,6 +89,7 @@ var defaultFieldNames = {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.innerValue = val;
|
||||
this.updateTabs();
|
||||
},
|
||||
updateFieldNames: function () {
|
||||
@@ -110,12 +114,15 @@ var defaultFieldNames = {
|
||||
}
|
||||
}
|
||||
},
|
||||
updateTabs: function (isAsync) {
|
||||
updateTabs: function () {
|
||||
var _this = this;
|
||||
if (isAsync === void 0) { isAsync = false; }
|
||||
var _a = this.data, options = _a.options, value = _a.value;
|
||||
if (value !== undefined) {
|
||||
var selectedOptions = this.getSelectedOptionsByValue(options, value);
|
||||
var options = this.data.options;
|
||||
var innerValue = this.innerValue;
|
||||
if (!options.length) {
|
||||
return;
|
||||
}
|
||||
if (innerValue !== undefined) {
|
||||
var selectedOptions = this.getSelectedOptionsByValue(options, innerValue);
|
||||
if (selectedOptions) {
|
||||
var optionsCursor_1 = options;
|
||||
var tabs_1 = selectedOptions.map(function (option) {
|
||||
@@ -146,16 +153,6 @@ var defaultFieldNames = {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 异步更新
|
||||
if (isAsync) {
|
||||
var tabs = this.data.tabs;
|
||||
tabs[tabs.length - 1].options =
|
||||
options[options.length - 1][this.data.childrenKey];
|
||||
this.setData({
|
||||
tabs: tabs,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
tabs: [
|
||||
{
|
||||
@@ -171,6 +168,9 @@ var defaultFieldNames = {
|
||||
onClickTab: function (e) {
|
||||
var _a = e.detail, tabIndex = _a.index, title = _a.title;
|
||||
this.$emit('click-tab', { title: title, tabIndex: tabIndex });
|
||||
this.setData({
|
||||
activeTab: tabIndex,
|
||||
});
|
||||
},
|
||||
// 选中
|
||||
onSelect: function (e) {
|
||||
@@ -206,11 +206,13 @@ var defaultFieldNames = {
|
||||
tabs: tabs,
|
||||
});
|
||||
var selectedOptions = tabs.map(function (tab) { return tab.selected; }).filter(Boolean);
|
||||
var value = option[valueKey];
|
||||
var params = {
|
||||
value: option[valueKey],
|
||||
value: value,
|
||||
tabIndex: tabIndex,
|
||||
selectedOptions: selectedOptions,
|
||||
};
|
||||
this.innerValue = value;
|
||||
this.$emit('change', params);
|
||||
if (!option[childrenKey]) {
|
||||
this.$emit('finish', params);
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
wx:for="{{ tab.options }}"
|
||||
wx:for-item="option"
|
||||
wx:key="index"
|
||||
class="{{ option.className }} {{ utils.optionClass(tab, textKey, option) }}"
|
||||
style="{{ utils.optionStyle({ tab, textKey, option, activeColor }) }}"
|
||||
class="{{ option.className }} {{ utils.optionClass(tab, valueKey, option) }}"
|
||||
style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}"
|
||||
data-option="{{ option }}"
|
||||
data-tab-index="{{ tabIndex }}"
|
||||
bind:tap="onSelect"
|
||||
>
|
||||
<text>{{ option[textKey] }}</text>
|
||||
<van-icon wx:if="{{ utils.isSelected(tab, textKey, option) }}" name="success" size="18" />
|
||||
<van-icon wx:if="{{ utils.isSelected(tab, valueKey, option) }}" name="success" size="18" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 暂不支持 -->
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
var utils = require('../wxs/utils.wxs');
|
||||
var style = require('../wxs/style.wxs');
|
||||
|
||||
function isSelected(tab, textKey, option) {
|
||||
return tab.selected && tab.selected[textKey] === option[textKey]
|
||||
function isSelected(tab, valueKey, option) {
|
||||
return tab.selected && tab.selected[valueKey] === option[valueKey]
|
||||
}
|
||||
|
||||
function optionClass(tab, textKey, option) {
|
||||
return utils.bem('cascader__option', { selected: isSelected({ tab, textKey, option }), disabled: option.disabled })
|
||||
function optionClass(tab, valueKey, option) {
|
||||
return utils.bem('cascader__option', { selected: isSelected(tab, valueKey, option), disabled: option.disabled })
|
||||
}
|
||||
|
||||
function optionStyle(data) {
|
||||
var color = data.option.color || (isSelected(data.tab, data.textKey, data.option) ? data.activeColor : undefined);
|
||||
var color = data.option.color || (isSelected(data.tab, data.valueKey, data.option) ? data.activeColor : undefined);
|
||||
return style({
|
||||
color
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
declare type CanvasContext = WechatMiniprogram.CanvasContext;
|
||||
type CanvasContext = WechatMiniprogram.CanvasContext;
|
||||
export declare function adaptor(ctx: CanvasContext & Record<string, unknown>): CanvasContext;
|
||||
export {};
|
||||
|
||||
@@ -98,6 +98,8 @@ var STEP = 1;
|
||||
var _a = this.data, color = _a.color, size = _a.size;
|
||||
if ((0, validator_1.isObj)(color)) {
|
||||
return this.getContext().then(function (context) {
|
||||
if (!context)
|
||||
return;
|
||||
var LinearColor = context.createLinearGradient(size, 0, 0, 0);
|
||||
Object.keys(color)
|
||||
.sort(function (a, b) { return parseFloat(a) - parseFloat(b); })
|
||||
@@ -142,6 +144,8 @@ var STEP = 1;
|
||||
var _this = this;
|
||||
var size = this.data.size;
|
||||
this.getContext().then(function (context) {
|
||||
if (!context)
|
||||
return;
|
||||
context.clearRect(0, 0, size, size);
|
||||
_this.renderLayerCircle(context);
|
||||
var formatValue = format(currentValue);
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
declare type TrivialInstance = WechatMiniprogram.Component.TrivialInstance;
|
||||
type TrivialInstance = WechatMiniprogram.Component.TrivialInstance;
|
||||
export declare function useParent(name: string, onEffect?: (this: TrivialInstance) => void): {
|
||||
relations: {
|
||||
[x: string]: WechatMiniprogram.Component.RelationOption;
|
||||
|
||||
@@ -14,4 +14,7 @@ export declare function getRect(context: WechatMiniprogram.Component.TrivialInst
|
||||
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>;
|
||||
export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void;
|
||||
export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>;
|
||||
export declare function addNumber(num1: any, num2: any): number;
|
||||
export declare const clamp: (num: any, min: any, max: any) => number;
|
||||
export declare function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject;
|
||||
export declare const isPC: boolean;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getCurrentPage = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.nextTick = exports.range = exports.getSystemInfoSync = exports.isDef = void 0;
|
||||
exports.isPC = exports.getCurrentPage = exports.clamp = exports.addNumber = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.nextTick = exports.range = exports.getSystemInfoSync = exports.isDef = void 0;
|
||||
var validator_1 = require("./validator");
|
||||
var version_1 = require("./version");
|
||||
var validator_2 = require("./validator");
|
||||
@@ -90,8 +90,18 @@ function toPromise(promiseLike) {
|
||||
return Promise.resolve(promiseLike);
|
||||
}
|
||||
exports.toPromise = toPromise;
|
||||
// 浮点数精度处理
|
||||
function addNumber(num1, num2) {
|
||||
var cardinal = Math.pow(10, 10);
|
||||
return Math.round((num1 + num2) * cardinal) / cardinal;
|
||||
}
|
||||
exports.addNumber = addNumber;
|
||||
// 限制value在[min, max]之间
|
||||
var clamp = function (num, min, max) { return Math.min(Math.max(num, min), max); };
|
||||
exports.clamp = clamp;
|
||||
function getCurrentPage() {
|
||||
var pages = getCurrentPages();
|
||||
return pages[pages.length - 1];
|
||||
}
|
||||
exports.getCurrentPage = getCurrentPage;
|
||||
exports.isPC = ['mac', 'windows'].includes((0, version_1.getSystemInfoSync)().platform);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export declare type TimeData = {
|
||||
export type TimeData = {
|
||||
days: number;
|
||||
hours: number;
|
||||
minutes: number;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ interface VantComponentInstance {
|
||||
index: number;
|
||||
$emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
|
||||
}
|
||||
export declare type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = {
|
||||
export type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = {
|
||||
data?: Data;
|
||||
field?: boolean;
|
||||
classes?: string[];
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
export declare type Action = 'confirm' | 'cancel' | 'overlay';
|
||||
declare type DialogContext = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
|
||||
export type Action = 'confirm' | 'cancel' | 'overlay';
|
||||
type DialogContext = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
|
||||
interface DialogOptions {
|
||||
lang?: string;
|
||||
show?: boolean;
|
||||
|
||||
@@ -6,6 +6,7 @@ var color_1 = require("../common/color");
|
||||
var utils_1 = require("../common/utils");
|
||||
(0, component_1.VantComponent)({
|
||||
mixins: [button_1.button],
|
||||
classes: ['cancle-button-class', 'confirm-button-class'],
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
size="large"
|
||||
loading="{{ loading.cancel }}"
|
||||
class="van-dialog__button van-hairline--right"
|
||||
custom-class="van-dialog__cancel"
|
||||
custom-class="van-dialog__cancel cancle-button-class"
|
||||
custom-style="color: {{ cancelButtonColor }}"
|
||||
bind:click="onCancel"
|
||||
>
|
||||
@@ -44,7 +44,7 @@
|
||||
size="large"
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm"
|
||||
custom-class="van-dialog__confirm confirm-button-class"
|
||||
custom-style="color: {{ confirmButtonColor }}"
|
||||
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
@@ -75,7 +75,7 @@
|
||||
size="large"
|
||||
loading="{{ loading.cancel }}"
|
||||
class="van-dialog__button van-hairline--right"
|
||||
custom-class="van-dialog__cancel"
|
||||
custom-class="van-dialog__cancel cancle-button-class"
|
||||
custom-style="color: {{ cancelButtonColor }}"
|
||||
bind:click="onCancel"
|
||||
>
|
||||
@@ -86,7 +86,7 @@
|
||||
size="large"
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm"
|
||||
custom-class="van-dialog__confirm confirm-button-class"
|
||||
custom-style="color: {{ confirmButtonColor }}"
|
||||
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
|
||||
@@ -32,12 +32,17 @@ var component_1 = require("../common/component");
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
transition: true,
|
||||
showPopup: false,
|
||||
showWrapper: false,
|
||||
displayTitle: '',
|
||||
safeAreaTabBar: false,
|
||||
},
|
||||
methods: {
|
||||
rerender: function () {
|
||||
@@ -49,13 +54,14 @@ var component_1 = require("../common/component");
|
||||
},
|
||||
updateDataFromParent: function () {
|
||||
if (this.parent) {
|
||||
var _a = this.parent.data, overlay = _a.overlay, duration = _a.duration, activeColor = _a.activeColor, closeOnClickOverlay = _a.closeOnClickOverlay, direction = _a.direction;
|
||||
var _a = this.parent.data, overlay = _a.overlay, duration = _a.duration, activeColor = _a.activeColor, closeOnClickOverlay = _a.closeOnClickOverlay, direction = _a.direction, safeAreaTabBar = _a.safeAreaTabBar;
|
||||
this.setData({
|
||||
overlay: overlay,
|
||||
duration: duration,
|
||||
activeColor: activeColor,
|
||||
closeOnClickOverlay: closeOnClickOverlay,
|
||||
direction: direction,
|
||||
safeAreaTabBar: safeAreaTabBar,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
overlay="{{ overlay }}"
|
||||
position="{{ direction === 'down' ? 'top' : 'bottom' }}"
|
||||
duration="{{ transition ? duration : 0 }}"
|
||||
safe-area-tab-bar="{{ safeAreaTabBar }}"
|
||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||
rootPortal="{{ rootPortal }}"
|
||||
bind:enter="onOpen"
|
||||
bind:leave="onClose"
|
||||
bind:close="toggle"
|
||||
|
||||
@@ -34,6 +34,10 @@ var ARRAY = [];
|
||||
value: 'down',
|
||||
observer: 'updateChildrenData',
|
||||
},
|
||||
safeAreaTabBar: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
|
||||
@@ -49,11 +49,19 @@ var props_1 = require("./props");
|
||||
this.setData({ innerValue: this.value });
|
||||
},
|
||||
methods: {
|
||||
formatValue: function (value) {
|
||||
var maxlength = this.data.maxlength;
|
||||
if (maxlength !== -1 && value.length > maxlength) {
|
||||
return value.slice(0, maxlength);
|
||||
}
|
||||
return value;
|
||||
},
|
||||
onInput: function (event) {
|
||||
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
|
||||
this.value = value;
|
||||
var formatValue = this.formatValue(value);
|
||||
this.value = formatValue;
|
||||
this.setShowClear();
|
||||
this.emitChange(event.detail);
|
||||
return this.emitChange(__assign(__assign({}, event.detail), { value: formatValue }));
|
||||
},
|
||||
onFocus: function (event) {
|
||||
this.focused = true;
|
||||
@@ -102,14 +110,16 @@ var props_1 = require("./props");
|
||||
this.$emit('keyboardheightchange', event.detail);
|
||||
},
|
||||
emitChange: function (detail) {
|
||||
var _this = this;
|
||||
var extraEventParams = this.data.extraEventParams;
|
||||
this.setData({ value: detail.value });
|
||||
(0, utils_1.nextTick)(function () {
|
||||
var data = extraEventParams ? detail : detail.value;
|
||||
_this.$emit('input', data);
|
||||
_this.$emit('change', data);
|
||||
});
|
||||
var result;
|
||||
var data = extraEventParams
|
||||
? __assign(__assign({}, detail), { callback: function (data) {
|
||||
result = data;
|
||||
} }) : detail.value;
|
||||
this.$emit('input', data);
|
||||
this.$emit('change', data);
|
||||
return result;
|
||||
},
|
||||
setShowClear: function () {
|
||||
var _a = this.data, clearable = _a.clearable, readonly = _a.readonly, clearTrigger = _a.clearTrigger;
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
title-style="margin-right: 12px;"
|
||||
custom-style="{{ customStyle }}"
|
||||
arrow-direction="{{ arrowDirection }}"
|
||||
custom-class="van-field"
|
||||
custom-class="custom-class van-field"
|
||||
>
|
||||
<slot name="left-icon" slot="icon" />
|
||||
<view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
|
||||
<label for="{{ name }}" wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
|
||||
{{ label }}
|
||||
</view>
|
||||
</label>
|
||||
<slot wx:else name="label" slot="title" />
|
||||
<view class="{{ utils.bem('field__body', [type]) }}">
|
||||
<view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
|
||||
@@ -47,10 +47,10 @@
|
||||
<slot name="button" />
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
|
||||
<label for="{{ name }}" wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
|
||||
<view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
|
||||
</view>
|
||||
<view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
|
||||
</label>
|
||||
<label for="{{ name }}" wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
|
||||
{{ errorMessage }}
|
||||
</view>
|
||||
</label>
|
||||
</van-cell>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<input
|
||||
id="{{ name }}"
|
||||
class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class"
|
||||
type="{{ type }}"
|
||||
focus="{{ focus }}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<textarea
|
||||
id="{{ name }}"
|
||||
class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class"
|
||||
fixed="{{ fixed }}"
|
||||
focus="{{ focus }}"
|
||||
|
||||
@@ -10,6 +10,10 @@ var link_1 = require("../mixins/link");
|
||||
props: {
|
||||
text: String,
|
||||
color: String,
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal',
|
||||
},
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
plain: Boolean,
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
id="{{ id }}"
|
||||
lang="{{ lang }}"
|
||||
type="{{ type }}"
|
||||
size="{{ size }}"
|
||||
color="{{ color }}"
|
||||
plain="{{ plain }}"
|
||||
loading="{{ loading }}"
|
||||
disabled="{{ disabled }}"
|
||||
open-type="{{ openType }}"
|
||||
class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}"
|
||||
custom-class="van-goods-action-button__inner"
|
||||
custom-class="van-goods-action-button__inner custom-class"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
|
||||
@@ -4,13 +4,15 @@ var component_1 = require("../common/component");
|
||||
var button_1 = require("../mixins/button");
|
||||
var link_1 = require("../mixins/link");
|
||||
(0, component_1.VantComponent)({
|
||||
classes: ['icon-class', 'text-class'],
|
||||
classes: ['icon-class', 'text-class', 'info-class'],
|
||||
mixins: [link_1.link, button_1.button],
|
||||
props: {
|
||||
text: String,
|
||||
dot: Boolean,
|
||||
info: String,
|
||||
icon: String,
|
||||
size: String,
|
||||
color: String,
|
||||
classPrefix: {
|
||||
type: String,
|
||||
value: 'van-icon',
|
||||
|
||||
@@ -27,9 +27,12 @@
|
||||
name="{{ icon }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
size="{{ size }}"
|
||||
color="{{ color }}"
|
||||
class-prefix="{{ classPrefix }}"
|
||||
class="van-goods-action-icon__icon"
|
||||
custom-class="icon-class"
|
||||
info-class="info-class"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
<text class="text-class">{{ text }}</text>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
(0, component_1.VantComponent)({
|
||||
classes: ['info-class'],
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
wx:if="{{ info !== null || dot }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
custom-class="van-icon__info"
|
||||
custom-class="van-icon__info info-class"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ computed.isImage(name) }}"
|
||||
|
||||
@@ -9,6 +9,10 @@ function isImage(name) {
|
||||
function rootClass(data) {
|
||||
var classes = ['custom-class'];
|
||||
|
||||
if (data.classPrefix !== 'van-icon') {
|
||||
classes.push('van-icon--custom')
|
||||
}
|
||||
|
||||
if (data.classPrefix != null) {
|
||||
classes.push(data.classPrefix);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -31,6 +31,9 @@ exports.button = Behavior({
|
||||
onGetPhoneNumber: function (event) {
|
||||
this.triggerEvent('getphonenumber', event.detail);
|
||||
},
|
||||
onGetRealTimePhoneNumber: function (event) {
|
||||
this.triggerEvent('getrealtimephonenumber', event.detail);
|
||||
},
|
||||
onError: function (event) {
|
||||
this.triggerEvent('error', event.detail);
|
||||
},
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
declare type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
|
||||
declare type Scroller = (this: WechatMiniprogram.Component.TrivialInstance, event?: IPageScrollOption) => void;
|
||||
type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
|
||||
type Scroller = (this: WechatMiniprogram.Component.TrivialInstance, event?: IPageScrollOption) => void;
|
||||
export declare function pageScrollMixin(scroller: Scroller): string;
|
||||
export {};
|
||||
|
||||
@@ -17,6 +17,10 @@ var component_1 = require("../common/component");
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClick: function () {
|
||||
|
||||
@@ -1,21 +1,7 @@
|
||||
<van-transition
|
||||
wx:if="{{ lockScroll }}"
|
||||
show="{{ show }}"
|
||||
custom-class="van-overlay custom-class"
|
||||
custom-style="z-index: {{ zIndex }}; {{ customStyle }}"
|
||||
duration="{{ duration }}"
|
||||
bind:tap="onClick"
|
||||
catch:touchmove="noop"
|
||||
>
|
||||
<slot></slot>
|
||||
</van-transition>
|
||||
<van-transition
|
||||
wx:else
|
||||
show="{{ show }}"
|
||||
custom-class="van-overlay custom-class"
|
||||
custom-style="z-index: {{ zIndex }}; {{ customStyle }}"
|
||||
duration="{{ duration }}"
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<slot></slot>
|
||||
</van-transition>
|
||||
<import src="./overlay.wxml" />
|
||||
|
||||
<root-portal wx:if="{{ rootPortal }}">
|
||||
<include src="./overlay.wxml" />
|
||||
</root-portal>
|
||||
|
||||
<include wx:else src="./overlay.wxml" />
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<van-transition
|
||||
show="{{ show }}"
|
||||
custom-class="van-overlay custom-class"
|
||||
custom-style="z-index: {{ zIndex }}; {{ customStyle }}"
|
||||
duration="{{ duration }}"
|
||||
bind:tap="onClick"
|
||||
catch:touchmove="{{ lockScroll ? 'noop' : ''}}"
|
||||
>
|
||||
<slot></slot>
|
||||
</van-transition>
|
||||
@@ -55,10 +55,18 @@ var transition_1 = require("../mixins/transition");
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
safeAreaTabBar: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
lockScroll: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
this.observeClass();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<import src="./popup.wxml" />
|
||||
|
||||
<van-overlay
|
||||
wx:if="{{ overlay }}"
|
||||
show="{{ show }}"
|
||||
@@ -9,18 +11,11 @@
|
||||
duration="{{ duration }}"
|
||||
bind:click="onClickOverlay"
|
||||
lock-scroll="{{ lockScroll }}"
|
||||
root-portal="{{ rootPortal }}"
|
||||
/>
|
||||
<view
|
||||
wx:if="{{ inited }}"
|
||||
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop }]) }}"
|
||||
style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle }) }}"
|
||||
bind:transitionend="onTransitionEnd"
|
||||
>
|
||||
<slot />
|
||||
<van-icon
|
||||
wx:if="{{ closeable }}"
|
||||
name="{{ closeIcon }}"
|
||||
class="close-icon-class van-popup__close-icon van-popup__close-icon--{{ closeIconPosition }}"
|
||||
bind:tap="onClickCloseIcon"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<root-portal wx:if="{{ rootPortal }}">
|
||||
<include src="./popup.wxml" />
|
||||
</root-portal>
|
||||
|
||||
<include wx:else src="./popup.wxml" />
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,#fff);box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.van-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:var(--popup-round-border-radius,16px)}.van-popup--top{left:0;top:0;width:100%}.van-popup--top.van-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.van-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.van-popup--bottom{bottom:0;left:0;width:100%}.van-popup--bottom.van-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.van-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.van-popup--bottom.van-popup--safe{padding-bottom:env(safe-area-inset-bottom)}.van-popup--safeTop{padding-top:env(safe-area-inset-top)}.van-popup__close-icon{color:var(--popup-close-icon-color,#969799);font-size:var(--popup-close-icon-size,18px);position:absolute;z-index:var(--popup-close-icon-z-index,1)}.van-popup__close-icon--top-left{left:var(--popup-close-icon-margin,16px);top:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{right:var(--popup-close-icon-margin,16px);top:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:var(--popup-close-icon-margin,16px);left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{bottom:var(--popup-close-icon-margin,16px);right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,transform}.van-scale-enter,.van-scale-leave-to{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:transform}.van-bottom-enter,.van-bottom-leave-to{transform:translate3d(0,100%,0)}.van-top-enter,.van-top-leave-to{transform:translate3d(0,-100%,0)}.van-left-enter,.van-left-leave-to{transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{transform:translate3d(100%,-50%,0)}
|
||||
@import '../common/index.wxss';.van-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,#fff);box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.van-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:var(--popup-round-border-radius,16px)}.van-popup--top{left:0;top:0;width:100%}.van-popup--top.van-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.van-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.van-popup--bottom{bottom:0;left:0;width:100%}.van-popup--bottom.van-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.van-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.van-popup--bottom.van-popup--safe{padding-bottom:env(safe-area-inset-bottom)}.van-popup--bottom.van-popup--safeTabBar,.van-popup--top.van-popup--safeTabBar{bottom:var(--tabbar-height,50px)}.van-popup--safeTop{padding-top:env(safe-area-inset-top)}.van-popup__close-icon{color:var(--popup-close-icon-color,#969799);font-size:var(--popup-close-icon-size,18px);position:absolute;z-index:var(--popup-close-icon-z-index,1)}.van-popup__close-icon--top-left{left:var(--popup-close-icon-margin,16px);top:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{right:var(--popup-close-icon-margin,16px);top:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:var(--popup-close-icon-margin,16px);left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{bottom:var(--popup-close-icon-margin,16px);right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,transform}.van-scale-enter,.van-scale-leave-to{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:transform}.van-bottom-enter,.van-bottom-leave-to{transform:translate3d(0,100%,0)}.van-top-enter,.van-top-leave-to{transform:translate3d(0,-100%,0)}.van-left-enter,.van-left-leave-to{transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{transform:translate3d(100%,-50%,0)}
|
||||
@@ -0,0 +1,14 @@
|
||||
<view
|
||||
wx:if="{{ inited }}"
|
||||
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"
|
||||
style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle }) }}"
|
||||
bind:transitionend="onTransitionEnd"
|
||||
>
|
||||
<slot />
|
||||
<van-icon
|
||||
wx:if="{{ closeable }}"
|
||||
name="{{ closeIcon }}"
|
||||
class="close-icon-class van-popup__close-icon van-popup__close-icon--{{ closeIconPosition }}"
|
||||
bind:tap="onClickCloseIcon"
|
||||
/>
|
||||
</view>
|
||||
@@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-rate{display:inline-flex;-webkit-user-select:none;user-select:none}.van-rate__item{padding:0 var(--rate-horizontal-padding,2px);position:relative}.van-rate__item:not(:last-child){padding-right:var(--rate-icon-gutter,4px)}.van-rate__icon{color:var(--rate-icon-void-color,#c8c9cc);display:block;font-size:var(--rate-icon-size,20px);height:1em}.van-rate__icon--half{left:var(--rate-horizontal-padding,2px);overflow:hidden;position:absolute;top:0;width:.5em}.van-rate__icon--full,.van-rate__icon--half{color:var(--rate-icon-full-color,#ee0a24)}.van-rate__icon--disabled{color:var(--rate-icon-disabled-color,#c8c9cc)}
|
||||
@import '../common/index.wxss';.van-rate{display:inline-flex;-webkit-user-select:none;user-select:none}.van-rate__item{padding:0 var(--rate-horizontal-padding,2px);position:relative}.van-rate__item:not(:last-child){padding-right:var(--rate-icon-gutter,4px)}.van-rate__icon{color:var(--rate-icon-void-color,#c8c9cc);display:block;font-size:var(--rate-icon-size,20px);height:100%}.van-rate__icon--half{left:var(--rate-horizontal-padding,2px);overflow:hidden;position:absolute;top:0;width:.5em}.van-rate__icon--full,.van-rate__icon--half{color:var(--rate-icon-full-color,#ee0a24)}.van-rate__icon--disabled{color:var(--rate-icon-disabled-color,#c8c9cc)}
|
||||
@@ -195,8 +195,12 @@ var DRAG_STATUS = {
|
||||
return '0%';
|
||||
},
|
||||
format: function (value) {
|
||||
var _a = this.data, max = _a.max, min = _a.min, step = _a.step;
|
||||
return Math.round(Math.max(min, Math.min(value, max)) / step) * step;
|
||||
var min = +this.data.min;
|
||||
var max = +this.data.max;
|
||||
var step = +this.data.step;
|
||||
value = (0, utils_1.clamp)(value, min, max);
|
||||
var diff = Math.round((value - min) / step) * step;
|
||||
return (0, utils_1.addNumber)(min, diff);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -102,9 +102,9 @@ function equal(value1, value2) {
|
||||
isDisabled: function (type) {
|
||||
var _a = this.data, disabled = _a.disabled, disablePlus = _a.disablePlus, disableMinus = _a.disableMinus, currentValue = _a.currentValue, max = _a.max, min = _a.min;
|
||||
if (type === 'plus') {
|
||||
return disabled || disablePlus || currentValue >= max;
|
||||
return disabled || disablePlus || +currentValue >= +max;
|
||||
}
|
||||
return disabled || disableMinus || currentValue <= min;
|
||||
return disabled || disableMinus || +currentValue <= +min;
|
||||
},
|
||||
onFocus: function (event) {
|
||||
this.$emit('focus', event.detail);
|
||||
@@ -112,6 +112,7 @@ function equal(value1, value2) {
|
||||
onBlur: function (event) {
|
||||
var value = this.format(event.detail.value);
|
||||
this.setData({ currentValue: value });
|
||||
this.emitChange(value);
|
||||
this.$emit('blur', __assign(__assign({}, event.detail), { value: value }));
|
||||
},
|
||||
// filter illegal characters
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<slot name="minus" />
|
||||
</view>
|
||||
<input
|
||||
always-embed="{{ false }}"
|
||||
type="{{ integer ? 'number' : 'digit' }}"
|
||||
class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
||||
style="{{ computed.inputStyle({ buttonSize, inputWidth }) }}"
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{position:absolute;right:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
|
||||
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{position:absolute;right:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
|
||||
@@ -61,10 +61,8 @@ var ROOT_ELEMENT = '.van-sticky';
|
||||
}
|
||||
this.scrollTop = scrollTop || this.scrollTop;
|
||||
if (typeof container === 'function') {
|
||||
Promise.all([
|
||||
(0, utils_1.getRect)(this, ROOT_ELEMENT),
|
||||
this.getContainerRect(),
|
||||
]).then(function (_a) {
|
||||
Promise.all([(0, utils_1.getRect)(this, ROOT_ELEMENT), this.getContainerRect()])
|
||||
.then(function (_a) {
|
||||
var root = _a[0], container = _a[1];
|
||||
if (offsetTop + root.height > container.height + container.top) {
|
||||
_this.setDataAfterDiff({
|
||||
@@ -82,7 +80,8 @@ var ROOT_ELEMENT = '.van-sticky';
|
||||
else {
|
||||
_this.setDataAfterDiff({ fixed: false, transform: 0 });
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(function () { });
|
||||
return;
|
||||
}
|
||||
(0, utils_1.getRect)(this, ROOT_ELEMENT).then(function (root) {
|
||||
@@ -118,6 +117,9 @@ var ROOT_ELEMENT = '.van-sticky';
|
||||
},
|
||||
getContainerRect: function () {
|
||||
var nodesRef = this.data.container();
|
||||
if (!nodesRef) {
|
||||
return Promise.reject(new Error('not found container'));
|
||||
}
|
||||
return new Promise(function (resolve) { return nodesRef.boundingClientRect(resolve).exec(); });
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,6 +8,14 @@ var relation_1 = require("../common/relation");
|
||||
name: null,
|
||||
icon: String,
|
||||
dot: Boolean,
|
||||
url: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
linkType: {
|
||||
type: String,
|
||||
value: 'redirectTo',
|
||||
},
|
||||
iconPrefix: {
|
||||
type: String,
|
||||
value: 'van-icon',
|
||||
@@ -29,6 +37,10 @@ var relation_1 = require("../common/relation");
|
||||
parent.$emit('change', active);
|
||||
}
|
||||
}
|
||||
var _a = this.data, url = _a.url, linkType = _a.linkType;
|
||||
if (url && wx[linkType]) {
|
||||
return wx[linkType]({ url: url });
|
||||
}
|
||||
this.$emit('click');
|
||||
},
|
||||
updateFromParent: function () {
|
||||
|
||||
@@ -179,6 +179,9 @@ var relation_1 = require("../common/relation");
|
||||
});
|
||||
});
|
||||
if (currentIndex === data.currentIndex) {
|
||||
if (!data.inited) {
|
||||
this.resize();
|
||||
}
|
||||
return;
|
||||
}
|
||||
var shouldEmitChange = data.currentIndex !== null;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="custom-class {{ utils.bem('tabs', [type]) }}">
|
||||
<view class="custom-class {{ utils.bem('tabs') }}">
|
||||
<van-sticky
|
||||
disabled="{{ !sticky }}"
|
||||
z-index="{{ zIndex }}"
|
||||
@@ -9,7 +9,7 @@
|
||||
container="{{ container }}"
|
||||
bind:scroll="onTouchScroll"
|
||||
>
|
||||
<view class="{{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }} wrap-class">
|
||||
<view class="{{ utils.bem('tabs--') + type }} {{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }} wrap-class">
|
||||
<slot name="nav-left" />
|
||||
|
||||
<scroll-view
|
||||
|
||||
@@ -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;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}
|
||||
@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);overflow:auto}.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{height:var(--tabs-line-height,44px)}.van-tabs--card{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{position:relative!important;top:-1px!important;transform:translateX(0)!important}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
declare type ToastMessage = string | number;
|
||||
declare type ToastContext = WechatMiniprogram.Component.TrivialInstance | WechatMiniprogram.Page.TrivialInstance;
|
||||
type ToastMessage = string | number;
|
||||
type ToastContext = WechatMiniprogram.Component.TrivialInstance | WechatMiniprogram.Page.TrivialInstance;
|
||||
interface ToastOptions {
|
||||
show?: boolean;
|
||||
type?: string;
|
||||
|
||||
@@ -47,13 +47,16 @@ var validator_1 = require("../common/validator");
|
||||
}, previewFullImage: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
}, videoFit: {
|
||||
type: String,
|
||||
value: 'contain',
|
||||
}, imageFit: {
|
||||
type: String,
|
||||
value: 'scaleToFill',
|
||||
}, uploadIcon: {
|
||||
type: String,
|
||||
value: 'photograph',
|
||||
} }, shared_1.chooseImageProps), shared_1.chooseVideoProps), shared_1.chooseMediaProps), shared_1.chooseMessageFileProps),
|
||||
} }, shared_1.imageProps), shared_1.videoProps), shared_1.mediaProps), shared_1.messageFileProps),
|
||||
data: {
|
||||
lists: [],
|
||||
isInCount: true,
|
||||
@@ -129,11 +132,12 @@ var validator_1 = require("../common/validator");
|
||||
if (!this.data.previewFullImage)
|
||||
return;
|
||||
var index = event.currentTarget.dataset.index;
|
||||
var lists = this.data.lists;
|
||||
var _a = this.data, lists = _a.lists, showmenu = _a.showmenu;
|
||||
var item = lists[index];
|
||||
wx.previewImage({
|
||||
urls: lists.filter(function (item) { return (0, utils_1.isImageFile)(item); }).map(function (item) { return item.url; }),
|
||||
current: item.url,
|
||||
showmenu: showmenu,
|
||||
fail: function () {
|
||||
wx.showToast({ title: '预览图片失败', icon: 'none' });
|
||||
},
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
title="{{ item.name || ('视频' + index) }}"
|
||||
poster="{{ item.thumb }}"
|
||||
autoplay="{{ item.autoplay }}"
|
||||
object-fit="{{videoFit}}"
|
||||
class="van-uploader__preview-image"
|
||||
style="{{ computed.sizeStyle({ previewSize }) }}"
|
||||
data-index="{{ index }}"
|
||||
|
||||
+8
-4
@@ -1,4 +1,4 @@
|
||||
export declare const chooseImageProps: {
|
||||
export declare const imageProps: {
|
||||
sizeType: {
|
||||
type: ArrayConstructor;
|
||||
value: string[];
|
||||
@@ -7,8 +7,12 @@ export declare const chooseImageProps: {
|
||||
type: ArrayConstructor;
|
||||
value: string[];
|
||||
};
|
||||
showmenu: {
|
||||
type: BooleanConstructor;
|
||||
value: boolean;
|
||||
};
|
||||
};
|
||||
export declare const chooseVideoProps: {
|
||||
export declare const videoProps: {
|
||||
capture: {
|
||||
type: ArrayConstructor;
|
||||
value: string[];
|
||||
@@ -26,7 +30,7 @@ export declare const chooseVideoProps: {
|
||||
value: string;
|
||||
};
|
||||
};
|
||||
export declare const chooseMediaProps: {
|
||||
export declare const mediaProps: {
|
||||
capture: {
|
||||
type: ArrayConstructor;
|
||||
value: string[];
|
||||
@@ -44,6 +48,6 @@ export declare const chooseMediaProps: {
|
||||
value: string;
|
||||
};
|
||||
};
|
||||
export declare const chooseMessageFileProps: {
|
||||
export declare const messageFileProps: {
|
||||
extension: null;
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.chooseMessageFileProps = exports.chooseMediaProps = exports.chooseVideoProps = exports.chooseImageProps = void 0;
|
||||
// props for choose image
|
||||
exports.chooseImageProps = {
|
||||
exports.messageFileProps = exports.mediaProps = exports.videoProps = exports.imageProps = void 0;
|
||||
// props for image
|
||||
exports.imageProps = {
|
||||
sizeType: {
|
||||
type: Array,
|
||||
value: ['original', 'compressed'],
|
||||
@@ -11,9 +11,13 @@ exports.chooseImageProps = {
|
||||
type: Array,
|
||||
value: ['album', 'camera'],
|
||||
},
|
||||
showmenu: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
};
|
||||
// props for choose video
|
||||
exports.chooseVideoProps = {
|
||||
// props for video
|
||||
exports.videoProps = {
|
||||
capture: {
|
||||
type: Array,
|
||||
value: ['album', 'camera'],
|
||||
@@ -31,8 +35,8 @@ exports.chooseVideoProps = {
|
||||
value: 'back',
|
||||
},
|
||||
};
|
||||
// props for choose media
|
||||
exports.chooseMediaProps = {
|
||||
// props for media
|
||||
exports.mediaProps = {
|
||||
capture: {
|
||||
type: Array,
|
||||
value: ['album', 'camera'],
|
||||
@@ -50,7 +54,7 @@ exports.chooseMediaProps = {
|
||||
value: 'back',
|
||||
},
|
||||
};
|
||||
// props for choose file
|
||||
exports.chooseMessageFileProps = {
|
||||
// props for file
|
||||
exports.messageFileProps = {
|
||||
extension: null,
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ function isVideoFile(item) {
|
||||
}
|
||||
exports.isVideoFile = isVideoFile;
|
||||
function formatImage(res) {
|
||||
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { type: 'image', url: item.path, thumb: item.path })); });
|
||||
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { type: 'image', url: item.tempFilePath || item.path, thumb: item.tempFilePath || item.path })); });
|
||||
}
|
||||
function formatVideo(res) {
|
||||
return [
|
||||
@@ -59,13 +59,27 @@ function chooseFile(_a) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
switch (accept) {
|
||||
case 'image':
|
||||
wx.chooseImage({
|
||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||
sourceType: capture,
|
||||
sizeType: sizeType,
|
||||
success: function (res) { return resolve(formatImage(res)); },
|
||||
fail: reject,
|
||||
});
|
||||
if (utils_1.isPC) {
|
||||
wx.chooseImage({
|
||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||
sourceType: capture,
|
||||
sizeType: sizeType,
|
||||
success: function (res) { return resolve(formatImage(res)); },
|
||||
fail: reject,
|
||||
});
|
||||
}
|
||||
else {
|
||||
wx.chooseMedia({
|
||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: capture,
|
||||
maxDuration: maxDuration,
|
||||
sizeType: sizeType,
|
||||
camera: camera,
|
||||
success: function (res) { return resolve(formatImage(res)); },
|
||||
fail: reject,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'media':
|
||||
wx.chooseMedia({
|
||||
|
||||
Reference in New Issue
Block a user