Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

vant

Package Overview
Dependencies
Maintainers
7
Versions
566
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vant - npm Package Compare versions

Comparing version 4.8.11 to 4.9.0

26

es/calendar/Calendar.d.ts
import { type PropType, type ExtractPropTypes } from 'vue';
import { PopupPosition } from '../popup';
import type { CalendarType, CalendarDayItem } from './types';
import type { CalendarType, CalendarSwitchMode, CalendarDayItem } from './types';
export declare const calendarProps: {

@@ -10,2 +10,6 @@ show: BooleanConstructor;

};
switchMode: {
type: PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
title: StringConstructor;

@@ -78,3 +82,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -84,3 +87,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -100,2 +102,6 @@ firstDayOfWeek: {

};
switchMode: {
type: PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
title: StringConstructor;

@@ -168,3 +174,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -174,3 +179,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -182,3 +186,3 @@ firstDayOfWeek: {

};
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<ExtractPropTypes<{
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<ExtractPropTypes<{
show: BooleanConstructor;

@@ -189,2 +193,6 @@ type: {

};
switchMode: {
type: PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
title: StringConstructor;

@@ -257,3 +265,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -263,3 +270,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -277,2 +283,3 @@ firstDayOfWeek: {

onClickSubtitle?: ((...args: any[]) => any) | undefined;
onPanelChange?: ((...args: any[]) => any) | undefined;
onUnselect?: ((...args: any[]) => any) | undefined;

@@ -292,2 +299,3 @@ onMonthShow?: ((...args: any[]) => any) | undefined;

safeAreaInsetTop: boolean;
switchMode: CalendarSwitchMode;
poppable: boolean;

@@ -301,6 +309,4 @@ maxRange: string | number;

showRangePrompt: boolean;
minDate: Date;
maxDate: Date;
firstDayOfWeek: string | number;
}, {}>;
export default _default;

@@ -0,3 +1,6 @@

import type { CalendarSwitchMode } from './types';
declare const _default: import("vue").DefineComponent<{
date: DateConstructor;
minDate: DateConstructor;
maxDate: DateConstructor;
title: StringConstructor;

@@ -8,4 +11,10 @@ subtitle: StringConstructor;

firstDayOfWeek: NumberConstructor;
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickSubtitle"[], "clickSubtitle", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
switchMode: {
type: import("vue").PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clickSubtitle" | "panelChange")[], "clickSubtitle" | "panelChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
date: DateConstructor;
minDate: DateConstructor;
maxDate: DateConstructor;
title: StringConstructor;

@@ -16,5 +25,11 @@ subtitle: StringConstructor;

firstDayOfWeek: NumberConstructor;
switchMode: {
type: import("vue").PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
}>> & {
onClickSubtitle?: ((...args: any[]) => any) | undefined;
onPanelChange?: ((...args: any[]) => any) | undefined;
}, {
switchMode: CalendarSwitchMode;
showTitle: boolean;

@@ -21,0 +36,0 @@ showSubtitle: boolean;

@@ -10,10 +10,4 @@ import { type PropType, type ExtractPropTypes } from 'vue';

color: StringConstructor;
minDate: {
type: DateConstructor;
required: true;
};
maxDate: {
type: DateConstructor;
required: true;
};
minDate: DateConstructor;
maxDate: DateConstructor;
showMark: BooleanConstructor;

@@ -37,10 +31,4 @@ rowHeight: (NumberConstructor | StringConstructor)[];

color: StringConstructor;
minDate: {
type: DateConstructor;
required: true;
};
maxDate: {
type: DateConstructor;
required: true;
};
minDate: DateConstructor;
maxDate: DateConstructor;
showMark: BooleanConstructor;

@@ -62,10 +50,4 @@ rowHeight: (NumberConstructor | StringConstructor)[];

color: StringConstructor;
minDate: {
type: DateConstructor;
required: true;
};
maxDate: {
type: DateConstructor;
required: true;
};
minDate: DateConstructor;
maxDate: DateConstructor;
showMark: BooleanConstructor;

@@ -72,0 +54,0 @@ rowHeight: (NumberConstructor | StringConstructor)[];

@@ -7,2 +7,6 @@ export declare const Calendar: import("../utils").WithInstall<import("vue").DefineComponent<{

};
switchMode: {
type: import("vue").PropType<import("./types").CalendarSwitchMode>;
default: import("./types").CalendarSwitchMode;
};
title: StringConstructor;

@@ -75,3 +79,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -81,3 +84,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -89,3 +91,3 @@ firstDayOfWeek: {

};
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
show: BooleanConstructor;

@@ -96,2 +98,6 @@ type: {

};
switchMode: {
type: import("vue").PropType<import("./types").CalendarSwitchMode>;
default: import("./types").CalendarSwitchMode;
};
title: StringConstructor;

@@ -164,3 +170,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -170,3 +175,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -184,2 +188,3 @@ firstDayOfWeek: {

onClickSubtitle?: ((...args: any[]) => any) | undefined;
onPanelChange?: ((...args: any[]) => any) | undefined;
onUnselect?: ((...args: any[]) => any) | undefined;

@@ -199,2 +204,3 @@ onMonthShow?: ((...args: any[]) => any) | undefined;

safeAreaInsetTop: boolean;
switchMode: import("./types").CalendarSwitchMode;
poppable: boolean;

@@ -208,4 +214,2 @@ maxRange: string | number;

showRangePrompt: boolean;
minDate: Date;
maxDate: Date;
firstDayOfWeek: string | number;

@@ -212,0 +216,0 @@ }, {}>>;

@@ -5,2 +5,3 @@ import type { ComponentPublicInstance, ComputedRef, Ref } from 'vue';

import type { CalendarMonthProps } from './CalendarMonth';
export type CalendarSwitchMode = 'none' | 'month' | 'year-month';
export type CalendarType = 'single' | 'range' | 'multiple';

@@ -37,2 +38,5 @@ export type CalendarDayType = '' | 'start' | 'start-end' | 'middle' | 'end' | 'selected' | 'multiple-middle' | 'multiple-selected' | 'disabled' | 'placeholder';

calendarHeaderSubtitleFontSize?: string;
calendarHeaderActionWidth?: string;
calendarHeaderActionColor?: string;
calendarHeaderActionDisabledColor?: string;
calendarWeekdaysHeight?: string;

@@ -39,0 +43,0 @@ calendarWeekdaysFontSize?: string;

@@ -9,5 +9,11 @@ declare const name: string, bem: (el?: import("../utils").Mods | undefined, mods?: import("../utils").Mods | undefined) => import("../utils").Mods, t: (path: string, ...args: unknown[]) => any;

export declare function getDayByOffset(date: Date, offset: number): Date;
export declare function getMonthByOffset(date: Date, offset: number): Date;
export declare function getYearByOffset(date: Date, offset: number): Date;
export declare const getPrevDay: (date: Date) => Date;
export declare const getNextDay: (date: Date) => Date;
export declare const getPrevMonth: (date: Date) => Date;
export declare const getNextMonth: (date: Date) => Date;
export declare const getPrevYear: (date: Date) => Date;
export declare const getNextYear: (date: Date) => Date;
export declare const getToday: () => Date;
export declare function calcDateNum(date: [Date, Date]): number;

@@ -109,2 +109,2 @@ export * from "./action-bar";

export function install(app: any): void;
export const version: "4.8.11";
export const version: "4.9.0";

@@ -12,2 +12,6 @@ import { PickerGroupProps } from './PickerGroup';

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -27,2 +31,6 @@ title: StringConstructor;

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -37,2 +45,3 @@ title: StringConstructor;

}, {
showToolbar: boolean;
tabs: string[];

@@ -39,0 +48,0 @@ activeTab: string | number;

@@ -14,2 +14,6 @@ import { type InjectionKey, type ExtractPropTypes } from 'vue';

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -31,2 +35,6 @@ title: StringConstructor;

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -46,2 +54,6 @@ title: StringConstructor;

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -56,2 +68,3 @@ title: StringConstructor;

}, {
showToolbar: boolean;
tabs: string[];

@@ -58,0 +71,0 @@ activeTab: string | number;

@@ -30,2 +30,2 @@ import type { ComponentPublicInstance } from 'vue';

export declare const toArray: <T>(item: T | T[]) => T[];
export declare const flat: <T>(arr: (T | T[])[]) => T[];
export declare const flat: <T>(arr: Array<T | T[]>) => T[];
import { type PropType, type ExtractPropTypes } from 'vue';
import { PopupPosition } from '../popup';
import type { CalendarType, CalendarDayItem } from './types';
import type { CalendarType, CalendarSwitchMode, CalendarDayItem } from './types';
export declare const calendarProps: {

@@ -10,2 +10,6 @@ show: BooleanConstructor;

};
switchMode: {
type: PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
title: StringConstructor;

@@ -78,3 +82,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -84,3 +87,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -100,2 +102,6 @@ firstDayOfWeek: {

};
switchMode: {
type: PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
title: StringConstructor;

@@ -168,3 +174,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -174,3 +179,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -182,3 +186,3 @@ firstDayOfWeek: {

};
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<ExtractPropTypes<{
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<ExtractPropTypes<{
show: BooleanConstructor;

@@ -189,2 +193,6 @@ type: {

};
switchMode: {
type: PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
title: StringConstructor;

@@ -257,3 +265,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -263,3 +270,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -277,2 +283,3 @@ firstDayOfWeek: {

onClickSubtitle?: ((...args: any[]) => any) | undefined;
onPanelChange?: ((...args: any[]) => any) | undefined;
onUnselect?: ((...args: any[]) => any) | undefined;

@@ -292,2 +299,3 @@ onMonthShow?: ((...args: any[]) => any) | undefined;

safeAreaInsetTop: boolean;
switchMode: CalendarSwitchMode;
poppable: boolean;

@@ -301,6 +309,4 @@ maxRange: string | number;

showRangePrompt: boolean;
minDate: Date;
maxDate: Date;
firstDayOfWeek: string | number;
}, {}>;
export default _default;

@@ -49,2 +49,3 @@ var __create = Object.create;

type: (0, import_utils.makeStringProp)("single"),
switchMode: (0, import_utils.makeStringProp)("none"),
title: String,

@@ -77,12 +78,7 @@ color: String,

type: Date,
validator: import_utils.isDate,
default: import_utils2.getToday
validator: import_utils.isDate
},
maxDate: {
type: Date,
validator: import_utils.isDate,
default: () => {
const now = (0, import_utils2.getToday)();
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
}
validator: import_utils.isDate
},

@@ -98,3 +94,3 @@ firstDayOfWeek: {

props: calendarProps,
emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate"],
emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate", "panelChange"],
setup(props, {

@@ -104,9 +100,22 @@ emit,

}) {
const limitDateRange = (date, minDate = props.minDate, maxDate = props.maxDate) => {
if ((0, import_utils2.compareDay)(date, minDate) === -1) {
return minDate;
const canSwitch = (0, import_vue2.computed)(() => props.switchMode !== "none");
const minDate = (0, import_vue2.computed)(() => {
if (!props.minDate && !canSwitch.value) {
return (0, import_utils2.getToday)();
}
if ((0, import_utils2.compareDay)(date, maxDate) === 1) {
return maxDate;
return props.minDate;
});
const maxDate = (0, import_vue2.computed)(() => {
if (!props.maxDate && !canSwitch.value) {
return (0, import_utils2.getMonthByOffset)((0, import_utils2.getToday)(), 6);
}
return props.maxDate;
});
const limitDateRange = (date, min = minDate.value, max = maxDate.value) => {
if (min && (0, import_utils2.compareDay)(date, min) === -1) {
return min;
}
if (max && (0, import_utils2.compareDay)(date, max) === 1) {
return max;
}
return date;

@@ -117,4 +126,2 @@ };

type,
minDate,
maxDate,
allowSameDay

@@ -130,4 +137,6 @@ } = props;

}
const start = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : (0, import_utils2.getPrevDay)(maxDate));
const end = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : (0, import_utils2.getNextDay)(minDate));
const min = minDate.value;
const max = maxDate.value;
const start = limitDateRange(defaultDate[0] || now, min, max ? allowSameDay ? max : (0, import_utils2.getPrevDay)(max) : void 0);
const end = limitDateRange(defaultDate[1] || (allowSameDay ? now : (0, import_utils2.getNextDay)(now)), min ? allowSameDay ? min : (0, import_utils2.getNextDay)(min) : void 0);
return [start, end];

@@ -146,9 +155,11 @@ }

};
const getInitialPanelDate = () => {
const date = Array.isArray(currentDate.value) ? currentDate.value[0] : currentDate.value;
return date ? date : limitDateRange((0, import_utils2.getToday)());
};
let bodyHeight;
const bodyRef = (0, import_vue2.ref)();
const subtitle = (0, import_vue2.ref)({
textFn: () => "",
date: void 0
});
const currentDate = (0, import_vue2.ref)(getInitialDate());
const currentPanelDate = (0, import_vue2.ref)(getInitialPanelDate());
const currentMonthRef = (0, import_vue2.ref)();
const [monthRefs, setMonthRefs] = (0, import_use_refs.useRefs)();

@@ -158,3 +169,6 @@ const dayOffset = (0, import_vue2.computed)(() => props.firstDayOfWeek ? +props.firstDayOfWeek % 7 : 0);

const months2 = [];
const cursor = new Date(props.minDate);
if (!minDate.value || !maxDate.value) {
return months2;
}
const cursor = new Date(minDate.value);
cursor.setDate(1);

@@ -164,3 +178,3 @@ do {

cursor.setMonth(cursor.getMonth() + 1);
} while ((0, import_utils2.compareMonth)(cursor, props.maxDate) !== 1);
} while ((0, import_utils2.compareMonth)(cursor, maxDate.value) !== 1);
return months2;

@@ -215,21 +229,22 @@ });

if (currentMonth) {
subtitle.value = {
textFn: currentMonth.getTitle,
date: currentMonth.date
};
currentMonthRef.value = currentMonth;
}
};
const scrollToDate = (targetDate) => {
(0, import_use.raf)(() => {
months.value.some((month, index) => {
if ((0, import_utils2.compareMonth)(month, targetDate) === 0) {
if (bodyRef.value) {
monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
if (canSwitch.value) {
currentPanelDate.value = targetDate;
} else {
(0, import_use.raf)(() => {
months.value.some((month, index) => {
if ((0, import_utils2.compareMonth)(month, targetDate) === 0) {
if (bodyRef.value) {
monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
}
return true;
}
return true;
}
return false;
return false;
});
onScroll();
});
onScroll();
});
}
};

@@ -245,3 +260,3 @@ const scrollToCurrentDate = () => {

}
} else {
} else if (!canSwitch.value) {
(0, import_use.raf)(onScroll);

@@ -254,5 +269,7 @@ }

}
(0, import_use.raf)(() => {
bodyHeight = Math.floor((0, import_use.useRect)(bodyRef).height);
});
if (!canSwitch.value) {
(0, import_use.raf)(() => {
bodyHeight = Math.floor((0, import_use.useRect)(bodyRef).height);
});
}
scrollToCurrentDate();

@@ -279,2 +296,8 @@ };

};
const onPanelChange = (date) => {
currentPanelDate.value = date;
emit("panelChange", {
date
});
};
const onConfirm = () => {

@@ -371,8 +394,11 @@ var _a;

return (0, import_vue.createVNode)(import_CalendarMonth.default, (0, import_vue.mergeProps)({
"ref": setMonthRefs(index),
"ref": canSwitch.value ? currentMonthRef : setMonthRefs(index),
"date": date,
"currentDate": currentDate.value,
"showMonthTitle": showMonthTitle,
"firstDayOfWeek": dayOffset.value
}, (0, import_utils.pick)(props, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
"firstDayOfWeek": dayOffset.value,
"lazyRender": canSwitch.value ? false : props.lazyRender,
"maxDate": maxDate.value,
"minDate": minDate.value
}, (0, import_utils.pick)(props, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
"onClick": onClickDay,

@@ -412,21 +438,25 @@ "onClickDisabledDate": (item) => emit("clickDisabledDate", item)

const renderCalendar = () => {
const subTitle = subtitle.value.textFn();
var _a, _b;
return (0, import_vue.createVNode)("div", {
"class": (0, import_utils2.bem)()
}, [(0, import_vue.createVNode)(import_CalendarHeader.default, {
"date": subtitle.value.date,
"date": (_a = currentMonthRef.value) == null ? void 0 : _a.date,
"maxDate": maxDate.value,
"minDate": minDate.value,
"title": props.title,
"subtitle": subTitle,
"subtitle": (_b = currentMonthRef.value) == null ? void 0 : _b.getTitle(),
"showTitle": props.showTitle,
"showSubtitle": props.showSubtitle,
"switchMode": props.switchMode,
"firstDayOfWeek": dayOffset.value,
"onClickSubtitle": (event) => emit("clickSubtitle", event)
}, (0, import_utils.pick)(slots, ["title", "subtitle"])), (0, import_vue.createVNode)("div", {
"onClickSubtitle": (event) => emit("clickSubtitle", event),
"onPanelChange": onPanelChange
}, (0, import_utils.pick)(slots, ["title", "subtitle", "prev-month", "prev-year", "next-month", "next-year"])), (0, import_vue.createVNode)("div", {
"ref": bodyRef,
"class": (0, import_utils2.bem)("body"),
"onScroll": onScroll
}, [months.value.map(renderMonth)]), renderFooter()]);
"onScroll": canSwitch.value ? void 0 : onScroll
}, [canSwitch.value ? renderMonth(currentPanelDate.value, 0) : months.value.map(renderMonth)]), renderFooter()]);
};
(0, import_vue2.watch)(() => props.show, init);
(0, import_vue2.watch)(() => [props.type, props.minDate, props.maxDate], () => reset(getInitialDate(currentDate.value)));
(0, import_vue2.watch)(() => [props.type, props.minDate, props.maxDate, props.switchMode], () => reset(getInitialDate(currentDate.value)));
(0, import_vue2.watch)(() => props.defaultDate, (value = null) => {

@@ -433,0 +463,0 @@ currentDate.value = value;

@@ -0,3 +1,6 @@

import type { CalendarSwitchMode } from './types';
declare const _default: import("vue").DefineComponent<{
date: DateConstructor;
minDate: DateConstructor;
maxDate: DateConstructor;
title: StringConstructor;

@@ -8,4 +11,10 @@ subtitle: StringConstructor;

firstDayOfWeek: NumberConstructor;
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickSubtitle"[], "clickSubtitle", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
switchMode: {
type: import("vue").PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clickSubtitle" | "panelChange")[], "clickSubtitle" | "panelChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
date: DateConstructor;
minDate: DateConstructor;
maxDate: DateConstructor;
title: StringConstructor;

@@ -16,5 +25,11 @@ subtitle: StringConstructor;

firstDayOfWeek: NumberConstructor;
switchMode: {
type: import("vue").PropType<CalendarSwitchMode>;
default: CalendarSwitchMode;
};
}>> & {
onClickSubtitle?: ((...args: any[]) => any) | undefined;
onPanelChange?: ((...args: any[]) => any) | undefined;
}, {
switchMode: CalendarSwitchMode;
showTitle: boolean;

@@ -21,0 +36,0 @@ showSubtitle: boolean;

@@ -27,2 +27,3 @@ var __defProp = Object.defineProperty;

var import_utils2 = require("./utils");
var import_icon = require("../icon");
const [name] = (0, import_utils.createNamespace)("calendar-header");

@@ -33,2 +34,4 @@ var stdin_default = (0, import_vue2.defineComponent)({

date: Date,
minDate: Date,
maxDate: Date,
title: String,

@@ -38,5 +41,6 @@ subtitle: String,

showSubtitle: Boolean,
firstDayOfWeek: Number
firstDayOfWeek: Number,
switchMode: (0, import_utils.makeStringProp)("none")
},
emits: ["clickSubtitle"],
emits: ["clickSubtitle", "panelChange"],
setup(props, {

@@ -46,2 +50,18 @@ slots,

}) {
const prevMonthDisabled = (0, import_vue2.computed)(() => {
const prevMonth = (0, import_utils2.getPrevMonth)(props.date);
return props.minDate && prevMonth < props.minDate;
});
const prevYearDisabled = (0, import_vue2.computed)(() => {
const prevYear = (0, import_utils2.getPrevYear)(props.date);
return props.minDate && prevYear < props.minDate;
});
const nextMonthDisabled = (0, import_vue2.computed)(() => {
const nextMonth = (0, import_utils2.getNextMonth)(props.date);
return props.maxDate && nextMonth > props.maxDate;
});
const nextYearDisabled = (0, import_vue2.computed)(() => {
const nextYear = (0, import_utils2.getNextYear)(props.date);
return props.maxDate && nextYear > props.maxDate;
});
const renderTitle = () => {

@@ -57,2 +77,41 @@ if (props.showTitle) {

const onClickSubtitle = (event) => emit("clickSubtitle", event);
const onPanelChange = (date) => emit("panelChange", date);
const renderAction = (isNext) => {
const showYearAction = props.switchMode === "year-month";
const monthSlot = slots[isNext ? "next-month" : "prev-month"];
const yearSlot = slots[isNext ? "next-year" : "prev-year"];
const monthDisabled = isNext ? nextMonthDisabled.value : prevMonthDisabled.value;
const yearDisabled = isNext ? nextYearDisabled.value : prevYearDisabled.value;
const monthIconName = isNext ? "arrow" : "arrow-left";
const yearIconName = isNext ? "arrow-double-right" : "arrow-double-left";
const onMonthChange = () => onPanelChange((isNext ? import_utils2.getNextMonth : import_utils2.getPrevMonth)(props.date));
const onYearChange = () => onPanelChange((isNext ? import_utils2.getNextYear : import_utils2.getPrevYear)(props.date));
const MonthAction = (0, import_vue.createVNode)("view", {
"class": (0, import_utils2.bem)("header-action", {
disabled: monthDisabled
}),
"onClick": monthDisabled ? void 0 : onMonthChange
}, [monthSlot ? monthSlot({
disabled: monthDisabled
}) : (0, import_vue.createVNode)(import_icon.Icon, {
"class": {
[import_utils.HAPTICS_FEEDBACK]: !monthDisabled
},
"name": monthIconName
}, null)]);
const YearAction = showYearAction && (0, import_vue.createVNode)("view", {
"class": (0, import_utils2.bem)("header-action", {
disabled: yearDisabled
}),
"onClick": yearDisabled ? void 0 : onYearChange
}, [yearSlot ? yearSlot({
disabled: yearDisabled
}) : (0, import_vue.createVNode)(import_icon.Icon, {
"class": {
[import_utils.HAPTICS_FEEDBACK]: !yearDisabled
},
"name": yearIconName
}, null)]);
return isNext ? [MonthAction, YearAction] : [YearAction, MonthAction];
};
const renderSubtitle = () => {

@@ -64,6 +123,11 @@ if (props.showSubtitle) {

}) : props.subtitle;
const canSwitch = props.switchMode !== "none";
return (0, import_vue.createVNode)("div", {
"class": (0, import_utils2.bem)("header-subtitle"),
"class": (0, import_utils2.bem)("header-subtitle", {
"with-swicth": canSwitch
}),
"onClick": onClickSubtitle
}, [title]);
}, [canSwitch ? [renderAction(), (0, import_vue.createVNode)("div", {
"class": (0, import_utils2.bem)("header-subtitle-text")
}, [title]), renderAction(true)] : title]);
}

@@ -70,0 +134,0 @@ };

@@ -10,10 +10,4 @@ import { type PropType, type ExtractPropTypes } from 'vue';

color: StringConstructor;
minDate: {
type: DateConstructor;
required: true;
};
maxDate: {
type: DateConstructor;
required: true;
};
minDate: DateConstructor;
maxDate: DateConstructor;
showMark: BooleanConstructor;

@@ -37,10 +31,4 @@ rowHeight: (NumberConstructor | StringConstructor)[];

color: StringConstructor;
minDate: {
type: DateConstructor;
required: true;
};
maxDate: {
type: DateConstructor;
required: true;
};
minDate: DateConstructor;
maxDate: DateConstructor;
showMark: BooleanConstructor;

@@ -62,10 +50,4 @@ rowHeight: (NumberConstructor | StringConstructor)[];

color: StringConstructor;
minDate: {
type: DateConstructor;
required: true;
};
maxDate: {
type: DateConstructor;
required: true;
};
minDate: DateConstructor;
maxDate: DateConstructor;
showMark: BooleanConstructor;

@@ -72,0 +54,0 @@ rowHeight: (NumberConstructor | StringConstructor)[];

@@ -47,4 +47,4 @@ var __create = Object.create;

color: String,
minDate: (0, import_utils.makeRequiredProp)(Date),
maxDate: (0, import_utils.makeRequiredProp)(Date),
minDate: Date,
maxDate: Date,
showMark: Boolean,

@@ -75,3 +75,5 @@ rowHeight: import_utils.numericProp,

const offset = (0, import_vue2.computed)(() => {
const realDay = props.date.getDay();
const date = props.date.getDate();
const day = props.date.getDay();
const realDay = (day - date % 7 + 8) % 7;
if (props.firstDayOfWeek) {

@@ -136,3 +138,3 @@ return (realDay + 7 - props.firstDayOfWeek) % 7;

} = props;
if ((0, import_utils3.compareDay)(day, minDate) < 0 || (0, import_utils3.compareDay)(day, maxDate) > 0) {
if (minDate && (0, import_utils3.compareDay)(day, minDate) < 0 || maxDate && (0, import_utils3.compareDay)(day, maxDate) > 0) {
return "disabled";

@@ -139,0 +141,0 @@ }

@@ -7,2 +7,6 @@ export declare const Calendar: import("../utils").WithInstall<import("vue").DefineComponent<{

};
switchMode: {
type: import("vue").PropType<import("./types").CalendarSwitchMode>;
default: import("./types").CalendarSwitchMode;
};
title: StringConstructor;

@@ -75,3 +79,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -81,3 +84,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -89,3 +91,3 @@ firstDayOfWeek: {

};
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
show: BooleanConstructor;

@@ -96,2 +98,6 @@ type: {

};
switchMode: {
type: import("vue").PropType<import("./types").CalendarSwitchMode>;
default: import("./types").CalendarSwitchMode;
};
title: StringConstructor;

@@ -164,3 +170,2 @@ color: StringConstructor;

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -170,3 +175,2 @@ maxDate: {

validator: (val: unknown) => val is Date;
default: () => Date;
};

@@ -184,2 +188,3 @@ firstDayOfWeek: {

onClickSubtitle?: ((...args: any[]) => any) | undefined;
onPanelChange?: ((...args: any[]) => any) | undefined;
onUnselect?: ((...args: any[]) => any) | undefined;

@@ -199,2 +204,3 @@ onMonthShow?: ((...args: any[]) => any) | undefined;

safeAreaInsetTop: boolean;
switchMode: import("./types").CalendarSwitchMode;
poppable: boolean;

@@ -208,4 +214,2 @@ maxRange: string | number;

showRangePrompt: boolean;
minDate: Date;
maxDate: Date;
firstDayOfWeek: string | number;

@@ -212,0 +216,0 @@ }, {}>>;

@@ -5,2 +5,3 @@ import type { ComponentPublicInstance, ComputedRef, Ref } from 'vue';

import type { CalendarMonthProps } from './CalendarMonth';
export type CalendarSwitchMode = 'none' | 'month' | 'year-month';
export type CalendarType = 'single' | 'range' | 'multiple';

@@ -37,2 +38,5 @@ export type CalendarDayType = '' | 'start' | 'start-end' | 'middle' | 'end' | 'selected' | 'multiple-middle' | 'multiple-selected' | 'disabled' | 'placeholder';

calendarHeaderSubtitleFontSize?: string;
calendarHeaderActionWidth?: string;
calendarHeaderActionColor?: string;
calendarHeaderActionDisabledColor?: string;
calendarWeekdaysHeight?: string;

@@ -39,0 +43,0 @@ calendarWeekdaysFontSize?: string;

@@ -9,5 +9,11 @@ declare const name: string, bem: (el?: import("../utils").Mods | undefined, mods?: import("../utils").Mods | undefined) => import("../utils").Mods, t: (path: string, ...args: unknown[]) => any;

export declare function getDayByOffset(date: Date, offset: number): Date;
export declare function getMonthByOffset(date: Date, offset: number): Date;
export declare function getYearByOffset(date: Date, offset: number): Date;
export declare const getPrevDay: (date: Date) => Date;
export declare const getNextDay: (date: Date) => Date;
export declare const getPrevMonth: (date: Date) => Date;
export declare const getNextMonth: (date: Date) => Date;
export declare const getPrevYear: (date: Date) => Date;
export declare const getNextYear: (date: Date) => Date;
export declare const getToday: () => Date;
export declare function calcDateNum(date: [Date, Date]): number;

@@ -28,5 +28,11 @@ var __defProp = Object.defineProperty;

getDayByOffset: () => getDayByOffset,
getMonthByOffset: () => getMonthByOffset,
getNextDay: () => getNextDay,
getNextMonth: () => getNextMonth,
getNextYear: () => getNextYear,
getPrevDay: () => getPrevDay,
getPrevMonth: () => getPrevMonth,
getPrevYear: () => getPrevYear,
getToday: () => getToday,
getYearByOffset: () => getYearByOffset,
name: () => name,

@@ -65,4 +71,18 @@ t: () => t

}
function getMonthByOffset(date, offset) {
const cloned = cloneDate(date);
cloned.setMonth(cloned.getMonth() + offset);
return cloned;
}
function getYearByOffset(date, offset) {
const cloned = cloneDate(date);
cloned.setFullYear(cloned.getFullYear() + offset);
return cloned;
}
const getPrevDay = (date) => getDayByOffset(date, -1);
const getNextDay = (date) => getDayByOffset(date, 1);
const getPrevMonth = (date) => getMonthByOffset(date, -1);
const getNextMonth = (date) => getMonthByOffset(date, 1);
const getPrevYear = (date) => getYearByOffset(date, -1);
const getNextYear = (date) => getYearByOffset(date, 1);
const getToday = () => {

@@ -69,0 +89,0 @@ const today = /* @__PURE__ */ new Date();

@@ -92,2 +92,9 @@ var __defProp = Object.defineProperty;

const lastChunk = chunks[chunks.length - 1];
if (!lastChunk) {
chunks.push({
start: 0,
end: sourceString.length,
highlight: false
});
}
if (lastChunk && lastChunk.end < sourceString.length) {

@@ -94,0 +101,0 @@ chunks.push({

@@ -216,2 +216,4 @@ var __defProp = Object.defineProperty;

const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
if (!swipeItemEl)
return;
const imageEl = swipeItemEl.firstElementChild;

@@ -218,0 +220,0 @@ const isClickOverlay = event.target === swipeItemEl;

@@ -111,3 +111,7 @@ var __defProp = Object.defineProperty;

const rect = match.getRect(scrollParent.value, scrollParentRect);
active = getActiveAnchor(rect.top, rects);
if (props.sticky && props.stickyOffsetTop) {
active = getActiveAnchor(rect.top - props.stickyOffsetTop, rects);
} else {
active = getActiveAnchor(rect.top, rects);
}
}

@@ -185,3 +189,7 @@ } else {

if (props.sticky && props.stickyOffsetTop) {
(0, import_utils.setRootScrollTop)((0, import_utils.getRootScrollTop)() - props.stickyOffsetTop);
if ((0, import_utils.getRootScrollTop)() === offsetHeight - scrollParentRect.height) {
(0, import_utils.setRootScrollTop)((0, import_utils.getRootScrollTop)());
} else {
(0, import_utils.setRootScrollTop)((0, import_utils.getRootScrollTop)() - props.stickyOffsetTop);
}
}

@@ -188,0 +196,0 @@ emit("select", match.index);

@@ -109,2 +109,2 @@ export * from "./action-bar";

export function install(app: any): void;
export const version: "4.8.11";
export const version: "4.9.0";

@@ -229,3 +229,3 @@ var __defProp = Object.defineProperty;

__reExport(stdin_exports, require("./watermark"), module.exports);
const version = "4.8.11";
const version = "4.9.0";
function install(app) {

@@ -232,0 +232,0 @@ const components = [

@@ -12,2 +12,6 @@ import { PickerGroupProps } from './PickerGroup';

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -27,2 +31,6 @@ title: StringConstructor;

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -37,2 +45,3 @@ title: StringConstructor;

}, {
showToolbar: boolean;
tabs: string[];

@@ -39,0 +48,0 @@ activeTab: string | number;

@@ -14,2 +14,6 @@ import { type InjectionKey, type ExtractPropTypes } from 'vue';

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -31,2 +35,6 @@ title: StringConstructor;

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -46,2 +54,6 @@ title: StringConstructor;

nextStepText: StringConstructor;
showToolbar: {
type: BooleanConstructor;
default: true;
};
} & {

@@ -56,2 +68,3 @@ title: StringConstructor;

}, {
showToolbar: boolean;
tabs: string[];

@@ -58,0 +71,0 @@ activeTab: string | number;

@@ -48,3 +48,4 @@ var __create = Object.create;

activeTab: (0, import_utils.makeNumericProp)(0),
nextStepText: String
nextStepText: String,
showToolbar: import_utils.truthProp
}, import_PickerToolbar.pickerToolbarProps);

@@ -88,3 +89,3 @@ var stdin_default = (0, import_vue2.defineComponent)({

"class": bem()
}, [(0, import_vue.createVNode)(import_PickerToolbar.default, {
}, [props.showToolbar ? (0, import_vue.createVNode)(import_PickerToolbar.default, {
"title": props.title,

@@ -95,3 +96,3 @@ "cancelButtonText": props.cancelButtonText,

"onCancel": onCancel
}, (0, import_utils.pick)(slots, import_PickerToolbar.pickerToolbarSlots)), (0, import_vue.createVNode)(import_tabs.Tabs, {
}, (0, import_utils.pick)(slots, import_PickerToolbar.pickerToolbarSlots)) : null, (0, import_vue.createVNode)(import_tabs.Tabs, {
"active": activeTab.value,

@@ -98,0 +99,0 @@ "onUpdate:active": ($event) => activeTab.value = $event,

@@ -30,2 +30,2 @@ import type { ComponentPublicInstance } from 'vue';

export declare const toArray: <T>(item: T | T[]) => T[];
export declare const flat: <T>(arr: (T | T[])[]) => T[];
export declare const flat: <T>(arr: Array<T | T[]>) => T[];
{
"name": "vant",
"version": "4.8.11",
"version": "4.9.0",
"description": "Mobile UI Components built on Vue",

@@ -36,5 +36,5 @@ "main": "lib/vant.cjs.js",

"dependencies": {
"@vue/shared": "^3.4.21",
"@vant/use": "^1.6.0",
"@vant/popperjs": "^1.3.0"
"@vue/shared": "^3.4.26",
"@vant/popperjs": "^1.3.0",
"@vant/use": "^1.6.0"
},

@@ -45,7 +45,7 @@ "peerDependencies": {

"devDependencies": {
"@types/node": "^18.19.29",
"@vitejs/plugin-vue": "^4.6.2",
"@types/node": "^18.19.31",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vitest/coverage-istanbul": "^1.1.3",
"@vue/runtime-core": "^3.4.21",
"@vitest/coverage-istanbul": "^1.5.3",
"@vue/runtime-core": "^3.4.26",
"@vue/test-utils": "^2.4.5",

@@ -55,12 +55,12 @@ "csstype": "^3.1.3",

"jsdom": "^22.1.0",
"typescript": "^5.0.4",
"vite": "^5.0.12",
"vitest": "^1.1.3",
"typescript": "^5.4.5",
"vite": "^5.2.10",
"vitest": "^1.5.3",
"vitest-canvas-mock": "^0.3.3",
"vue": "^3.4.21",
"vue-router": "^4.3.0",
"vue": "^3.4.26",
"vue-router": "^4.3.2",
"@vant/area-data": "1.5.1",
"@vant/eslint-config": "4.0.0",
"@vant/cli": "7.0.1",
"@vant/icons": "3.0.2",
"@vant/area-data": "1.5.1"
"@vant/cli": "7.0.2"
},

@@ -67,0 +67,0 @@ "sideEffects": [

@@ -13,11 +13,14 @@ <p align="center">

<img src="https://img.shields.io/npm/dm/vant.svg?style=flat-square&color=#4fc08d" alt="downloads" />
<img src="https://img.badgesize.io/https://unpkg.com/vant/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
</p>
<p align="center">
πŸ”₯ <a href="https://vant-contrib.gitee.io/vant">ζ–‡ζ‘£η½‘η«™οΌˆε›½ε†…οΌ‰</a>
<a href="https://vant-ui.github.io/vant">Documentation</a>
&nbsp;
🌈 <a href="https://vant-ui.github.io/vant">ζ–‡ζ‘£η½‘η«™οΌˆGitHubοΌ‰</a>
Β·
&nbsp;
πŸ‡¨πŸ‡³ <a href="./README.zh-CN.md">δΈ­ζ–‡η‰ˆδ»‹η»</a>
<a href="https://vant-ui.github.io/vant">ζ–‡ζ‘£η«™</a>
&nbsp;
Β·
&nbsp;
<a href="./README.zh-CN.md">中文介绍</a>
</p>

@@ -124,3 +127,2 @@

| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
| [vant-theme](https://github.com/Aisen60/vant-theme) | Online theme preview built on Vant UI |

@@ -127,0 +129,0 @@ | [@antmjs/vantui](https://github.com/antmjs/vantui) | Mobile UI Components based on Vant, supporting Taro and React |

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc