build: compile 1.10.20

This commit is contained in:
landluck 2023-07-03 17:44:54 +08:00
parent 3d1d27641b
commit d72580fe7d
16 changed files with 50 additions and 12 deletions

View File

@ -170,7 +170,8 @@ VantComponent({
defaultDate = []; defaultDate = [];
} }
const [startDay, endDay] = defaultDate || []; const [startDay, endDay] = defaultDate || [];
const start = this.limitDateRange(startDay || now, minDate, getPrevDay(new Date(maxDate)).getTime()); const startDate = getTime(startDay || now);
const start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : getPrevDay(new Date(maxDate)).getTime());
const date = getTime(endDay || now); const date = getTime(endDay || now);
const end = this.limitDateRange(date, allowSameDay ? date : getNextDay(new Date(minDate)).getTime()); const end = this.limitDateRange(date, allowSameDay ? date : getNextDay(new Date(minDate)).getTime());
return [start, end]; return [start, end];

View File

@ -14,4 +14,6 @@ export declare function getRect(context: WechatMiniprogram.Component.TrivialInst
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>; 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 groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void;
export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>; 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 function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject;

View File

@ -70,6 +70,13 @@ export function toPromise(promiseLike) {
} }
return Promise.resolve(promiseLike); return Promise.resolve(promiseLike);
} }
// 浮点数精度处理
export function addNumber(num1, num2) {
const cardinal = Math.pow(10, 10);
return Math.round((num1 + num2) * cardinal) / cardinal;
}
// 限制value在[min, max]之间
export const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
export function getCurrentPage() { export function getCurrentPage() {
const pages = getCurrentPages(); const pages = getCurrentPages();
return pages[pages.length - 1]; return pages[pages.length - 1];

View File

@ -2,13 +2,14 @@ import { VantComponent } from '../common/component';
import { button } from '../mixins/button'; import { button } from '../mixins/button';
import { link } from '../mixins/link'; import { link } from '../mixins/link';
VantComponent({ VantComponent({
classes: ['icon-class', 'text-class'], classes: ['icon-class', 'text-class', 'info-class'],
mixins: [link, button], mixins: [link, button],
props: { props: {
text: String, text: String,
dot: Boolean, dot: Boolean,
info: String, info: String,
icon: String, icon: String,
size: String,
color: String, color: String,
classPrefix: { classPrefix: {
type: String, type: String,

View File

@ -27,10 +27,12 @@
name="{{ icon }}" name="{{ icon }}"
dot="{{ dot }}" dot="{{ dot }}"
info="{{ info }}" info="{{ info }}"
size="{{ size }}"
color="{{ color }}" color="{{ color }}"
class-prefix="{{ classPrefix }}" class-prefix="{{ classPrefix }}"
class="van-goods-action-icon__icon" class="van-goods-action-icon__icon"
custom-class="icon-class" custom-class="icon-class"
info-class="info-class"
/> />
<slot wx:else name="icon" /> <slot wx:else name="icon" />
<text class="text-class">{{ text }}</text> <text class="text-class">{{ text }}</text>

1
dist/icon/index.js vendored
View File

@ -1,5 +1,6 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
VantComponent({ VantComponent({
classes: ['info-class'],
props: { props: {
dot: Boolean, dot: Boolean,
info: null, info: null,

View File

@ -9,7 +9,7 @@
wx:if="{{ info !== null || dot }}" wx:if="{{ info !== null || dot }}"
dot="{{ dot }}" dot="{{ dot }}"
info="{{ info }}" info="{{ info }}"
custom-class="van-icon__info" custom-class="van-icon__info info-class"
/> />
<image <image
wx:if="{{ computed.isImage(name) }}" wx:if="{{ computed.isImage(name) }}"

10
dist/slider/index.js vendored
View File

@ -1,7 +1,7 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { touch } from '../mixins/touch'; import { touch } from '../mixins/touch';
import { canIUseModel } from '../common/version'; import { canIUseModel } from '../common/version';
import { getRect, addUnit, nextTick } from '../common/utils'; import { getRect, addUnit, nextTick, addNumber, clamp } from '../common/utils';
const DRAG_STATUS = { const DRAG_STATUS = {
START: 'start', START: 'start',
MOVING: 'moving', MOVING: 'moving',
@ -196,8 +196,12 @@ VantComponent({
return '0%'; return '0%';
}, },
format(value) { format(value) {
const { max, min, step } = this.data; const min = +this.data.min;
return Math.round(Math.max(min, Math.min(value, max)) / step) * step; const max = +this.data.max;
const step = +this.data.step;
value = clamp(value, min, max);
const diff = Math.round((value - min) / step) * step;
return addNumber(min, diff);
}, },
}, },
}); });

View File

@ -191,7 +191,8 @@ var getTime = function (date) {
defaultDate = []; defaultDate = [];
} }
var _b = defaultDate || [], startDay = _b[0], endDay = _b[1]; 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 date = getTime(endDay || now);
var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime()); var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime());
return [start, end]; return [start, end];

View File

@ -14,4 +14,6 @@ export declare function getRect(context: WechatMiniprogram.Component.TrivialInst
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>; 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 groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void;
export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>; 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 function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject;

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); 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.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 validator_1 = require("./validator");
var version_1 = require("./version"); var version_1 = require("./version");
var validator_2 = require("./validator"); var validator_2 = require("./validator");
@ -90,6 +90,15 @@ function toPromise(promiseLike) {
return Promise.resolve(promiseLike); return Promise.resolve(promiseLike);
} }
exports.toPromise = toPromise; 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() { function getCurrentPage() {
var pages = getCurrentPages(); var pages = getCurrentPages();
return pages[pages.length - 1]; return pages[pages.length - 1];

View File

@ -4,13 +4,14 @@ var component_1 = require("../common/component");
var button_1 = require("../mixins/button"); var button_1 = require("../mixins/button");
var link_1 = require("../mixins/link"); var link_1 = require("../mixins/link");
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
classes: ['icon-class', 'text-class'], classes: ['icon-class', 'text-class', 'info-class'],
mixins: [link_1.link, button_1.button], mixins: [link_1.link, button_1.button],
props: { props: {
text: String, text: String,
dot: Boolean, dot: Boolean,
info: String, info: String,
icon: String, icon: String,
size: String,
color: String, color: String,
classPrefix: { classPrefix: {
type: String, type: String,

View File

@ -27,10 +27,12 @@
name="{{ icon }}" name="{{ icon }}"
dot="{{ dot }}" dot="{{ dot }}"
info="{{ info }}" info="{{ info }}"
size="{{ size }}"
color="{{ color }}" color="{{ color }}"
class-prefix="{{ classPrefix }}" class-prefix="{{ classPrefix }}"
class="van-goods-action-icon__icon" class="van-goods-action-icon__icon"
custom-class="icon-class" custom-class="icon-class"
info-class="info-class"
/> />
<slot wx:else name="icon" /> <slot wx:else name="icon" />
<text class="text-class">{{ text }}</text> <text class="text-class">{{ text }}</text>

View File

@ -2,6 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
classes: ['info-class'],
props: { props: {
dot: Boolean, dot: Boolean,
info: null, info: null,

View File

@ -9,7 +9,7 @@
wx:if="{{ info !== null || dot }}" wx:if="{{ info !== null || dot }}"
dot="{{ dot }}" dot="{{ dot }}"
info="{{ info }}" info="{{ info }}"
custom-class="van-icon__info" custom-class="van-icon__info info-class"
/> />
<image <image
wx:if="{{ computed.isImage(name) }}" wx:if="{{ computed.isImage(name) }}"

View File

@ -195,8 +195,12 @@ var DRAG_STATUS = {
return '0%'; return '0%';
}, },
format: function (value) { format: function (value) {
var _a = this.data, max = _a.max, min = _a.min, step = _a.step; var min = +this.data.min;
return Math.round(Math.max(min, Math.min(value, max)) / step) * step; 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);
}, },
}, },
}); });