完全跑通1.0版本
This commit is contained in:
8
frontend/node_modules/element-plus/lib/components/countdown/index.d.ts
generated
vendored
Normal file
8
frontend/node_modules/element-plus/lib/components/countdown/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { SFCWithInstall } from "../../utils/vue/typescript.js";
|
||||
import { CountdownEmits, CountdownInstance, CountdownProps, CountdownPropsPublic, countdownEmits, countdownProps } from "./src/countdown.js";
|
||||
import _default from "./src/countdown.vue.js";
|
||||
|
||||
//#region ../../packages/components/countdown/index.d.ts
|
||||
declare const ElCountdown: SFCWithInstall<typeof _default>;
|
||||
//#endregion
|
||||
export { CountdownEmits, CountdownInstance, CountdownProps, CountdownPropsPublic, ElCountdown, ElCountdown as default, countdownEmits, countdownProps };
|
||||
16
frontend/node_modules/element-plus/lib/components/countdown/index.js
generated
vendored
Normal file
16
frontend/node_modules/element-plus/lib/components/countdown/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
Object.defineProperties(exports, {
|
||||
__esModule: { value: true },
|
||||
[Symbol.toStringTag]: { value: "Module" }
|
||||
});
|
||||
const require_install = require("../../utils/vue/install.js");
|
||||
const require_countdown = require("./src/countdown.js");
|
||||
const require_countdown$1 = require("./src/countdown2.js");
|
||||
//#region ../../packages/components/countdown/index.ts
|
||||
const ElCountdown = require_install.withInstall(require_countdown$1.default);
|
||||
//#endregion
|
||||
exports.ElCountdown = ElCountdown;
|
||||
exports.default = ElCountdown;
|
||||
exports.countdownEmits = require_countdown.countdownEmits;
|
||||
exports.countdownProps = require_countdown.countdownProps;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/element-plus/lib/components/countdown/index.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/components/countdown/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["withInstall","Countdown"],"sources":["../../../../../packages/components/countdown/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Countdown from './src/countdown.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElCountdown: SFCWithInstall<typeof Countdown> =\n withInstall(Countdown)\nexport default ElCountdown\n\nexport * from './src/countdown'\n"],"mappings":";;;;;;;;AAKA,MAAa,cACXA,gBAAAA,YAAYC,oBAAAA,QAAU"}
|
||||
56
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.d.ts
generated
vendored
Normal file
56
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.d.ts
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
import { EpPropFinalized } from "../../../utils/vue/props/types.js";
|
||||
import _default from "./countdown.vue.js";
|
||||
import * as _$vue from "vue";
|
||||
import { ExtractPublicPropTypes, StyleValue } from "vue";
|
||||
import { Dayjs } from "dayjs";
|
||||
|
||||
//#region ../../packages/components/countdown/src/countdown.d.ts
|
||||
interface CountdownProps {
|
||||
/**
|
||||
* @description Formatting the countdown display
|
||||
*/
|
||||
format?: string;
|
||||
/**
|
||||
* @description Sets the prefix of a countdown
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* @description Sets the suffix of a countdown
|
||||
*/
|
||||
suffix?: string;
|
||||
/**
|
||||
* @description countdown titles
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* @description target time
|
||||
*/
|
||||
value?: number | Dayjs;
|
||||
/**
|
||||
* @description Styles countdown values
|
||||
*/
|
||||
valueStyle?: StyleValue;
|
||||
}
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `CountdownProps` instead.
|
||||
*/
|
||||
declare const countdownProps: {
|
||||
readonly format: EpPropFinalized<StringConstructor, unknown, unknown, "HH:mm:ss", boolean>;
|
||||
readonly prefix: StringConstructor;
|
||||
readonly suffix: StringConstructor;
|
||||
readonly title: StringConstructor;
|
||||
readonly value: EpPropFinalized<(new (...args: any[]) => number | Dayjs) | (() => number | Dayjs) | (((new (...args: any[]) => number | Dayjs) | (() => number | Dayjs)) | null)[], unknown, unknown, 0, boolean>;
|
||||
readonly valueStyle: EpPropFinalized<(new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown, undefined, boolean>;
|
||||
};
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `CountdownProps` instead.
|
||||
*/
|
||||
type CountdownPropsPublic = ExtractPublicPropTypes<typeof countdownProps>;
|
||||
declare const countdownEmits: {
|
||||
finish: () => boolean;
|
||||
change: (value: number) => boolean;
|
||||
};
|
||||
type CountdownEmits = typeof countdownEmits;
|
||||
type CountdownInstance = InstanceType<typeof _default> & unknown;
|
||||
//#endregion
|
||||
export { CountdownEmits, CountdownInstance, CountdownProps, CountdownPropsPublic, countdownEmits, countdownProps };
|
||||
57
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.js
generated
vendored
Normal file
57
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const require_event = require("../../../constants/event.js");
|
||||
const require_types = require("../../../utils/types.js");
|
||||
const require_runtime = require("../../../utils/vue/props/runtime.js");
|
||||
//#region ../../packages/components/countdown/src/countdown.ts
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `CountdownProps` instead.
|
||||
*/
|
||||
const countdownProps = require_runtime.buildProps({
|
||||
/**
|
||||
* @description Formatting the countdown display
|
||||
*/
|
||||
format: {
|
||||
type: String,
|
||||
default: "HH:mm:ss"
|
||||
},
|
||||
/**
|
||||
* @description Sets the prefix of a countdown
|
||||
*/
|
||||
prefix: String,
|
||||
/**
|
||||
* @description Sets the suffix of a countdown
|
||||
*/
|
||||
suffix: String,
|
||||
/**
|
||||
* @description countdown titles
|
||||
*/
|
||||
title: String,
|
||||
/**
|
||||
* @description target time
|
||||
*/
|
||||
value: {
|
||||
type: require_runtime.definePropType([Number, Object]),
|
||||
default: 0
|
||||
},
|
||||
/**
|
||||
* @description Styles countdown values
|
||||
*/
|
||||
valueStyle: {
|
||||
type: require_runtime.definePropType([
|
||||
String,
|
||||
Object,
|
||||
Array,
|
||||
Boolean
|
||||
]),
|
||||
default: void 0
|
||||
}
|
||||
});
|
||||
const countdownEmits = {
|
||||
finish: () => true,
|
||||
[require_event.CHANGE_EVENT]: (value) => require_types.isNumber(value)
|
||||
};
|
||||
//#endregion
|
||||
exports.countdownEmits = countdownEmits;
|
||||
exports.countdownProps = countdownProps;
|
||||
|
||||
//# sourceMappingURL=countdown.js.map
|
||||
1
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"countdown.js","names":["buildProps","definePropType","CHANGE_EVENT","isNumber"],"sources":["../../../../../../packages/components/countdown/src/countdown.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\n\nimport type { ExtractPublicPropTypes, StyleValue } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type Countdown from './countdown.vue'\n\nexport interface CountdownProps {\n /**\n * @description Formatting the countdown display\n */\n format?: string\n /**\n * @description Sets the prefix of a countdown\n */\n prefix?: string\n /**\n * @description Sets the suffix of a countdown\n */\n suffix?: string\n /**\n * @description countdown titles\n */\n title?: string\n /**\n * @description target time\n */\n value?: number | Dayjs\n /**\n * @description Styles countdown values\n */\n valueStyle?: StyleValue\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `CountdownProps` instead.\n */\nexport const countdownProps = buildProps({\n /**\n * @description Formatting the countdown display\n */\n format: {\n type: String,\n default: 'HH:mm:ss',\n },\n /**\n * @description Sets the prefix of a countdown\n */\n prefix: String,\n /**\n * @description Sets the suffix of a countdown\n */\n suffix: String,\n /**\n * @description countdown titles\n */\n title: String,\n /**\n * @description target time\n */\n value: {\n type: definePropType<number | Dayjs>([Number, Object]),\n default: 0,\n },\n /**\n * @description Styles countdown values\n */\n valueStyle: {\n type: definePropType<StyleValue>([String, Object, Array, Boolean]),\n default: undefined,\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `CountdownProps` instead.\n */\nexport type CountdownPropsPublic = ExtractPublicPropTypes<typeof countdownProps>\n\nexport const countdownEmits = {\n finish: () => true,\n [CHANGE_EVENT]: (value: number) => isNumber(value),\n}\nexport type CountdownEmits = typeof countdownEmits\n\nexport type CountdownInstance = InstanceType<typeof Countdown> & unknown\n"],"mappings":";;;;;;;;AAqCA,MAAa,iBAAiBA,gBAAAA,WAAW;;;;CAIvC,QAAQ;EACN,MAAM;EACN,SAAS;EACV;;;;CAID,QAAQ;;;;CAIR,QAAQ;;;;CAIR,OAAO;;;;CAIP,OAAO;EACL,MAAMC,gBAAAA,eAA+B,CAAC,QAAQ,OAAO,CAAC;EACtD,SAAS;EACV;;;;CAID,YAAY;EACV,MAAMA,gBAAAA,eAA2B;GAAC;GAAQ;GAAQ;GAAO;GAAQ,CAAC;EAClE,SAAS,KAAA;EACV;CACF,CAAU;AAOX,MAAa,iBAAiB;CAC5B,cAAc;EACbC,cAAAA,gBAAgB,UAAkBC,cAAAA,SAAS,MAAM;CACnD"}
|
||||
32
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.vue.d.ts
generated
vendored
Normal file
32
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.vue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { CountdownProps } from "./countdown.js";
|
||||
import * as _$vue from "vue";
|
||||
import * as _$dayjs from "dayjs";
|
||||
|
||||
//#region ../../packages/components/countdown/src/countdown.vue.d.ts
|
||||
declare var __VLS_10: string, __VLS_11: {};
|
||||
type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any };
|
||||
declare const __VLS_base: _$vue.DefineComponent<CountdownProps, {
|
||||
/**
|
||||
* @description current display value
|
||||
*/
|
||||
displayValue: _$vue.ComputedRef<string>;
|
||||
}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
|
||||
finish: () => void;
|
||||
change: (value: number) => void;
|
||||
}, string, _$vue.PublicProps, Readonly<CountdownProps> & Readonly<{
|
||||
onFinish?: (() => any) | undefined;
|
||||
onChange?: ((value: number) => any) | undefined;
|
||||
}>, {
|
||||
value: number | _$dayjs.Dayjs;
|
||||
format: string;
|
||||
valueStyle: string | false | _$vue.CSSProperties | _$vue.StyleValue[] | null;
|
||||
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
|
||||
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
||||
declare const _default: typeof __VLS_export;
|
||||
type __VLS_WithSlots<T, S> = T & {
|
||||
new (): {
|
||||
$slots: S;
|
||||
};
|
||||
};
|
||||
//#endregion
|
||||
export { _default as default };
|
||||
82
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.vue_vue_type_script_setup_true_lang.js
generated
vendored
Normal file
82
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.vue_vue_type_script_setup_true_lang.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
require("../../../_virtual/_rolldown/runtime.js");
|
||||
const require_event = require("../../../constants/event.js");
|
||||
const require_raf = require("../../../utils/raf.js");
|
||||
const require_countdown = require("./countdown.js");
|
||||
const require_index = require("../../statistic/index.js");
|
||||
const require_utils = require("./utils.js");
|
||||
let vue = require("vue");
|
||||
//#region ../../packages/components/countdown/src/countdown.vue?vue&type=script&setup=true&lang.ts
|
||||
var countdown_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
||||
name: "ElCountdown",
|
||||
__name: "countdown",
|
||||
props: require_countdown.countdownProps,
|
||||
emits: require_countdown.countdownEmits,
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
let timer;
|
||||
const rawValue = (0, vue.ref)(0);
|
||||
const displayValue = (0, vue.computed)(() => require_utils.formatTime(rawValue.value, props.format));
|
||||
const formatter = (val) => require_utils.formatTime(val, props.format);
|
||||
const stopTimer = () => {
|
||||
if (timer) {
|
||||
require_raf.cAF(timer);
|
||||
timer = void 0;
|
||||
}
|
||||
};
|
||||
const startTimer = () => {
|
||||
const timestamp = require_utils.getTime(props.value);
|
||||
const frameFunc = () => {
|
||||
let diff = timestamp - Date.now();
|
||||
emit(require_event.CHANGE_EVENT, diff);
|
||||
if (diff <= 0) {
|
||||
diff = 0;
|
||||
stopTimer();
|
||||
emit("finish");
|
||||
} else timer = require_raf.rAF(frameFunc);
|
||||
rawValue.value = diff;
|
||||
};
|
||||
timer = require_raf.rAF(frameFunc);
|
||||
};
|
||||
(0, vue.onMounted)(() => {
|
||||
rawValue.value = require_utils.getTime(props.value) - Date.now();
|
||||
(0, vue.watch)(() => [props.value, props.format], () => {
|
||||
stopTimer();
|
||||
startTimer();
|
||||
}, { immediate: true });
|
||||
});
|
||||
(0, vue.onBeforeUnmount)(() => {
|
||||
stopTimer();
|
||||
});
|
||||
__expose({
|
||||
/**
|
||||
* @description current display value
|
||||
*/
|
||||
displayValue });
|
||||
return (_ctx, _cache) => {
|
||||
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(require_index.ElStatistic), {
|
||||
value: rawValue.value,
|
||||
title: __props.title,
|
||||
prefix: __props.prefix,
|
||||
suffix: __props.suffix,
|
||||
"value-style": __props.valueStyle,
|
||||
formatter
|
||||
}, (0, vue.createSlots)({ _: 2 }, [(0, vue.renderList)(_ctx.$slots, (_, name) => {
|
||||
return {
|
||||
name,
|
||||
fn: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, name)])
|
||||
};
|
||||
})]), 1032, [
|
||||
"value",
|
||||
"title",
|
||||
"prefix",
|
||||
"suffix",
|
||||
"value-style"
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
exports.default = countdown_vue_vue_type_script_setup_true_lang_default;
|
||||
|
||||
//# sourceMappingURL=countdown.vue_vue_type_script_setup_true_lang.js.map
|
||||
1
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.vue_vue_type_script_setup_true_lang.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/components/countdown/src/countdown.vue_vue_type_script_setup_true_lang.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"countdown.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../../../../packages/components/countdown/src/countdown.vue"],"sourcesContent":["<template>\n <el-statistic\n :value=\"rawValue\"\n :title=\"title\"\n :prefix=\"prefix\"\n :suffix=\"suffix\"\n :value-style=\"valueStyle\"\n :formatter=\"formatter\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]>\n <slot :name=\"name\" />\n </template>\n </el-statistic>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { ElStatistic } from '@element-plus/components/statistic'\nimport { cAF, rAF } from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport { countdownEmits } from './countdown'\nimport { formatTime, getTime } from './utils'\n\nimport type { CountdownProps } from './countdown'\n\ndefineOptions({\n name: 'ElCountdown',\n})\nconst props = withDefaults(defineProps<CountdownProps>(), {\n format: 'HH:mm:ss',\n value: 0,\n valueStyle: undefined,\n})\nconst emit = defineEmits(countdownEmits)\n\nlet timer: ReturnType<typeof rAF> | undefined\nconst rawValue = ref<number>(0)\nconst displayValue = computed(() => formatTime(rawValue.value, props.format))\n\nconst formatter = (val: number) => formatTime(val, props.format)\n\nconst stopTimer = () => {\n if (timer) {\n cAF(timer)\n timer = undefined\n }\n}\n\nconst startTimer = () => {\n const timestamp = getTime(props.value)\n const frameFunc = () => {\n let diff = timestamp - Date.now()\n emit(CHANGE_EVENT, diff)\n if (diff <= 0) {\n diff = 0\n stopTimer()\n emit('finish')\n } else {\n timer = rAF(frameFunc)\n }\n rawValue.value = diff\n }\n timer = rAF(frameFunc)\n}\n\nonMounted(() => {\n rawValue.value = getTime(props.value) - Date.now()\n\n watch(\n () => [props.value, props.format],\n () => {\n stopTimer()\n startTimer()\n },\n {\n immediate: true,\n }\n )\n})\n\nonBeforeUnmount(() => {\n stopTimer()\n})\n\ndefineExpose({\n /**\n * @description current display value\n */\n displayValue,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;EA4BA,MAAM,QAAQ;EAKd,MAAM,OAAO;EAEb,IAAI;EACJ,MAAM,YAAA,GAAA,IAAA,KAAuB,EAAC;EAC9B,MAAM,gBAAA,GAAA,IAAA,gBAA8B,cAAA,WAAW,SAAS,OAAO,MAAM,OAAO,CAAA;EAE5E,MAAM,aAAa,QAAgB,cAAA,WAAW,KAAK,MAAM,OAAM;EAE/D,MAAM,kBAAkB;GACtB,IAAI,OAAO;IACT,YAAA,IAAI,MAAK;IACT,QAAQ,KAAA;;;EAIZ,MAAM,mBAAmB;GACvB,MAAM,YAAY,cAAA,QAAQ,MAAM,MAAK;GACrC,MAAM,kBAAkB;IACtB,IAAI,OAAO,YAAY,KAAK,KAAI;IAChC,KAAK,cAAA,cAAc,KAAI;IACvB,IAAI,QAAQ,GAAG;KACb,OAAO;KACP,WAAU;KACV,KAAK,SAAQ;WAEb,QAAQ,YAAA,IAAI,UAAS;IAEvB,SAAS,QAAQ;;GAEnB,QAAQ,YAAA,IAAI,UAAS;;EAGvB,CAAA,GAAA,IAAA,iBAAgB;GACd,SAAS,QAAQ,cAAA,QAAQ,MAAM,MAAM,GAAG,KAAK,KAAI;GAEjD,CAAA,GAAA,IAAA,aACQ,CAAC,MAAM,OAAO,MAAM,OAAO,QAC3B;IACJ,WAAU;IACV,YAAW;MAEb,EACE,WAAW,MACb,CACF;IACD;EAED,CAAA,GAAA,IAAA,uBAAsB;GACpB,WAAU;IACX;EAED,SAAa;;;;AAIX,cACD,CAAA;;oEA7EgB,cAAA,YAAA,EAAA;IAVZ,OAAO,SAAA;IACP,OAAO,QAAA;IACP,QAAQ,QAAA;IACR,QAAQ,QAAA;IACR,eAAa,QAAA;IACF;0DAEkBA,KAAAA,SAAZ,GAAG,SAAI;;KAAc;gCAChB,EAAA,GAAA,IAAA,YAAA,KAAA,QAAR,KAAI,CAAA,CAAA"}
|
||||
10
frontend/node_modules/element-plus/lib/components/countdown/src/countdown2.js
generated
vendored
Normal file
10
frontend/node_modules/element-plus/lib/components/countdown/src/countdown2.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
Object.defineProperties(exports, {
|
||||
__esModule: { value: true },
|
||||
[Symbol.toStringTag]: { value: "Module" }
|
||||
});
|
||||
//#region ../../packages/components/countdown/src/countdown.vue
|
||||
var countdown_default = require("./countdown.vue_vue_type_script_setup_true_lang.js").default;
|
||||
//#endregion
|
||||
exports.default = countdown_default;
|
||||
|
||||
//# sourceMappingURL=countdown2.js.map
|
||||
1
frontend/node_modules/element-plus/lib/components/countdown/src/countdown2.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/components/countdown/src/countdown2.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"countdown2.js","names":[],"sources":["../../../../../../packages/components/countdown/src/countdown.vue"],"sourcesContent":["<template>\n <el-statistic\n :value=\"rawValue\"\n :title=\"title\"\n :prefix=\"prefix\"\n :suffix=\"suffix\"\n :value-style=\"valueStyle\"\n :formatter=\"formatter\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]>\n <slot :name=\"name\" />\n </template>\n </el-statistic>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { ElStatistic } from '@element-plus/components/statistic'\nimport { cAF, rAF } from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport { countdownEmits } from './countdown'\nimport { formatTime, getTime } from './utils'\n\nimport type { CountdownProps } from './countdown'\n\ndefineOptions({\n name: 'ElCountdown',\n})\nconst props = withDefaults(defineProps<CountdownProps>(), {\n format: 'HH:mm:ss',\n value: 0,\n valueStyle: undefined,\n})\nconst emit = defineEmits(countdownEmits)\n\nlet timer: ReturnType<typeof rAF> | undefined\nconst rawValue = ref<number>(0)\nconst displayValue = computed(() => formatTime(rawValue.value, props.format))\n\nconst formatter = (val: number) => formatTime(val, props.format)\n\nconst stopTimer = () => {\n if (timer) {\n cAF(timer)\n timer = undefined\n }\n}\n\nconst startTimer = () => {\n const timestamp = getTime(props.value)\n const frameFunc = () => {\n let diff = timestamp - Date.now()\n emit(CHANGE_EVENT, diff)\n if (diff <= 0) {\n diff = 0\n stopTimer()\n emit('finish')\n } else {\n timer = rAF(frameFunc)\n }\n rawValue.value = diff\n }\n timer = rAF(frameFunc)\n}\n\nonMounted(() => {\n rawValue.value = getTime(props.value) - Date.now()\n\n watch(\n () => [props.value, props.format],\n () => {\n stopTimer()\n startTimer()\n },\n {\n immediate: true,\n }\n )\n})\n\nonBeforeUnmount(() => {\n stopTimer()\n})\n\ndefineExpose({\n /**\n * @description current display value\n */\n displayValue,\n})\n</script>\n"],"mappings":""}
|
||||
7
frontend/node_modules/element-plus/lib/components/countdown/src/utils.d.ts
generated
vendored
Normal file
7
frontend/node_modules/element-plus/lib/components/countdown/src/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Dayjs } from "dayjs";
|
||||
|
||||
//#region ../../packages/components/countdown/src/utils.d.ts
|
||||
declare const getTime: (value: number | Dayjs) => number;
|
||||
declare const formatTime: (timestamp: number, format: string) => string;
|
||||
//#endregion
|
||||
export { formatTime, getTime };
|
||||
32
frontend/node_modules/element-plus/lib/components/countdown/src/utils.js
generated
vendored
Normal file
32
frontend/node_modules/element-plus/lib/components/countdown/src/utils.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const require_types = require("../../../utils/types.js");
|
||||
//#region ../../packages/components/countdown/src/utils.ts
|
||||
const timeUnits = [
|
||||
["Y", 1e3 * 60 * 60 * 24 * 365],
|
||||
["M", 1e3 * 60 * 60 * 24 * 30],
|
||||
["D", 1e3 * 60 * 60 * 24],
|
||||
["H", 1e3 * 60 * 60],
|
||||
["m", 1e3 * 60],
|
||||
["s", 1e3],
|
||||
["S", 1]
|
||||
];
|
||||
const getTime = (value) => {
|
||||
return require_types.isNumber(value) ? new Date(value).getTime() : value.valueOf();
|
||||
};
|
||||
const formatTime = (timestamp, format) => {
|
||||
let timeLeft = timestamp;
|
||||
return timeUnits.reduce((current, [name, unit]) => {
|
||||
const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
|
||||
if (replaceRegex.test(current)) {
|
||||
const value = Math.floor(timeLeft / unit);
|
||||
timeLeft -= value * unit;
|
||||
return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
|
||||
}
|
||||
return current;
|
||||
}, format).replace(/\[([^\]]*)]/g, "$1");
|
||||
};
|
||||
//#endregion
|
||||
exports.formatTime = formatTime;
|
||||
exports.getTime = getTime;
|
||||
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
frontend/node_modules/element-plus/lib/components/countdown/src/utils.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/components/countdown/src/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","names":["isNumber"],"sources":["../../../../../../packages/components/countdown/src/utils.ts"],"sourcesContent":["import { isNumber } from '@element-plus/utils'\n\nimport type { Dayjs } from 'dayjs'\n\nconst timeUnits = [\n ['Y', 1000 * 60 * 60 * 24 * 365], // years\n ['M', 1000 * 60 * 60 * 24 * 30], // months\n ['D', 1000 * 60 * 60 * 24], // days\n ['H', 1000 * 60 * 60], // hours\n ['m', 1000 * 60], // minutes\n ['s', 1000], // seconds\n ['S', 1], // million seconds\n] as const\n\nexport const getTime = (value: number | Dayjs) => {\n return isNumber(value) ? new Date(value).getTime() : value.valueOf()\n}\n\nexport const formatTime = (timestamp: number, format: string) => {\n let timeLeft = timestamp\n const escapeRegex = /\\[([^\\]]*)]/g\n\n const replacedText = timeUnits.reduce((current, [name, unit]) => {\n const replaceRegex = new RegExp(`${name}+(?![^\\\\[\\\\]]*\\\\])`, 'g')\n if (replaceRegex.test(current)) {\n const value = Math.floor(timeLeft / unit)\n timeLeft -= value * unit\n return current.replace(replaceRegex, (match) =>\n String(value).padStart(match.length, '0')\n )\n }\n return current\n }, format)\n\n return replacedText.replace(escapeRegex, '$1')\n}\n"],"mappings":";;;AAIA,MAAM,YAAY;CAChB,CAAC,KAAK,MAAO,KAAK,KAAK,KAAK,IAAI;CAChC,CAAC,KAAK,MAAO,KAAK,KAAK,KAAK,GAAG;CAC/B,CAAC,KAAK,MAAO,KAAK,KAAK,GAAG;CAC1B,CAAC,KAAK,MAAO,KAAK,GAAG;CACrB,CAAC,KAAK,MAAO,GAAG;CAChB,CAAC,KAAK,IAAK;CACX,CAAC,KAAK,EAAE;CACT;AAED,MAAa,WAAW,UAA0B;CAChD,OAAOA,cAAAA,SAAS,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,SAAS,GAAG,MAAM,SAAS;;AAGtE,MAAa,cAAc,WAAmB,WAAmB;CAC/D,IAAI,WAAW;CAef,OAZqB,UAAU,QAAQ,SAAS,CAAC,MAAM,UAAU;EAC/D,MAAM,eAAe,IAAI,OAAO,GAAG,KAAK,qBAAqB,IAAI;EACjE,IAAI,aAAa,KAAK,QAAQ,EAAE;GAC9B,MAAM,QAAQ,KAAK,MAAM,WAAW,KAAK;GACzC,YAAY,QAAQ;GACpB,OAAO,QAAQ,QAAQ,eAAe,UACpC,OAAO,MAAM,CAAC,SAAS,MAAM,QAAQ,IAAI,CAC1C;;EAEH,OAAO;IACN,OAEgB,CAAC,QAAQ,gBAAa,KAAK"}
|
||||
3
frontend/node_modules/element-plus/lib/components/countdown/style/css.js
generated
vendored
Normal file
3
frontend/node_modules/element-plus/lib/components/countdown/style/css.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
require("../../base/style/css.js");
|
||||
require("element-plus/theme-chalk/el-statistic.css");
|
||||
3
frontend/node_modules/element-plus/lib/components/countdown/style/index.js
generated
vendored
Normal file
3
frontend/node_modules/element-plus/lib/components/countdown/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
require("../../base/style/index.js");
|
||||
require("element-plus/theme-chalk/src/statistic.scss");
|
||||
Reference in New Issue
Block a user