mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-21 05:50:47 +08:00
build: compile 1.7.2
This commit is contained in:
parent
98721b7b7e
commit
1bbc24b742
62
dist/calendar/index.js
vendored
62
dist/calendar/index.js
vendored
@ -1,7 +1,9 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import {
|
||||
ROW_HEIGHT,
|
||||
getPrevDay,
|
||||
getNextDay,
|
||||
getToday,
|
||||
compareDay,
|
||||
copyDates,
|
||||
calcDateNum,
|
||||
@ -12,6 +14,15 @@ import {
|
||||
} from './utils';
|
||||
import Toast from '../toast/toast';
|
||||
import { requestAnimationFrame } from '../common/utils';
|
||||
const initialMinDate = getToday().getTime();
|
||||
const initialMaxDate = (() => {
|
||||
const now = getToday();
|
||||
return new Date(
|
||||
now.getFullYear(),
|
||||
now.getMonth() + 6,
|
||||
now.getDate()
|
||||
).getTime();
|
||||
})();
|
||||
VantComponent({
|
||||
props: {
|
||||
title: {
|
||||
@ -54,15 +65,11 @@ VantComponent({
|
||||
},
|
||||
minDate: {
|
||||
type: null,
|
||||
value: Date.now(),
|
||||
value: initialMinDate,
|
||||
},
|
||||
maxDate: {
|
||||
type: null,
|
||||
value: new Date(
|
||||
new Date().getFullYear(),
|
||||
new Date().getMonth() + 6,
|
||||
new Date().getDate()
|
||||
).getTime(),
|
||||
value: initialMaxDate,
|
||||
},
|
||||
position: {
|
||||
type: String,
|
||||
@ -151,19 +158,46 @@ VantComponent({
|
||||
}
|
||||
});
|
||||
},
|
||||
getInitialDate() {
|
||||
const { type, defaultDate, minDate } = this.data;
|
||||
limitDateRange(date, minDate = null, maxDate = null) {
|
||||
minDate = minDate || this.data.minDate;
|
||||
maxDate = maxDate || this.data.maxDate;
|
||||
if (compareDay(date, minDate) === -1) {
|
||||
return minDate;
|
||||
}
|
||||
if (compareDay(date, maxDate) === 1) {
|
||||
return maxDate;
|
||||
}
|
||||
return date;
|
||||
},
|
||||
getInitialDate(defaultDate = null) {
|
||||
const { type, minDate, maxDate } = this.data;
|
||||
const now = getToday().getTime();
|
||||
if (type === 'range') {
|
||||
if (!Array.isArray(defaultDate)) {
|
||||
defaultDate = [];
|
||||
}
|
||||
const [startDay, endDay] = defaultDate || [];
|
||||
return [
|
||||
startDay || minDate,
|
||||
endDay || getNextDay(new Date(minDate)).getTime(),
|
||||
];
|
||||
const start = this.limitDateRange(
|
||||
startDay || now,
|
||||
minDate,
|
||||
getPrevDay(maxDate).getTime()
|
||||
);
|
||||
const end = this.limitDateRange(
|
||||
endDay || now,
|
||||
getNextDay(minDate).getTime()
|
||||
);
|
||||
return [start, end];
|
||||
}
|
||||
if (type === 'multiple') {
|
||||
return defaultDate || [minDate];
|
||||
if (Array.isArray(defaultDate)) {
|
||||
return defaultDate.map((date) => this.limitDateRange(date));
|
||||
}
|
||||
return defaultDate || minDate;
|
||||
return [this.limitDateRange(now)];
|
||||
}
|
||||
if (!defaultDate || Array.isArray(defaultDate)) {
|
||||
defaultDate = now;
|
||||
}
|
||||
return this.limitDateRange(defaultDate);
|
||||
},
|
||||
scrollIntoView() {
|
||||
requestAnimationFrame(() => {
|
||||
|
1
dist/calendar/utils.d.ts
vendored
1
dist/calendar/utils.d.ts
vendored
@ -11,6 +11,7 @@ export declare function compareDay(
|
||||
export declare function getDayByOffset(date: Date, offset: number): Date;
|
||||
export declare function getPrevDay(date: Date): Date;
|
||||
export declare function getNextDay(date: Date): Date;
|
||||
export declare function getToday(): Date;
|
||||
export declare function calcDateNum(date: [Date, Date]): number;
|
||||
export declare function copyDates(dates: Date | Date[]): Date | Date[];
|
||||
export declare function getMonthEndDay(year: number, month: number): number;
|
||||
|
5
dist/calendar/utils.js
vendored
5
dist/calendar/utils.js
vendored
@ -47,6 +47,11 @@ export function getPrevDay(date) {
|
||||
export function getNextDay(date) {
|
||||
return getDayByOffset(date, 1);
|
||||
}
|
||||
export function getToday() {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
return today;
|
||||
}
|
||||
export function calcDateNum(date) {
|
||||
const day1 = new Date(date[0]).getTime();
|
||||
const day2 = new Date(date[1]).getTime();
|
||||
|
1
dist/cell-group/index.js
vendored
1
dist/cell-group/index.js
vendored
@ -6,5 +6,6 @@ VantComponent({
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
inset: Boolean,
|
||||
},
|
||||
});
|
||||
|
6
dist/cell-group/index.wxml
vendored
6
dist/cell-group/index.wxml
vendored
@ -1,9 +1,11 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
wx:if="{{ title }}"
|
||||
class="van-cell-group__title"
|
||||
class="{{ utils.bem('cell-group__title', { inset }) }}"
|
||||
>
|
||||
{{ title }}
|
||||
</view>
|
||||
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<view class="custom-class {{ utils.bem('cell-group', { inset }) }} {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<slot />
|
||||
</view>
|
||||
|
2
dist/cell-group/index.wxss
vendored
2
dist/cell-group/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}
|
||||
@import '../common/index.wxss';.van-cell-group--inset{margin:0 16px;margin:var(--cell-group-inset-padding,0 16px);border-radius:8px;border-radius:var(--cell-group-inset-border-radius,8px);overflow:hidden}.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}.van-cell-group__title--inset{padding:16px 16px 8px 32px;padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)}
|
@ -16,6 +16,15 @@ var component_1 = require('../common/component');
|
||||
var utils_1 = require('./utils');
|
||||
var toast_1 = __importDefault(require('../toast/toast'));
|
||||
var utils_2 = require('../common/utils');
|
||||
var initialMinDate = utils_1.getToday().getTime();
|
||||
var initialMaxDate = (function () {
|
||||
var now = utils_1.getToday();
|
||||
return new Date(
|
||||
now.getFullYear(),
|
||||
now.getMonth() + 6,
|
||||
now.getDate()
|
||||
).getTime();
|
||||
})();
|
||||
component_1.VantComponent({
|
||||
props: {
|
||||
title: {
|
||||
@ -58,15 +67,11 @@ component_1.VantComponent({
|
||||
},
|
||||
minDate: {
|
||||
type: null,
|
||||
value: Date.now(),
|
||||
value: initialMinDate,
|
||||
},
|
||||
maxDate: {
|
||||
type: null,
|
||||
value: new Date(
|
||||
new Date().getFullYear(),
|
||||
new Date().getMonth() + 6,
|
||||
new Date().getDate()
|
||||
).getTime(),
|
||||
value: initialMaxDate,
|
||||
},
|
||||
position: {
|
||||
type: String,
|
||||
@ -158,24 +163,63 @@ component_1.VantComponent({
|
||||
}
|
||||
});
|
||||
},
|
||||
getInitialDate: function () {
|
||||
limitDateRange: function (date, minDate, maxDate) {
|
||||
if (minDate === void 0) {
|
||||
minDate = null;
|
||||
}
|
||||
if (maxDate === void 0) {
|
||||
maxDate = null;
|
||||
}
|
||||
minDate = minDate || this.data.minDate;
|
||||
maxDate = maxDate || this.data.maxDate;
|
||||
if (utils_1.compareDay(date, minDate) === -1) {
|
||||
return minDate;
|
||||
}
|
||||
if (utils_1.compareDay(date, maxDate) === 1) {
|
||||
return maxDate;
|
||||
}
|
||||
return date;
|
||||
},
|
||||
getInitialDate: function (defaultDate) {
|
||||
var _this = this;
|
||||
if (defaultDate === void 0) {
|
||||
defaultDate = null;
|
||||
}
|
||||
var _a = this.data,
|
||||
type = _a.type,
|
||||
defaultDate = _a.defaultDate,
|
||||
minDate = _a.minDate;
|
||||
minDate = _a.minDate,
|
||||
maxDate = _a.maxDate;
|
||||
var now = utils_1.getToday().getTime();
|
||||
if (type === 'range') {
|
||||
if (!Array.isArray(defaultDate)) {
|
||||
defaultDate = [];
|
||||
}
|
||||
var _b = defaultDate || [],
|
||||
startDay = _b[0],
|
||||
endDay = _b[1];
|
||||
return [
|
||||
startDay || minDate,
|
||||
endDay || utils_1.getNextDay(new Date(minDate)).getTime(),
|
||||
];
|
||||
var start = this.limitDateRange(
|
||||
startDay || now,
|
||||
minDate,
|
||||
utils_1.getPrevDay(maxDate).getTime()
|
||||
);
|
||||
var end = this.limitDateRange(
|
||||
endDay || now,
|
||||
utils_1.getNextDay(minDate).getTime()
|
||||
);
|
||||
return [start, end];
|
||||
}
|
||||
if (type === 'multiple') {
|
||||
return defaultDate || [minDate];
|
||||
if (Array.isArray(defaultDate)) {
|
||||
return defaultDate.map(function (date) {
|
||||
return _this.limitDateRange(date);
|
||||
});
|
||||
}
|
||||
return defaultDate || minDate;
|
||||
return [this.limitDateRange(now)];
|
||||
}
|
||||
if (!defaultDate || Array.isArray(defaultDate)) {
|
||||
defaultDate = now;
|
||||
}
|
||||
return this.limitDateRange(defaultDate);
|
||||
},
|
||||
scrollIntoView: function () {
|
||||
var _this = this;
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
|
||||
exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
|
||||
exports.ROW_HEIGHT = 64;
|
||||
function formatMonthTitle(date) {
|
||||
if (!(date instanceof Date)) {
|
||||
@ -56,6 +56,12 @@ function getNextDay(date) {
|
||||
return getDayByOffset(date, 1);
|
||||
}
|
||||
exports.getNextDay = getNextDay;
|
||||
function getToday() {
|
||||
var today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
return today;
|
||||
}
|
||||
exports.getToday = getToday;
|
||||
function calcDateNum(date) {
|
||||
var day1 = new Date(date[0]).getTime();
|
||||
var day2 = new Date(date[1]).getTime();
|
||||
|
@ -8,5 +8,6 @@ component_1.VantComponent({
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
inset: Boolean,
|
||||
},
|
||||
});
|
||||
|
@ -1,9 +1,11 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
wx:if="{{ title }}"
|
||||
class="van-cell-group__title"
|
||||
class="{{ utils.bem('cell-group__title', { inset }) }}"
|
||||
>
|
||||
{{ title }}
|
||||
</view>
|
||||
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<view class="custom-class {{ utils.bem('cell-group', { inset }) }} {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<slot />
|
||||
</view>
|
||||
|
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}
|
||||
@import '../common/index.wxss';.van-cell-group--inset{margin:0 16px;margin:var(--cell-group-inset-padding,0 16px);border-radius:8px;border-radius:var(--cell-group-inset-border-radius,8px);overflow:hidden}.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}.van-cell-group__title--inset{padding:16px 16px 8px 32px;padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)}
|
@ -77,8 +77,5 @@ component_1.VantComponent({
|
||||
onClear: function (event) {
|
||||
this.$emit('clear', event.detail);
|
||||
},
|
||||
onClickInput: function (event) {
|
||||
this.$emit('click-input', event.detail);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -32,7 +32,6 @@
|
||||
bind:change="onChange"
|
||||
bind:confirm="onSearch"
|
||||
bind:clear="onClear"
|
||||
bind:click-input="onClickInput"
|
||||
>
|
||||
<slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" />
|
||||
<slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user