mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
build: compile 1.10.12
This commit is contained in:
parent
231aa05e8d
commit
7cec5690ce
5
dist/calendar/index.js
vendored
5
dist/calendar/index.js
vendored
@ -159,7 +159,7 @@ VantComponent({
|
||||
return date;
|
||||
},
|
||||
getInitialDate(defaultDate = null) {
|
||||
const { type, minDate, maxDate } = this.data;
|
||||
const { type, minDate, maxDate, allowSameDay } = this.data;
|
||||
const now = getToday().getTime();
|
||||
if (type === 'range') {
|
||||
if (!Array.isArray(defaultDate)) {
|
||||
@ -167,7 +167,8 @@ VantComponent({
|
||||
}
|
||||
const [startDay, endDay] = defaultDate || [];
|
||||
const start = this.limitDateRange(startDay || now, minDate, getPrevDay(new Date(maxDate)).getTime());
|
||||
const end = this.limitDateRange(endDay || now, getNextDay(new Date(minDate)).getTime());
|
||||
const date = getTime(endDay || now);
|
||||
const end = this.limitDateRange(date, allowSameDay ? date : getNextDay(new Date(minDate)).getTime());
|
||||
return [start, end];
|
||||
}
|
||||
if (type === 'multiple') {
|
||||
|
1
dist/common/component.js
vendored
1
dist/common/component.js
vendored
@ -11,6 +11,7 @@ function VantComponent(vantOptions) {
|
||||
mapKeys(vantOptions, options, {
|
||||
data: 'data',
|
||||
props: 'properties',
|
||||
watch: 'observers',
|
||||
mixins: 'behaviors',
|
||||
methods: 'methods',
|
||||
beforeCreate: 'created',
|
||||
|
1
dist/definitions/index.d.ts
vendored
1
dist/definitions/index.d.ts
vendored
@ -15,6 +15,7 @@ export declare type VantComponentOptions<Data extends WechatMiniprogram.Componen
|
||||
relations: Record<string, WechatMiniprogram.Component.RelationOption>;
|
||||
mixin: string;
|
||||
};
|
||||
watch?: Record<string, (...args: any[]) => any>;
|
||||
methods?: Methods;
|
||||
beforeCreate?: () => void;
|
||||
created?: () => void;
|
||||
|
45
dist/dropdown-item/index.js
vendored
45
dist/dropdown-item/index.js
vendored
@ -26,6 +26,10 @@ VantComponent({
|
||||
observer: 'rerender',
|
||||
},
|
||||
popupStyle: String,
|
||||
useBeforeToggle: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
transition: true,
|
||||
@ -77,7 +81,6 @@ VantComponent({
|
||||
}
|
||||
},
|
||||
toggle(show, options = {}) {
|
||||
var _a;
|
||||
const { showPopup } = this.data;
|
||||
if (typeof show !== 'boolean') {
|
||||
show = !showPopup;
|
||||
@ -85,19 +88,37 @@ VantComponent({
|
||||
if (show === showPopup) {
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
transition: !options.immediate,
|
||||
showPopup: show,
|
||||
});
|
||||
if (show) {
|
||||
(_a = this.parent) === null || _a === void 0 ? void 0 : _a.getChildWrapperStyle().then((wrapperStyle) => {
|
||||
this.setData({ wrapperStyle, showWrapper: true });
|
||||
this.rerender();
|
||||
this.onBeforeToggle(show).then((status) => {
|
||||
var _a;
|
||||
if (!status) {
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
transition: !options.immediate,
|
||||
showPopup: show,
|
||||
});
|
||||
if (show) {
|
||||
(_a = this.parent) === null || _a === void 0 ? void 0 : _a.getChildWrapperStyle().then((wrapperStyle) => {
|
||||
this.setData({ wrapperStyle, showWrapper: true });
|
||||
this.rerender();
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.rerender();
|
||||
}
|
||||
});
|
||||
},
|
||||
onBeforeToggle(status) {
|
||||
const { useBeforeToggle } = this.data;
|
||||
if (!useBeforeToggle) {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
else {
|
||||
this.rerender();
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
this.$emit('before-toggle', {
|
||||
status,
|
||||
callback: (value) => resolve(value),
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
19
dist/field/index.js
vendored
19
dist/field/index.js
vendored
@ -22,6 +22,9 @@ VantComponent({
|
||||
}, clearIcon: {
|
||||
type: String,
|
||||
value: 'clear',
|
||||
}, extraEventParams: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
} }),
|
||||
data: {
|
||||
focused: false,
|
||||
@ -37,7 +40,7 @@ VantComponent({
|
||||
const { value = '' } = event.detail || {};
|
||||
this.value = value;
|
||||
this.setShowClear();
|
||||
this.emitChange();
|
||||
this.emitChange(event.detail);
|
||||
},
|
||||
onFocus(event) {
|
||||
this.focused = true;
|
||||
@ -60,7 +63,7 @@ VantComponent({
|
||||
this.value = '';
|
||||
this.setShowClear();
|
||||
nextTick(() => {
|
||||
this.emitChange();
|
||||
this.emitChange({ value: '' });
|
||||
this.$emit('clear', '');
|
||||
});
|
||||
},
|
||||
@ -76,7 +79,7 @@ VantComponent({
|
||||
if (value === '') {
|
||||
this.setData({ innerValue: '' });
|
||||
}
|
||||
this.emitChange();
|
||||
this.emitChange({ value });
|
||||
},
|
||||
onLineChange(event) {
|
||||
this.$emit('linechange', event.detail);
|
||||
@ -84,11 +87,13 @@ VantComponent({
|
||||
onKeyboardHeightChange(event) {
|
||||
this.$emit('keyboardheightchange', event.detail);
|
||||
},
|
||||
emitChange() {
|
||||
this.setData({ value: this.value });
|
||||
emitChange(detail) {
|
||||
const { extraEventParams } = this.data;
|
||||
this.setData({ value: detail.value });
|
||||
nextTick(() => {
|
||||
this.$emit('input', this.value);
|
||||
this.$emit('change', this.value);
|
||||
const data = extraEventParams ? detail : detail.value;
|
||||
this.$emit('input', data);
|
||||
this.$emit('change', data);
|
||||
});
|
||||
},
|
||||
setShowClear() {
|
||||
|
8
dist/field/types.d.ts
vendored
Normal file
8
dist/field/types.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
export interface InputDetails {
|
||||
/** 输入框内容 */
|
||||
value: string;
|
||||
/** 光标位置 */
|
||||
cursor?: number;
|
||||
/** keyCode 为键值 (目前工具还不支持返回keyCode参数) `2.1.0` 起支持 */
|
||||
keyCode?: number;
|
||||
}
|
1
dist/field/types.js
vendored
Normal file
1
dist/field/types.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
12
dist/stepper/index.js
vendored
12
dist/stepper/index.js
vendored
@ -16,7 +16,6 @@ VantComponent({
|
||||
props: {
|
||||
value: {
|
||||
type: null,
|
||||
observer: 'observeValue',
|
||||
},
|
||||
integer: {
|
||||
type: Boolean,
|
||||
@ -66,6 +65,11 @@ VantComponent({
|
||||
data: {
|
||||
currentValue: '',
|
||||
},
|
||||
watch: {
|
||||
value() {
|
||||
this.observeValue();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.setData({
|
||||
currentValue: this.format(this.data.value),
|
||||
@ -73,10 +77,8 @@ VantComponent({
|
||||
},
|
||||
methods: {
|
||||
observeValue() {
|
||||
const { value, currentValue } = this.data;
|
||||
if (!equal(value, currentValue)) {
|
||||
this.setData({ currentValue: this.format(value) });
|
||||
}
|
||||
const { value } = this.data;
|
||||
this.setData({ currentValue: this.format(value) });
|
||||
},
|
||||
check() {
|
||||
const val = this.format(this.data.currentValue);
|
||||
|
@ -180,7 +180,7 @@ var getTime = function (date) {
|
||||
getInitialDate: function (defaultDate) {
|
||||
var _this = this;
|
||||
if (defaultDate === void 0) { defaultDate = null; }
|
||||
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate;
|
||||
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, allowSameDay = _a.allowSameDay;
|
||||
var now = (0, utils_1.getToday)().getTime();
|
||||
if (type === 'range') {
|
||||
if (!Array.isArray(defaultDate)) {
|
||||
@ -188,7 +188,8 @@ var getTime = function (date) {
|
||||
}
|
||||
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 end = this.limitDateRange(endDay || now, (0, utils_1.getNextDay)(new Date(minDate)).getTime());
|
||||
var date = getTime(endDay || now);
|
||||
var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime());
|
||||
return [start, end];
|
||||
}
|
||||
if (type === 'multiple') {
|
||||
|
@ -14,6 +14,7 @@ function VantComponent(vantOptions) {
|
||||
mapKeys(vantOptions, options, {
|
||||
data: 'data',
|
||||
props: 'properties',
|
||||
watch: 'observers',
|
||||
mixins: 'behaviors',
|
||||
methods: 'methods',
|
||||
beforeCreate: 'created',
|
||||
|
1
lib/definitions/index.d.ts
vendored
1
lib/definitions/index.d.ts
vendored
@ -15,6 +15,7 @@ export declare type VantComponentOptions<Data extends WechatMiniprogram.Componen
|
||||
relations: Record<string, WechatMiniprogram.Component.RelationOption>;
|
||||
mixin: string;
|
||||
};
|
||||
watch?: Record<string, (...args: any[]) => any>;
|
||||
methods?: Methods;
|
||||
beforeCreate?: () => void;
|
||||
created?: () => void;
|
||||
|
@ -28,6 +28,10 @@ var component_1 = require("../common/component");
|
||||
observer: 'rerender',
|
||||
},
|
||||
popupStyle: String,
|
||||
useBeforeToggle: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
transition: true,
|
||||
@ -81,7 +85,6 @@ var component_1 = require("../common/component");
|
||||
},
|
||||
toggle: function (show, options) {
|
||||
var _this = this;
|
||||
var _a;
|
||||
if (options === void 0) { options = {}; }
|
||||
var showPopup = this.data.showPopup;
|
||||
if (typeof show !== 'boolean') {
|
||||
@ -90,19 +93,38 @@ var component_1 = require("../common/component");
|
||||
if (show === showPopup) {
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
transition: !options.immediate,
|
||||
showPopup: show,
|
||||
});
|
||||
if (show) {
|
||||
(_a = this.parent) === null || _a === void 0 ? void 0 : _a.getChildWrapperStyle().then(function (wrapperStyle) {
|
||||
_this.setData({ wrapperStyle: wrapperStyle, showWrapper: true });
|
||||
_this.rerender();
|
||||
this.onBeforeToggle(show).then(function (status) {
|
||||
var _a;
|
||||
if (!status) {
|
||||
return;
|
||||
}
|
||||
_this.setData({
|
||||
transition: !options.immediate,
|
||||
showPopup: show,
|
||||
});
|
||||
if (show) {
|
||||
(_a = _this.parent) === null || _a === void 0 ? void 0 : _a.getChildWrapperStyle().then(function (wrapperStyle) {
|
||||
_this.setData({ wrapperStyle: wrapperStyle, showWrapper: true });
|
||||
_this.rerender();
|
||||
});
|
||||
}
|
||||
else {
|
||||
_this.rerender();
|
||||
}
|
||||
});
|
||||
},
|
||||
onBeforeToggle: function (status) {
|
||||
var _this = this;
|
||||
var useBeforeToggle = this.data.useBeforeToggle;
|
||||
if (!useBeforeToggle) {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
else {
|
||||
this.rerender();
|
||||
}
|
||||
return new Promise(function (resolve) {
|
||||
_this.$emit('before-toggle', {
|
||||
status: status,
|
||||
callback: function (value) { return resolve(value); },
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -35,6 +35,9 @@ var props_1 = require("./props");
|
||||
}, clearIcon: {
|
||||
type: String,
|
||||
value: 'clear',
|
||||
}, extraEventParams: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
} }),
|
||||
data: {
|
||||
focused: false,
|
||||
@ -50,7 +53,7 @@ var props_1 = require("./props");
|
||||
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
|
||||
this.value = value;
|
||||
this.setShowClear();
|
||||
this.emitChange();
|
||||
this.emitChange(event.detail);
|
||||
},
|
||||
onFocus: function (event) {
|
||||
this.focused = true;
|
||||
@ -74,7 +77,7 @@ var props_1 = require("./props");
|
||||
this.value = '';
|
||||
this.setShowClear();
|
||||
(0, utils_1.nextTick)(function () {
|
||||
_this.emitChange();
|
||||
_this.emitChange({ value: '' });
|
||||
_this.$emit('clear', '');
|
||||
});
|
||||
},
|
||||
@ -90,7 +93,7 @@ var props_1 = require("./props");
|
||||
if (value === '') {
|
||||
this.setData({ innerValue: '' });
|
||||
}
|
||||
this.emitChange();
|
||||
this.emitChange({ value: value });
|
||||
},
|
||||
onLineChange: function (event) {
|
||||
this.$emit('linechange', event.detail);
|
||||
@ -98,12 +101,14 @@ var props_1 = require("./props");
|
||||
onKeyboardHeightChange: function (event) {
|
||||
this.$emit('keyboardheightchange', event.detail);
|
||||
},
|
||||
emitChange: function () {
|
||||
emitChange: function (detail) {
|
||||
var _this = this;
|
||||
this.setData({ value: this.value });
|
||||
var extraEventParams = this.data.extraEventParams;
|
||||
this.setData({ value: detail.value });
|
||||
(0, utils_1.nextTick)(function () {
|
||||
_this.$emit('input', _this.value);
|
||||
_this.$emit('change', _this.value);
|
||||
var data = extraEventParams ? detail : detail.value;
|
||||
_this.$emit('input', data);
|
||||
_this.$emit('change', data);
|
||||
});
|
||||
},
|
||||
setShowClear: function () {
|
||||
|
8
lib/field/types.d.ts
vendored
Normal file
8
lib/field/types.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
export interface InputDetails {
|
||||
/** 输入框内容 */
|
||||
value: string;
|
||||
/** 光标位置 */
|
||||
cursor?: number;
|
||||
/** keyCode 为键值 (目前工具还不支持返回keyCode参数) `2.1.0` 起支持 */
|
||||
keyCode?: number;
|
||||
}
|
2
lib/field/types.js
Normal file
2
lib/field/types.js
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
@ -29,7 +29,6 @@ function equal(value1, value2) {
|
||||
props: {
|
||||
value: {
|
||||
type: null,
|
||||
observer: 'observeValue',
|
||||
},
|
||||
integer: {
|
||||
type: Boolean,
|
||||
@ -79,6 +78,11 @@ function equal(value1, value2) {
|
||||
data: {
|
||||
currentValue: '',
|
||||
},
|
||||
watch: {
|
||||
value: function () {
|
||||
this.observeValue();
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
this.setData({
|
||||
currentValue: this.format(this.data.value),
|
||||
@ -86,10 +90,8 @@ function equal(value1, value2) {
|
||||
},
|
||||
methods: {
|
||||
observeValue: function () {
|
||||
var _a = this.data, value = _a.value, currentValue = _a.currentValue;
|
||||
if (!equal(value, currentValue)) {
|
||||
this.setData({ currentValue: this.format(value) });
|
||||
}
|
||||
var value = this.data.value;
|
||||
this.setData({ currentValue: this.format(value) });
|
||||
},
|
||||
check: function () {
|
||||
var val = this.format(this.data.currentValue);
|
||||
|
Loading…
x
Reference in New Issue
Block a user