UNPKG

tdesign-pro-component

Version:

ProComponents tdesign-vue-next + Vue3 + TS

97 lines (96 loc) 2.76 kB
import { a as P, w } from "./utils-DU1amZow.js"; import { defineComponent as I, ref as N, onMounted as v, resolveComponent as u, openBlock as B, createBlock as K, mergeProps as r, withCtx as C, createVNode as F, unref as W, isRef as x } from "vue"; import { u as z } from "./hooks-9GWkbKry.js"; const A = /* @__PURE__ */ I({ name: "ProFormInputNumber", __name: "ProFormInputNumber", props: { name: {}, modelValue: {}, label: {}, rules: {}, formItemProps: {}, labelWidth: {}, labelAlign: { default: "left" }, size: {}, autoWidth: { type: Boolean }, disabled: { type: Boolean }, readonly: { type: Boolean }, theme: { default: "column" }, inputNumberProps: {}, placeholder: {}, style: {} }, emits: ["update:modelValue", "change", "input", "blur", "focus", "keydown", "keypress", "keyup", "validate"], setup(s, { expose: m, emit: d }) { const e = s, o = d, t = z(e, "modelValue", o, e.modelValue || ""), a = N(); v(() => { e.name || P("name is empty"); }); function i(l) { o("input", l); } function p(l, n) { o("change", l, n); } function c(l, n) { o("blur", l, n); } function f(l, n) { o("focus", l, n); } function b(l, n) { o("keydown", l, n); } function h(l, n) { o("keypress", l, n); } function y(l, n) { o("keyup", l, n); } function _(l) { o("validate", l); } return m({ getValue: () => t.value, focus: () => a.value.focus(), blur: () => a.value.blur() }), (l, n) => { const V = u("t-input-number"), g = u("t-form-item"); return B(), K(g, r({ label: e.label, name: e.name, rules: e.rules, labelWidth: e.labelWidth, labelAlign: e.labelAlign }, e.formItemProps), { default: C(() => [ F(V, r({ style: e.style, ref_key: "inputNumberRef", ref: a, modelValue: W(t), "onUpdate:modelValue": n[0] || (n[0] = (k) => x(t) ? t.value = k : null), onInput: i, onChange: p, onBlur: c, onFocus: f, onKeydown: b, onKeypress: h, onKeyup: y, onValidate: _, theme: e.theme, readonly: e.readonly, disabled: e.disabled, size: e.size, placeholder: e.placeholder || `请输入${e.label || "数据"}` }, e.inputNumberProps), null, 16, ["style", "modelValue", "theme", "readonly", "disabled", "size", "placeholder"]) ]), _: 1 }, 16, ["label", "name", "rules", "labelWidth", "labelAlign"]); }; } }), $ = w(A); export { $ as P };