first commit
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
import { SFCWithInstall } from "../../utils/vue/typescript.js";
|
||||
import "../../utils/index.js";
|
||||
import { BadgeProps, BadgePropsPublic, badgeProps } from "./src/badge.js";
|
||||
import { _default } from "./src/badge.vue.js";
|
||||
import { BadgeInstance } from "./src/instance.js";
|
||||
|
||||
//#region ../../packages/components/badge/index.d.ts
|
||||
declare const ElBadge: SFCWithInstall<typeof _default>;
|
||||
//#endregion
|
||||
export { type BadgeInstance, BadgeProps, BadgePropsPublic, ElBadge, ElBadge as default, badgeProps };
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
||||
const require_install = require('../../utils/vue/install.js');
|
||||
const require_badge = require('./src/badge.js');
|
||||
const require_badge$1 = require('./src/badge2.js');
|
||||
|
||||
//#region ../../packages/components/badge/index.ts
|
||||
const ElBadge = require_install.withInstall(require_badge$1.default);
|
||||
|
||||
//#endregion
|
||||
exports.ElBadge = ElBadge;
|
||||
exports.default = ElBadge;
|
||||
exports.badgeProps = require_badge.badgeProps;
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["withInstall","Badge"],"sources":["../../../../../packages/components/badge/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Badge from './src/badge.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElBadge: SFCWithInstall<typeof Badge> = withInstall(Badge)\nexport default ElBadge\n\nexport * from './src/badge'\nexport type { BadgeInstance } from './src/instance'\n"],"mappings":";;;;;;AAKA,MAAa,UAAwCA,4BAAYC,wBAAM"}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
|
||||
import "../../../utils/index.js";
|
||||
import * as vue from "vue";
|
||||
import { ExtractPublicPropTypes, StyleValue } from "vue";
|
||||
|
||||
//#region ../../packages/components/badge/src/badge.d.ts
|
||||
interface BadgeProps {
|
||||
/**
|
||||
* @description display value.
|
||||
*/
|
||||
value?: string | number;
|
||||
/**
|
||||
* @description maximum value, shows `{max}+` when exceeded. Only works if value is a number.
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* @description if a little dot is displayed.
|
||||
*/
|
||||
isDot?: boolean;
|
||||
/**
|
||||
* @description hidden badge.
|
||||
*/
|
||||
hidden?: boolean;
|
||||
/**
|
||||
* @description badge type.
|
||||
*/
|
||||
type?: 'primary' | 'success' | 'warning' | 'info' | 'danger';
|
||||
/**
|
||||
* @description whether to show badge when value is zero.
|
||||
*/
|
||||
showZero?: boolean;
|
||||
/**
|
||||
* @description customize dot background color
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* @description CSS style of badge
|
||||
*/
|
||||
badgeStyle?: StyleValue;
|
||||
/**
|
||||
* @description set offset of the badge
|
||||
*/
|
||||
offset?: [number, number];
|
||||
/**
|
||||
* @description custom class name of badge
|
||||
*/
|
||||
badgeClass?: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `BadgeProps` instead.
|
||||
*/
|
||||
declare const badgeProps: {
|
||||
readonly value: EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
||||
readonly max: EpPropFinalized<NumberConstructor, unknown, unknown, 99, boolean>;
|
||||
readonly isDot: BooleanConstructor;
|
||||
readonly hidden: BooleanConstructor;
|
||||
readonly type: EpPropFinalized<StringConstructor, "info" | "primary" | "success" | "warning" | "danger", unknown, "danger", boolean>;
|
||||
readonly showZero: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
||||
readonly color: StringConstructor;
|
||||
readonly badgeStyle: {
|
||||
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;
|
||||
};
|
||||
readonly offset: EpPropFinalized<(new (...args: any[]) => [number, number]) | (() => [number, number]) | (((new (...args: any[]) => [number, number]) | (() => [number, number])) | null)[], unknown, unknown, () => number[], boolean>;
|
||||
readonly badgeClass: {
|
||||
readonly type: vue.PropType<string>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `BadgeProps` instead.
|
||||
*/
|
||||
type BadgePropsPublic = ExtractPublicPropTypes<typeof badgeProps>;
|
||||
//#endregion
|
||||
export { BadgeProps, BadgePropsPublic, badgeProps };
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
const require_runtime = require('../../../utils/vue/props/runtime.js');
|
||||
|
||||
//#region ../../packages/components/badge/src/badge.ts
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `BadgeProps` instead.
|
||||
*/
|
||||
const badgeProps = require_runtime.buildProps({
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
default: 99
|
||||
},
|
||||
isDot: Boolean,
|
||||
hidden: Boolean,
|
||||
type: {
|
||||
type: String,
|
||||
values: [
|
||||
"primary",
|
||||
"success",
|
||||
"warning",
|
||||
"info",
|
||||
"danger"
|
||||
],
|
||||
default: "danger"
|
||||
},
|
||||
showZero: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
color: String,
|
||||
badgeStyle: { type: require_runtime.definePropType([
|
||||
String,
|
||||
Object,
|
||||
Array
|
||||
]) },
|
||||
offset: {
|
||||
type: require_runtime.definePropType(Array),
|
||||
default: () => [0, 0]
|
||||
},
|
||||
badgeClass: { type: String }
|
||||
});
|
||||
|
||||
//#endregion
|
||||
exports.badgeProps = badgeProps;
|
||||
//# sourceMappingURL=badge.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"badge.js","names":["buildProps","definePropType"],"sources":["../../../../../../packages/components/badge/src/badge.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes, StyleValue } from 'vue'\n\nexport interface BadgeProps {\n /**\n * @description display value.\n */\n value?: string | number\n /**\n * @description maximum value, shows `{max}+` when exceeded. Only works if value is a number.\n */\n max?: number\n /**\n * @description if a little dot is displayed.\n */\n isDot?: boolean\n /**\n * @description hidden badge.\n */\n hidden?: boolean\n /**\n * @description badge type.\n */\n type?: 'primary' | 'success' | 'warning' | 'info' | 'danger'\n /**\n * @description whether to show badge when value is zero.\n */\n showZero?: boolean\n /**\n * @description customize dot background color\n */\n color?: string\n /**\n * @description CSS style of badge\n */\n badgeStyle?: StyleValue\n /**\n * @description set offset of the badge\n */\n offset?: [number, number]\n /**\n * @description custom class name of badge\n */\n badgeClass?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `BadgeProps` instead.\n */\nexport const badgeProps = buildProps({\n /**\n * @description display value.\n */\n value: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description maximum value, shows `{max}+` when exceeded. Only works if value is a number.\n */\n max: {\n type: Number,\n default: 99,\n },\n /**\n * @description if a little dot is displayed.\n */\n isDot: Boolean,\n /**\n * @description hidden badge.\n */\n hidden: Boolean,\n /**\n * @description badge type.\n */\n type: {\n type: String,\n values: ['primary', 'success', 'warning', 'info', 'danger'],\n default: 'danger',\n },\n /**\n * @description whether to show badge when value is zero.\n */\n showZero: {\n type: Boolean,\n default: true,\n },\n /**\n * @description customize dot background color\n */\n color: String,\n /**\n * @description CSS style of badge\n */\n badgeStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n },\n /**\n * @description set offset of the badge\n */\n offset: {\n type: definePropType<[number, number]>(Array),\n default: () => [0, 0],\n },\n /**\n * @description custom class name of badge\n */\n badgeClass: {\n type: String,\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `BadgeProps` instead.\n */\nexport type BadgePropsPublic = ExtractPublicPropTypes<typeof badgeProps>\n"],"mappings":";;;;;;;AAkDA,MAAa,aAAaA,2BAAW;CAInC,OAAO;EACL,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAID,KAAK;EACH,MAAM;EACN,SAAS;EACV;CAID,OAAO;CAIP,QAAQ;CAIR,MAAM;EACJ,MAAM;EACN,QAAQ;GAAC;GAAW;GAAW;GAAW;GAAQ;GAAS;EAC3D,SAAS;EACV;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,OAAO;CAIP,YAAY,EACV,MAAMC,+BAA2B;EAAC;EAAQ;EAAQ;EAAM,CAAC,EAC1D;CAID,QAAQ;EACN,MAAMA,+BAAiC,MAAM;EAC7C,eAAe,CAAC,GAAG,EAAE;EACtB;CAID,YAAY,EACV,MAAM,QACP;CACF,CAAU"}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
import { BadgeProps } from "./badge.js";
|
||||
import * as vue from "vue";
|
||||
import { StyleValue } from "vue";
|
||||
|
||||
//#region ../../packages/components/badge/src/badge.vue.d.ts
|
||||
declare var __VLS_1: {}, __VLS_9: {
|
||||
value: string;
|
||||
};
|
||||
type __VLS_Slots = {} & {
|
||||
default?: (props: typeof __VLS_1) => any;
|
||||
} & {
|
||||
content?: (props: typeof __VLS_9) => any;
|
||||
};
|
||||
declare const __VLS_base: vue.DefineComponent<BadgeProps, {
|
||||
/** @description badge content */content: vue.ComputedRef<string>;
|
||||
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<BadgeProps> & Readonly<{}>, {
|
||||
type: "primary" | "success" | "warning" | "info" | "danger";
|
||||
value: string | number;
|
||||
offset: [number, number];
|
||||
max: number;
|
||||
showZero: boolean;
|
||||
badgeStyle: string | false | vue.CSSProperties | 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 };
|
||||
Generated
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
||||
const require_types = require('../../../utils/types.js');
|
||||
const require_style = require('../../../utils/dom/style.js');
|
||||
const require_index = require('../../../hooks/use-namespace/index.js');
|
||||
const require_badge = require('./badge.js');
|
||||
let vue = require("vue");
|
||||
|
||||
//#region ../../packages/components/badge/src/badge.vue?vue&type=script&setup=true&lang.ts
|
||||
var badge_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
||||
name: "ElBadge",
|
||||
__name: "badge",
|
||||
props: require_badge.badgeProps,
|
||||
setup(__props, { expose: __expose }) {
|
||||
const props = __props;
|
||||
const ns = require_index.useNamespace("badge");
|
||||
const content = (0, vue.computed)(() => {
|
||||
if (props.isDot) return "";
|
||||
if (require_types.isNumber(props.value) && require_types.isNumber(props.max)) return props.max < props.value ? `${props.max}+` : `${props.value}`;
|
||||
return `${props.value}`;
|
||||
});
|
||||
const style = (0, vue.computed)(() => {
|
||||
return [{
|
||||
backgroundColor: props.color,
|
||||
marginRight: require_style.addUnit(-props.offset[0]),
|
||||
marginTop: require_style.addUnit(props.offset[1])
|
||||
}, props.badgeStyle ?? {}];
|
||||
});
|
||||
__expose({ content });
|
||||
return (_ctx, _cache) => {
|
||||
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)((0, vue.unref)(ns).b()) }, [(0, vue.renderSlot)(_ctx.$slots, "default"), (0, vue.createVNode)(vue.Transition, { name: `${(0, vue.unref)(ns).namespace.value}-zoom-in-center` }, {
|
||||
default: (0, vue.withCtx)(() => [!__props.hidden && (content.value || __props.isDot || _ctx.$slots.content) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("sup", {
|
||||
key: 0,
|
||||
class: (0, vue.normalizeClass)([
|
||||
(0, vue.unref)(ns).e("content"),
|
||||
(0, vue.unref)(ns).em("content", __props.type),
|
||||
(0, vue.unref)(ns).is("fixed", !!_ctx.$slots.default),
|
||||
(0, vue.unref)(ns).is("dot", __props.isDot),
|
||||
(0, vue.unref)(ns).is("hide-zero", !__props.showZero && __props.value === 0),
|
||||
__props.badgeClass
|
||||
]),
|
||||
style: (0, vue.normalizeStyle)(style.value)
|
||||
}, [(0, vue.renderSlot)(_ctx.$slots, "content", { value: content.value }, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(content.value), 1)])], 6)) : (0, vue.createCommentVNode)("v-if", true)]),
|
||||
_: 3
|
||||
}, 8, ["name"])], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
//#endregion
|
||||
exports.default = badge_vue_vue_type_script_setup_true_lang_default;
|
||||
//# sourceMappingURL=badge.vue_vue_type_script_setup_true_lang.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"badge.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../../../../packages/components/badge/src/badge.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <slot />\n <transition :name=\"`${ns.namespace.value}-zoom-in-center`\">\n <sup\n v-if=\"!hidden && (content || isDot || $slots.content)\"\n :class=\"[\n ns.e('content'),\n ns.em('content', type),\n ns.is('fixed', !!$slots.default),\n ns.is('dot', isDot),\n ns.is('hide-zero', !showZero && value === 0),\n badgeClass,\n ]\"\n :style=\"style\"\n >\n <slot name=\"content\" :value=\"content\">\n {{ content }}\n </slot>\n </sup>\n </transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { addUnit, isNumber } from '@element-plus/utils'\n\nimport type { StyleValue } from 'vue'\nimport type { BadgeProps } from './badge'\n\ndefineOptions({\n name: 'ElBadge',\n})\n\nconst props = withDefaults(defineProps<BadgeProps>(), {\n badgeStyle: undefined,\n value: '',\n max: 99,\n type: 'danger',\n showZero: true,\n offset: () => [0, 0],\n})\n\nconst ns = useNamespace('badge')\n\nconst content = computed<string>(() => {\n if (props.isDot) return ''\n if (isNumber(props.value) && isNumber(props.max)) {\n return props.max < props.value ? `${props.max}+` : `${props.value}`\n }\n return `${props.value}`\n})\n\nconst style = computed<StyleValue>(() => {\n return [\n {\n backgroundColor: props.color,\n marginRight: addUnit(-props.offset[0]),\n marginTop: addUnit(props.offset[1]),\n },\n props.badgeStyle ?? {},\n ]\n})\n\ndefineExpose({\n /** @description badge content */\n content,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;EAoCA,MAAM,QAAQ;EASd,MAAM,KAAK,2BAAa,QAAO;EAE/B,MAAM,kCAAiC;AACrC,OAAI,MAAM,MAAO,QAAO;AACxB,OAAI,uBAAS,MAAM,MAAM,IAAI,uBAAS,MAAM,IAAI,CAC9C,QAAO,MAAM,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,KAAK,GAAG,MAAM;AAE9D,UAAO,GAAG,MAAM;IACjB;EAED,MAAM,gCAAmC;AACvC,UAAO,CACL;IACE,iBAAiB,MAAM;IACvB,aAAa,sBAAQ,CAAC,MAAM,OAAO,GAAG;IACtC,WAAW,sBAAQ,MAAM,OAAO,GAAG;IACpC,EACD,MAAM,cAAc,EAAE,CACxB;IACD;AAED,WAAa,EAEX,SACD,CAAA;;4DAhDO,OAAA,EApBA,8CAAO,GAAE,CAAC,GAAC,CAAA,yBACP,KAAA,QAAA,UAAA,uBAkBK,gBAAA,EAjBA,MAAI,kBAAK,GAAE,CAAC,UAAU,MAAK;oCAgBhC,EAdG,QAAA,WAAW,QAAA,SAAW,QAAA,SAASA,KAAAA,OAAO,8DAczC,OAAA;;KAbH,+BAAK;qBAAc,GAAE,CAAC,EAAC,UAAA;qBAAuB,GAAE,CAAC,GAAE,WAAY,QAAA,KAAI;qBAAa,GAAE,CAAC,GAAE,SAAA,CAAA,CAAYA,KAAAA,OAAO,QAAO;qBAAa,GAAE,CAAC,GAAE,OAAQ,QAAA,MAAK;qBAAa,GAAE,CAAC,GAAE,aAAA,CAAe,QAAA,YAAY,QAAA,UAAK,EAAA;MAAmB,QAAA;;KAQnN,+BAAO,MAAA,MAAK;4BAIN,KAAA,QAAA,WAAA,EAFe,OAAO,QAAA,OAAO,QAE7B,mDADF,QAAA,MAAO,EAAA,EAAA"}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
||||
const require_badge_vue_vue_type_script_setup_true_lang = require('./badge.vue_vue_type_script_setup_true_lang.js');
|
||||
|
||||
//#region ../../packages/components/badge/src/badge.vue
|
||||
var badge_default = require_badge_vue_vue_type_script_setup_true_lang.default;
|
||||
|
||||
//#endregion
|
||||
exports.default = badge_default;
|
||||
//# sourceMappingURL=badge2.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"badge2.js","names":[],"sources":["../../../../../../packages/components/badge/src/badge.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <slot />\n <transition :name=\"`${ns.namespace.value}-zoom-in-center`\">\n <sup\n v-if=\"!hidden && (content || isDot || $slots.content)\"\n :class=\"[\n ns.e('content'),\n ns.em('content', type),\n ns.is('fixed', !!$slots.default),\n ns.is('dot', isDot),\n ns.is('hide-zero', !showZero && value === 0),\n badgeClass,\n ]\"\n :style=\"style\"\n >\n <slot name=\"content\" :value=\"content\">\n {{ content }}\n </slot>\n </sup>\n </transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { addUnit, isNumber } from '@element-plus/utils'\n\nimport type { StyleValue } from 'vue'\nimport type { BadgeProps } from './badge'\n\ndefineOptions({\n name: 'ElBadge',\n})\n\nconst props = withDefaults(defineProps<BadgeProps>(), {\n badgeStyle: undefined,\n value: '',\n max: 99,\n type: 'danger',\n showZero: true,\n offset: () => [0, 0],\n})\n\nconst ns = useNamespace('badge')\n\nconst content = computed<string>(() => {\n if (props.isDot) return ''\n if (isNumber(props.value) && isNumber(props.max)) {\n return props.max < props.value ? `${props.max}+` : `${props.value}`\n }\n return `${props.value}`\n})\n\nconst style = computed<StyleValue>(() => {\n return [\n {\n backgroundColor: props.color,\n marginRight: addUnit(-props.offset[0]),\n marginTop: addUnit(props.offset[1]),\n },\n props.badgeStyle ?? {},\n ]\n})\n\ndefineExpose({\n /** @description badge content */\n content,\n})\n</script>\n"],"mappings":""}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import { _default } from "./badge.vue.js";
|
||||
|
||||
//#region ../../packages/components/badge/src/instance.d.ts
|
||||
type BadgeInstance = InstanceType<typeof _default> & unknown;
|
||||
//#endregion
|
||||
export { BadgeInstance };
|
||||
+1
@@ -0,0 +1 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
require('../../base/style/css.js');
|
||||
require("element-plus/theme-chalk/el-badge.css");
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
require('../../base/style/index.js');
|
||||
require("element-plus/theme-chalk/src/badge.scss");
|
||||
Reference in New Issue
Block a user