UNPKG

@easyui/element-plus-pro

Version:

This is an extended ui components library for element-plus

106 lines (105 loc) 3.57 kB
import { withInstall as h } from "../../../utils/_install.js"; import { defineComponent as P, mergeModels as p, useModel as w, ref as I, computed as d, resolveComponent as c, openBlock as b, createBlock as v, mergeProps as M, createSlots as x, withCtx as n, renderSlot as s, createCommentVNode as y, unref as u, normalizeClass as z, createVNode as E } from "vue"; import { l as $ } from "../../../_dependencies/lodash.js"; import { c as R } from "../../../_dependencies/element-plus-icons.js"; import U from "../../../hooks/_useTheme.js"; const F = /* @__PURE__ */ P({ name: "SInputNumber", __name: "input-number", props: /* @__PURE__ */ p({ modelValue: {}, min: {}, max: {}, step: { default: 1 }, stepStrictly: { type: Boolean, default: !1 }, precision: {}, size: {}, readonly: { type: Boolean, default: !1 }, disabled: { type: Boolean, default: !1 }, ghost: { type: Boolean, default: !1 }, controls: { type: Boolean, default: !0 }, controlsPosition: { default: "right" }, placeholder: {}, ariaLabel: {}, name: {}, id: {}, clearable: { type: Boolean, default: !1 }, valueOnClear: { type: Boolean }, validateEvent: { type: Boolean, default: !0 } }, { modelValue: {}, modelModifiers: {} }), emits: /* @__PURE__ */ p(["change", "focus", "blur"], ["update:modelValue"]), setup(i, { expose: B, emit: V }) { const { _themePre: m } = U(), a = V, f = i, t = w(i, "modelValue"), r = I(), k = d(() => ({ [`${m}-input-number-wrapper`]: !0, "is-ghost": f.ghost })), g = d(() => $.omit(f, ["modelValue", "clearable"])); return B({ focus: () => { var e; return (e = r.value) == null ? void 0 : e.focus(); }, blur: () => { var e; return (e = r.value) == null ? void 0 : e.blur(); } }), (e, o) => { const C = c("el-icon"), N = c("el-input-number"); return b(), v(N, M({ ref_key: "inputNumberRef", ref: r, class: k.value, modelValue: t.value, "onUpdate:modelValue": o[1] || (o[1] = (l) => t.value = l) }, g.value, { onChange: o[2] || (o[2] = (l, S) => a("change", l, S)), onFocus: o[3] || (o[3] = (l) => a("focus", l)), onBlur: o[4] || (o[4] = (l) => a("blur", l)) }), x({ _: 2 }, [ e.$slots["decrease-icon"] ? { name: "decrease-icon", fn: n(() => [ s(e.$slots, "decrease-icon") ]), key: "0" } : void 0, e.$slots["increase-icon"] ? { name: "increase-icon", fn: n(() => [ s(e.$slots, "increase-icon") ]), key: "1" } : void 0, e.$slots.prefix ? { name: "prefix", fn: n(() => [ s(e.$slots, "prefix") ]), key: "2" } : void 0, e.$slots.suffix || e.clearable ? { name: "suffix", fn: n(() => [ e.$slots.suffix ? s(e.$slots, "suffix", { key: 0 }) : y("", !0), e.clearable && !u($.isUndefined)(t.value) ? (b(), v(C, { key: 1, class: z(`${u(m)}-input-number-clear-btn`), onClick: o[0] || (o[0] = (l) => t.value = void 0) }, { default: n(() => [ E(u(R)) ]), _: 1 }, 8, ["class"])) : y("", !0) ]), key: "3" } : void 0 ]), 1040, ["class", "modelValue"]); }; } }), A = h(F); export { A as SInputNumber };