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

265 lines
9.2 KiB
JavaScript

/**
* e-icon-picker v2.1.1
* (c) 2019 - 2022 cnovel.club
* @license MIT
*/
import { defineComponent as I, openBlock as r, createElementBlock as c, normalizeClass as d, createElementVNode as f, createBlock as z, resolveDynamicComponent as O, normalizeStyle as b, createCommentVNode as V, reactive as A, shallowRef as P, computed as v, watch as U, onMounted as W, resolveComponent as F, renderSlot as D, createVNode as R, withModifiers as j, createTextVNode as q } from "vue";
var N;
const h = typeof window < "u";
h && ((N = window == null ? void 0 : window.navigator) != null && N.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function p(e) {
return /^(https?:|data:|\/\/?)/.test(e);
}
(function() {
return h && 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 h && 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);
};
})();
h && function(e, n, t) {
!e.composedPath && t && (e.composedPath = function() {
if (this.path)
return this.path;
let o = this.target;
for (this.path = []; o.parentNode !== null; )
this.path.push(o), o = o.parentNode;
return this.path.push(n, t), this.path;
}), String.prototype.startsWith || Object.defineProperty(String.prototype, "startsWith", {
value: function(o, s) {
return s = !s || s < 0 ? 0 : +s, this.substring(s, s + o.length) === o;
}
});
}(Event.prototype, document, window);
const E = "update:modelValue", y = "change", C = "input", G = "clear", H = "focus", K = "blur", J = "mouseleave", Q = "mouseenter", k = "click", X = I({
name: "e-icon",
props: {
iconName: {
type: String,
required: !0
},
className: {
type: String,
default: ""
}
},
emits: [k],
setup(e, n) {
return {
click: (o, s) => {
s && s.preventDefault(), n.emit(k, o);
}
};
},
computed: {
fontClass() {
return this.iconName && this.iconName.trim().length > 2 && !p(this.iconName) && !this.iconName.startsWith("#") && !this.iconName.startsWith("component ");
},
svg() {
return this.iconName && this.iconName.trim().length > 2 && !p(this.iconName) && this.iconName.startsWith("#");
},
isComponent() {
return this.iconName && this.iconName.trim().length > 2 && !p(this.iconName) && this.iconName.startsWith("component ");
},
component() {
return this.iconName.replace("component ", "");
},
isExternal() {
return p(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 L = (e, n) => {
const t = e.__vccOpts || e;
for (const [o, s] of n)
t[o] = s;
return t;
}, Y = ["xlink:href"];
function Z(e, n, t, o, s, u) {
return e.fontClass ? (r(), c("i", {
key: 0,
class: d(["e-icon", [e.iconName, e.className]]),
onClick: n[0] || (n[0] = (l) => e.click(e.iconName, l))
}, null, 2)) : e.svg ? (r(), c("svg", {
key: 1,
class: d([e.svgClass, "e-icon e-icon-svg"]),
"aria-hidden": "true",
onClick: n[1] || (n[1] = (l) => e.click(e.iconName, l))
}, [
f("use", { "xlink:href": e.iconName }, null, 8, Y)
], 2)) : e.isComponent ? (r(), z(O(e.component), {
key: 2,
class: "e-icon icon e-icon-svg",
onClick: n[2] || (n[2] = (l) => e.click(e.iconName, l))
})) : e.isExternal ? (r(), c("div", {
key: 3,
style: b(e.styleExternalIcon),
class: d([e.className, "e-icon icon external-icon"]),
onClick: n[3] || (n[3] = (l) => e.click(e.iconName, l))
}, null, 6)) : V("", !0);
}
const _ = /* @__PURE__ */ L(X, [["render", Z], ["__scopeId", "data-v-8e177972"]]), x = I({
name: "e-input",
components: {
eIcon: _
},
props: {
prefixIcon: {
type: String,
default: "eiconfont e-icon-bi"
},
disabled: {
type: Boolean,
default: !1
},
readonly: {
type: Boolean,
default: !1
},
placeholder: {
type: String,
default: ""
},
style: {
type: Object,
default: {}
},
clearable: {
type: Boolean,
default: !0
},
modelValue: {
type: String,
default: ""
},
size: {
type: String,
default: "default",
required: !1
}
},
setup(e, { emit: n }) {
const t = A({
prefixIcon: e.prefixIcon,
focused: !1,
hovering: !1
}), o = P(), s = v(() => o.value), u = v(
() => e.modelValue ? String(e.modelValue) : ""
), l = (a) => {
let { value: g } = a.target;
n(E, g), n(C, g), m();
}, i = (a) => {
t.focused = !0, n(H, a);
}, M = (a) => {
t.focused = !1, n(K, a);
}, S = (a) => {
n(y, a.target.value);
}, $ = v(
() => e.clearable && !e.disabled && !e.readonly && !!u.value && (t.focused || t.hovering)
), T = (a) => {
t.hovering = !1, n(J, a);
}, B = (a) => {
t.hovering = !0, n(Q, a);
}, m = () => {
const a = s.value;
!a || a.value === u.value || (a.value = u.value);
};
return U(u, () => m()), W(async () => {
m();
}), {
state: t,
handleInput: l,
handleFocus: i,
handleBlur: M,
handleChange: S,
showClear: $,
handleMouseLeave: T,
handleMouseEnter: B,
input: o,
clear: () => {
n(E, ""), n(y, ""), n(G), n(C, "");
}
};
}
});
const ee = { class: "prefix-icon" }, ne = ["disabled", "readonly", "placeholder"], te = {
t: "1657525825723",
class: "icon",
viewBox: "0 0 1024 1024",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg"
}, oe = ["fill"];
function se(e, n, t, o, s, u) {
const l = F("e-icon");
return r(), c("div", {
class: d(["e-input", `e-input--${e.size}`]),
onMouseenter: n[5] || (n[5] = (...i) => e.handleMouseEnter && e.handleMouseEnter(...i)),
onMouseleave: n[6] || (n[6] = (...i) => e.handleMouseLeave && e.handleMouseLeave(...i))
}, [
f("div", ee, [
D(e.$slots, "prepend", {
icon: e.state.prefixIcon
}, () => [
R(l, {
"icon-name": e.state.prefixIcon,
class: "e-icon"
}, null, 8, ["icon-name"])
], !0)
]),
f("input", {
type: "text",
ref: "input",
class: d(["e-input-inner", e.disabled ? "is-disabled" : ""]),
disabled: e.disabled,
readonly: e.readonly,
placeholder: e.placeholder,
style: b(e.style),
onInput: n[0] || (n[0] = (...i) => e.handleInput && e.handleInput(...i)),
onFocus: n[1] || (n[1] = (...i) => e.handleFocus && e.handleFocus(...i)),
onBlur: n[2] || (n[2] = (...i) => e.handleBlur && e.handleBlur(...i)),
onChange: n[3] || (n[3] = (...i) => e.handleChange && e.handleChange(...i))
}, null, 46, ne),
e.showClear ? (r(), c("div", {
key: 0,
class: "suffix-icon",
onClick: n[4] || (n[4] = j((...i) => e.clear && e.clear(...i), ["stop"]))
}, [
(r(), c("svg", te, [
q(' p-id="1823" width="200" height="200"> '),
f("path", {
d: "M466.986667 512L376.021333 421.973333a33.450667 33.450667 0 0 1-8.96-22.997333 30.72 30.72 0 0 1 9.514667-22.485333 30.72 30.72 0 0 1 22.485333-9.514667c8.661333 0 16.341333 2.986667 22.997334 8.96l90.026666 91.050667 90.026667-91.008c9.301333-8.661333 19.797333-11.349333 31.445333-8.021334a30.890667 30.890667 0 0 1 22.528 22.485334c3.328 11.690667 0.682667 22.186667-8.021333 31.530666L557.013333 512l91.008 89.984c8.661333 9.344 11.349333 19.84 8.021334 31.488a30.890667 30.890667 0 0 1-22.485334 22.485333c-11.690667 3.370667-22.186667 0.682667-31.530666-7.978666L512 556.970667l-89.984 91.008a33.450667 33.450667 0 0 1-23.04 8.96 30.72 30.72 0 0 1-22.485333-9.472 30.72 30.72 0 0 1-9.472-22.485334c0-8.704 2.986667-16.341333 8.96-23.04L466.986667 512zM512 896c108.672-2.688 199.168-40.192 271.488-112.512C855.808 711.168 893.312 620.672 896 512c-2.688-108.672-40.192-199.168-112.512-271.488C711.168 168.192 620.672 130.688 512 128c-108.672 2.688-199.168 40.192-271.488 112.512C168.192 312.874667 130.688 403.370667 128 512c2.688 108.672 40.192 199.168 112.512 271.488C312.874667 855.808 403.370667 893.312 512 896z m0 64c-126.677333-3.328-232.192-47.146667-316.501333-131.498667C111.146667 744.192 67.328 638.72 64 512c3.328-126.677333 47.146667-232.192 131.498667-316.501333C279.808 111.146667 385.28 67.328 512 64c126.677333 3.328 232.192 47.146667 316.501333 131.498667C912.853333 279.808 956.672 385.28 960 512c-3.328 126.677333-47.146667 232.192-131.498667 316.501333C744.192 912.853333 638.72 956.672 512 960z",
"p-id": "1824",
fill: e.state.focused ? "#606266" : "#C0C4CC"
}, null, 8, oe)
]))
])) : V("", !0)
], 34);
}
const w = /* @__PURE__ */ L(x, [["render", se], ["__scopeId", "data-v-d2b0f76c"]]), le = {
install(e) {
e.component(w.name, w);
}
};
export {
le as default,
w as eInput
};