1 | var __defProp = Object.defineProperty;
|
2 | var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3 | var __getOwnPropNames = Object.getOwnPropertyNames;
|
4 | var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5 | var __export = (target, all) => {
|
6 | for (var name2 in all)
|
7 | __defProp(target, name2, { get: all[name2], enumerable: true });
|
8 | };
|
9 | var __copyProps = (to, from, except, desc) => {
|
10 | if (from && typeof from === "object" || typeof from === "function") {
|
11 | for (let key of __getOwnPropNames(from))
|
12 | if (!__hasOwnProp.call(to, key) && key !== except)
|
13 | __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14 | }
|
15 | return to;
|
16 | };
|
17 | var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18 | var stdin_exports = {};
|
19 | __export(stdin_exports, {
|
20 | default: () => stdin_default,
|
21 | iconProps: () => iconProps
|
22 | });
|
23 | module.exports = __toCommonJS(stdin_exports);
|
24 | var import_vue = require("vue");
|
25 | var import_utils = require("../utils");
|
26 | var import_badge = require("../badge");
|
27 | var import_ConfigProvider = require("../config-provider/ConfigProvider");
|
28 | const [name, bem] = (0, import_utils.createNamespace)("icon");
|
29 | const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
|
30 | const iconProps = {
|
31 | dot: Boolean,
|
32 | tag: (0, import_utils.makeStringProp)("i"),
|
33 | name: String,
|
34 | size: import_utils.numericProp,
|
35 | badge: import_utils.numericProp,
|
36 | color: String,
|
37 | badgeProps: Object,
|
38 | classPrefix: String
|
39 | };
|
40 | var stdin_default = (0, import_vue.defineComponent)({
|
41 | name,
|
42 | props: iconProps,
|
43 | setup(props, {
|
44 | slots
|
45 | }) {
|
46 | const config = (0, import_vue.inject)(import_ConfigProvider.CONFIG_PROVIDER_KEY, null);
|
47 | const classPrefix = (0, import_vue.computed)(() => props.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem());
|
48 | return () => {
|
49 | const {
|
50 | tag,
|
51 | dot,
|
52 | name: name2,
|
53 | size,
|
54 | badge,
|
55 | color
|
56 | } = props;
|
57 | const isImageIcon = isImage(name2);
|
58 | return (0, import_vue.createVNode)(import_badge.Badge, (0, import_vue.mergeProps)({
|
59 | "dot": dot,
|
60 | "tag": tag,
|
61 | "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
|
62 | "style": {
|
63 | color,
|
64 | fontSize: (0, import_utils.addUnit)(size)
|
65 | },
|
66 | "content": badge
|
67 | }, props.badgeProps), {
|
68 | default: () => {
|
69 | var _a;
|
70 | return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && (0, import_vue.createVNode)("img", {
|
71 | "class": bem("image"),
|
72 | "src": name2
|
73 | }, null)];
|
74 | }
|
75 | });
|
76 | };
|
77 | }
|
78 | });
|