UNPKG

tdesign-pro-component

Version:

ProComponents tdesign-vue-next + Vue3 + TS

99 lines (98 loc) 3.05 kB
import "lodash-es"; import { c as g, w as F } from "./utils-CIySOLoe.js"; import { defineComponent as k, ref as w, onMounted as P, resolveComponent as u, createBlock as I, openBlock as v, mergeProps as a, withCtx as x, createVNode as K, unref as S, isRef as j } from "vue"; import { u as A } from "./hooks-9GWkbKry.js"; const C = /* @__PURE__ */ k({ name: "ProFormInputNumber", __name: "ProFormInputNumber", props: { name: {}, modelValue: { type: [String, Number, Boolean] }, label: { type: [String, Object, Number, Boolean, null, Array, Function] }, rules: {}, formItemProps: {}, placeholder: {}, type: {}, prepend: { type: [Object, String, Number, Boolean, null, Array, Function] }, append: { type: [Object, String, Number, Boolean, null, Array, Function] }, inputLabel: { type: [Object, String, Number, Boolean, null, Array, Function] }, suffix: { type: [Object, String, Number, Boolean, null, Array, Function] }, clearable: { type: Boolean }, readonly: { type: Boolean }, disabled: { type: Boolean }, borderless: { type: Boolean }, inputNumberProps: {}, theme: { default: "column" }, min: {}, max: {} }, emits: ["update:modelValue", "change", "input", "blur", "focus", "keydown", "keypress", "keyup", "validate"], setup(m, { expose: p, emit: i }) { const o = m, l = i, t = A(o, "modelValue", l, o.modelValue || ""), r = w(); P(() => { o.name || g("name is empty"); }); function s(e) { l("input", e); } function d(e, n) { l("change", e, n); } function c(e, n) { l("blur", e, n); } function b(e, n) { l("focus", e, n); } function y(e, n) { l("keydown", e, n); } function f(e, n) { l("keypress", e, n); } function h(e, n) { l("keyup", e, n); } function B(e) { l("validate", e); } return p({ getValue: () => t.value, focus: () => r.value.focus(), blur: () => r.value.blur() }), (e, n) => { const N = u("t-input-number"), _ = u("t-form-item"); return v(), I(_, a({ label: o.label, name: o.name, rules: o.rules }, o.formItemProps), { default: x(() => [ K(N, a({ style: { width: "100%" }, ref_key: "inputNumberRef", ref: r, modelValue: S(t), "onUpdate:modelValue": n[0] || (n[0] = (V) => j(t) ? t.value = V : null), onInput: s, onChange: d, onBlur: c, onFocus: b, onKeydown: y, onKeypress: f, onKeyup: h, onValidate: B, theme: o.theme, readonly: o.readonly, disabled: o.disabled, placeholder: o.placeholder || "请输入" }, o.inputNumberProps), null, 16, ["modelValue", "theme", "readonly", "disabled", "placeholder"]) ]), _: 1 }, 16, ["label", "name", "rules"]); }; } }), U = F(C); export { U as P };