feat: initial commit - Phase 1 & 2 core features

This commit is contained in:
hiderfong
2026-04-22 17:07:33 +08:00
commit 1773bda06b
25005 changed files with 6252106 additions and 0 deletions
@@ -0,0 +1,9 @@
import { SFCWithInstall } from "../../utils/vue/typescript.js";
import "../../utils/index.js";
import { StatisticInstance, StatisticProps, StatisticPropsPublic, statisticProps } from "./src/statistic.js";
import { _default } from "./src/statistic.vue.js";
//#region ../../packages/components/statistic/index.d.ts
declare const ElStatistic: SFCWithInstall<typeof _default>;
//#endregion
export { ElStatistic, ElStatistic as default, StatisticInstance, StatisticProps, StatisticPropsPublic, statisticProps };
+13
View File
@@ -0,0 +1,13 @@
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const require_install = require('../../utils/vue/install.js');
const require_statistic = require('./src/statistic.js');
const require_statistic$1 = require('./src/statistic2.js');
//#region ../../packages/components/statistic/index.ts
const ElStatistic = require_install.withInstall(require_statistic$1.default);
//#endregion
exports.ElStatistic = ElStatistic;
exports.default = ElStatistic;
exports.statisticProps = require_statistic.statisticProps;
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["withInstall","Statistic"],"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"],"mappings":";;;;;;AAKA,MAAa,cACXA,4BAAYC,4BAAU"}
@@ -0,0 +1,72 @@
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import "../../../utils/index.js";
import { _default } from "./statistic.vue.js";
import * as vue from "vue";
import { ExtractPublicPropTypes, StyleValue } from "vue";
import { Dayjs } from "dayjs";
//#region ../../packages/components/statistic/src/statistic.d.ts
interface StatisticProps {
/**
* @description Setting the decimal point
*/
decimalSeparator?: string;
/**
* @description Sets the thousandth identifier
*/
groupSeparator?: string;
/**
* @description numerical precision
*/
precision?: number;
/**
* @description Custom numerical presentation
*/
formatter?: (...args: any[]) => string | number;
/**
* @description Numerical content
*/
value?: number | Dayjs;
/**
* @description Sets the prefix of a number
*/
prefix?: string;
/**
* @description Sets the suffix of a number
*/
suffix?: string;
/**
* @description Numeric titles
*/
title?: string;
/**
* @description Styles numeric values
*/
valueStyle?: StyleValue;
}
/**
* @deprecated Removed after 3.0.0, Use `StatisticProps` instead.
*/
declare const statisticProps: {
readonly decimalSeparator: EpPropFinalized<StringConstructor, unknown, unknown, ".", boolean>;
readonly groupSeparator: EpPropFinalized<StringConstructor, unknown, unknown, ",", boolean>;
readonly precision: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly formatter: FunctionConstructor;
readonly value: EpPropFinalized<(new (...args: any[]) => number | Dayjs) | (() => number | Dayjs) | (((new (...args: any[]) => number | Dayjs) | (() => number | Dayjs)) | null)[], unknown, unknown, 0, boolean>;
readonly prefix: StringConstructor;
readonly suffix: StringConstructor;
readonly title: StringConstructor;
readonly valueStyle: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | false | vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
/**
* @deprecated Removed after 3.0.0, Use `StatisticProps` instead.
*/
type StatisticPropsPublic = ExtractPublicPropTypes<typeof statisticProps>;
type StatisticInstance = InstanceType<typeof _default> & unknown;
//#endregion
export { StatisticInstance, StatisticProps, StatisticPropsPublic, statisticProps };
@@ -0,0 +1,38 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../../../utils/vue/props/runtime.js');
//#region ../../packages/components/statistic/src/statistic.ts
/**
* @deprecated Removed after 3.0.0, Use `StatisticProps` instead.
*/
const statisticProps = require_runtime.buildProps({
decimalSeparator: {
type: String,
default: "."
},
groupSeparator: {
type: String,
default: ","
},
precision: {
type: Number,
default: 0
},
formatter: Function,
value: {
type: require_runtime.definePropType([Number, Object]),
default: 0
},
prefix: String,
suffix: String,
title: String,
valueStyle: { type: require_runtime.definePropType([
String,
Object,
Array
]) }
});
//#endregion
exports.statisticProps = statisticProps;
//# sourceMappingURL=statistic.js.map
@@ -0,0 +1 @@
{"version":3,"file":"statistic.js","names":["buildProps","definePropType"],"sources":["../../../../../../packages/components/statistic/src/statistic.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes, StyleValue } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type Statistic from './statistic.vue'\n\nexport interface StatisticProps {\n /**\n * @description Setting the decimal point\n */\n decimalSeparator?: string\n /**\n * @description Sets the thousandth identifier\n */\n groupSeparator?: string\n /**\n * @description numerical precision\n */\n precision?: number\n /**\n * @description Custom numerical presentation\n */\n formatter?: (...args: any[]) => string | number\n /**\n * @description Numerical content\n */\n value?: number | Dayjs\n /**\n * @description Sets the prefix of a number\n */\n prefix?: string\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?: StyleValue\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `StatisticProps` instead.\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)\n\n/**\n * @deprecated Removed after 3.0.0, Use `StatisticProps` instead.\n */\nexport type StatisticPropsPublic = ExtractPublicPropTypes<typeof statisticProps>\n\nexport type StatisticInstance = InstanceType<typeof Statistic> & unknown\n"],"mappings":";;;;;;;AAgDA,MAAa,iBAAiBA,2BAAW;CAIvC,kBAAkB;EAChB,MAAM;EACN,SAAS;EACV;CAID,gBAAgB;EACd,MAAM;EACN,SAAS;EACV;CAID,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,WAAW;CAIX,OAAO;EACL,MAAMC,+BAA+B,CAAC,QAAQ,OAAO,CAAC;EACtD,SAAS;EACV;CAID,QAAQ;CAKR,QAAQ;CAIR,OAAO;CAIP,YAAY,EACV,MAAMA,+BAA2B;EAAC;EAAQ;EAAQ;EAAM,CAAC,EAC1D;CACF,CAAU"}
@@ -0,0 +1,34 @@
import { StatisticProps } from "./statistic.js";
import * as vue from "vue";
import * as dayjs$1 from "dayjs";
//#region ../../packages/components/statistic/src/statistic.vue.d.ts
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
type __VLS_Slots = {} & {
title?: (props: typeof __VLS_1) => any;
} & {
prefix?: (props: typeof __VLS_3) => any;
} & {
suffix?: (props: typeof __VLS_5) => any;
};
declare const __VLS_base: vue.DefineComponent<StatisticProps, {
/**
* @description current display value
*/
displayValue: vue.ComputedRef<string | number | dayjs$1.Dayjs>;
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<StatisticProps> & Readonly<{}>, {
value: number | dayjs$1.Dayjs;
precision: number;
decimalSeparator: string;
groupSeparator: 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 };
@@ -0,0 +1,50 @@
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
const require_types = require('../../../utils/types.js');
const require_index = require('../../../hooks/use-namespace/index.js');
const require_statistic = require('./statistic.js');
let vue = require("vue");
let _vue_shared = require("@vue/shared");
//#region ../../packages/components/statistic/src/statistic.vue?vue&type=script&setup=true&lang.ts
var statistic_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
name: "ElStatistic",
__name: "statistic",
props: require_statistic.statisticProps,
setup(__props, { expose: __expose }) {
const props = __props;
const ns = require_index.useNamespace("statistic");
const displayValue = (0, vue.computed)(() => {
const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
if ((0, _vue_shared.isFunction)(formatter)) return formatter(value);
if (!require_types.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 (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)((0, vue.unref)(ns).b()) }, [_ctx.$slots.title || __props.title ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
key: 0,
class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("head"))
}, [(0, vue.renderSlot)(_ctx.$slots, "title", {}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.title), 1)])], 2)) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("content")) }, [
_ctx.$slots.prefix || __props.prefix ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
key: 0,
class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("prefix"))
}, [(0, vue.renderSlot)(_ctx.$slots, "prefix", {}, () => [(0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(__props.prefix), 1)])], 2)) : (0, vue.createCommentVNode)("v-if", true),
(0, vue.createElementVNode)("span", {
class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("number")),
style: (0, vue.normalizeStyle)(__props.valueStyle)
}, (0, vue.toDisplayString)(displayValue.value), 7),
_ctx.$slots.suffix || __props.suffix ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
key: 1,
class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("suffix"))
}, [(0, vue.renderSlot)(_ctx.$slots, "suffix", {}, () => [(0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(__props.suffix), 1)])], 2)) : (0, vue.createCommentVNode)("v-if", true)
], 2)], 2);
};
}
});
//#endregion
exports.default = statistic_vue_vue_type_script_setup_true_lang_default;
//# sourceMappingURL=statistic.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
{"version":3,"file":"statistic.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"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'\n\nimport type { StatisticProps } from './statistic'\n\ndefineOptions({\n name: 'ElStatistic',\n})\n\nconst props = withDefaults(defineProps<StatisticProps>(), {\n decimalSeparator: '.',\n groupSeparator: ',',\n precision: 0,\n value: 0,\n valueStyle: undefined,\n})\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"],"mappings":";;;;;;;;;;;;;EAoCA,MAAM,QAAQ;EAOd,MAAM,KAAK,2BAAa,YAAW;EAEnC,MAAM,uCAA8B;GAClC,MAAM,EAAE,OAAO,WAAW,WAAW,kBAAkB,mBACrD;AAEF,mCAAe,UAAU,CAAE,QAAO,UAAU,MAAK;AAGjD,OAAI,CAAC,uBAAS,MAAM,IAAI,OAAO,MAAM,MAAM,CAAE,QAAO;GAEpD,IAAI,CAAC,SAAS,UAAU,MAAM,OAAO,MAAM,CAAC,MAAM,IAAG;AACrD,aAAU,QACP,OAAO,WAAW,IAAG,CACrB,MAAM,GAAG,YAAY,IAAI,YAAY,EAAC;AACzC,aAAU,QAAQ,QAAQ,yBAAyB,eAAc;AACjE,UAAO,CAAC,SAAS,QAAQ,CAAC,KAAK,UAAU,mBAAmB,GAAE;IAC/D;AAED,WAAa,EAIX,cACD,CAAA;;4DA7CO,OAAA,EArBA,8CAAO,GAAE,CAAC,GAAC,CAAA,KACJA,KAAAA,OAAO,SAAS,QAAA,2DAIrB,OAAA;;IAJ6B,8CAAO,GAAE,CAAC,EAAC,OAAA,CAAA;2BAGrC,KAAA,QAAA,SAAA,EAAA,QAAA,mDADF,QAAA,MAAK,EAAA,EAAA,kFAiBN,OAAA,EAdA,8CAAO,GAAE,CAAC,EAAC,UAAA,CAAA;IACJA,KAAAA,OAAO,UAAU,QAAA,4DAItB,OAAA;;KAJ+B,8CAAO,GAAE,CAAC,EAAC,SAAA,CAAA;4BAGvC,KAAA,QAAA,UAAA,EAAA,QAAA,6BADoB,QAAA,+BAAhB,QAAA,OAAM,EAAA,EAAA;gCAKZ,QAAA;KAFA,8CAAO,GAAE,CAAC,EAAC,SAAA,CAAA;KAAa,+BAAO,QAAA,WAAU;gCAC3C,aAAA,MAAY,EAAA,EAAA;IAENA,KAAAA,OAAO,UAAU,QAAA,4DAItB,OAAA;;KAJ+B,8CAAO,GAAE,CAAC,EAAC,SAAA,CAAA;4BAGvC,KAAA,QAAA,UAAA,EAAA,QAAA,6BADoB,QAAA,+BAAhB,QAAA,OAAM,EAAA,EAAA"}
@@ -0,0 +1,9 @@
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const require_statistic_vue_vue_type_script_setup_true_lang = require('./statistic.vue_vue_type_script_setup_true_lang.js');
//#region ../../packages/components/statistic/src/statistic.vue
var statistic_default = require_statistic_vue_vue_type_script_setup_true_lang.default;
//#endregion
exports.default = statistic_default;
//# sourceMappingURL=statistic2.js.map
@@ -0,0 +1 @@
{"version":3,"file":"statistic2.js","names":[],"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'\n\nimport type { StatisticProps } from './statistic'\n\ndefineOptions({\n name: 'ElStatistic',\n})\n\nconst props = withDefaults(defineProps<StatisticProps>(), {\n decimalSeparator: '.',\n groupSeparator: ',',\n precision: 0,\n value: 0,\n valueStyle: undefined,\n})\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"],"mappings":""}
@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
require('../../base/style/css.js');
require("element-plus/theme-chalk/el-statistic.css");
@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
require('../../base/style/index.js');
require("element-plus/theme-chalk/src/statistic.scss");