This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import Statistic from './src/statistic.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElStatistic: SFCWithInstall<typeof Statistic>;
export default ElStatistic;
export * from './src/statistic';

View File

@@ -0,0 +1,8 @@
import Statistic from './src/statistic2.mjs';
export { statisticProps } from './src/statistic.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElStatistic = withInstall(Statistic);
export { ElStatistic, ElStatistic as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/statistic/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Statistic from './src/statistic.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElStatistic: SFCWithInstall<typeof Statistic> =\n withInstall(Statistic)\n\nexport default ElStatistic\nexport * from './src/statistic'\n"],"names":[],"mappings":";;;;AAEY,MAAC,WAAW,GAAG,WAAW,CAAC,SAAS;;;;"}

View File

@@ -0,0 +1,22 @@
import type { ExtractPropTypes, StyleValue, __ExtractPublicPropTypes } from 'vue';
import type { Dayjs } from 'dayjs';
import type Statistic from './statistic.vue';
export declare const statisticProps: {
readonly decimalSeparator: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, ".", boolean>;
readonly groupSeparator: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, ",", boolean>;
readonly precision: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly formatter: FunctionConstructor;
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number | Dayjs) | (() => number | Dayjs) | ((new (...args: any[]) => number | Dayjs) | (() => number | Dayjs))[], unknown, unknown, 0, boolean>;
readonly prefix: StringConstructor;
readonly suffix: StringConstructor;
readonly title: StringConstructor;
readonly valueStyle: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | import("vue").CSSProperties | StyleValue[]) | (() => StyleValue) | ((new (...args: any[]) => string | import("vue").CSSProperties | StyleValue[]) | (() => StyleValue))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export type StatisticProps = ExtractPropTypes<typeof statisticProps>;
export type StatisticPropsPublic = __ExtractPublicPropTypes<typeof statisticProps>;
export type StatisticInstance = InstanceType<typeof Statistic> & unknown;

View File

@@ -0,0 +1,30 @@
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
const statisticProps = buildProps({
decimalSeparator: {
type: String,
default: "."
},
groupSeparator: {
type: String,
default: ","
},
precision: {
type: Number,
default: 0
},
formatter: Function,
value: {
type: definePropType([Number, Object]),
default: 0
},
prefix: String,
suffix: String,
title: String,
valueStyle: {
type: definePropType([String, Object, Array])
}
});
export { statisticProps };
//# sourceMappingURL=statistic.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"statistic.mjs","sources":["../../../../../../packages/components/statistic/src/statistic.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type {\n ExtractPropTypes,\n StyleValue,\n __ExtractPublicPropTypes,\n} from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type Statistic from './statistic.vue'\n\nexport const statisticProps = buildProps({\n /**\n * @description Setting the decimal point\n */\n decimalSeparator: {\n type: String,\n default: '.',\n },\n /**\n * @description Sets the thousandth identifier\n */\n groupSeparator: {\n type: String,\n default: ',',\n },\n /**\n * @description numerical precision\n */\n precision: {\n type: Number,\n default: 0,\n },\n /**\n * @description Custom numerical presentation\n */\n formatter: Function,\n /**\n * @description Numerical content\n */\n value: {\n type: definePropType<number | Dayjs>([Number, Object]),\n default: 0,\n },\n /**\n * @description Sets the prefix of a number\n */\n prefix: String,\n\n /**\n * @description Sets the suffix of a number\n */\n suffix: String,\n /**\n * @description Numeric titles\n */\n title: String,\n /**\n * @description Styles numeric values\n */\n valueStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n },\n} as const)\nexport type StatisticProps = ExtractPropTypes<typeof statisticProps>\nexport type StatisticPropsPublic = __ExtractPublicPropTypes<\n typeof statisticProps\n>\n\nexport type StatisticInstance = InstanceType<typeof Statistic> & unknown\n"],"names":[],"mappings":";;AACY,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,gBAAgB,EAAE;AACpB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,cAAc,EAAE;AAClB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,SAAS,EAAE,QAAQ;AACrB,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,GAAG;AACH,CAAC;;;;"}

View File

@@ -0,0 +1,53 @@
declare function __VLS_template(): {
title?(_: {}): any;
prefix?(_: {}): any;
suffix?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly decimalSeparator: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, ".", boolean>;
readonly groupSeparator: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, ",", boolean>;
readonly precision: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly formatter: FunctionConstructor;
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number | import("dayjs").Dayjs) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => number | import("dayjs").Dayjs) | (() => number | import("dayjs").Dayjs))[], unknown, unknown, 0, boolean>;
readonly prefix: StringConstructor;
readonly suffix: StringConstructor;
readonly title: StringConstructor;
readonly valueStyle: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | import("vue").CSSProperties | import("vue").StyleValue[]) | (() => import("vue").StyleValue) | ((new (...args: any[]) => string | import("vue").CSSProperties | import("vue").StyleValue[]) | (() => import("vue").StyleValue))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}, {
/**
* @description current display value
*/
displayValue: import("vue").ComputedRef<any>;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly decimalSeparator: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, ".", boolean>;
readonly groupSeparator: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, ",", boolean>;
readonly precision: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly formatter: FunctionConstructor;
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number | import("dayjs").Dayjs) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => number | import("dayjs").Dayjs) | (() => number | import("dayjs").Dayjs))[], unknown, unknown, 0, boolean>;
readonly prefix: StringConstructor;
readonly suffix: StringConstructor;
readonly title: StringConstructor;
readonly valueStyle: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | import("vue").CSSProperties | import("vue").StyleValue[]) | (() => import("vue").StyleValue) | ((new (...args: any[]) => string | import("vue").CSSProperties | import("vue").StyleValue[]) | (() => import("vue").StyleValue))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}>>, {
readonly value: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => number | import("dayjs").Dayjs) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => number | import("dayjs").Dayjs) | (() => number | import("dayjs").Dayjs))[], unknown, unknown>;
readonly decimalSeparator: string;
readonly groupSeparator: string;
readonly precision: number;
}>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};

View File

@@ -0,0 +1,74 @@
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, normalizeStyle } from 'vue';
import { statisticProps } from './statistic.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { isFunction } from '@vue/shared';
import { isNumber } from '../../../utils/types.mjs';
const __default__ = defineComponent({
name: "ElStatistic"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: statisticProps,
setup(__props, { expose }) {
const props = __props;
const ns = useNamespace("statistic");
const displayValue = computed(() => {
const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
if (isFunction(formatter))
return formatter(value);
if (!isNumber(value) || Number.isNaN(value))
return value;
let [integer, decimal = ""] = String(value).split(".");
decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
return [integer, decimal].join(decimal ? decimalSeparator : "");
});
expose({
displayValue
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(ns).b())
}, [
_ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).e("head"))
}, [
renderSlot(_ctx.$slots, "title", {}, () => [
createTextVNode(toDisplayString(_ctx.title), 1)
])
], 2)) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(ns).e("content"))
}, [
_ctx.$slots.prefix || _ctx.prefix ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).e("prefix"))
}, [
renderSlot(_ctx.$slots, "prefix", {}, () => [
createElementVNode("span", null, toDisplayString(_ctx.prefix), 1)
])
], 2)) : createCommentVNode("v-if", true),
createElementVNode("span", {
class: normalizeClass(unref(ns).e("number")),
style: normalizeStyle(_ctx.valueStyle)
}, toDisplayString(unref(displayValue)), 7),
_ctx.$slots.suffix || _ctx.suffix ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(ns).e("suffix"))
}, [
renderSlot(_ctx.$slots, "suffix", {}, () => [
createElementVNode("span", null, toDisplayString(_ctx.suffix), 1)
])
], 2)) : createCommentVNode("v-if", true)
], 2)
], 2);
};
}
});
var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "statistic.vue"]]);
export { Statistic as default };
//# sourceMappingURL=statistic2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"statistic2.mjs","sources":["../../../../../../packages/components/statistic/src/statistic.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <div v-if=\"$slots.title || title\" :class=\"ns.e('head')\">\n <slot name=\"title\">\n {{ title }}\n </slot>\n </div>\n <div :class=\"ns.e('content')\">\n <div v-if=\"$slots.prefix || prefix\" :class=\"ns.e('prefix')\">\n <slot name=\"prefix\">\n <span>{{ prefix }}</span>\n </slot>\n </div>\n <span :class=\"ns.e('number')\" :style=\"valueStyle\">\n {{ displayValue }}\n </span>\n <div v-if=\"$slots.suffix || suffix\" :class=\"ns.e('suffix')\">\n <slot name=\"suffix\">\n <span>{{ suffix }}</span>\n </slot>\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { isFunction, isNumber } from '@element-plus/utils'\nimport { statisticProps } from './statistic'\n\ndefineOptions({\n name: 'ElStatistic',\n})\n\nconst props = defineProps(statisticProps)\nconst ns = useNamespace('statistic')\n\nconst displayValue = computed(() => {\n const { value, formatter, precision, decimalSeparator, groupSeparator } =\n props\n\n if (isFunction(formatter)) return formatter(value)\n\n // https://github.com/element-plus/element-plus/issues/17784\n if (!isNumber(value) || Number.isNaN(value)) return value\n\n let [integer, decimal = ''] = String(value).split('.')\n decimal = decimal\n .padEnd(precision, '0')\n .slice(0, precision > 0 ? precision : 0)\n integer = integer.replace(/\\B(?=(\\d{3})+(?!\\d))/g, groupSeparator)\n return [integer, decimal].join(decimal ? decimalSeparator : '')\n})\n\ndefineExpose({\n /**\n * @description current display value\n */\n displayValue,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;mCA+Bc,CAAA;AAAA,EACZ,IAAM,EAAA,aAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAGA,IAAM,MAAA,EAAA,GAAK,aAAa,WAAW,CAAA,CAAA;AAEnC,IAAM,MAAA,YAAA,GAAe,SAAS,MAAM;AAClC,MAAA,MAAM,EAAE,KAAO,EAAA,SAAA,EAAW,SAAW,EAAA,gBAAA,EAAkB,gBACrD,GAAA,KAAA,CAAA;AAEF,MAAA,IAAI,UAAW,CAAA,SAAS,CAAG;AAG3B,QAAI,gBAAe,CAAA,KAAK;AAExB,MAAI,IAAA,CAAC,SAAS,KAAU,CAAA,IAAA,MAAM,CAAO,KAAA,CAAA,KAAK,CAAE;AAC5C,QAAU,OAAA,KAAA,CAAA;AAGV,MAAU,IAAA,CAAA,OAAA,EAAA,OAAgB,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA,KAAA,CAAA,CAAA,KAAA,CAAA,GAAuC,CAAA,CAAA;AACjE,MAAA,OAAO,GAAU,OAAA,CAAA,MAAO,UAAO,EAAA,GAAA,CAAA,CAAU,qBAAqB,CAAA,GAAA,SAAA,GAAA,CAAA,CAAA,CAAA;AAAA,MAC/D,OAAA,GAAA,OAAA,CAAA,OAAA,CAAA,uBAAA,EAAA,cAAA,CAAA,CAAA;AAED,MAAa,OAAA,CAAA,OAAA,EAAA,OAAA,CAAA,CAAA,IAAA,CAAA,OAAA,GAAA,gBAAA,GAAA,EAAA,CAAA,CAAA;AAAA,KAAA,CAAA,CAAA;AAAA,IAAA,MAAA,CAAA;AAAA,MAAA,YAAA;AAAA,KAIX,CAAA,CAAA;AAAA,IACF,OAAC,CAAA,IAAA,EAAA,MAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,2 @@
import 'element-plus/es/components/base/style/css';
import 'element-plus/theme-chalk/el-statistic.css';

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-statistic.css';
//# sourceMappingURL=css.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}

View File

@@ -0,0 +1,2 @@
import 'element-plus/es/components/base/style';
import 'element-plus/theme-chalk/src/statistic.scss';

View File

@@ -0,0 +1,3 @@
import '../../base/style/index.mjs';
import 'element-plus/theme-chalk/src/statistic.scss';
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}