first commit
This commit is contained in:
55
node_modules/vant/es/count-down/CountDown.d.ts
generated
vendored
Normal file
55
node_modules/vant/es/count-down/CountDown.d.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import { type ExtractPropTypes } from 'vue';
|
||||
export declare const countDownProps: {
|
||||
time: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
format: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
autoStart: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
millisecond: BooleanConstructor;
|
||||
};
|
||||
export type CountDownProps = ExtractPropTypes<typeof countDownProps>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
time: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
format: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
autoStart: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
millisecond: BooleanConstructor;
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "finish")[], "change" | "finish", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
time: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
format: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
autoStart: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
millisecond: BooleanConstructor;
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
onFinish?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
time: string | number;
|
||||
format: string;
|
||||
autoStart: boolean;
|
||||
millisecond: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
56
node_modules/vant/es/count-down/CountDown.mjs
generated
vendored
Normal file
56
node_modules/vant/es/count-down/CountDown.mjs
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
import { watch, computed, defineComponent, createVNode as _createVNode } from "vue";
|
||||
import { truthProp, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
||||
import { parseFormat } from "./utils.mjs";
|
||||
import { useCountDown } from "@vant/use";
|
||||
import { useExpose } from "../composables/use-expose.mjs";
|
||||
const [name, bem] = createNamespace("count-down");
|
||||
const countDownProps = {
|
||||
time: makeNumericProp(0),
|
||||
format: makeStringProp("HH:mm:ss"),
|
||||
autoStart: truthProp,
|
||||
millisecond: Boolean
|
||||
};
|
||||
var stdin_default = defineComponent({
|
||||
name,
|
||||
props: countDownProps,
|
||||
emits: ["change", "finish"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
const {
|
||||
start,
|
||||
pause,
|
||||
reset,
|
||||
current
|
||||
} = useCountDown({
|
||||
time: +props.time,
|
||||
millisecond: props.millisecond,
|
||||
onChange: (current2) => emit("change", current2),
|
||||
onFinish: () => emit("finish")
|
||||
});
|
||||
const timeText = computed(() => parseFormat(props.format, current.value));
|
||||
const resetTime = () => {
|
||||
reset(+props.time);
|
||||
if (props.autoStart) {
|
||||
start();
|
||||
}
|
||||
};
|
||||
watch(() => props.time, resetTime, {
|
||||
immediate: true
|
||||
});
|
||||
useExpose({
|
||||
start,
|
||||
pause,
|
||||
reset: resetTime
|
||||
});
|
||||
return () => _createVNode("div", {
|
||||
"role": "timer",
|
||||
"class": bem()
|
||||
}, [slots.default ? slots.default(current.value) : timeText.value]);
|
||||
}
|
||||
});
|
||||
export {
|
||||
countDownProps,
|
||||
stdin_default as default
|
||||
};
|
||||
1
node_modules/vant/es/count-down/index.css
generated
vendored
Normal file
1
node_modules/vant/es/count-down/index.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
:root,:host{--van-count-down-text-color: var(--van-text-color);--van-count-down-font-size: var(--van-font-size-md);--van-count-down-line-height: var(--van-line-height-md)}.van-count-down{color:var(--van-count-down-text-color);font-size:var(--van-count-down-font-size);line-height:var(--van-count-down-line-height)}
|
||||
46
node_modules/vant/es/count-down/index.d.ts
generated
vendored
Normal file
46
node_modules/vant/es/count-down/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
export declare const CountDown: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
time: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
format: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
autoStart: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
millisecond: BooleanConstructor;
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "finish")[], "change" | "finish", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
time: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
format: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
autoStart: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
millisecond: BooleanConstructor;
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
onFinish?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
time: string | number;
|
||||
format: string;
|
||||
autoStart: boolean;
|
||||
millisecond: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default CountDown;
|
||||
export { countDownProps } from './CountDown';
|
||||
export type { CountDownProps } from './CountDown';
|
||||
export type { CountDownInstance, CountDownThemeVars, CountDownCurrentTime, } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanCountDown: typeof CountDown;
|
||||
}
|
||||
}
|
||||
10
node_modules/vant/es/count-down/index.mjs
generated
vendored
Normal file
10
node_modules/vant/es/count-down/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { withInstall } from "../utils/index.mjs";
|
||||
import _CountDown from "./CountDown.mjs";
|
||||
const CountDown = withInstall(_CountDown);
|
||||
var stdin_default = CountDown;
|
||||
import { countDownProps } from "./CountDown.mjs";
|
||||
export {
|
||||
CountDown,
|
||||
countDownProps,
|
||||
stdin_default as default
|
||||
};
|
||||
1
node_modules/vant/es/count-down/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/es/count-down/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
2
node_modules/vant/es/count-down/style/index.mjs
generated
vendored
Normal file
2
node_modules/vant/es/count-down/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import "../../style/base.css";
|
||||
import "../index.css";
|
||||
16
node_modules/vant/es/count-down/types.d.ts
generated
vendored
Normal file
16
node_modules/vant/es/count-down/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { ComponentPublicInstance } from 'vue';
|
||||
import type { CurrentTime } from '@vant/use';
|
||||
import type { CountDownProps } from './CountDown';
|
||||
type CountDownExpose = {
|
||||
start: () => void;
|
||||
pause: () => void;
|
||||
reset: () => void;
|
||||
};
|
||||
export type CountDownInstance = ComponentPublicInstance<CountDownProps, CountDownExpose>;
|
||||
export type CountDownCurrentTime = CurrentTime;
|
||||
export type CountDownThemeVars = {
|
||||
countDownTextColor?: string;
|
||||
countDownFontSize?: string;
|
||||
countDownLineHeight?: number | string;
|
||||
};
|
||||
export {};
|
||||
0
node_modules/vant/es/count-down/types.mjs
generated
vendored
Normal file
0
node_modules/vant/es/count-down/types.mjs
generated
vendored
Normal file
2
node_modules/vant/es/count-down/utils.d.ts
generated
vendored
Normal file
2
node_modules/vant/es/count-down/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { CurrentTime } from '@vant/use';
|
||||
export declare function parseFormat(format: string, currentTime: CurrentTime): string;
|
||||
39
node_modules/vant/es/count-down/utils.mjs
generated
vendored
Normal file
39
node_modules/vant/es/count-down/utils.mjs
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { padZero } from "../utils/index.mjs";
|
||||
function parseFormat(format, currentTime) {
|
||||
const { days } = currentTime;
|
||||
let { hours, minutes, seconds, milliseconds } = currentTime;
|
||||
if (format.includes("DD")) {
|
||||
format = format.replace("DD", padZero(days));
|
||||
} else {
|
||||
hours += days * 24;
|
||||
}
|
||||
if (format.includes("HH")) {
|
||||
format = format.replace("HH", padZero(hours));
|
||||
} else {
|
||||
minutes += hours * 60;
|
||||
}
|
||||
if (format.includes("mm")) {
|
||||
format = format.replace("mm", padZero(minutes));
|
||||
} else {
|
||||
seconds += minutes * 60;
|
||||
}
|
||||
if (format.includes("ss")) {
|
||||
format = format.replace("ss", padZero(seconds));
|
||||
} else {
|
||||
milliseconds += seconds * 1e3;
|
||||
}
|
||||
if (format.includes("S")) {
|
||||
const ms = padZero(milliseconds, 3);
|
||||
if (format.includes("SSS")) {
|
||||
format = format.replace("SSS", ms);
|
||||
} else if (format.includes("SS")) {
|
||||
format = format.replace("SS", ms.slice(0, 2));
|
||||
} else {
|
||||
format = format.replace("S", ms.charAt(0));
|
||||
}
|
||||
}
|
||||
return format;
|
||||
}
|
||||
export {
|
||||
parseFormat
|
||||
};
|
||||
Reference in New Issue
Block a user