django-vue3-admin-web/node_modules/e-icon-picker/components/eIcon/index.mjs
2025-10-20 21:21:14 +08:00

128 lines
3.8 KiB
JavaScript

/**
* e-icon-picker v2.1.1
* (c) 2019 - 2022 cnovel.club
* @license MIT
*/
import { defineComponent as h, openBlock as r, createElementBlock as l, normalizeClass as u, createElementVNode as f, createBlock as N, resolveDynamicComponent as g, normalizeStyle as k, createCommentVNode as v } from "vue";
var m;
const c = typeof window < "u";
c && ((m = window == null ? void 0 : window.navigator) != null && m.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function a(e) {
return /^(https?:|data:|\/\/?)/.test(e);
}
(function() {
return c && document && document.addEventListener ? (e, n, t) => {
e && n && t && e.addEventListener(n, t, !1);
} : (e, n, t) => {
e && n && t && e.attachEvent("on" + n, t);
};
})();
(function() {
return c && document && document.removeEventListener ? function(e, n, t) {
e && n && e.removeEventListener(n, t, !1);
} : function(e, n, t) {
e && n && e.detachEvent("on" + n, t);
};
})();
c && function(e, n, t) {
!e.composedPath && t && (e.composedPath = function() {
if (this.path)
return this.path;
let i = this.target;
for (this.path = []; i.parentNode !== null; )
this.path.push(i), i = i.parentNode;
return this.path.push(n, t), this.path;
}), String.prototype.startsWith || Object.defineProperty(String.prototype, "startsWith", {
value: function(i, o) {
return o = !o || o < 0 ? 0 : +o, this.substring(o, o + i.length) === i;
}
});
}(Event.prototype, document, window);
const p = "click", y = h({
name: "e-icon",
props: {
iconName: {
type: String,
required: !0
},
className: {
type: String,
default: ""
}
},
emits: [p],
setup(e, n) {
return {
click: (i, o) => {
o && o.preventDefault(), n.emit(p, i);
}
};
},
computed: {
fontClass() {
return this.iconName && this.iconName.trim().length > 2 && !a(this.iconName) && !this.iconName.startsWith("#") && !this.iconName.startsWith("component ");
},
svg() {
return this.iconName && this.iconName.trim().length > 2 && !a(this.iconName) && this.iconName.startsWith("#");
},
isComponent() {
return this.iconName && this.iconName.trim().length > 2 && !a(this.iconName) && this.iconName.startsWith("component ");
},
component() {
return this.iconName.replace("component ", "");
},
isExternal() {
return a(this.iconName);
},
svgClass() {
return this.className ? "icon " + this.className : "icon";
},
styleExternalIcon() {
return {
"background-image": `url(${this.iconName})`,
"background-repeat": "no-repeat",
"background-size": "100% 100%",
"-moz-background-size": "100% 100%"
};
}
}
});
const C = (e, n) => {
const t = e.__vccOpts || e;
for (const [i, o] of n)
t[i] = o;
return t;
}, E = ["xlink:href"];
function w(e, n, t, i, o, b) {
return e.fontClass ? (r(), l("i", {
key: 0,
class: u(["e-icon", [e.iconName, e.className]]),
onClick: n[0] || (n[0] = (s) => e.click(e.iconName, s))
}, null, 2)) : e.svg ? (r(), l("svg", {
key: 1,
class: u([e.svgClass, "e-icon e-icon-svg"]),
"aria-hidden": "true",
onClick: n[1] || (n[1] = (s) => e.click(e.iconName, s))
}, [
f("use", { "xlink:href": e.iconName }, null, 8, E)
], 2)) : e.isComponent ? (r(), N(g(e.component), {
key: 2,
class: "e-icon icon e-icon-svg",
onClick: n[2] || (n[2] = (s) => e.click(e.iconName, s))
})) : e.isExternal ? (r(), l("div", {
key: 3,
style: k(e.styleExternalIcon),
class: u([e.className, "e-icon icon external-icon"]),
onClick: n[3] || (n[3] = (s) => e.click(e.iconName, s))
}, null, 6)) : v("", !0);
}
const d = /* @__PURE__ */ C(y, [["render", w], ["__scopeId", "data-v-8e177972"]]), W = {
install(e) {
e.component(d.name, d);
}
};
export {
W as default,
d as eIcon
};